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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2513293002: Revert of Avoid special handling of LayoutSVGForeignObject about its paint offset (Closed)
Patch Set: Rebase (with good parts kept) Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index b903dbe5ca502038f08d48e03dd118bf05bb148d..74bae4548d574c54e93fd836044f0d74cf80b4ab 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -266,11 +266,16 @@ void PaintPropertyTreeBuilder::updateTransformForNonRootSVG(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
DCHECK(object.isSVG() && !object.isSVGRoot());
- // SVG does not use paint offset internally.
- DCHECK(context.current.paintOffset == LayoutPoint());
+ // SVG (other than SVGForeignObject) does not use paint offset internally.
+ DCHECK(object.isSVGForeignObject() ||
+ context.current.paintOffset == LayoutPoint());
if (object.needsPaintPropertyUpdate()) {
- const AffineTransform& transform = object.localToSVGParentTransform();
+ // TODO(pdr): Refactor this so all non-root SVG objects use the same
+ // transform function.
+ const AffineTransform& transform = object.isSVGForeignObject()
+ ? object.localSVGTransform()
+ : object.localToSVGParentTransform();
// TODO(pdr): Check for the presence of a transform instead of the value.
// Checking for an identity matrix will cause the property tree structure
// to change during animations if the animation passes through the
@@ -840,8 +845,12 @@ static void deriveBorderBoxFromContainerContext(
ASSERT_NOT_REACHED();
}
+ // SVGForeignObject needs paint offset because its viewport offset is baked
+ // into its location(), while its localSVGTransform() doesn't contain the
+ // offset.
if (boxModelObject.isBox() &&
- (!boxModelObject.isSVG() || boxModelObject.isSVGRoot())) {
+ (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() ||
+ boxModelObject.isSVGForeignObject())) {
// TODO(pdr): Several calls in this function walk back up the tree to
// calculate containers (e.g., topLeftLocation, offsetForInFlowPosition*).
// The containing block and other containers can be stored on

Powered by Google App Engine
This is Rietveld 408576698