|
Lines 32-43
WebCore/rendering/SVGRenderSupport.cpp_sec1
|
| 32 |
#include "ImageBuffer.h" |
32 |
#include "ImageBuffer.h" |
| 33 |
#include "NodeRenderStyle.h" |
33 |
#include "NodeRenderStyle.h" |
| 34 |
#include "RenderLayer.h" |
34 |
#include "RenderLayer.h" |
|
|
35 |
#include "RenderPath.h" |
| 35 |
#include "RenderSVGContainer.h" |
36 |
#include "RenderSVGContainer.h" |
| 36 |
#include "RenderSVGResource.h" |
37 |
#include "RenderSVGResource.h" |
| 37 |
#include "RenderSVGResourceClipper.h" |
38 |
#include "RenderSVGResourceClipper.h" |
| 38 |
#include "RenderSVGResourceFilter.h" |
39 |
#include "RenderSVGResourceFilter.h" |
| 39 |
#include "RenderSVGResourceMarker.h" |
40 |
#include "RenderSVGResourceMarker.h" |
| 40 |
#include "RenderSVGResourceMasker.h" |
41 |
#include "RenderSVGResourceMasker.h" |
|
|
42 |
#include "RenderSVGRoot.h" |
| 41 |
#include "SVGStyledElement.h" |
43 |
#include "SVGStyledElement.h" |
| 42 |
#include "TransformState.h" |
44 |
#include "TransformState.h" |
| 43 |
#include <wtf/UnusedParam.h> |
45 |
#include <wtf/UnusedParam.h> |
|
Lines 230-254
FloatRect SVGRenderSupport::computeConta
WebCore/rendering/SVGRenderSupport.cpp_sec2
|
| 230 |
return boundingBox; |
232 |
return boundingBox; |
| 231 |
} |
233 |
} |
| 232 |
|
234 |
|
|
|
235 |
static inline RenderSVGRoot* svgRootTreeObject(RenderObject* start) |
| 236 |
{ |
| 237 |
while (start && !start->isSVGRoot()) |
| 238 |
start = start->parent(); |
| 239 |
|
| 240 |
ASSERT(start); |
| 241 |
ASSERT(start->isSVGRoot()); |
| 242 |
return toRenderSVGRoot(start); |
| 243 |
} |
| 244 |
|
| 233 |
void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) |
245 |
void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) |
| 234 |
{ |
246 |
{ |
|
|
247 |
bool layoutSizeChanged = svgRootTreeObject(start)->isLayoutSizeChanged(); |
| 248 |
|
| 235 |
for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { |
249 |
for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { |
| 236 |
// Only force our kids to layout if we're being asked to relayout as a result of a parent changing |
|
|
| 237 |
// FIXME: We should be able to skip relayout of non-relative kids when only bounds size has changed |
| 238 |
// that's a possible future optimization using LayoutState |
| 239 |
// http://bugs.webkit.org/show_bug.cgi?id=15391 |
| 240 |
bool needsLayout = selfNeedsLayout; |
250 |
bool needsLayout = selfNeedsLayout; |
| 241 |
if (!needsLayout) { |
251 |
|
|
|
252 |
if (layoutSizeChanged) { |
| 253 |
// When selfNeedsLayout is false and the layout size changed, we have to check whether this child uses relative lengths |
| 242 |
if (SVGElement* element = child->node()->isSVGElement() ? static_cast<SVGElement*>(child->node()) : 0) { |
254 |
if (SVGElement* element = child->node()->isSVGElement() ? static_cast<SVGElement*>(child->node()) : 0) { |
| 243 |
if (element->isStyled()) |
255 |
if (element->isStyled() && static_cast<SVGStyledElement*>(element)->hasRelativeLengths()) { |
| 244 |
needsLayout = static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); |
256 |
// When the layout size changed and when using relative values tell the RenderPath to update its Path object |
|
|
257 |
if (child->isRenderPath()) |
| 258 |
toRenderPath(child)->setNeedsPathUpdate(); |
| 259 |
|
| 260 |
needsLayout = true; |
| 261 |
} |
| 245 |
} |
262 |
} |
| 246 |
} |
263 |
} |
| 247 |
|
264 |
|
| 248 |
if (needsLayout) |
265 |
if (needsLayout) { |
| 249 |
child->setNeedsLayout(true, false); |
266 |
child->setNeedsLayout(true, false); |
|
|
267 |
child->layout(); |
| 268 |
} else |
| 269 |
child->layoutIfNeeded(); |
| 250 |
|
270 |
|
| 251 |
child->layoutIfNeeded(); |
|
|
| 252 |
ASSERT(!child->needsLayout()); |
271 |
ASSERT(!child->needsLayout()); |
| 253 |
} |
272 |
} |
| 254 |
} |
273 |
} |