Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: Source/core/rendering/svg/SVGInlineFlowBox.cpp

Issue 18309003: Inroduce toSVGInlineTextBox, and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 23 matching lines...) Expand all
34 namespace WebCore { 34 namespace WebCore {
35 35
36 void SVGInlineFlowBox::paintSelectionBackground(PaintInfo& paintInfo) 36 void SVGInlineFlowBox::paintSelectionBackground(PaintInfo& paintInfo)
37 { 37 {
38 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection); 38 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection);
39 ASSERT(!paintInfo.context->paintingDisabled()); 39 ASSERT(!paintInfo.context->paintingDisabled());
40 40
41 PaintInfo childPaintInfo(paintInfo); 41 PaintInfo childPaintInfo(paintInfo);
42 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { 42 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
43 if (child->isSVGInlineTextBox()) 43 if (child->isSVGInlineTextBox())
44 static_cast<SVGInlineTextBox*>(child)->paintSelectionBackground(chil dPaintInfo); 44 toSVGInlineTextBox(child)->paintSelectionBackground(childPaintInfo);
45 else if (child->isSVGInlineFlowBox()) 45 else if (child->isSVGInlineFlowBox())
46 static_cast<SVGInlineFlowBox*>(child)->paintSelectionBackground(chil dPaintInfo); 46 static_cast<SVGInlineFlowBox*>(child)->paintSelectionBackground(chil dPaintInfo);
47 } 47 }
48 } 48 }
49 49
50 void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni t, LayoutUnit) 50 void SVGInlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint&, LayoutUni t, LayoutUnit)
51 { 51 {
52 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection); 52 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection);
53 ASSERT(!paintInfo.context->paintingDisabled()); 53 ASSERT(!paintInfo.context->paintingDisabled());
54 54
55 RenderObject* boxRenderer = renderer(); 55 RenderObject* boxRenderer = renderer();
56 ASSERT(boxRenderer); 56 ASSERT(boxRenderer);
57 57
58 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon text::SaveGraphicsContext); 58 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon text::SaveGraphicsContext);
59 if (renderingContext.isRenderingPrepared()) { 59 if (renderingContext.isRenderingPrepared()) {
60 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) { 60 for (InlineBox* child = firstChild(); child; child = child->nextOnLine() ) {
61 if (child->isSVGInlineTextBox()) 61 if (child->isSVGInlineTextBox())
62 computeTextMatchMarkerRectForRenderer(toRenderSVGInlineText(stat ic_cast<SVGInlineTextBox*>(child)->textRenderer())); 62 computeTextMatchMarkerRectForRenderer(toRenderSVGInlineText(toSV GInlineTextBox(child)->textRenderer()));
63 63
64 child->paint(paintInfo, LayoutPoint(), 0, 0); 64 child->paint(paintInfo, LayoutPoint(), 0, 0);
65 } 65 }
66 } 66 }
67 } 67 }
68 68
69 FloatRect SVGInlineFlowBox::calculateBoundaries() const 69 FloatRect SVGInlineFlowBox::calculateBoundaries() const
70 { 70 {
71 FloatRect childRect; 71 FloatRect childRect;
72 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { 72 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
(...skipping 25 matching lines...) Expand all
98 98
99 // SVG is only interessted in the TextMatch marker, for now. 99 // SVG is only interessted in the TextMatch marker, for now.
100 if (marker->type() != DocumentMarker::TextMatch) 100 if (marker->type() != DocumentMarker::TextMatch)
101 continue; 101 continue;
102 102
103 FloatRect markerRect; 103 FloatRect markerRect;
104 for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box-> nextTextBox()) { 104 for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box-> nextTextBox()) {
105 if (!box->isSVGInlineTextBox()) 105 if (!box->isSVGInlineTextBox())
106 continue; 106 continue;
107 107
108 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(box); 108 SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
109 109
110 int markerStartPosition = max<int>(marker->startOffset() - textBox-> start(), 0); 110 int markerStartPosition = max<int>(marker->startOffset() - textBox-> start(), 0);
111 int markerEndPosition = min<int>(marker->endOffset() - textBox->star t(), textBox->len()); 111 int markerEndPosition = min<int>(marker->endOffset() - textBox->star t(), textBox->len());
112 112
113 if (markerStartPosition >= markerEndPosition) 113 if (markerStartPosition >= markerEndPosition)
114 continue; 114 continue;
115 115
116 int fragmentStartPosition = 0; 116 int fragmentStartPosition = 0;
117 int fragmentEndPosition = 0; 117 int fragmentEndPosition = 0;
118 118
(...skipping 14 matching lines...) Expand all
133 133
134 markerRect.unite(fragmentRect); 134 markerRect.unite(fragmentRect);
135 } 135 }
136 } 136 }
137 137
138 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToA bsoluteQuad(markerRect).enclosingBoundingBox()); 138 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer->localToA bsoluteQuad(markerRect).enclosingBoundingBox());
139 } 139 }
140 } 140 }
141 141
142 } // namespace WebCore 142 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGInlineText.cpp ('k') | Source/core/rendering/svg/SVGInlineTextBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698