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

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

Issue 2378833002: Output svg foreign object paint offset in paint properties (Closed)
Patch Set: paint offset Created 4 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
« no previous file with comments | « no previous file | 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 FloatSize borderBoxSize(box.size()); 211 FloatSize borderBoxSize(box.size());
212 return FloatPoint3D( 212 return FloatPoint3D(
213 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), 213 floatValueForLength(style.transformOriginX(), borderBoxSize.width()),
214 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), 214 floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
215 style.transformOriginZ()); 215 style.transformOriginZ());
216 } 216 }
217 217
218 void PaintPropertyTreeBuilder::updateTransform(const LayoutObject& object, Paint PropertyTreeBuilderContext& context) 218 void PaintPropertyTreeBuilder::updateTransform(const LayoutObject& object, Paint PropertyTreeBuilderContext& context)
219 { 219 {
220 if (object.isSVG() && !object.isSVGRoot()) { 220 if (object.isSVG() && !object.isSVGRoot()) {
221 // SVG does not use paint offset internally. 221 // SVG (other than SVGForeign object) does not use paint offset internal ly.
pdr. 2016/09/29 01:26:34 I think LayoutSVGText uses this too (the comment i
Xianzhu 2016/09/29 01:32:47 Done.
Xianzhu 2016/09/29 02:57:40 Just looked into LayoutSVGText and found that it's
222 DCHECK(context.current.paintOffset == LayoutPoint()); 222 DCHECK(object.isSVGForeignObject() || context.current.paintOffset == Lay outPoint());
223 223
224 // FIXME(pdr): Check for the presence of a transform instead of the valu e. Checking for an 224 // FIXME(pdr): Check for the presence of a transform instead of the valu e. Checking for an
225 // identity matrix will cause the property tree structure to change duri ng animations if 225 // identity matrix will cause the property tree structure to change duri ng animations if
226 // the animation passes through the identity matrix. 226 // the animation passes through the identity matrix.
227 // FIXME(pdr): Refactor this so all non-root SVG objects use the same tr ansform function. 227 // FIXME(pdr): Refactor this so all non-root SVG objects use the same tr ansform function.
228 const AffineTransform& transform = object.isSVGForeignObject() ? object. localSVGTransform() : object.localToSVGParentTransform(); 228 const AffineTransform& transform = object.isSVGForeignObject() ? object. localSVGTransform() : object.localToSVGParentTransform();
229 if (!transform.isIdentity()) { 229 if (!transform.isIdentity()) {
230 // The origin is included in the local transform, so leave origin em pty. 230 // The origin is included in the local transform, so leave origin em pty.
231 context.current.transform = object.getMutableForPainting().ensureObj ectPaintProperties().createOrUpdateTransform( 231 context.current.transform = object.getMutableForPainting().ensureObj ectPaintProperties().createOrUpdateTransform(
232 context.current.transform, TransformationMatrix(transform), Floa tPoint3D()); 232 context.current.transform, TransformationMatrix(transform), Floa tPoint3D());
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 534 }
535 case StickyPosition: 535 case StickyPosition:
536 context.current.paintOffset += boxModelObject.offsetForInFlowPosition(); 536 context.current.paintOffset += boxModelObject.offsetForInFlowPosition();
537 break; 537 break;
538 case FixedPosition: 538 case FixedPosition:
539 context.current = context.fixedPosition; 539 context.current = context.fixedPosition;
540 break; 540 break;
541 default: 541 default:
542 ASSERT_NOT_REACHED(); 542 ASSERT_NOT_REACHED();
543 } 543 }
544 if (boxModelObject.isBox() && (!boxModelObject.isSVG() || boxModelObject.isS VGRoot())) { 544 if (boxModelObject.isBox() && (!boxModelObject.isSVG() || boxModelObject.isS VGRoot() || boxModelObject.isSVGForeignObject())) {
545 // TODO(pdr): Several calls in this function walk back up the tree to ca lculate containers 545 // TODO(pdr): Several calls in this function walk back up the tree to ca lculate containers
546 // (e.g., topLeftLocation, offsetForInFlowPosition*). The containing blo ck and other 546 // (e.g., topLeftLocation, offsetForInFlowPosition*). The containing blo ck and other
547 // containers can be stored on PaintPropertyTreeBuilderContext instead o f recomputing them. 547 // containers can be stored on PaintPropertyTreeBuilderContext instead o f recomputing them.
548 context.current.paintOffset.moveBy(toLayoutBox(boxModelObject).topLeftLo cation()); 548 context.current.paintOffset.moveBy(toLayoutBox(boxModelObject).topLeftLo cation());
549 // This is a weird quirk that table cells paint as children of table row s, 549 // This is a weird quirk that table cells paint as children of table row s,
550 // but their location have the row's location baked-in. 550 // but their location have the row's location baked-in.
551 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). 551 // Similar adjustment is done in LayoutTableCell::offsetFromContainer().
552 if (boxModelObject.isTableCell()) { 552 if (boxModelObject.isTableCell()) {
553 LayoutObject* parentRow = boxModelObject.parent(); 553 LayoutObject* parentRow = boxModelObject.parent();
554 ASSERT(parentRow && parentRow->isTableRow()); 554 ASSERT(parentRow && parentRow->isTableRow());
(...skipping 24 matching lines...) Expand all
579 return; 579 return;
580 580
581 updateOverflowClip(object, context); 581 updateOverflowClip(object, context);
582 updatePerspective(object, context); 582 updatePerspective(object, context);
583 updateSvgLocalToBorderBoxTransform(object, context); 583 updateSvgLocalToBorderBoxTransform(object, context);
584 updateScrollAndScrollTranslation(object, context); 584 updateScrollAndScrollTranslation(object, context);
585 updateOutOfFlowContext(object, context); 585 updateOutOfFlowContext(object, context);
586 } 586 }
587 587
588 } // namespace blink 588 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698