summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp')
-rw-r--r--Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp89
1 files changed, 10 insertions, 79 deletions
diff --git a/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp b/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
index db017adba..2d5079e32 100644
--- a/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
+++ b/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
- * Copyright (C) 2006 Apple Computer Inc.
+ * Copyright (C) 2006 Apple Inc.
* Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
@@ -23,10 +23,7 @@
#include "config.h"
#include "SVGInlineFlowBox.h"
-#if ENABLE(SVG)
-#include "DocumentMarkerController.h"
#include "GraphicsContext.h"
-#include "RenderedDocumentMarker.h"
#include "SVGInlineTextBox.h"
#include "SVGRenderingContext.h"
@@ -35,30 +32,26 @@ namespace WebCore {
void SVGInlineFlowBox::paintSelectionBackground(PaintInfo& paintInfo)
{
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
- ASSERT(!paintInfo.context->paintingDisabled());
+ ASSERT(!paintInfo.context().paintingDisabled());
PaintInfo childPaintInfo(paintInfo);
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
- if (child->isSVGInlineTextBox())
- toSVGInlineTextBox(child)->paintSelectionBackground(childPaintInfo);
- else if (child->isSVGInlineFlowBox())
- toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintInfo);
+ if (is<SVGInlineTextBox>(*child))
+ downcast<SVGInlineTextBox>(*child).paintSelectionBackground(childPaintInfo);
+ else if (is<SVGInlineFlowBox>(*child))
+ downcast<SVGInlineFlowBox>(*child).paintSelectionBackground(childPaintInfo);
}
}
-void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUnit, LayoutUnit)
+void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit, LayoutUnit)
{
ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
- ASSERT(!paintInfo.context->paintingDisabled());
+ ASSERT(!paintInfo.context().paintingDisabled());
SVGRenderingContext renderingContext(renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
if (renderingContext.isRenderingPrepared()) {
- for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
- if (child->isSVGInlineTextBox())
- computeTextMatchMarkerRectForRenderer(&(toSVGInlineTextBox(child)->renderer()));
-
- child->paint(paintInfo, LayoutPoint(), 0, 0);
- }
+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine())
+ child->paint(paintInfo, paintOffset, 0, 0);
}
}
@@ -73,66 +66,4 @@ FloatRect SVGInlineFlowBox::calculateBoundaries() const
return childRect;
}
-void SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(RenderSVGInlineText* textRenderer)
-{
- ASSERT(textRenderer);
-
- Text& textNode = textRenderer->textNode();
- if (!textNode.inDocument())
- return;
-
- RenderStyle& style = textRenderer->style();
-
- AffineTransform fragmentTransform;
- Vector<DocumentMarker*> markers = textRenderer->document().markers().markersFor(&textNode);
-
- Vector<DocumentMarker*>::iterator markerEnd = markers.end();
- for (Vector<DocumentMarker*>::iterator markerIt = markers.begin(); markerIt != markerEnd; ++markerIt) {
- DocumentMarker* marker = *markerIt;
-
- // SVG is only interessted in the TextMatch marker, for now.
- if (marker->type() != DocumentMarker::TextMatch)
- continue;
-
- FloatRect markerRect;
- for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
- if (!box->isSVGInlineTextBox())
- continue;
-
- SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
-
- int markerStartPosition = std::max<int>(marker->startOffset() - textBox->start(), 0);
- int markerEndPosition = std::min<int>(marker->endOffset() - textBox->start(), textBox->len());
-
- if (markerStartPosition >= markerEndPosition)
- continue;
-
- int fragmentStartPosition = 0;
- int fragmentEndPosition = 0;
-
- const Vector<SVGTextFragment>& fragments = textBox->textFragments();
- unsigned textFragmentsSize = fragments.size();
- for (unsigned i = 0; i < textFragmentsSize; ++i) {
- const SVGTextFragment& fragment = fragments.at(i);
-
- fragmentStartPosition = markerStartPosition;
- fragmentEndPosition = markerEndPosition;
- if (!textBox->mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
- continue;
-
- FloatRect fragmentRect = textBox->selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, &style);
- fragment.buildFragmentTransform(fragmentTransform);
- if (!fragmentTransform.isIdentity())
- fragmentRect = fragmentTransform.mapRect(fragmentRect);
-
- markerRect.unite(fragmentRect);
- }
- }
-
- toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToAbsoluteQuad(markerRect).enclosingBoundingBox());
- }
-}
-
} // namespace WebCore
-
-#endif // ENABLE(SVG)