Changeset 88007 in webkit
- Timestamp:
- Jun 3, 2011 5:11:19 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88005 r88007 1 2011-06-03 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Andreas Kling. 4 5 Zooming <object style="width/height: auto" data="foo.svg"/> doesn't work as expected 6 https://bugs.webkit.org/show_bug.cgi?id=62005 7 8 Zooming an object with auto size, that references a svg with fixed size was broken. The svg size stayed the same. 9 Added new tests covering this zooming. 10 11 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png: 12 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt: 13 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png: 14 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt: 15 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.png: Added. 16 * platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt: Added. 17 * svg/zoom/page/resources/circle.svg: Added. 18 * svg/zoom/page/zoom-svg-through-object-with-auto-size.html: Added. 19 1 20 2011-06-03 Csaba Osztrogonác <ossy@webkit.org> 2 21 -
trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt
r87526 r88007 28 28 RenderView at (0,0) size 138x69 29 29 layer at (0,0) size 138x69 30 RenderSVGRoot {svg} at (2 3,0) size 92x6930 RenderSVGRoot {svg} at (22,0) size 93x69 31 31 RenderSVGContainer {g} at (27,8) size 73x46 32 32 RenderSVGPath {rect} at (28,8) size 11x17 [stroke={[type=SOLID] [color=#000000]}] [x=30.00] [y=46.00] [width=50.00] [height=80.00] … … 41 41 RenderSVGInlineText {#text} at (0,0) size 272x48 42 42 chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 271.30: "$Revision: 1.7 $" 43 RenderSVGPath {rect} at (2 3,0) size 92x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]43 RenderSVGPath {rect} at (22,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00] 44 44 RenderText {#text} at (0,0) size 0x0 45 45 RenderTableCell {td} at (245,90) size 244x82 [r=2 c=1 rs=1 cs=1] -
trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt
r87526 r88007 28 28 RenderView at (0,0) size 138x69 29 29 layer at (0,0) size 138x69 30 RenderSVGRoot {svg} at (2 3,0) size 92x6930 RenderSVGRoot {svg} at (22,0) size 93x69 31 31 RenderSVGContainer {g} at (27,8) size 73x46 32 32 RenderSVGPath {rect} at (28,8) size 11x17 [stroke={[type=SOLID] [color=#000000]}] [x=30.00] [y=46.00] [width=50.00] [height=80.00] … … 41 41 RenderSVGInlineText {#text} at (0,0) size 272x48 42 42 chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 271.30: "$Revision: 1.7 $" 43 RenderSVGPath {rect} at (2 3,0) size 92x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]43 RenderSVGPath {rect} at (22,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00] 44 44 RenderText {#text} at (0,0) size 0x0 45 45 RenderTableCell {td} at (245,90) size 244x82 [r=2 c=1 rs=1 cs=1] -
trunk/Source/WebCore/ChangeLog
r88004 r88007 1 2011-06-03 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Andreas Kling. 4 5 Zooming <object style="width/height: auto" data="foo.svg"/> doesn't work as expected 6 https://bugs.webkit.org/show_bug.cgi?id=62005 7 8 Zooming an object with auto size, that references a svg with fixed size was broken. The svg size stayed the same. 9 Get rid of the dependency between RenderSVGRoot and SVGSVGElement::currentScale(), always ask for the effective 10 zoom in the RenderStyle instead of asking SVGSVGElement. 11 12 The SVGSVGElement::currentScale()/setCurrentScale() methods are now only used when called from the bindings (eg. JS). 13 They only take effect on the outermost <svg> element in standalone documents, otherwhise they are no-ops. 14 15 Test: svg/zoom/page/zoom-svg-through-object-with-auto-size.html 16 17 * rendering/svg/RenderSVGRoot.cpp: 18 (WebCore::RenderSVGRoot::computeIntrinsicWidth): 19 (WebCore::RenderSVGRoot::computeIntrinsicHeight): 20 (WebCore::RenderSVGRoot::localToBorderBoxTransform): 21 * svg/SVGSVGElement.cpp: 22 (WebCore::SVGSVGElement::SVGSVGElement): 23 (WebCore::SVGSVGElement::currentScale): 24 (WebCore::SVGSVGElement::setCurrentScale): 25 * svg/SVGSVGElement.h: 26 1 27 2011-06-03 Mario Sanchez Prada <msanchez@igalia.com> 2 28 -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r87801 r88007 118 118 if (!style()->width().isPercent()) 119 119 return replacedWidth; 120 121 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 122 return static_cast<int>(ceilf(replacedWidth * svg->currentScale())); 120 return static_cast<int>(ceilf(replacedWidth * style()->effectiveZoom())); 123 121 } 124 122 … … 127 125 if (!style()->height().isPercent()) 128 126 return replacedHeight; 129 130 const SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 131 return static_cast<int>(ceilf(replacedHeight * svg->currentScale())); 127 return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom())); 132 128 } 133 129 … … 368 364 IntSize borderAndPadding = borderOriginToContentBox(); 369 365 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); 370 float scale = s vg->currentScale();366 float scale = style()->effectiveZoom(); 371 367 FloatPoint translate = svg->currentTranslate(); 372 368 AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()); -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r87526 r88007 74 74 , m_useCurrentView(false) 75 75 , m_timeContainer(SMILTimeContainer::create(this)) 76 , m_scale(1)77 76 , m_containerSize(300, 150) 78 77 , m_hasSetContainerSize(false) … … 200 199 float SVGSVGElement::currentScale() const 201 200 { 202 if (!inDocument() )201 if (!inDocument() || !isOutermostSVG()) 203 202 return 1; 204 203 … … 210 209 ASSERT(frameTree); 211 210 212 // If we have a parent frame, only return the user-specified m_scale here. 213 if (frameTree->parent()) 214 return m_scale; 215 216 return frame->pageZoomFactor(); 211 // The behaviour of currentScale() is undefined, when we're dealing with non-standalone SVG documents. 212 // If the svg is embedded, the scaling is handled by the host renderer, so when asking from inside 213 // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale. 214 return frameTree->parent() ? 1 : frame->pageZoomFactor(); 217 215 } 218 216 219 217 void SVGSVGElement::setCurrentScale(float scale) 220 218 { 221 if (!inDocument() )219 if (!inDocument() || !isOutermostSVG()) 222 220 return; 223 221 … … 229 227 ASSERT(frameTree); 230 228 231 bool hasFrameParent = frameTree->parent(); 232 233 // Calling setCurrentScale() on the outermost <svg> element in a standalone SVG document 234 // is allowed to change the page zoom factor, influencing the document size, scrollbars etc. 235 if (!hasFrameParent && isOutermostSVG()) { 236 frame->setPageZoomFactor(scale); 237 m_scale = 1; 229 // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents. 230 // We choose the ignore this call, it's pretty useless to support calling setCurrentScale() from within 231 // an embedded SVG document, for the same reasons as in currentScale() - needs resolution by SVG WG. 232 if (frameTree->parent()) 238 233 return; 239 } 240 241 m_scale = scale; 242 243 if (RenderObject* object = renderer()) 244 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); 234 235 frame->setPageZoomFactor(scale); 245 236 } 246 237 -
trunk/Source/WebCore/svg/SVGSVGElement.h
r87526 r88007 172 172 RefPtr<SMILTimeContainer> m_timeContainer; 173 173 FloatPoint m_translation; 174 float m_scale;175 174 mutable OwnPtr<SVGViewSpec> m_viewSpec; 176 175 IntSize m_containerSize;
Note: See TracChangeset
for help on using the changeset viewer.