| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 toRenderSVGText(child)->setNeedsTextMetricsUpdate(); | 235 toRenderSVGText(child)->setNeedsTextMetricsUpdate(); |
| 236 toRenderSVGText(child)->setNeedsPositioningValuesUpdate(
); | 236 toRenderSVGText(child)->setNeedsPositioningValuesUpdate(
); |
| 237 } | 237 } |
| 238 | 238 |
| 239 needsLayout = true; | 239 needsLayout = true; |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 SubtreeLayoutScope layoutScope(child); | 244 SubtreeLayoutScope layoutScope(child); |
| 245 if (needsLayout) | 245 // Resource containers are nasty: they can invalidate clients outside th
e current SubtreeLayoutScope. |
| 246 // Since they only care about viewport size changes (to resolve their re
lative lengths), we trigger |
| 247 // their invalidation directly from SVGSVGElement::svgAttributeChange()
or at a higher |
| 248 // SubtreeLayoutScope (in RenderView::layout()). |
| 249 if (needsLayout && !child->isSVGResourceContainer()) |
| 246 layoutScope.setNeedsLayout(child); | 250 layoutScope.setNeedsLayout(child); |
| 247 | 251 |
| 252 layoutResourcesIfNeeded(child); |
| 253 |
| 248 if (child->needsLayout()) { | 254 if (child->needsLayout()) { |
| 249 child->layout(); | 255 child->layout(); |
| 250 // Renderers are responsible for repainting themselves when changing
, except | 256 // Renderers are responsible for repainting themselves when changing
, except |
| 251 // for the initial paint to avoid potential double-painting caused b
y non-sensical "old" bounds. | 257 // for the initial paint to avoid potential double-painting caused b
y non-sensical "old" bounds. |
| 252 // We could handle this in the individual objects, but for now it's
easier to have | 258 // We could handle this in the individual objects, but for now it's
easier to have |
| 253 // parent containers call repaint(). (RenderBlock::layout* has simi
lar logic.) | 259 // parent containers call repaint(). (RenderBlock::layout* has simi
lar logic.) |
| 254 if (!childEverHadLayout) | 260 if (!childEverHadLayout) |
| 255 child->repaint(); | 261 child->repaint(); |
| 256 } else if (layoutSizeChanged) | 262 } else if (layoutSizeChanged) |
| 257 notlayoutedObjects.add(child); | 263 notlayoutedObjects.add(child); |
| 258 } | 264 } |
| 259 | 265 |
| 260 if (!layoutSizeChanged) { | 266 if (!layoutSizeChanged) { |
| 261 ASSERT(notlayoutedObjects.isEmpty()); | 267 ASSERT(notlayoutedObjects.isEmpty()); |
| 262 return; | 268 return; |
| 263 } | 269 } |
| 264 | 270 |
| 265 // If the layout size changed, invalidate all resources of all children that
didn't go through the layout() code path. | 271 // If the layout size changed, invalidate all resources of all children that
didn't go through the layout() code path. |
| 266 HashSet<RenderObject*>::iterator end = notlayoutedObjects.end(); | 272 HashSet<RenderObject*>::iterator end = notlayoutedObjects.end(); |
| 267 for (HashSet<RenderObject*>::iterator it = notlayoutedObjects.begin(); it !=
end; ++it) | 273 for (HashSet<RenderObject*>::iterator it = notlayoutedObjects.begin(); it !=
end; ++it) |
| 268 invalidateResourcesOfChildren(*it); | 274 invalidateResourcesOfChildren(*it); |
| 269 } | 275 } |
| 270 | 276 |
| 277 void SVGRenderSupport::layoutResourcesIfNeeded(const RenderObject* object) |
| 278 { |
| 279 ASSERT(object); |
| 280 |
| 281 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
object); |
| 282 if (resources) |
| 283 resources->layoutIfNeeded(); |
| 284 } |
| 285 |
| 271 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) | 286 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) |
| 272 { | 287 { |
| 273 // SVG doesn't support independent x/y overflow | 288 // SVG doesn't support independent x/y overflow |
| 274 ASSERT(object->style()->overflowX() == object->style()->overflowY()); | 289 ASSERT(object->style()->overflowX() == object->style()->overflowY()); |
| 275 | 290 |
| 276 // OSCROLL is never set for SVG - see StyleResolver::adjustRenderStyle | 291 // OSCROLL is never set for SVG - see StyleResolver::adjustRenderStyle |
| 277 ASSERT(object->style()->overflowX() != OSCROLL); | 292 ASSERT(object->style()->overflowX() != OSCROLL); |
| 278 | 293 |
| 279 // RenderSVGRoot should never query for overflow state - it should always cl
ip itself to the initial viewport size. | 294 // RenderSVGRoot should never query for overflow state - it should always cl
ip itself to the initial viewport size. |
| 280 ASSERT(!object->isRoot()); | 295 ASSERT(!object->isRoot()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 406 |
| 392 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object) | 407 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object) |
| 393 { | 408 { |
| 394 // RenderSVGInlineText performs whitespace filtering in order to support xml
:space | 409 // RenderSVGInlineText performs whitespace filtering in order to support xml
:space |
| 395 // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up wit
h an empty string | 410 // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up wit
h an empty string |
| 396 // even when its original constructor argument is non-empty. | 411 // even when its original constructor argument is non-empty. |
| 397 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT
ext(); | 412 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT
ext(); |
| 398 } | 413 } |
| 399 | 414 |
| 400 } | 415 } |
| OLD | NEW |