| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/css/RuleFeature.h" | 30 #include "core/css/RuleFeature.h" |
| 31 | 31 |
| 32 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
| 33 #include "core/css/CSSSelector.h" | 33 #include "core/css/CSSSelector.h" |
| 34 #include "core/css/CSSSelectorList.h" | 34 #include "core/css/CSSSelectorList.h" |
| 35 #include "core/css/RuleSet.h" | 35 #include "core/css/RuleSet.h" |
| 36 #include "core/css/StyleRule.h" | 36 #include "core/css/StyleRule.h" |
| 37 #include "core/css/invalidation/DescendantInvalidationSet.h" | 37 #include "core/css/invalidation/DescendantInvalidationSet.h" |
| 38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 39 #include "core/dom/Node.h" | 39 #include "core/dom/Node.h" |
| 40 #include "core/inspector/InspectorTraceEvents.h" |
| 40 #include "wtf/BitVector.h" | 41 #include "wtf/BitVector.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 #if ENABLE(ASSERT) | 45 #if ENABLE(ASSERT) |
| 45 | 46 |
| 46 static bool supportsInvalidation(CSSSelector::Match match) | 47 static bool supportsInvalidation(CSSSelector::Match match) |
| 47 { | 48 { |
| 48 switch (match) { | 49 switch (match) { |
| 49 case CSSSelector::Tag: | 50 case CSSSelector::Tag: |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 for (unsigned i = 0; i < oldClasses.size(); ++i) { | 592 for (unsigned i = 0; i < oldClasses.size(); ++i) { |
| 592 if (remainingClassBits.quickGet(i)) | 593 if (remainingClassBits.quickGet(i)) |
| 593 continue; | 594 continue; |
| 594 // Class was removed. | 595 // Class was removed. |
| 595 addClassToInvalidationSet(oldClasses[i], element); | 596 addClassToInvalidationSet(oldClasses[i], element); |
| 596 } | 597 } |
| 597 } | 598 } |
| 598 | 599 |
| 599 void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const Qualified
Name& attributeName, Element& element) | 600 void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const Qualified
Name& attributeName, Element& element) |
| 600 { | 601 { |
| 601 | 602 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_attrib
uteInvalidationSets.get(attributeName.localName())) { |
| 602 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_attrib
uteInvalidationSets.get(attributeName.localName())) | 603 TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, attributeCh
ange, attributeName); |
| 603 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 604 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 605 } |
| 604 } | 606 } |
| 605 | 607 |
| 606 void RuleFeatureSet::scheduleStyleInvalidationForIdChange(const AtomicString& ol
dId, const AtomicString& newId, Element& element) | 608 void RuleFeatureSet::scheduleStyleInvalidationForIdChange(const AtomicString& ol
dId, const AtomicString& newId, Element& element) |
| 607 { | 609 { |
| 608 if (!oldId.isEmpty()) { | 610 if (!oldId.isEmpty()) { |
| 609 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_id
InvalidationSets.get(oldId)) | 611 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_id
InvalidationSets.get(oldId)) { |
| 612 TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, idChang
e, oldId); |
| 610 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 613 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 614 } |
| 611 } | 615 } |
| 612 if (!newId.isEmpty()) { | 616 if (!newId.isEmpty()) { |
| 613 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_id
InvalidationSets.get(newId)) | 617 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_id
InvalidationSets.get(newId)) { |
| 618 TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, idChang
e, newId); |
| 614 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 619 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 620 } |
| 615 } | 621 } |
| 616 } | 622 } |
| 617 | 623 |
| 618 void RuleFeatureSet::scheduleStyleInvalidationForPseudoChange(CSSSelector::Pseud
oType pseudo, Element& element) | 624 void RuleFeatureSet::scheduleStyleInvalidationForPseudoChange(CSSSelector::Pseud
oType pseudo, Element& element) |
| 619 { | 625 { |
| 620 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_pseudo
InvalidationSets.get(pseudo)) | 626 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_pseudo
InvalidationSets.get(pseudo)) { |
| 627 TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, pseudoChang
e, pseudo); |
| 621 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 628 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 629 } |
| 622 } | 630 } |
| 623 | 631 |
| 624 void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& className, El
ement& element) | 632 inline void RuleFeatureSet::addClassToInvalidationSet(const AtomicString& classN
ame, Element& element) |
| 625 { | 633 { |
| 626 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_classI
nvalidationSets.get(className)) | 634 if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_classI
nvalidationSets.get(className)) { |
| 635 TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, classChange
, className); |
| 627 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 636 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 637 } |
| 628 } | 638 } |
| 629 | 639 |
| 630 StyleInvalidator& RuleFeatureSet::styleInvalidator() | 640 StyleInvalidator& RuleFeatureSet::styleInvalidator() |
| 631 { | 641 { |
| 632 return m_styleInvalidator; | 642 return m_styleInvalidator; |
| 633 } | 643 } |
| 634 | 644 |
| 635 void RuleFeatureSet::trace(Visitor* visitor) | 645 void RuleFeatureSet::trace(Visitor* visitor) |
| 636 { | 646 { |
| 637 #if ENABLE(OILPAN) | 647 #if ENABLE(OILPAN) |
| 638 visitor->trace(siblingRules); | 648 visitor->trace(siblingRules); |
| 639 visitor->trace(uncommonAttributeRules); | 649 visitor->trace(uncommonAttributeRules); |
| 640 visitor->trace(m_classInvalidationSets); | 650 visitor->trace(m_classInvalidationSets); |
| 641 visitor->trace(m_attributeInvalidationSets); | 651 visitor->trace(m_attributeInvalidationSets); |
| 642 visitor->trace(m_idInvalidationSets); | 652 visitor->trace(m_idInvalidationSets); |
| 643 visitor->trace(m_pseudoInvalidationSets); | 653 visitor->trace(m_pseudoInvalidationSets); |
| 644 visitor->trace(m_styleInvalidator); | 654 visitor->trace(m_styleInvalidator); |
| 645 #endif | 655 #endif |
| 646 } | 656 } |
| 647 | 657 |
| 648 } // namespace blink | 658 } // namespace blink |
| OLD | NEW |