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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (scalingFactor != 1) { | 322 if (scalingFactor != 1) { |
323 textOrigin.scale(scalingFactor, scalingFactor); | 323 textOrigin.scale(scalingFactor, scalingFactor); |
324 textSize.scale(scalingFactor); | 324 textSize.scale(scalingFactor); |
325 stateSaver.save(); | 325 stateSaver.save(); |
326 context->scale(1 / scalingFactor, 1 / scalingFactor); | 326 context->scale(1 / scalingFactor, 1 / scalingFactor); |
327 // Adjust the paint-server coordinate space. | 327 // Adjust the paint-server coordinate space. |
328 paintServerTransform.scale(scalingFactor); | 328 paintServerTransform.scale(scalingFactor); |
329 additionalPaintServerTransform = &paintServerTransform; | 329 additionalPaintServerTransform = &paintServerTransform; |
330 } | 330 } |
331 | 331 |
332 // FIXME: Non-scaling stroke is not applied here. | |
333 SkPaint paint; | 332 SkPaint paint; |
334 if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, m_svgInlineText
Box.parent()->layoutObject(), resourceMode, paint, additionalPaintServerTransfor
m)) | 333 if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, m_svgInlineText
Box.parent()->layoutObject(), resourceMode, paint, additionalPaintServerTransfor
m)) |
335 return; | 334 return; |
336 paint.setAntiAlias(true); | 335 paint.setAntiAlias(true); |
337 | 336 |
338 if (hasShadow) { | 337 if (hasShadow) { |
339 OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLoop
er(DrawLooperBuilder::ShadowRespectsAlpha); | 338 OwnPtr<DrawLooperBuilder> drawLooperBuilder = shadowList->createDrawLoop
er(DrawLooperBuilder::ShadowRespectsAlpha); |
340 RefPtr<SkDrawLooper> drawLooper = drawLooperBuilder->detachDrawLooper(); | 339 RefPtr<SkDrawLooper> drawLooper = drawLooperBuilder->detachDrawLooper(); |
341 paint.setLooper(drawLooper.get()); | 340 paint.setLooper(drawLooper.get()); |
342 } | 341 } |
343 | 342 |
344 if (resourceMode == ApplyToStrokeMode) { | 343 if (resourceMode == ApplyToStrokeMode) { |
345 StrokeData strokeData; | 344 StrokeData strokeData; |
346 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, m_svgI
nlineTextBox.parent()->layoutObject()); | 345 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, m_svgI
nlineTextBox.parent()->layoutObject()); |
347 strokeData.setThickness(strokeData.thickness() * scalingFactor); | 346 if (style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE) |
| 347 strokeData.setThickness(strokeData.thickness() * scalingFactor); |
348 strokeData.setupPaint(&paint); | 348 strokeData.setupPaint(&paint); |
349 } | 349 } |
350 | 350 |
351 TextRunPaintInfo textRunPaintInfo(textRun); | 351 TextRunPaintInfo textRunPaintInfo(textRun); |
352 textRunPaintInfo.from = startPosition; | 352 textRunPaintInfo.from = startPosition; |
353 textRunPaintInfo.to = endPosition; | 353 textRunPaintInfo.to = endPosition; |
354 | 354 |
355 float baseline = scaledFont.fontMetrics().floatAscent(); | 355 float baseline = scaledFont.fontMetrics().floatAscent(); |
356 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, | 356 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, |
357 textSize.width(), textSize.height()); | 357 textSize.width(), textSize.height()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if (!fragmentTransform.isIdentity()) | 445 if (!fragmentTransform.isIdentity()) |
446 context->concatCTM(fragmentTransform); | 446 context->concatCTM(fragmentTransform); |
447 context->setFillColor(color); | 447 context->setFillColor(color); |
448 context->fillRect(fragmentRect, color); | 448 context->fillRect(fragmentRect, color); |
449 } | 449 } |
450 } | 450 } |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 } // namespace blink | 454 } // namespace blink |
OLD | NEW |