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

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

Issue 2510513002: Issue paint offset for SVGText, etc. (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), 260 floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
261 style.transformOriginZ()); 261 style.transformOriginZ());
262 } 262 }
263 263
264 // SVG does not use the general transform update of |updateTransform|, instead 264 // SVG does not use the general transform update of |updateTransform|, instead
265 // creating a transform node for SVG-specific transforms without 3D. 265 // creating a transform node for SVG-specific transforms without 3D.
266 void PaintPropertyTreeBuilder::updateTransformForNonRootSVG( 266 void PaintPropertyTreeBuilder::updateTransformForNonRootSVG(
267 const LayoutObject& object, 267 const LayoutObject& object,
268 PaintPropertyTreeBuilderContext& context) { 268 PaintPropertyTreeBuilderContext& context) {
269 DCHECK(object.isSVG() && !object.isSVGRoot()); 269 DCHECK(object.isSVG() && !object.isSVGRoot());
270 // SVG (other than SVGForeignObject) does not use paint offset internally. 270 // SVG does not use paint offset internally, except for SVGForeignObject which
271 // has different SVG and HTML coordinate spaces.
271 DCHECK(object.isSVGForeignObject() || 272 DCHECK(object.isSVGForeignObject() ||
272 context.current.paintOffset == LayoutPoint()); 273 context.current.paintOffset == LayoutPoint());
273 274
274 if (object.needsPaintPropertyUpdate()) { 275 if (object.needsPaintPropertyUpdate()) {
275 AffineTransform transform = object.localToSVGParentTransform(); 276 AffineTransform transform = object.localToSVGParentTransform();
276 // TODO(pdr): Check for the presence of a transform instead of the value. 277 // TODO(pdr): Check for the presence of a transform instead of the value.
277 // Checking for an identity matrix will cause the property tree structure 278 // Checking for an identity matrix will cause the property tree structure
278 // to change during animations if the animation passes through the 279 // to change during animations if the animation passes through the
279 // identity matrix. 280 // identity matrix.
280 if (!transform.isIdentity()) { 281 if (!transform.isIdentity()) {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 overrideContaineringBlockContextFromRealContainingBlock( 839 overrideContaineringBlockContextFromRealContainingBlock(
839 toLayoutBlock(*boxModelObject.container()), context.current); 840 toLayoutBlock(*boxModelObject.container()), context.current);
840 } else { 841 } else {
841 context.current = context.fixedPosition; 842 context.current = context.fixedPosition;
842 } 843 }
843 break; 844 break;
844 default: 845 default:
845 ASSERT_NOT_REACHED(); 846 ASSERT_NOT_REACHED();
846 } 847 }
847 848
848 // SVGForeignObject needs paint offset because its viewport offset is baked 849 if (boxModelObject.isBox()) {
849 // into its location(), while its localSVGTransform() doesn't contain the
850 // offset.
851 if (boxModelObject.isBox() &&
852 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() ||
853 boxModelObject.isSVGForeignObject())) {
854 // TODO(pdr): Several calls in this function walk back up the tree to 850 // TODO(pdr): Several calls in this function walk back up the tree to
855 // calculate containers (e.g., physicalLocation, offsetForInFlowPosition*). 851 // calculate containers (e.g., physicalLocation, offsetForInFlowPosition*).
856 // The containing block and other containers can be stored on 852 // The containing block and other containers can be stored on
857 // PaintPropertyTreeBuilderContext instead of recomputing them. 853 // PaintPropertyTreeBuilderContext instead of recomputing them.
858 context.current.paintOffset.moveBy( 854 context.current.paintOffset.moveBy(
859 toLayoutBox(boxModelObject).physicalLocation()); 855 toLayoutBox(boxModelObject).physicalLocation());
860 // This is a weird quirk that table cells paint as children of table rows, 856 // This is a weird quirk that table cells paint as children of table rows,
861 // but their location have the row's location baked-in. 857 // but their location have the row's location baked-in.
862 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). 858 // Similar adjustment is done in LayoutTableCell::offsetFromContainer().
863 if (boxModelObject.isTableCell()) { 859 if (boxModelObject.isTableCell()) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 #endif 896 #endif
901 897
902 updateOverflowClip(object, context); 898 updateOverflowClip(object, context);
903 updatePerspective(object, context); 899 updatePerspective(object, context);
904 updateSvgLocalToBorderBoxTransform(object, context); 900 updateSvgLocalToBorderBoxTransform(object, context);
905 updateScrollAndScrollTranslation(object, context); 901 updateScrollAndScrollTranslation(object, context);
906 updateOutOfFlowContext(object, context); 902 updateOutOfFlowContext(object, context);
907 } 903 }
908 904
909 } // namespace blink 905 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698