OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/SVGInlineTextBoxPainter.h" | 6 #include "core/paint/SVGInlineTextBoxPainter.h" |
7 | 7 |
8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
9 #include "core/dom/RenderedDocumentMarker.h" | 9 #include "core/dom/RenderedDocumentMarker.h" |
10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 paintInfo.context->concatCTM(fragmentTransform); | 111 paintInfo.context->concatCTM(fragmentTransform); |
112 } | 112 } |
113 | 113 |
114 // Spec: All text decorations except line-through should be drawn before
the text is filled and stroked; thus, the text is rendered on top of these deco
rations. | 114 // Spec: All text decorations except line-through should be drawn before
the text is filled and stroked; thus, the text is rendered on top of these deco
rations. |
115 unsigned decorations = style.textDecorationsInEffect(); | 115 unsigned decorations = style.textDecorationsInEffect(); |
116 if (decorations & TextDecorationUnderline) | 116 if (decorations & TextDecorationUnderline) |
117 paintDecoration(paintInfo, TextDecorationUnderline, fragment); | 117 paintDecoration(paintInfo, TextDecorationUnderline, fragment); |
118 if (decorations & TextDecorationOverline) | 118 if (decorations & TextDecorationOverline) |
119 paintDecoration(paintInfo, TextDecorationOverline, fragment); | 119 paintDecoration(paintInfo, TextDecorationOverline, fragment); |
120 | 120 |
121 for (int i = 0; i < 3; i++) { | 121 auto paintOrder = svgStyle.paintTypesForPaintOrder(); |
122 switch (svgStyle.paintOrderType(i)) { | 122 for (unsigned i = 0; i < paintOrder.size(); ++i) { |
| 123 switch (paintOrder.at(i)) { |
123 case PT_FILL: | 124 case PT_FILL: |
124 if (hasFill) | 125 if (hasFill) |
125 paintText(paintInfo, style, *selectionStyle, fragment, Apply
ToFillMode, shouldPaintSelection); | 126 paintText(paintInfo, style, *selectionStyle, fragment, Apply
ToFillMode, shouldPaintSelection); |
126 break; | 127 break; |
127 case PT_STROKE: | 128 case PT_STROKE: |
128 if (hasVisibleStroke) | 129 if (hasVisibleStroke) |
129 paintText(paintInfo, style, *selectionStyle, fragment, Apply
ToStrokeMode, shouldPaintSelection); | 130 paintText(paintInfo, style, *selectionStyle, fragment, Apply
ToStrokeMode, shouldPaintSelection); |
130 break; | 131 break; |
131 case PT_MARKERS: | 132 case PT_MARKERS: |
132 // Markers don't apply to text | 133 // Markers don't apply to text |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return; | 254 return; |
254 | 255 |
255 float decorationOffset = baselineOffsetForDecoration(decoration, scaledFont.
fontMetrics(), thickness); | 256 float decorationOffset = baselineOffsetForDecoration(decoration, scaledFont.
fontMetrics(), thickness); |
256 FloatPoint decorationOrigin(fragment.x, fragment.y - decorationOffset / scal
ingFactor); | 257 FloatPoint decorationOrigin(fragment.x, fragment.y - decorationOffset / scal
ingFactor); |
257 | 258 |
258 Path path; | 259 Path path; |
259 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness
/ scalingFactor))); | 260 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness
/ scalingFactor))); |
260 | 261 |
261 const SVGComputedStyle& svgDecorationStyle = decorationStyle.svgStyle(); | 262 const SVGComputedStyle& svgDecorationStyle = decorationStyle.svgStyle(); |
262 | 263 |
263 for (int i = 0; i < 3; i++) { | 264 auto paintOrder = svgDecorationStyle.paintTypesForPaintOrder(); |
264 switch (svgDecorationStyle.paintOrderType(i)) { | 265 for (unsigned i = 0; i < paintOrder.size(); ++i) { |
| 266 switch (paintOrder.at(i)) { |
265 case PT_FILL: | 267 case PT_FILL: |
266 if (svgDecorationStyle.hasFill()) { | 268 if (svgDecorationStyle.hasFill()) { |
267 SkPaint fillPaint; | 269 SkPaint fillPaint; |
268 if (!SVGPaintContext::paintForLayoutObject(paintInfo, decoration
Style, *decorationLayoutObject, ApplyToFillMode, fillPaint)) | 270 if (!SVGPaintContext::paintForLayoutObject(paintInfo, decoration
Style, *decorationLayoutObject, ApplyToFillMode, fillPaint)) |
269 break; | 271 break; |
270 fillPaint.setAntiAlias(true); | 272 fillPaint.setAntiAlias(true); |
271 paintInfo.context->drawPath(path.skPath(), fillPaint); | 273 paintInfo.context->drawPath(path.skPath(), fillPaint); |
272 } | 274 } |
273 break; | 275 break; |
274 case PT_STROKE: | 276 case PT_STROKE: |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (!fragmentTransform.isIdentity()) | 443 if (!fragmentTransform.isIdentity()) |
442 context->concatCTM(fragmentTransform); | 444 context->concatCTM(fragmentTransform); |
443 context->setFillColor(color); | 445 context->setFillColor(color); |
444 context->fillRect(fragmentRect, color); | 446 context->fillRect(fragmentRect, color); |
445 } | 447 } |
446 } | 448 } |
447 } | 449 } |
448 } | 450 } |
449 | 451 |
450 } // namespace blink | 452 } // namespace blink |
OLD | NEW |