Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 bool someChildrenNeedStyleRecalc = false; | 425 bool someChildrenNeedStyleRecalc = false; |
| 426 // foundInvalidationSet will be true if we are in a subtree of a node with a DescendantInvalidationSet on it. | 426 // foundInvalidationSet will be true if we are in a subtree of a node with a DescendantInvalidationSet on it. |
| 427 // We need to check all nodes in the subtree of such a node. | 427 // We need to check all nodes in the subtree of such a node. |
| 428 if (foundInvalidationSet || element->childNeedsStyleInvalidation()) { | 428 if (foundInvalidationSet || element->childNeedsStyleInvalidation()) { |
| 429 someChildrenNeedStyleRecalc = invalidateStyleForClassChangeOnChildren(el ement, invalidationClasses, foundInvalidationSet); | 429 someChildrenNeedStyleRecalc = invalidateStyleForClassChangeOnChildren(el ement, invalidationClasses, foundInvalidationSet); |
| 430 } | 430 } |
| 431 | 431 |
| 432 if (thisElementNeedsStyleRecalc) { | 432 if (thisElementNeedsStyleRecalc) { |
| 433 element->setNeedsStyleRecalc(LocalStyleChange); | 433 element->setNeedsStyleRecalc(LocalStyleChange); |
| 434 } else if (foundInvalidationSet && someChildrenNeedStyleRecalc) { | 434 } else if (foundInvalidationSet && someChildrenNeedStyleRecalc) { |
| 435 // Clone the RenderStyle in order to preserve correct style sharing. | 435 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style. |
| 436 if (RenderStyle* renderStyle = element->renderStyle()) | 436 bool clonedStyle = false; |
| 437 element->renderer()->setStyle(RenderStyle::clone(renderStyle)); | 437 if (RenderObject* renderer = element->renderer()) { |
| 438 if (RenderStyle* renderStyle = renderer->style()) { | |
|
esprehn
2014/03/03 21:43:52
If you have a renderer you must have a style, this
chrishtr
2014/03/03 21:53:37
Done.
| |
| 439 renderer->setStyleInternal(RenderStyle::clone(renderStyle)); | |
| 440 clonedStyle = true; | |
| 441 } | |
| 442 } | |
| 443 if (!clonedStyle) | |
| 444 element->setNeedsStyleRecalc(LocalStyleChange); | |
| 438 } | 445 } |
| 439 | 446 |
| 440 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 447 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
| 441 element->clearChildNeedsStyleInvalidation(); | 448 element->clearChildNeedsStyleInvalidation(); |
| 442 element->clearNeedsStyleInvalidation(); | 449 element->clearNeedsStyleInvalidation(); |
| 443 | 450 |
| 444 return thisElementNeedsStyleRecalc; | 451 return thisElementNeedsStyleRecalc; |
| 445 } | 452 } |
| 446 | 453 |
| 447 } // namespace WebCore | 454 } // namespace WebCore |
| OLD | NEW |