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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp

Issue 2778873002: Reland "Let SVGForeignObject's local SVG coordinates mean what it should" (Closed)
Patch Set: Fix Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 : DescendantIsolationNeedsUpdate); 92 : DescendantIsolationNeedsUpdate);
93 } 93 }
94 94
95 LayoutBlock::styleDidChange(diff, oldStyle); 95 LayoutBlock::styleDidChange(diff, oldStyle);
96 SVGResourcesCache::clientStyleChanged(this, diff, styleRef()); 96 SVGResourcesCache::clientStyleChanged(this, diff, styleRef());
97 } 97 }
98 98
99 void LayoutSVGBlock::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, 99 void LayoutSVGBlock::mapLocalToAncestor(const LayoutBoxModelObject* ancestor,
100 TransformState& transformState, 100 TransformState& transformState,
101 MapCoordinatesFlags flags) const { 101 MapCoordinatesFlags flags) const {
102 // Convert from local HTML coordinates to local SVG coordinates.
103 transformState.move(locationOffset());
104 // Apply other mappings on local SVG coordinates.
102 SVGLayoutSupport::mapLocalToAncestor(this, ancestor, transformState, flags); 105 SVGLayoutSupport::mapLocalToAncestor(this, ancestor, transformState, flags);
103 } 106 }
104 107
105 void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, 108 void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor,
106 TransformState& transformState, 109 TransformState& transformState,
107 MapCoordinatesFlags flags) const { 110 MapCoordinatesFlags flags) const {
108 if (this == ancestor) 111 if (this == ancestor)
109 return; 112 return;
110 113
114 // Map to local SVG coordinates.
111 SVGLayoutSupport::mapAncestorToLocal(*this, ancestor, transformState, flags); 115 SVGLayoutSupport::mapAncestorToLocal(*this, ancestor, transformState, flags);
116 // Convert from local SVG coordinates to local HTML coordinates.
117 transformState.move(locationOffset());
Xianzhu 2017/03/28 17:45:09 This is the fix. In the original patch, this was "
112 } 118 }
113 119
114 const LayoutObject* LayoutSVGBlock::pushMappingToContainer( 120 const LayoutObject* LayoutSVGBlock::pushMappingToContainer(
115 const LayoutBoxModelObject* ancestorToStopAt, 121 const LayoutBoxModelObject* ancestorToStopAt,
116 LayoutGeometryMap& geometryMap) const { 122 LayoutGeometryMap& geometryMap) const {
123 // Convert from local HTML coordinates to local SVG coordinates.
124 geometryMap.push(this, locationOffset());
125 // Apply other mappings on local SVG coordinates.
117 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt, 126 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt,
118 geometryMap); 127 geometryMap);
119 } 128 }
120 129
121 LayoutRect LayoutSVGBlock::absoluteVisualRect() const { 130 LayoutRect LayoutSVGBlock::absoluteVisualRect() const {
122 return SVGLayoutSupport::visualRectInAncestorSpace(*this, *view()); 131 return SVGLayoutSupport::visualRectInAncestorSpace(*this, *view());
123 } 132 }
124 133
125 bool LayoutSVGBlock::mapToVisualRectInAncestorSpaceInternal( 134 bool LayoutSVGBlock::mapToVisualRectInAncestorSpaceInternal(
126 const LayoutBoxModelObject* ancestor, 135 const LayoutBoxModelObject* ancestor,
127 TransformState& transformState, 136 TransformState& transformState,
128 VisualRectFlags) const { 137 VisualRectFlags) const {
129 transformState.flatten(); 138 transformState.flatten();
130 LayoutRect rect(transformState.lastPlanarQuad().boundingBox()); 139 LayoutRect rect(transformState.lastPlanarQuad().boundingBox());
140 // Convert from local HTML coordinates to local SVG coordinates.
141 rect.moveBy(location());
142 // Apply other mappings on local SVG coordinates.
131 bool retval = SVGLayoutSupport::mapToVisualRectInAncestorSpace( 143 bool retval = SVGLayoutSupport::mapToVisualRectInAncestorSpace(
132 *this, ancestor, FloatRect(rect), rect); 144 *this, ancestor, FloatRect(rect), rect);
133 transformState.setQuad(FloatQuad(FloatRect(rect))); 145 transformState.setQuad(FloatQuad(FloatRect(rect)));
134 return retval; 146 return retval;
135 } 147 }
136 148
137 bool LayoutSVGBlock::nodeAtPoint(HitTestResult&, 149 bool LayoutSVGBlock::nodeAtPoint(HitTestResult&,
138 const HitTestLocation&, 150 const HitTestLocation&,
139 const LayoutPoint&, 151 const LayoutPoint&,
140 HitTestAction) { 152 HitTestAction) {
141 NOTREACHED(); 153 NOTREACHED();
142 return false; 154 return false;
143 } 155 }
144 156
145 } // namespace blink 157 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698