| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 Element* childElement = toElement(child); | 373 Element* childElement = toElement(child); |
| 374 bool childRecalced = invalidateStyleForClassChange(childElement, inv
alidationClasses, foundInvalidationSet); | 374 bool childRecalced = invalidateStyleForClassChange(childElement, inv
alidationClasses, foundInvalidationSet); |
| 375 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; | 375 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 return someChildrenNeedStyleRecalc; | 378 return someChildrenNeedStyleRecalc; |
| 379 } | 379 } |
| 380 | 380 |
| 381 bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom
icString>& invalidationClasses, bool foundInvalidationSet) | 381 bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom
icString>& invalidationClasses, bool foundInvalidationSet) |
| 382 { | 382 { |
| 383 bool thisElementNeedsStyleRecalc = false; |
| 383 int oldSize = invalidationClasses.size(); | 384 int oldSize = invalidationClasses.size(); |
| 385 |
| 384 if (element->needsStyleInvalidation()) { | 386 if (element->needsStyleInvalidation()) { |
| 385 if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(el
ement)) { | 387 InvalidationList* invalidationList = m_pendingInvalidationMap.get(elemen
t); |
| 386 foundInvalidationSet = true; | 388 ASSERT(invalidationList); |
| 387 for (InvalidationList::const_iterator it = invalidationList->begin()
; it != invalidationList->end(); ++it) { | 389 // FIXME: it's really only necessary to clone the render style for this
element, not full style recalc. |
| 388 if ((*it)->wholeSubtreeInvalid()) { | 390 thisElementNeedsStyleRecalc = true; |
| 389 element->setNeedsStyleRecalc(SubtreeStyleChange); | 391 foundInvalidationSet = true; |
| 390 invalidationClasses.remove(oldSize, invalidationClasses.size
() - oldSize); | 392 for (InvalidationList::const_iterator it = invalidationList->begin(); it
!= invalidationList->end(); ++it) { |
| 391 element->clearChildNeedsStyleInvalidation(); | 393 if ((*it)->wholeSubtreeInvalid()) { |
| 392 return true; | 394 element->setNeedsStyleRecalc(SubtreeStyleChange); |
| 393 } | 395 invalidationClasses.remove(oldSize, invalidationClasses.size() -
oldSize); |
| 394 (*it)->getClasses(invalidationClasses); | 396 element->clearChildNeedsStyleInvalidation(); |
| 397 return true; |
| 395 } | 398 } |
| 399 (*it)->getClasses(invalidationClasses); |
| 396 } | 400 } |
| 397 } | 401 } |
| 398 | 402 |
| 399 bool thisElementNeedsStyleRecalc = false; | |
| 400 | |
| 401 if (element->hasClass()) { | 403 if (element->hasClass()) { |
| 402 const SpaceSplitString& classNames = element->classNames(); | 404 const SpaceSplitString& classNames = element->classNames(); |
| 403 for (Vector<AtomicString>::const_iterator it = invalidationClasses.begin
(); it != invalidationClasses.end(); ++it) { | 405 for (Vector<AtomicString>::const_iterator it = invalidationClasses.begin
(); it != invalidationClasses.end(); ++it) { |
| 404 if (classNames.contains(*it)) { | 406 if (classNames.contains(*it)) { |
| 405 thisElementNeedsStyleRecalc = true; | 407 thisElementNeedsStyleRecalc = true; |
| 406 break; | 408 break; |
| 407 } | 409 } |
| 408 } | 410 } |
| 409 } | 411 } |
| 410 | 412 |
| 411 // foundInvalidationSet will be true if we are in a subtree of a node with a
DescendantInvalidationSet on it. | 413 // foundInvalidationSet will be true if we are in a subtree of a node with a
DescendantInvalidationSet on it. |
| 412 // We need to check all nodes in the subtree of such a node. | 414 // We need to check all nodes in the subtree of such a node. |
| 413 if (foundInvalidationSet || element->childNeedsStyleInvalidation()) { | 415 if (foundInvalidationSet || element->childNeedsStyleInvalidation()) { |
| 414 bool someChildrenNeedStyleRecalc = invalidateStyleForClassChangeOnChildr
en(element, invalidationClasses, foundInvalidationSet); | 416 bool someChildrenNeedStyleRecalc = invalidateStyleForClassChangeOnChildr
en(element, invalidationClasses, foundInvalidationSet); |
| 415 // We only need to possibly recalc style if this node is in the subtree
of a node with a DescendantInvalidationSet on it. | 417 // We only need to possibly recalc style if this node is in the subtree
of a node with a DescendantInvalidationSet on it. |
| 418 // FIXME: it's really only necessary to clone the render style for this
element, not full style recalc. |
| 416 if (foundInvalidationSet) | 419 if (foundInvalidationSet) |
| 417 thisElementNeedsStyleRecalc = thisElementNeedsStyleRecalc || someChi
ldrenNeedStyleRecalc; | 420 thisElementNeedsStyleRecalc = thisElementNeedsStyleRecalc || someChi
ldrenNeedStyleRecalc; |
| 418 } | 421 } |
| 419 | 422 |
| 420 if (thisElementNeedsStyleRecalc) | 423 if (thisElementNeedsStyleRecalc) |
| 421 element->setNeedsStyleRecalc(LocalStyleChange); | 424 element->setNeedsStyleRecalc(LocalStyleChange); |
| 422 | 425 |
| 423 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); | 426 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
| 424 element->clearChildNeedsStyleInvalidation(); | 427 element->clearChildNeedsStyleInvalidation(); |
| 428 element->clearNeedsStyleInvalidation(); |
| 429 |
| 425 return thisElementNeedsStyleRecalc; | 430 return thisElementNeedsStyleRecalc; |
| 426 } | 431 } |
| 427 | 432 |
| 428 } // namespace WebCore | 433 } // namespace WebCore |
| OLD | NEW |