| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@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. | 5 * Copyright (C) 2009 Google, Inc. |
| 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 // Only SVGs embedded in <object> reach this point. | 206 // Only SVGs embedded in <object> reach this point. |
| 207 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); | 207 ASSERT(isEmbeddedThroughFrameContainingSVGDocument()); |
| 208 return document()->frame()->ownerRenderer()->availableLogicalHeight(); | 208 return document()->frame()->ownerRenderer()->availableLogicalHeight(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void RenderSVGRoot::layout() | 211 void RenderSVGRoot::layout() |
| 212 { | 212 { |
| 213 ASSERT(needsLayout()); | 213 ASSERT(needsLayout()); |
| 214 | 214 |
| 215 m_resourcesNeedingToInvalidateClients.clear(); |
| 216 |
| 215 // Arbitrary affine transforms are incompatible with LayoutState. | 217 // Arbitrary affine transforms are incompatible with LayoutState. |
| 216 LayoutStateDisabler layoutStateDisabler(view()); | 218 LayoutStateDisabler layoutStateDisabler(view()); |
| 217 | 219 |
| 218 bool needsLayout = selfNeedsLayout(); | 220 bool needsLayout = selfNeedsLayout(); |
| 219 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayou
t); | 221 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayou
t); |
| 220 | 222 |
| 221 LayoutSize oldSize(width(), height()); | 223 LayoutSize oldSize(width(), height()); |
| 222 computeLogicalWidth(); | 224 computeLogicalWidth(); |
| 223 computeLogicalHeight(); | 225 computeLogicalHeight(); |
| 224 buildLocalToBorderBoxTransform(); | 226 buildLocalToBorderBoxTransform(); |
| 225 | 227 |
| 226 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); | 228 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); |
| 227 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize
!= size()); | 229 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize
!= size()); |
| 228 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt
ersForceContainerLayout(this)); | 230 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt
ersForceContainerLayout(this)); |
| 229 m_isLayoutSizeChanged = false; | 231 m_isLayoutSizeChanged = false; |
| 230 | 232 |
| 233 if (!m_resourcesNeedingToInvalidateClients.isEmpty()) { |
| 234 // Invalidate resource clients, which may mark some nodes for layout. |
| 235 HashSet<RenderSVGResourceContainer*>::iterator end = m_resourcesNeedingT
oInvalidateClients.end(); |
| 236 for (HashSet<RenderSVGResourceContainer*>::iterator it = m_resourcesNeed
ingToInvalidateClients.begin(); it != end; ++it) |
| 237 (*it)->removeAllClientsFromCache(); |
| 238 |
| 239 m_isLayoutSizeChanged = false; |
| 240 SVGRenderSupport::layoutChildren(this, false); |
| 241 } |
| 242 |
| 231 // At this point LayoutRepainter already grabbed the old bounds, | 243 // At this point LayoutRepainter already grabbed the old bounds, |
| 232 // recalculate them now so repaintAfterLayout() uses the new bounds. | 244 // recalculate them now so repaintAfterLayout() uses the new bounds. |
| 233 if (m_needsBoundariesOrTransformUpdate) { | 245 if (m_needsBoundariesOrTransformUpdate) { |
| 234 updateCachedBoundaries(); | 246 updateCachedBoundaries(); |
| 235 m_needsBoundariesOrTransformUpdate = false; | 247 m_needsBoundariesOrTransformUpdate = false; |
| 236 } | 248 } |
| 237 | 249 |
| 238 repainter.repaintAfterLayout(); | 250 repainter.repaintAfterLayout(); |
| 239 | 251 |
| 240 setNeedsLayout(false); | 252 setNeedsLayout(false); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 424 } |
| 413 | 425 |
| 414 bool RenderSVGRoot::hasRelativeDimensions() const | 426 bool RenderSVGRoot::hasRelativeDimensions() const |
| 415 { | 427 { |
| 416 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); | 428 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); |
| 417 ASSERT(svg); | 429 ASSERT(svg); |
| 418 | 430 |
| 419 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent()
|| svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent(); | 431 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent()
|| svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
| 420 } | 432 } |
| 421 | 433 |
| 434 void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer*
resource) |
| 435 { |
| 436 RenderObject* svgRoot = resource->parent(); |
| 437 while (svgRoot && !svgRoot->isSVGRoot()) |
| 438 svgRoot = svgRoot->parent(); |
| 439 if (!svgRoot) |
| 440 return; |
| 441 static_cast<RenderSVGRoot*>(svgRoot)->m_resourcesNeedingToInvalidateClients.
add(resource); |
| 442 } |
| 443 |
| 422 } | 444 } |
| 423 | 445 |
| 424 #endif // ENABLE(SVG) | 446 #endif // ENABLE(SVG) |
| OLD | NEW |