Chromium Code Reviews| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 return document().frame()->ownerRenderer()->availableLogicalHeight(Inclu deMarginBorderPadding); | 190 return document().frame()->ownerRenderer()->availableLogicalHeight(Inclu deMarginBorderPadding); |
| 191 | 191 |
| 192 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G. | 192 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G. |
| 193 return RenderReplaced::computeReplacedLogicalHeight(); | 193 return RenderReplaced::computeReplacedLogicalHeight(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void RenderSVGRoot::layout() | 196 void RenderSVGRoot::layout() |
| 197 { | 197 { |
| 198 ASSERT(needsLayout()); | 198 ASSERT(needsLayout()); |
| 199 | 199 |
| 200 m_resourcesNeedingToInvalidateClients.clear(); | |
| 201 | |
| 202 // Arbitrary affine transforms are incompatible with LayoutState. | 200 // Arbitrary affine transforms are incompatible with LayoutState. |
| 203 LayoutStateDisabler layoutStateDisabler(view()); | 201 LayoutStateDisabler layoutStateDisabler(view()); |
| 204 | 202 |
| 205 bool needsLayout = selfNeedsLayout(); | 203 bool needsLayout = selfNeedsLayout(); |
| 206 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayou t); | 204 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayou t); |
| 207 | 205 |
| 208 LayoutSize oldSize = size(); | 206 LayoutSize oldSize = size(); |
| 209 updateLogicalWidth(); | 207 updateLogicalWidth(); |
| 210 updateLogicalHeight(); | 208 updateLogicalHeight(); |
| 211 buildLocalToBorderBoxTransform(); | 209 buildLocalToBorderBoxTransform(); |
| 212 | 210 |
| 211 // Layout own resources. | |
|
pdr.
2013/09/18 22:47:35
Lets pull this out into a helper.
| |
| 212 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj ect(this)) | |
| 213 resources->layoutIfNeeded(); | |
| 214 | |
| 213 SVGSVGElement* svg = toSVGSVGElement(node()); | 215 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 214 ASSERT(svg); | 216 ASSERT(svg); |
| 215 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); | 217 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); |
| 216 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this)); | 218 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this)); |
| 217 | 219 |
| 218 if (!m_resourcesNeedingToInvalidateClients.isEmpty()) { | |
| 219 // Invalidate resource clients, which may mark some nodes for layout. | |
| 220 HashSet<RenderSVGResourceContainer*>::iterator end = m_resourcesNeedingT oInvalidateClients.end(); | |
| 221 for (HashSet<RenderSVGResourceContainer*>::iterator it = m_resourcesNeed ingToInvalidateClients.begin(); it != end; ++it) | |
| 222 (*it)->removeAllClientsFromCache(); | |
| 223 | |
| 224 m_isLayoutSizeChanged = false; | |
| 225 SVGRenderSupport::layoutChildren(this, false); | |
| 226 } | |
| 227 | |
| 228 // At this point LayoutRepainter already grabbed the old bounds, | 220 // At this point LayoutRepainter already grabbed the old bounds, |
| 229 // recalculate them now so repaintAfterLayout() uses the new bounds. | 221 // recalculate them now so repaintAfterLayout() uses the new bounds. |
| 230 if (m_needsBoundariesOrTransformUpdate) { | 222 if (m_needsBoundariesOrTransformUpdate) { |
| 231 updateCachedBoundaries(); | 223 updateCachedBoundaries(); |
| 232 m_needsBoundariesOrTransformUpdate = false; | 224 m_needsBoundariesOrTransformUpdate = false; |
| 233 } | 225 } |
| 234 | 226 |
| 235 updateLayerTransform(); | 227 updateLayerTransform(); |
| 236 | 228 |
| 237 repainter.repaintAfterLayout(); | 229 repainter.repaintAfterLayout(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 } | 460 } |
| 469 | 461 |
| 470 bool RenderSVGRoot::hasRelativeLogicalHeight() const | 462 bool RenderSVGRoot::hasRelativeLogicalHeight() const |
| 471 { | 463 { |
| 472 SVGSVGElement* svg = toSVGSVGElement(node()); | 464 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 473 ASSERT(svg); | 465 ASSERT(svg); |
| 474 | 466 |
| 475 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); | 467 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); |
| 476 } | 468 } |
| 477 | 469 |
| 478 void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer* resource) | |
| 479 { | |
| 480 RenderObject* svgRoot = resource->parent(); | |
| 481 while (svgRoot && !svgRoot->isSVGRoot()) | |
| 482 svgRoot = svgRoot->parent(); | |
| 483 if (!svgRoot) | |
| 484 return; | |
| 485 toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource ); | |
| 486 } | 470 } |
| 487 | |
| 488 } | |
| OLD | NEW |