OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); | 338 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); |
339 } | 339 } |
340 | 340 |
341 bool SVGUseElement::willRecalcStyle(StyleChange change) | 341 bool SVGUseElement::willRecalcStyle(StyleChange change) |
342 { | 342 { |
343 // Eventually mark shadow root element needing style recalc | 343 // Eventually mark shadow root element needing style recalc |
344 if ((change >= Inherit || needsStyleRecalc() || childNeedsStyleRecalc()) &&
m_targetElementInstance && !m_updatesBlocked) { | 344 if ((change >= Inherit || needsStyleRecalc() || childNeedsStyleRecalc()) &&
m_targetElementInstance && !m_updatesBlocked) { |
345 if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement(
)) | 345 if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement(
)) |
346 shadowRoot->setNeedsStyleRecalc(); | 346 shadowRoot->setNeedsStyleRecalc(); |
347 } | 347 } |
| 348 // Do not do style calculation during shadow tree construction because it ma
y cause nodes to |
| 349 // be attached before they should be. Style recalc will happen when the tree
is constructed |
| 350 // and explicitly attached. |
| 351 if (m_updatesBlocked) |
| 352 return false; |
348 return true; | 353 return true; |
349 } | 354 } |
350 | 355 |
351 void SVGUseElement::didRecalcStyle(StyleChange change) | 356 void SVGUseElement::didRecalcStyle(StyleChange change) |
352 { | 357 { |
353 // Assure that the shadow tree has not been marked for recreation, while we'
re building it. | 358 // Assure that the shadow tree has not been marked for recreation, while we'
re building it. |
354 if (m_updatesBlocked) | 359 if (m_updatesBlocked && m_needsShadowTreeRecreation) { |
355 ASSERT(!m_needsShadowTreeRecreation); | 360 // We are about to recreate the tree while in the middle of recreating t
he tree. |
| 361 return; |
| 362 } |
356 | 363 |
357 RenderSVGShadowTreeRootContainer* shadowRoot = static_cast<RenderSVGShadowTr
eeRootContainer*>(renderer()); | 364 RenderSVGShadowTreeRootContainer* shadowRoot = static_cast<RenderSVGShadowTr
eeRootContainer*>(renderer()); |
358 if (!shadowRoot) | 365 if (!shadowRoot) |
359 return; | 366 return; |
360 | 367 |
361 bool needsStyleUpdate = !m_needsShadowTreeRecreation; | 368 bool needsStyleUpdate = !m_needsShadowTreeRecreation; |
362 if (m_needsShadowTreeRecreation) { | 369 if (m_needsShadowTreeRecreation) { |
363 shadowRoot->markShadowTreeForRecreation(); | 370 shadowRoot->markShadowTreeForRecreation(); |
364 m_needsShadowTreeRecreation = false; | 371 m_needsShadowTreeRecreation = false; |
365 } | 372 } |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 SVGElement* element = m_targetElementInstance->correspondingElement(); | 1087 SVGElement* element = m_targetElementInstance->correspondingElement(); |
1081 if (!element || !element->isStyled()) | 1088 if (!element || !element->isStyled()) |
1082 return false; | 1089 return false; |
1083 | 1090 |
1084 return static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); | 1091 return static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); |
1085 } | 1092 } |
1086 | 1093 |
1087 } | 1094 } |
1088 | 1095 |
1089 #endif // ENABLE(SVG) | 1096 #endif // ENABLE(SVG) |
OLD | NEW |