| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 uncommonAttributeRules.appendVector(other.uncommonAttributeRules); | 341 uncommonAttributeRules.appendVector(other.uncommonAttributeRules); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void RuleFeatureSet::clear() | 344 void RuleFeatureSet::clear() |
| 345 { | 345 { |
| 346 siblingRules.clear(); | 346 siblingRules.clear(); |
| 347 uncommonAttributeRules.clear(); | 347 uncommonAttributeRules.clear(); |
| 348 m_metadata.clear(); | 348 m_metadata.clear(); |
| 349 m_classInvalidationSets.clear(); | 349 m_classInvalidationSets.clear(); |
| 350 m_attributeInvalidationSets.clear(); | 350 m_attributeInvalidationSets.clear(); |
| 351 m_pendingInvalidationMap.clear(); | 351 m_styleInvalidator.clearPendingInvalidations(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
ing& changedClasses, Element* element) | 354 void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
ing& changedClasses, Element& element) |
| 355 { | 355 { |
| 356 unsigned changedSize = changedClasses.size(); | 356 unsigned changedSize = changedClasses.size(); |
| 357 for (unsigned i = 0; i < changedSize; ++i) { | 357 for (unsigned i = 0; i < changedSize; ++i) { |
| 358 addClassToInvalidationSet(changedClasses[i], element); | 358 addClassToInvalidationSet(changedClasses[i], element); |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
ing& oldClasses, const SpaceSplitString& newClasses, Element* element) | 362 void RuleFeatureSet::scheduleStyleInvalidationForClassChange(const SpaceSplitStr
ing& oldClasses, const SpaceSplitString& newClasses, Element& element) |
| 363 { | 363 { |
| 364 if (!oldClasses.size()) | 364 if (!oldClasses.size()) |
| 365 scheduleStyleInvalidationForClassChange(newClasses, element); | 365 scheduleStyleInvalidationForClassChange(newClasses, element); |
| 366 | 366 |
| 367 // Class vectors tend to be very short. This is faster than using a hash tab
le. | 367 // Class vectors tend to be very short. This is faster than using a hash tab
le. |
| 368 BitVector remainingClassBits; | 368 BitVector remainingClassBits; |
| 369 remainingClassBits.ensureSize(oldClasses.size()); | 369 remainingClassBits.ensureSize(oldClasses.size()); |
| 370 | 370 |
| 371 for (unsigned i = 0; i < newClasses.size(); ++i) { | 371 for (unsigned i = 0; i < newClasses.size(); ++i) { |
| 372 bool found = false; | 372 bool found = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 385 } | 385 } |
| 386 | 386 |
| 387 for (unsigned i = 0; i < oldClasses.size(); ++i) { | 387 for (unsigned i = 0; i < oldClasses.size(); ++i) { |
| 388 if (remainingClassBits.quickGet(i)) | 388 if (remainingClassBits.quickGet(i)) |
| 389 continue; | 389 continue; |
| 390 // Class was removed. | 390 // Class was removed. |
| 391 addClassToInvalidationSet(oldClasses[i], element); | 391 addClassToInvalidationSet(oldClasses[i], element); |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const Qualified
Name& attributeName, Element* element) | 395 void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const Qualified
Name& attributeName, Element& element) |
| 396 { | 396 { |
| 397 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidat
ionSets.get(attributeName.localName())) { | 397 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidat
ionSets.get(attributeName.localName())) |
| 398 ensurePendingInvalidationList(element).append(invalidationSet); | 398 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 399 element->setNeedsStyleInvalidation(); | |
| 400 } | |
| 401 } | 399 } |
| 402 | 400 |
| 403 void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, El
ement* element) | 401 void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, El
ement& element) |
| 404 { | 402 { |
| 405 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) { | 403 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) |
| 406 ensurePendingInvalidationList(element).append(invalidationSet); | 404 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 407 element->setNeedsStyleInvalidation(); | |
| 408 } | |
| 409 } | 405 } |
| 410 | 406 |
| 411 RuleFeatureSet::InvalidationList& RuleFeatureSet::ensurePendingInvalidationList(
Element* element) | 407 StyleInvalidator& RuleFeatureSet::styleInvalidator() |
| 412 { | 408 { |
| 413 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(e
lement, nullptr); | 409 return m_styleInvalidator; |
| 414 if (addResult.isNewEntry) | |
| 415 addResult.storedValue->value = adoptPtr(new InvalidationList); | |
| 416 return *addResult.storedValue->value; | |
| 417 } | |
| 418 | |
| 419 void RuleFeatureSet::clearStyleInvalidation(Node* node) | |
| 420 { | |
| 421 node->clearChildNeedsStyleInvalidation(); | |
| 422 node->clearNeedsStyleInvalidation(); | |
| 423 if (node->isElementNode()) | |
| 424 m_pendingInvalidationMap.remove(toElement(node)); | |
| 425 } | |
| 426 | |
| 427 RuleFeatureSet::PendingInvalidationMap& RuleFeatureSet::pendingInvalidationMap() | |
| 428 { | |
| 429 return m_pendingInvalidationMap; | |
| 430 } | 410 } |
| 431 | 411 |
| 432 } // namespace WebCore | 412 } // namespace WebCore |
| OLD | NEW |