Changeset 26077 in webkit
- Timestamp:
- Oct 6, 2007 1:49:47 AM (17 years ago)
- Location:
- branches/feature-branch/WebCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-branch/WebCore/ChangeLog
r26076 r26077 1 2007-10-06 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Oliver Hunt. 4 5 RenderSVGContainer (<g>) should not repaint when its bounds change (unless it has a filter) 6 http://bugs.webkit.org/show_bug.cgi?id=15388 7 This makes the Sun Lively Kernel invalidate only what it should! 8 9 No tests possible in DRT. 10 11 * ksvg2/svg/SVGCircleElement.cpp: 12 (WebCore::SVGCircleElement::notifyAttributeChange): replace call to rebuildRenderer 13 * ksvg2/svg/SVGEllipseElement.cpp: 14 (WebCore::SVGEllipseElement::notifyAttributeChange): replace call to rebuildRenderer 15 * ksvg2/svg/SVGImageElement.cpp: 16 (WebCore::SVGImageElement::notifyAttributeChange): replace call to rebuildRenderer 17 (WebCore::SVGImageElement::hasRelativeValues): implemented 18 * ksvg2/svg/SVGImageElement.h: 19 * ksvg2/svg/SVGLineElement.cpp: 20 (WebCore::SVGLineElement::notifyAttributeChange): replace call to rebuildRenderer 21 * ksvg2/svg/SVGPathElement.cpp: 22 (WebCore::SVGPathElement::notifyAttributeChange): replace call to rebuildRenderer 23 * ksvg2/svg/SVGPolyElement.cpp: 24 (WebCore::SVGPolyElement::notifyAttributeChange): replace call to rebuildRenderer 25 * ksvg2/svg/SVGRectElement.cpp: 26 (WebCore::SVGRectElement::notifyAttributeChange): replace call to rebuildRenderer 27 * ksvg2/svg/SVGStyledElement.cpp: 28 * ksvg2/svg/SVGStyledElement.h: 29 (WebCore::SVGStyledElement::hasRelativeValues): default to true instead 30 * ksvg2/svg/SVGStyledTransformableElement.cpp: 31 (WebCore::SVGStyledTransformableElement::updateLocalTransform): don't layout if no change 32 * ksvg2/svg/SVGStyledTransformableElement.h: 33 * ksvg2/svg/SVGTransform.h: 34 * rendering/RenderPath.cpp: 35 (WebCore::RenderPath::layout): 36 * rendering/RenderPath.h: 37 * rendering/RenderSVGContainer.cpp: 38 (WebCore::RenderSVGContainer::layout): 39 (WebCore::RenderSVGContainer::selfWillPaint): return true if have a filter 40 (WebCore::RenderSVGContainer::paint): 41 * rendering/RenderSVGContainer.h: 42 * rendering/RenderSVGHiddenContainer.cpp: 43 (WebCore::RenderSVGHiddenContainer::layout): 44 * rendering/RenderSVGRoot.cpp: 45 (WebCore::RenderSVGRoot::layout): 46 * rendering/RenderSVGViewportContainer.cpp: 47 (WebCore::RenderSVGViewportContainer::layout): 48 (WebCore::RenderSVGViewportContainer::calcViewport): use floats 49 1 50 2007-10-06 Rob Buis <buis@kde.org> 2 51 -
branches/feature-branch/WebCore/ksvg2/svg/SVGCircleElement.cpp
r26076 r26077 27 27 28 28 #include "FloatPoint.h" 29 #include "RenderPath.h" 29 30 #include "SVGNames.h" 30 31 … … 73 74 void SVGCircleElement::notifyAttributeChange() const 74 75 { 75 if (!document()->parsing() )76 re buildRenderer();76 if (!document()->parsing() && renderer()) 77 renderer()->setNeedsLayout(true); 77 78 78 79 SVGStyledTransformableElement::notifyAttributeChange(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGEllipseElement.cpp
r26076 r26077 27 27 28 28 #include "FloatPoint.h" 29 #include "RenderPath.h" 29 30 #include "SVGLength.h" 30 31 #include "SVGNames.h" … … 80 81 void SVGEllipseElement::notifyAttributeChange() const 81 82 { 82 if (!document()->parsing() )83 re buildRenderer();83 if (!document()->parsing() && renderer()) 84 renderer()->setNeedsLayout(true); 84 85 85 86 SVGStyledTransformableElement::notifyAttributeChange(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGImageElement.cpp
r26076 r26077 102 102 void SVGImageElement::notifyAttributeChange() const 103 103 { 104 if (!document()->parsing() )105 re buildRenderer();104 if (!document()->parsing() && renderer()) 105 renderer()->setNeedsLayout(true); 106 106 107 107 SVGStyledTransformableElement::notifyAttributeChange(); 108 } 109 110 bool SVGImageElement::hasRelativeValues() const 111 { 112 return (x().isRelative() || width().isRelative() || 113 y().isRelative() || height().isRelative()); 108 114 } 109 115 -
branches/feature-branch/WebCore/ksvg2/svg/SVGImageElement.h
r25754 r26077 61 61 protected: 62 62 virtual bool haveLoadedRequiredResources(); 63 64 virtual bool hasRelativeValues() const; 63 65 64 66 protected: -
branches/feature-branch/WebCore/ksvg2/svg/SVGLineElement.cpp
r26076 r26077 27 27 28 28 #include "FloatPoint.h" 29 #include "RenderPath.h" 29 30 #include "SVGLength.h" 30 31 #include "SVGNames.h" … … 77 78 void SVGLineElement::notifyAttributeChange() const 78 79 { 79 if (!document()->parsing() )80 re buildRenderer();80 if (!document()->parsing() && renderer()) 81 renderer()->setNeedsLayout(true); 81 82 82 83 SVGStyledTransformableElement::notifyAttributeChange(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGPathElement.cpp
r26076 r26077 26 26 #include "SVGPathElement.h" 27 27 28 #include "RenderPath.h" 28 29 #include "SVGNames.h" 29 30 #include "SVGParserUtilities.h" … … 195 196 void SVGPathElement::notifyAttributeChange() const 196 197 { 197 if (!document()->parsing() )198 re buildRenderer();198 if (!document()->parsing() && renderer()) 199 renderer()->setNeedsLayout(true); 199 200 200 201 SVGStyledTransformableElement::notifyAttributeChange(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGPolyElement.cpp
r26076 r26077 28 28 #include "Document.h" 29 29 #include "FloatPoint.h" 30 #include "RenderPath.h" 30 31 #include "SVGNames.h" 31 32 #include "SVGParserUtilities.h" … … 89 90 90 91 m_ignoreAttributeChanges = true; 91 rebuildRenderer(); 92 92 if (renderer()) 93 renderer()->setNeedsLayout(true); 94 93 95 ExceptionCode ec = 0; 94 96 -
branches/feature-branch/WebCore/ksvg2/svg/SVGRectElement.cpp
r26076 r26077 25 25 #include "SVGRectElement.h" 26 26 27 #include "RenderPath.h" 27 28 #include "SVGLength.h" 28 29 #include "SVGNames.h" … … 90 91 void SVGRectElement::notifyAttributeChange() const 91 92 { 92 if (!document()->parsing() )93 re buildRenderer();94 93 if (!document()->parsing() && renderer()) 94 renderer()->setNeedsLayout(true); 95 95 96 SVGStyledTransformableElement::notifyAttributeChange(); 96 97 } -
branches/feature-branch/WebCore/ksvg2/svg/SVGStyledElement.cpp
r25884 r26077 275 275 } 276 276 277 void SVGStyledElement::rebuildRenderer() const278 {279 if (!renderer() || !renderer()->isRenderPath())280 return;281 282 RenderPath* renderPath = static_cast<RenderPath*>(renderer());283 SVGElement* parentElement = svg_dynamic_cast(parentNode());284 if (parentElement && parentElement->renderer() && parentElement->isStyled() &&285 parentElement->childShouldCreateRenderer(const_cast<SVGStyledElement*>(this)))286 renderPath->setNeedsLayout(true);287 }288 289 277 } 290 278 -
branches/feature-branch/WebCore/ksvg2/svg/SVGStyledElement.h
r25884 r26077 64 64 // Centralized place to force a manual style resolution. Hacky but needed for now. 65 65 RenderStyle* resolveStyle(RenderStyle* parentStyle); 66 66 67 67 protected: 68 friend class RenderPath; 69 void rebuildRenderer() const; 70 71 virtual bool hasRelativeValues() const { return false; } 68 virtual bool hasRelativeValues() const { return true; } 72 69 73 70 static int cssPropertyIdForSVGAttributeName(const QualifiedName&); -
branches/feature-branch/WebCore/ksvg2/svg/SVGStyledTransformableElement.cpp
r25873 r26077 67 67 void SVGStyledTransformableElement::updateLocalTransform(SVGTransformList* localTransforms) 68 68 { 69 // Update cached local matrix70 69 SVGTransform localTransform = localTransforms->concatenate(); 71 if (localTransform. isValid())72 m_localMatrix = localTransform.matrix();73 else74 m_localMatrix = AffineTransform();70 if (localTransform.matrix() == m_localMatrix) 71 return; 72 73 m_localMatrix = localTransform.matrix(); 75 74 if (renderer()) { 76 75 renderer()->setLocalTransform(m_localMatrix); -
branches/feature-branch/WebCore/ksvg2/svg/SVGStyledTransformableElement.h
r25852 r26077 54 54 virtual FloatRect getBBox() const; 55 55 56 virtual void parseMappedAttribute(MappedAttribute* attr);56 virtual void parseMappedAttribute(MappedAttribute*); 57 57 58 void updateLocalTransform(SVGTransformList* localTransforms);58 void updateLocalTransform(SVGTransformList*); 59 59 60 60 virtual void attach(); -
branches/feature-branch/WebCore/ksvg2/svg/SVGTransform.h
r25754 r26077 47 47 48 48 SVGTransform(); 49 SVGTransform(SVGTransformType type);49 SVGTransform(SVGTransformType); 50 50 explicit SVGTransform(const AffineTransform&); 51 51 virtual ~SVGTransform(); -
branches/feature-branch/WebCore/rendering/RenderPath.cpp
r25879 r26077 121 121 IntRect oldBounds; 122 122 IntRect oldOutlineBox; 123 bool checkForRepaint = checkForRepaintDuringLayout() ;124 if ( selfNeedsLayout() &&checkForRepaint) {123 bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout(); 124 if (checkForRepaint) { 125 125 oldBounds = m_absoluteBounds; 126 126 oldOutlineBox = absoluteOutlineBox(); … … 134 134 setHeight(m_absoluteBounds.height()); 135 135 136 if ( selfNeedsLayout() &&checkForRepaint)136 if (checkForRepaint) 137 137 repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox); 138 138 … … 438 438 } 439 439 440 bool RenderPath::hasRelativeValues() const441 {442 return static_cast<SVGStyledElement*>(element())->hasRelativeValues();443 }444 445 440 } 446 441 -
branches/feature-branch/WebCore/rendering/RenderPath.h
r25839 r26077 76 76 FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const; 77 77 virtual FloatRect strokeBBox() const; 78 79 bool hasRelativeValues() const; 80 78 81 79 private: 82 80 FloatPoint mapAbsolutePointToLocal(const FloatPoint&) const; -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.cpp
r26075 r26077 234 234 IntRect oldBounds; 235 235 IntRect oldOutlineBox; 236 bool checkForRepaint = checkForRepaintDuringLayout() ;236 bool checkForRepaint = checkForRepaintDuringLayout() && selfWillPaint(); 237 237 if (checkForRepaint) { 238 238 oldBounds = m_absoluteBounds; … … 240 240 } 241 241 242 RenderObject* child = firstChild(); 243 while (child) { 242 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 244 243 // Only force our kids to layout if we're being asked to relayout as a result of a parent changing 245 if (selfNeedsLayout() && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())) 244 // FIXME: We should be able to skip relayout of non-relative kids when only bounds have changed 245 // however, we can't tell the difference between bounds changing and transform changing. 246 // http://bugs.webkit.org/show_bug.cgi?id=15391 247 if (selfNeedsLayout()) 246 248 child->setNeedsLayout(true); 247 249 248 250 child->layoutIfNeeded(); 249 251 ASSERT(!child->needsLayout()); 250 child = child->nextSibling();251 252 } 252 253 … … 304 305 } 305 306 307 bool RenderSVGContainer::selfWillPaint() const 308 { 309 #if ENABLE(SVG_EXPERIMENTAL_FEATURES) 310 const SVGRenderStyle* svgStyle = style()->svgStyle(); 311 AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter())); 312 SVGResourceFilter* filter = getFilterById(document(), filterId); 313 if (filter) 314 return true; 315 #endif 316 return false; 317 } 318 306 319 void RenderSVGContainer::paint(PaintInfo& paintInfo, int parentX, int parentY) 307 320 { … … 309 322 return; 310 323 311 if (!firstChild()) { 312 #if ENABLE(SVG_EXPERIMENTAL_FEATURES) 313 // Spec: groups w/o children still may render filter content. 314 const SVGRenderStyle* svgStyle = style()->svgStyle(); 315 AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter())); 316 SVGResourceFilter* filter = getFilterById(document(), filterId); 317 if (!filter) 318 #endif 319 return; 320 } 324 // Spec: groups w/o children still may render filter content. 325 if (!firstChild() && !selfWillPaint()) 326 return; 321 327 322 328 paintInfo.context->save(); -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.h
r25880 r26077 103 103 int m_width; 104 104 int m_height; 105 106 bool selfWillPaint() const; 105 107 106 108 bool m_drawsContents : 1; -
branches/feature-branch/WebCore/rendering/RenderSVGHiddenContainer.cpp
r25866 r26077 61 61 // Layout our kids to prevent a kid from being marked as needing layout 62 62 // then never being asked to layout. 63 RenderObject* child = firstChild(); 64 while (child) { 65 if (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues()) 63 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 64 if (selfNeedsLayout()) 66 65 child->setNeedsLayout(true); 67 66 68 67 child->layoutIfNeeded(); 69 68 ASSERT(!child->needsLayout()); 70 child = child->nextSibling();71 69 } 72 70 -
branches/feature-branch/WebCore/rendering/RenderSVGRoot.cpp
r26075 r26077 73 73 IntRect oldBounds = m_absoluteBounds; 74 74 IntRect oldOutlineBox; 75 bool checkForRepaint = checkForRepaintDuringLayout() ;76 if ( selfNeedsLayout() &&checkForRepaint)75 bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout(); 76 if (checkForRepaint) 77 77 oldOutlineBox = absoluteOutlineBox(); 78 78 … … 85 85 m_height = m_height * svg->currentScale(); 86 86 87 bool boundsChanged = m_absoluteBounds != oldBounds; 88 89 if (boundsChanged || normalChildNeedsLayout() || posChildNeedsLayout()) { 90 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 91 if (boundsChanged && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())) 92 child->setNeedsLayout(true); 93 94 child->layoutIfNeeded(); 95 ASSERT(!child->needsLayout()); 96 } 97 } 98 99 if (selfNeedsLayout() && checkForRepaint) 87 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 88 if (selfNeedsLayout()) // either bounds or transform changed, force kids to relayout 89 child->setNeedsLayout(true); 90 91 child->layoutIfNeeded(); 92 ASSERT(!child->needsLayout()); 93 } 94 95 if (checkForRepaint) 100 96 repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox); 101 97 -
branches/feature-branch/WebCore/rendering/RenderSVGViewportContainer.cpp
r26075 r26077 56 56 IntRect oldBounds = m_absoluteBounds; 57 57 IntRect oldOutlineBox; 58 bool checkForRepaint = checkForRepaintDuringLayout() ;59 if ( selfNeedsLayout() &&checkForRepaint)58 bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout(); 59 if (checkForRepaint) 60 60 oldOutlineBox = absoluteOutlineBox(); 61 61 … … 63 63 64 64 m_absoluteBounds = absoluteClippedOverflowRect(); 65 bool boundsChanged = m_absoluteBounds != oldBounds; 66 67 if (boundsChanged || normalChildNeedsLayout() || posChildNeedsLayout()) { 68 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 69 if (boundsChanged && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())) 70 child->setNeedsLayout(true); 71 72 child->layoutIfNeeded(); 73 ASSERT(!child->needsLayout()); 74 } 75 } 76 77 if (selfNeedsLayout() && checkForRepaint) 65 66 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 67 if (selfNeedsLayout()) 68 child->setNeedsLayout(true); 69 70 child->layoutIfNeeded(); 71 ASSERT(!child->needsLayout()); 72 } 73 74 if (checkForRepaint) 78 75 repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox); 79 76 … … 123 120 return; 124 121 125 doublex = svg->x().value();126 doubley = svg->y().value();127 doublew = svg->width().value();128 doubleh = svg->height().value();122 float x = svg->x().value(); 123 float y = svg->y().value(); 124 float w = svg->width().value(); 125 float h = svg->height().value(); 129 126 m_viewport = FloatRect(x, y, w, h); 130 127 } else if (svgelem->hasTagName(SVGNames::markerTag)) { … … 133 130 134 131 SVGMarkerElement* svg = static_cast<SVGMarkerElement*>(element()); 135 doublew = svg->markerWidth().value();136 doubleh = svg->markerHeight().value();132 float w = svg->markerWidth().value(); 133 float h = svg->markerHeight().value(); 137 134 m_viewport = FloatRect(0, 0, w, h); 138 135 }
Note: See TracChangeset
for help on using the changeset viewer.