| 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 18 matching lines...) Expand all Loading... |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "core/css/RuleFeature.h" | 30 #include "core/css/RuleFeature.h" |
| 31 | 31 |
| 32 #include "HTMLNames.h" | 32 #include "HTMLNames.h" |
| 33 #include "RuntimeEnabledFeatures.h" | 33 #include "RuntimeEnabledFeatures.h" |
| 34 #include "core/css/CSSSelector.h" | 34 #include "core/css/CSSSelector.h" |
| 35 #include "core/css/CSSSelectorList.h" | 35 #include "core/css/CSSSelectorList.h" |
| 36 #include "core/css/RuleSet.h" | 36 #include "core/css/RuleSet.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 39 #include "core/dom/ElementTraversal.h" |
| 39 #include "core/dom/Node.h" | 40 #include "core/dom/Node.h" |
| 40 #include "core/dom/shadow/ElementShadow.h" | 41 #include "core/dom/shadow/ElementShadow.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 42 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "wtf/BitVector.h" | 43 #include "wtf/BitVector.h" |
| 43 | 44 |
| 44 namespace WebCore { | 45 namespace WebCore { |
| 45 | 46 |
| 46 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) | 47 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) |
| 47 { | 48 { |
| 48 if (selector.matchesPseudoElement() || selector.pseudoType() == CSSSelector:
:PseudoHost) | 49 if (selector.matchesPseudoElement() || selector.pseudoType() == CSSSelector:
:PseudoHost) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 354 } |
| 354 } | 355 } |
| 355 document.clearChildNeedsStyleInvalidation(); | 356 document.clearChildNeedsStyleInvalidation(); |
| 356 m_pendingInvalidationMap.clear(); | 357 m_pendingInvalidationMap.clear(); |
| 357 } | 358 } |
| 358 | 359 |
| 359 bool RuleFeatureSet::invalidateStyleForClassChangeOnChildren(Element* element, V
ector<AtomicString>& invalidationClasses, bool foundInvalidationSet) | 360 bool RuleFeatureSet::invalidateStyleForClassChangeOnChildren(Element* element, V
ector<AtomicString>& invalidationClasses, bool foundInvalidationSet) |
| 360 { | 361 { |
| 361 bool someChildrenNeedStyleRecalc = false; | 362 bool someChildrenNeedStyleRecalc = false; |
| 362 for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root->ol
derShadowRoot()) { | 363 for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root->ol
derShadowRoot()) { |
| 363 for (Node* child = root->firstChild(); child; child = child->nextSibling
()) { | 364 for (Element* child = ElementTraversal::firstWithin(*root); child; child
= ElementTraversal::nextSibling(*child)) { |
| 364 if (child->isElementNode()) { | 365 bool childRecalced = invalidateStyleForClassChange(child, invalidati
onClasses, foundInvalidationSet); |
| 365 Element* childElement = toElement(child); | 366 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; |
| 366 bool childRecalced = invalidateStyleForClassChange(childElement,
invalidationClasses, foundInvalidationSet); | |
| 367 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || chi
ldRecalced; | |
| 368 } | |
| 369 } | 367 } |
| 370 } | 368 } |
| 371 for (Node* child = element->firstChild(); child; child = child->nextSibling(
)) { | 369 for (Element* child = ElementTraversal::firstWithin(*element); child; child
= ElementTraversal::nextSibling(*child)) { |
| 372 if (child->isElementNode()) { | 370 bool childRecalced = invalidateStyleForClassChange(child, invalidationCl
asses, foundInvalidationSet); |
| 373 Element* childElement = toElement(child); | 371 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalc
ed; |
| 374 bool childRecalced = invalidateStyleForClassChange(childElement, inv
alidationClasses, foundInvalidationSet); | |
| 375 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; | |
| 376 } | |
| 377 } | 372 } |
| 378 return someChildrenNeedStyleRecalc; | 373 return someChildrenNeedStyleRecalc; |
| 379 } | 374 } |
| 380 | 375 |
| 381 bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom
icString>& invalidationClasses, bool foundInvalidationSet) | 376 bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom
icString>& invalidationClasses, bool foundInvalidationSet) |
| 382 { | 377 { |
| 383 int oldSize = invalidationClasses.size(); | 378 int oldSize = invalidationClasses.size(); |
| 384 if (element->needsStyleInvalidation()) { | 379 if (element->needsStyleInvalidation()) { |
| 385 if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(el
ement)) { | 380 if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(el
ement)) { |
| 386 foundInvalidationSet = true; | 381 foundInvalidationSet = true; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 414 |
| 420 if (thisElementNeedsStyleRecalc) | 415 if (thisElementNeedsStyleRecalc) |
| 421 element->setNeedsStyleRecalc(LocalStyleChange); | 416 element->setNeedsStyleRecalc(LocalStyleChange); |
| 422 | 417 |
| 423 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 418 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
| 424 element->clearChildNeedsStyleInvalidation(); | 419 element->clearChildNeedsStyleInvalidation(); |
| 425 return thisElementNeedsStyleRecalc; | 420 return thisElementNeedsStyleRecalc; |
| 426 } | 421 } |
| 427 | 422 |
| 428 } // namespace WebCore | 423 } // namespace WebCore |
| OLD | NEW |