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

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

Issue 655263002: Let the paint-server client compute and pass any additional transform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGResource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 case PT_FILL: 266 case PT_FILL:
267 if (svgDecorationStyle.hasFill()) { 267 if (svgDecorationStyle.hasFill()) {
268 GraphicsContextStateSaver stateSaver(*context, false); 268 GraphicsContextStateSaver stateSaver(*context, false);
269 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat ionStyle, *decorationRenderer, ApplyToFillMode)) 269 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat ionStyle, *decorationRenderer, ApplyToFillMode))
270 break; 270 break;
271 context->fillPath(path); 271 context->fillPath(path);
272 } 272 }
273 break; 273 break;
274 case PT_STROKE: 274 case PT_STROKE:
275 if (svgDecorationStyle.hasVisibleStroke()) { 275 if (svgDecorationStyle.hasVisibleStroke()) {
276 // FIXME: Non-scaling stroke is not applied here.
fs 2014/10/15 15:42:11 This FIXME and the one below just document pre-exi
276 GraphicsContextStateSaver stateSaver(*context, false); 277 GraphicsContextStateSaver stateSaver(*context, false);
277 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat ionStyle, *decorationRenderer, ApplyToStrokeMode)) 278 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat ionStyle, *decorationRenderer, ApplyToStrokeMode))
278 break; 279 break;
279 context->strokePath(path); 280 context->strokePath(path);
280 } 281 }
281 break; 282 break;
282 case PT_MARKERS: 283 case PT_MARKERS:
283 break; 284 break;
284 default: 285 default:
285 ASSERT_NOT_REACHED(); 286 ASSERT_NOT_REACHED();
(...skipping 11 matching lines...) Expand all
297 ASSERT(scalingFactor); 298 ASSERT(scalingFactor);
298 299
299 const Font& scaledFont = textRenderer.scaledFont(); 300 const Font& scaledFont = textRenderer.scaledFont();
300 const ShadowList* shadowList = style->textShadow(); 301 const ShadowList* shadowList = style->textShadow();
301 302
302 // Text shadows are disabled when printing. http://crbug.com/258321 303 // Text shadows are disabled when printing. http://crbug.com/258321
303 bool hasShadow = shadowList && !context->printing(); 304 bool hasShadow = shadowList && !context->printing();
304 305
305 FloatPoint textOrigin(fragment.x, fragment.y); 306 FloatPoint textOrigin(fragment.x, fragment.y);
306 FloatSize textSize(fragment.width, fragment.height); 307 FloatSize textSize(fragment.width, fragment.height);
308 AffineTransform paintServerTransform;
309 const AffineTransform* additionalPaintServerTransform = 0;
307 310
308 GraphicsContextStateSaver stateSaver(*context, false); 311 GraphicsContextStateSaver stateSaver(*context, false);
309 if (scalingFactor != 1) { 312 if (scalingFactor != 1) {
310 textOrigin.scale(scalingFactor, scalingFactor); 313 textOrigin.scale(scalingFactor, scalingFactor);
311 textSize.scale(scalingFactor); 314 textSize.scale(scalingFactor);
312 stateSaver.save(); 315 stateSaver.save();
313 context->scale(1 / scalingFactor, 1 / scalingFactor); 316 context->scale(1 / scalingFactor, 1 / scalingFactor);
317 // Adjust the paint-server coordinate space.
318 paintServerTransform.scale(scalingFactor);
319 additionalPaintServerTransform = &paintServerTransform;
314 } 320 }
315 321
316 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, style, m_svgInlineT extBox.parent()->renderer(), resourceMode | ApplyToTextMode)) 322 // FIXME: Non-scaling stroke is not applied here.
323
324 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, style, m_svgInlineT extBox.parent()->renderer(), resourceMode, additionalPaintServerTransform))
317 return; 325 return;
318 326
319 if (hasShadow) { 327 if (hasShadow) {
320 stateSaver.saveIfNeeded(); 328 stateSaver.saveIfNeeded();
321 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S hadowRespectsAlpha)); 329 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S hadowRespectsAlpha));
322 } 330 }
323 331
324 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill : TextModeStroke); 332 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill : TextModeStroke);
325 333
326 if (scalingFactor != 1 && resourceMode == ApplyToStrokeMode) 334 if (scalingFactor != 1 && resourceMode == ApplyToStrokeMode)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 439
432 fragmentRect = fragmentTransform.mapRect(fragmentRect); 440 fragmentRect = fragmentTransform.mapRect(fragmentRect);
433 markerRect.unite(fragmentRect); 441 markerRect.unite(fragmentRect);
434 } 442 }
435 } 443 }
436 444
437 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu teQuad(markerRect).enclosingBoundingBox()); 445 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu teQuad(markerRect).enclosingBoundingBox());
438 } 446 }
439 447
440 } // namespace blink 448 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698