Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: Source/core/rendering/svg/RenderSVGRoot.cpp

Issue 23785014: [SVG] Resources should be laid out in dependecy order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: text-layout-crash.html needs image result update. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/SVGRenderSupport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SVGRenderSupport::layoutResourcesIfNeeded(this);
212
213 SVGSVGElement* svg = toSVGSVGElement(node()); 213 SVGSVGElement* svg = toSVGSVGElement(node());
214 ASSERT(svg); 214 ASSERT(svg);
215 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); 215 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size());
216 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this)); 216 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this));
217 217
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, 218 // At this point LayoutRepainter already grabbed the old bounds,
229 // recalculate them now so repaintAfterLayout() uses the new bounds. 219 // recalculate them now so repaintAfterLayout() uses the new bounds.
230 if (m_needsBoundariesOrTransformUpdate) { 220 if (m_needsBoundariesOrTransformUpdate) {
231 updateCachedBoundaries(); 221 updateCachedBoundaries();
232 m_needsBoundariesOrTransformUpdate = false; 222 m_needsBoundariesOrTransformUpdate = false;
233 } 223 }
234 224
235 updateLayerTransform(); 225 updateLayerTransform();
236 226
237 repainter.repaintAfterLayout(); 227 repainter.repaintAfterLayout();
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 458 }
469 459
470 bool RenderSVGRoot::hasRelativeLogicalHeight() const 460 bool RenderSVGRoot::hasRelativeLogicalHeight() const
471 { 461 {
472 SVGSVGElement* svg = toSVGSVGElement(node()); 462 SVGSVGElement* svg = toSVGSVGElement(node());
473 ASSERT(svg); 463 ASSERT(svg);
474 464
475 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent(); 465 return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent();
476 } 466 }
477 467
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 } 468 }
487
488 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/SVGRenderSupport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698