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

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp

Issue 1741073002: Rename enums/functions that collide in chromium style in core/layout/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-6
Patch Set: get-names-7: rebase Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/SVGInlineTextBoxPainter.h" 5 #include "core/paint/SVGInlineTextBoxPainter.h"
6 6
7 #include "core/editing/Editor.h" 7 #include "core/editing/Editor.h"
8 #include "core/editing/markers/DocumentMarkerController.h" 8 #include "core/editing/markers/DocumentMarkerController.h"
9 #include "core/editing/markers/RenderedDocumentMarker.h" 9 #include "core/editing/markers/RenderedDocumentMarker.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 16 matching lines...) Expand all
27 27
28 static inline bool textShouldBePainted(const LayoutSVGInlineText& textLayoutObje ct) 28 static inline bool textShouldBePainted(const LayoutSVGInlineText& textLayoutObje ct)
29 { 29 {
30 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which re turns "int(x + 0.5)". 30 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which re turns "int(x + 0.5)".
31 // If the absolute font size on screen is below x=0.5, don't render anything . 31 // If the absolute font size on screen is below x=0.5, don't render anything .
32 return textLayoutObject.scaledFont().fontDescription().computedPixelSize(); 32 return textLayoutObject.scaledFont().fontDescription().computedPixelSize();
33 } 33 }
34 34
35 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c onst 35 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c onst
36 { 36 {
37 return !paintInfo.isPrinting() && m_svgInlineTextBox.selectionState() != Sel ectionNone; 37 return !paintInfo.isPrinting() && m_svgInlineTextBox.getSelectionState() != SelectionNone;
38 } 38 }
39 39
40 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin t& paintOffset) 40 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin t& paintOffset)
41 { 41 {
42 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection); 42 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh aseSelection);
43 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); 43 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation);
44 44
45 if (m_svgInlineTextBox.lineLayoutItem().style()->visibility() != VISIBLE) 45 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE)
46 return; 46 return;
47 47
48 // We're explicitly not supporting composition & custom underlines and custo m highlighters -- unlike InlineTextBox. 48 // We're explicitly not supporting composition & custom underlines and custo m highlighters -- unlike InlineTextBox.
49 // If we ever need that for SVG, it's very easy to refactor and reuse the co de. 49 // If we ever need that for SVG, it's very easy to refactor and reuse the co de.
50 50
51 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection(paintInf o)) 51 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection(paintInf o))
52 return; 52 return;
53 53
54 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())); 54 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.getLineLayoutItem()));
55 if (!textShouldBePainted(textLayoutObject)) 55 if (!textShouldBePainted(textLayoutObject))
56 return; 56 return;
57 57
58 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase); 58 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase);
59 if (!DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_svgInl ineTextBox, displayItemType)) { 59 if (!DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_svgInl ineTextBox, displayItemType)) {
60 LayoutObject& parentLayoutObject = *LineLayoutAPIShim::layoutObjectFrom( m_svgInlineTextBox.parent()->lineLayoutItem()); 60 LayoutObject& parentLayoutObject = *LineLayoutAPIShim::layoutObjectFrom( m_svgInlineTextBox.parent()->getLineLayoutItem());
61 const ComputedStyle& style = parentLayoutObject.styleRef(); 61 const ComputedStyle& style = parentLayoutObject.styleRef();
62 62
63 // TODO(chrishtr): passing the cull rect is incorrect. 63 // TODO(chrishtr): passing the cull rect is incorrect.
64 DrawingRecorder recorder(paintInfo.context, m_svgInlineTextBox, displayI temType, FloatRect(paintInfo.cullRect().m_rect)); 64 DrawingRecorder recorder(paintInfo.context, m_svgInlineTextBox, displayI temType, FloatRect(paintInfo.cullRect().m_rect));
65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( 65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers(
66 paintInfo, paintOffset, style, 66 paintInfo, paintOffset, style,
67 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Background) ; 67 textLayoutObject.scaledFont(), DocumentMarkerPaintPhase::Background) ;
68 68
69 if (!m_svgInlineTextBox.textFragments().isEmpty()) 69 if (!m_svgInlineTextBox.textFragments().isEmpty())
70 paintTextFragments(paintInfo, parentLayoutObject); 70 paintTextFragments(paintInfo, parentLayoutObject);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 // Spec: Line-through should be drawn after the text is filled and strok ed; thus, the line-through is rendered on top of the text. 143 // Spec: Line-through should be drawn after the text is filled and strok ed; thus, the line-through is rendered on top of the text.
144 if (decorations & TextDecorationLineThrough) 144 if (decorations & TextDecorationLineThrough)
145 paintDecoration(paintInfo, TextDecorationLineThrough, fragment); 145 paintDecoration(paintInfo, TextDecorationLineThrough, fragment);
146 } 146 }
147 } 147 }
148 148
149 void SVGInlineTextBoxPainter::paintSelectionBackground(const PaintInfo& paintInf o) 149 void SVGInlineTextBoxPainter::paintSelectionBackground(const PaintInfo& paintInf o)
150 { 150 {
151 if (m_svgInlineTextBox.lineLayoutItem().style()->visibility() != VISIBLE) 151 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE)
152 return; 152 return;
153 153
154 ASSERT(!paintInfo.isPrinting()); 154 ASSERT(!paintInfo.isPrinting());
155 155
156 if (paintInfo.phase == PaintPhaseSelection || !shouldPaintSelection(paintInf o)) 156 if (paintInfo.phase == PaintPhaseSelection || !shouldPaintSelection(paintInf o))
157 return; 157 return;
158 158
159 Color backgroundColor = m_svgInlineTextBox.lineLayoutItem().selectionBackgro undColor(); 159 Color backgroundColor = m_svgInlineTextBox.getLineLayoutItem().selectionBack groundColor();
160 if (!backgroundColor.alpha()) 160 if (!backgroundColor.alpha())
161 return; 161 return;
162 162
163 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())); 163 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.getLineLayoutItem()));
164 if (!textShouldBePainted(textLayoutObject)) 164 if (!textShouldBePainted(textLayoutObject))
165 return; 165 return;
166 166
167 const ComputedStyle& style = m_svgInlineTextBox.parent()->lineLayoutItem().s tyleRef(); 167 const ComputedStyle& style = m_svgInlineTextBox.parent()->getLineLayoutItem( ).styleRef();
168 168
169 int startPosition, endPosition; 169 int startPosition, endPosition;
170 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition); 170 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition);
171 171
172 const Vector<SVGTextFragmentWithRange> fragmentInfoList = collectFragmentsIn Range(startPosition, endPosition); 172 const Vector<SVGTextFragmentWithRange> fragmentInfoList = collectFragmentsIn Range(startPosition, endPosition);
173 for (const SVGTextFragmentWithRange& fragmentWithRange : fragmentInfoList) { 173 for (const SVGTextFragmentWithRange& fragmentWithRange : fragmentInfoList) {
174 const SVGTextFragment& fragment = fragmentWithRange.fragment; 174 const SVGTextFragment& fragment = fragmentWithRange.fragment;
175 GraphicsContextStateSaver stateSaver(paintInfo.context); 175 GraphicsContextStateSaver stateSaver(paintInfo.context);
176 if (fragment.isTransformed()) 176 if (fragment.isTransformed())
177 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); 177 paintInfo.context.concatCTM(fragment.buildFragmentTransform());
178 178
179 paintInfo.context.setFillColor(backgroundColor); 179 paintInfo.context.setFillColor(backgroundColor);
180 paintInfo.context.fillRect(m_svgInlineTextBox.selectionRectForTextFragme nt(fragment, fragmentWithRange.startPosition, fragmentWithRange.endPosition, sty le), backgroundColor); 180 paintInfo.context.fillRect(m_svgInlineTextBox.selectionRectForTextFragme nt(fragment, fragmentWithRange.startPosition, fragmentWithRange.endPosition, sty le), backgroundColor);
181 } 181 }
182 } 182 }
183 183
184 static inline LayoutObject* findLayoutObjectDefininingTextDecoration(InlineFlowB ox* parentBox) 184 static inline LayoutObject* findLayoutObjectDefininingTextDecoration(InlineFlowB ox* parentBox)
185 { 185 {
186 // Lookup first layout object in parent hierarchy which has text-decoration set. 186 // Lookup first layout object in parent hierarchy which has text-decoration set.
187 LayoutObject* layoutObject = 0; 187 LayoutObject* layoutObject = 0;
188 while (parentBox) { 188 while (parentBox) {
189 layoutObject = LineLayoutAPIShim::layoutObjectFrom(parentBox->lineLayout Item()); 189 layoutObject = LineLayoutAPIShim::layoutObjectFrom(parentBox->getLineLay outItem());
190 190
191 if (layoutObject->style() && layoutObject->style()->textDecoration() != TextDecorationNone) 191 if (layoutObject->style() && layoutObject->style()->textDecoration() != TextDecorationNone)
192 break; 192 break;
193 193
194 parentBox = parentBox->parent(); 194 parentBox = parentBox->parent();
195 } 195 }
196 196
197 ASSERT(layoutObject); 197 ASSERT(layoutObject);
198 return layoutObject; 198 return layoutObject;
199 } 199 }
(...skipping 16 matching lines...) Expand all
216 216
217 static inline float thicknessForDecoration(TextDecoration, const Font& font) 217 static inline float thicknessForDecoration(TextDecoration, const Font& font)
218 { 218 {
219 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f ace> if specified. 219 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f ace> if specified.
220 // Compatible with Batik/Presto 220 // Compatible with Batik/Presto
221 return font.fontDescription().computedSize() / 20.0f; 221 return font.fontDescription().computedSize() / 20.0f;
222 } 222 }
223 223
224 void SVGInlineTextBoxPainter::paintDecoration(const PaintInfo& paintInfo, TextDe coration decoration, const SVGTextFragment& fragment) 224 void SVGInlineTextBoxPainter::paintDecoration(const PaintInfo& paintInfo, TextDe coration decoration, const SVGTextFragment& fragment)
225 { 225 {
226 if (m_svgInlineTextBox.lineLayoutItem().style()->textDecorationsInEffect() = = TextDecorationNone) 226 if (m_svgInlineTextBox.getLineLayoutItem().style()->textDecorationsInEffect( ) == TextDecorationNone)
227 return; 227 return;
228 228
229 if (fragment.width <= 0) 229 if (fragment.width <= 0)
230 return; 230 return;
231 231
232 // Find out which style defined the text-decoration, as its fill/stroke prop erties have to be used for drawing instead of ours. 232 // Find out which style defined the text-decoration, as its fill/stroke prop erties have to be used for drawing instead of ours.
233 LayoutObject* decorationLayoutObject = findLayoutObjectDefininingTextDecorat ion(m_svgInlineTextBox.parent()); 233 LayoutObject* decorationLayoutObject = findLayoutObjectDefininingTextDecorat ion(m_svgInlineTextBox.parent());
234 const ComputedStyle& decorationStyle = decorationLayoutObject->styleRef(); 234 const ComputedStyle& decorationStyle = decorationLayoutObject->styleRef();
235 235
236 if (decorationStyle.visibility() == HIDDEN) 236 if (decorationStyle.visibility() == HIDDEN)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 break; 282 break;
283 default: 283 default:
284 ASSERT_NOT_REACHED(); 284 ASSERT_NOT_REACHED();
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 bool SVGInlineTextBoxPainter::setupTextPaint(const PaintInfo& paintInfo, const C omputedStyle& style, 289 bool SVGInlineTextBoxPainter::setupTextPaint(const PaintInfo& paintInfo, const C omputedStyle& style,
290 LayoutSVGResourceMode resourceMode, SkPaint& paint) 290 LayoutSVGResourceMode resourceMode, SkPaint& paint)
291 { 291 {
292 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())); 292 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.getLineLayoutItem()));
293 293
294 float scalingFactor = textLayoutObject.scalingFactor(); 294 float scalingFactor = textLayoutObject.scalingFactor();
295 ASSERT(scalingFactor); 295 ASSERT(scalingFactor);
296 296
297 const ShadowList* shadowList = style.textShadow(); 297 const ShadowList* shadowList = style.textShadow();
298 298
299 // Text shadows are disabled when printing. http://crbug.com/258321 299 // Text shadows are disabled when printing. http://crbug.com/258321
300 bool hasShadow = shadowList && !paintInfo.isPrinting(); 300 bool hasShadow = shadowList && !paintInfo.isPrinting();
301 301
302 AffineTransform paintServerTransform; 302 AffineTransform paintServerTransform;
303 const AffineTransform* additionalPaintServerTransform = 0; 303 const AffineTransform* additionalPaintServerTransform = 0;
304 304
305 if (scalingFactor != 1) { 305 if (scalingFactor != 1) {
306 // Adjust the paint-server coordinate space. 306 // Adjust the paint-server coordinate space.
307 paintServerTransform.scale(scalingFactor); 307 paintServerTransform.scale(scalingFactor);
308 additionalPaintServerTransform = &paintServerTransform; 308 additionalPaintServerTransform = &paintServerTransform;
309 } 309 }
310 310
311 if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, *LineLayoutAPIS him::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()), resourceMo de, paint, additionalPaintServerTransform)) 311 if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, *LineLayoutAPIS him::layoutObjectFrom(m_svgInlineTextBox.parent()->getLineLayoutItem()), resourc eMode, paint, additionalPaintServerTransform))
312 return false; 312 return false;
313 paint.setAntiAlias(true); 313 paint.setAntiAlias(true);
314 314
315 if (hasShadow) { 315 if (hasShadow) {
316 OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLoop er(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSProper tyColor)); 316 OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLoop er(DrawLooperBuilder::ShadowRespectsAlpha, style.visitedDependentColor(CSSProper tyColor));
317 RefPtr<SkDrawLooper> drawLooper = drawLooperBuilder->detachDrawLooper(); 317 RefPtr<SkDrawLooper> drawLooper = drawLooperBuilder->detachDrawLooper();
318 paint.setLooper(drawLooper.get()); 318 paint.setLooper(drawLooper.get());
319 } 319 }
320 320
321 if (resourceMode == ApplyToStrokeMode) { 321 if (resourceMode == ApplyToStrokeMode) {
322 StrokeData strokeData; 322 StrokeData strokeData;
323 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, *LineL ayoutAPIShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()), 1 ); 323 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, *LineL ayoutAPIShim::layoutObjectFrom(m_svgInlineTextBox.parent()->getLineLayoutItem()) , 1);
324 if (style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE) 324 if (style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE)
325 strokeData.setThickness(strokeData.thickness() * scalingFactor); 325 strokeData.setThickness(strokeData.thickness() * scalingFactor);
326 strokeData.setupPaint(&paint); 326 strokeData.setupPaint(&paint);
327 } 327 }
328 return true; 328 return true;
329 } 329 }
330 330
331 void SVGInlineTextBoxPainter::paintText(const PaintInfo& paintInfo, TextRun& tex tRun, const SVGTextFragment& fragment, int startPosition, int endPosition, const SkPaint& paint) 331 void SVGInlineTextBoxPainter::paintText(const PaintInfo& paintInfo, TextRun& tex tRun, const SVGTextFragment& fragment, int startPosition, int endPosition, const SkPaint& paint)
332 { 332 {
333 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())); 333 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutAPI Shim::layoutObjectFrom(m_svgInlineTextBox.getLineLayoutItem()));
334 const Font& scaledFont = textLayoutObject.scaledFont(); 334 const Font& scaledFont = textLayoutObject.scaledFont();
335 335
336 float scalingFactor = textLayoutObject.scalingFactor(); 336 float scalingFactor = textLayoutObject.scalingFactor();
337 ASSERT(scalingFactor); 337 ASSERT(scalingFactor);
338 338
339 FloatPoint textOrigin(fragment.x, fragment.y); 339 FloatPoint textOrigin(fragment.x, fragment.y);
340 FloatSize textSize(fragment.width, fragment.height); 340 FloatSize textSize(fragment.width, fragment.height);
341 341
342 GraphicsContext& context = paintInfo.context; 342 GraphicsContext& context = paintInfo.context;
343 GraphicsContextStateSaver stateSaver(context, false); 343 GraphicsContextStateSaver stateSaver(context, false);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (startPosition > 0 && !paintSelectedTextOnly) { 384 if (startPosition > 0 && !paintSelectedTextOnly) {
385 SkPaint paint; 385 SkPaint paint;
386 if (setupTextPaint(paintInfo, style, resourceMode, paint)) 386 if (setupTextPaint(paintInfo, style, resourceMode, paint))
387 paintText(paintInfo, textRun, fragment, 0, startPosition, paint); 387 paintText(paintInfo, textRun, fragment, 0, startPosition, paint);
388 } 388 }
389 389
390 // Draw text using selection style from the start to the end position of the selection 390 // Draw text using selection style from the start to the end position of the selection
391 if (style != selectionStyle) { 391 if (style != selectionStyle) {
392 StyleDifference diff; 392 StyleDifference diff;
393 diff.setNeedsPaintInvalidationObject(); 393 diff.setNeedsPaintInvalidationObject();
394 SVGResourcesCache::clientStyleChanged(LineLayoutAPIShim::layoutObjectFro m(m_svgInlineTextBox.parent()->lineLayoutItem()), diff, selectionStyle); 394 SVGResourcesCache::clientStyleChanged(LineLayoutAPIShim::layoutObjectFro m(m_svgInlineTextBox.parent()->getLineLayoutItem()), diff, selectionStyle);
395 } 395 }
396 396
397 SkPaint paint; 397 SkPaint paint;
398 if (setupTextPaint(paintInfo, selectionStyle, resourceMode, paint)) 398 if (setupTextPaint(paintInfo, selectionStyle, resourceMode, paint))
399 paintText(paintInfo, textRun, fragment, startPosition, endPosition, pain t); 399 paintText(paintInfo, textRun, fragment, startPosition, endPosition, pain t);
400 400
401 if (style != selectionStyle) { 401 if (style != selectionStyle) {
402 StyleDifference diff; 402 StyleDifference diff;
403 diff.setNeedsPaintInvalidationObject(); 403 diff.setNeedsPaintInvalidationObject();
404 SVGResourcesCache::clientStyleChanged(LineLayoutAPIShim::layoutObjectFro m(m_svgInlineTextBox.parent()->lineLayoutItem()), diff, style); 404 SVGResourcesCache::clientStyleChanged(LineLayoutAPIShim::layoutObjectFro m(m_svgInlineTextBox.parent()->getLineLayoutItem()), diff, style);
405 } 405 }
406 406
407 // Eventually draw text using regular style from the end position of the sel ection to the end of the current chunk part 407 // Eventually draw text using regular style from the end position of the sel ection to the end of the current chunk part
408 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl y) { 408 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl y) {
409 SkPaint paint; 409 SkPaint paint;
410 if (setupTextPaint(paintInfo, style, resourceMode, paint)) 410 if (setupTextPaint(paintInfo, style, resourceMode, paint))
411 paintText(paintInfo, textRun, fragment, endPosition, fragment.length , paint); 411 paintText(paintInfo, textRun, fragment, endPosition, fragment.length , paint);
412 } 412 }
413 } 413 }
414 414
415 Vector<SVGTextFragmentWithRange> SVGInlineTextBoxPainter::collectTextMatches(Doc umentMarker* marker) const 415 Vector<SVGTextFragmentWithRange> SVGInlineTextBoxPainter::collectTextMatches(Doc umentMarker* marker) const
416 { 416 {
417 const Vector<SVGTextFragmentWithRange> emptyTextMatchList; 417 const Vector<SVGTextFragmentWithRange> emptyTextMatchList;
418 418
419 // SVG does not support grammar or spellcheck markers, so skip anything but TextMatch. 419 // SVG does not support grammar or spellcheck markers, so skip anything but TextMatch.
420 if (marker->type() != DocumentMarker::TextMatch) 420 if (marker->type() != DocumentMarker::TextMatch)
421 return emptyTextMatchList; 421 return emptyTextMatchList;
422 422
423 if (!LineLayoutAPIShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem() )->frame()->editor().markedTextMatchesAreHighlighted()) 423 if (!LineLayoutAPIShim::layoutObjectFrom(m_svgInlineTextBox.getLineLayoutIte m())->frame()->editor().markedTextMatchesAreHighlighted())
424 return emptyTextMatchList; 424 return emptyTextMatchList;
425 425
426 int markerStartPosition = std::max<int>(marker->startOffset() - m_svgInlineT extBox.start(), 0); 426 int markerStartPosition = std::max<int>(marker->startOffset() - m_svgInlineT extBox.start(), 0);
427 int markerEndPosition = std::min<int>(marker->endOffset() - m_svgInlineTextB ox.start(), m_svgInlineTextBox.len()); 427 int markerEndPosition = std::min<int>(marker->endOffset() - m_svgInlineTextB ox.start(), m_svgInlineTextBox.len());
428 428
429 if (markerStartPosition >= markerEndPosition) 429 if (markerStartPosition >= markerEndPosition)
430 return emptyTextMatchList; 430 return emptyTextMatchList;
431 431
432 return collectFragmentsInRange(markerStartPosition, markerEndPosition); 432 return collectFragmentsInRange(markerStartPosition, markerEndPosition);
433 } 433 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 stateSaver.save(); 496 stateSaver.save();
497 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); 497 paintInfo.context.concatCTM(fragment.buildFragmentTransform());
498 } 498 }
499 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment (fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); 499 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment (fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style);
500 paintInfo.context.setFillColor(color); 500 paintInfo.context.setFillColor(color);
501 paintInfo.context.fillRect(fragmentRect); 501 paintInfo.context.fillRect(fragmentRect);
502 } 502 }
503 } 503 }
504 504
505 } // namespace blink 505 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698