Move functions from NodeRareData to ElementRareData and other classes
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Jan 2013 23:57:39 +0000 (23:57 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Jan 2013 23:57:39 +0000 (23:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106679

Reviewed by Benjamin Poulain.

Moved tab index related functions from NodeRareData to ElementRareData since only
HTMLElement uses them, and moved related functions on Node to Element accordingly.

Also replaced transientMutationObserverRegistry and ensureTransientMutationObserverRegistry
by ensureMutationObserverData, and moved micro-data related member functions into
NodeMicroDataTokenLists, and moved NodeMutationObserverData and NodeMicroDataTokenLists
out of NodeRareData as they're used outside of NodeRareData now.

The intention is to move more code into NodeMutationObserverData and NodeMicroDataTokenLists
in the follow up patches so that they can detect the removability of NodeRareData.

No new tests are added since there should be no behavior changes.

* dom/Element.cpp:
(WebCore::Element::clearTabIndexExplicitlyIfNeeded):
(WebCore::Element::setTabIndexExplicitly):
(WebCore::Element::tabIndex):
(WebCore::Element::supportsFocus):
* dom/Element.h:
(Element):
* dom/ElementRareData.h:
(ElementRareData):
(WebCore::ElementRareData::tabIndex):
(WebCore::ElementRareData::setTabIndexExplicitly):
(WebCore::ElementRareData::tabIndexSetExplicitly):
(WebCore::ElementRareData::clearTabIndexExplicitly):
* dom/Node.cpp:
(WebCore::Node::tabIndex):
(WebCore::Node::supportsFocus):
(WebCore::Node::mutationObserverRegistry):
(WebCore::Node::transientMutationObserverRegistry):
(WebCore::Node::registerMutationObserver):
(WebCore::Node::registerTransientMutationObserver):
(WebCore::Node::itemProp):
(WebCore::Node::setItemProp):
(WebCore::Node::itemRef):
(WebCore::Node::setItemRef):
(WebCore::Node::itemType):
(WebCore::Node::setItemType):
* dom/Node.h:
(Node):
* dom/NodeRareData.h:
(NodeMutationObserverData):
(WebCore::NodeMutationObserverData::create):
(NodeMicroDataTokenLists):
(WebCore::NodeMicroDataTokenLists::create):
(WebCore::NodeMicroDataTokenLists::itemProp):
(WebCore::NodeMicroDataTokenLists::itemRef):
(WebCore::NodeMicroDataTokenLists::itemType):
(NodeRareData):
(WebCore::NodeRareData::mutationObserverData):
(WebCore::NodeRareData::ensureMutationObserverData):
(WebCore::NodeRareData::ensureMicroDataTokenLists):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseAttribute):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementRareData.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/NodeRareData.cpp
Source/WebCore/dom/NodeRareData.h
Source/WebCore/html/HTMLElement.cpp

index 693343607a21683bd5a17547185bae9c7be85ba0..a98340949e3f81ffa329c2f84c682e83cb4cd902 100644 (file)
@@ -1,3 +1,66 @@
+2013-01-11  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Move functions from NodeRareData to ElementRareData and other classes
+        https://bugs.webkit.org/show_bug.cgi?id=106679
+
+        Reviewed by Benjamin Poulain.
+
+        Moved tab index related functions from NodeRareData to ElementRareData since only
+        HTMLElement uses them, and moved related functions on Node to Element accordingly.
+
+        Also replaced transientMutationObserverRegistry and ensureTransientMutationObserverRegistry
+        by ensureMutationObserverData, and moved micro-data related member functions into
+        NodeMicroDataTokenLists, and moved NodeMutationObserverData and NodeMicroDataTokenLists
+        out of NodeRareData as they're used outside of NodeRareData now.
+
+        The intention is to move more code into NodeMutationObserverData and NodeMicroDataTokenLists
+        in the follow up patches so that they can detect the removability of NodeRareData.
+
+        No new tests are added since there should be no behavior changes.
+
+        * dom/Element.cpp:
+        (WebCore::Element::clearTabIndexExplicitlyIfNeeded):
+        (WebCore::Element::setTabIndexExplicitly):
+        (WebCore::Element::tabIndex):
+        (WebCore::Element::supportsFocus):
+        * dom/Element.h:
+        (Element):
+        * dom/ElementRareData.h:
+        (ElementRareData):
+        (WebCore::ElementRareData::tabIndex):
+        (WebCore::ElementRareData::setTabIndexExplicitly):
+        (WebCore::ElementRareData::tabIndexSetExplicitly):
+        (WebCore::ElementRareData::clearTabIndexExplicitly):
+        * dom/Node.cpp:
+        (WebCore::Node::tabIndex):
+        (WebCore::Node::supportsFocus):
+        (WebCore::Node::mutationObserverRegistry):
+        (WebCore::Node::transientMutationObserverRegistry):
+        (WebCore::Node::registerMutationObserver):
+        (WebCore::Node::registerTransientMutationObserver):
+        (WebCore::Node::itemProp):
+        (WebCore::Node::setItemProp):
+        (WebCore::Node::itemRef):
+        (WebCore::Node::setItemRef):
+        (WebCore::Node::itemType):
+        (WebCore::Node::setItemType):
+        * dom/Node.h:
+        (Node):
+        * dom/NodeRareData.h:
+        (NodeMutationObserverData):
+        (WebCore::NodeMutationObserverData::create):
+        (NodeMicroDataTokenLists):
+        (WebCore::NodeMicroDataTokenLists::create):
+        (WebCore::NodeMicroDataTokenLists::itemProp):
+        (WebCore::NodeMicroDataTokenLists::itemRef):
+        (WebCore::NodeMicroDataTokenLists::itemType):
+        (NodeRareData):
+        (WebCore::NodeRareData::mutationObserverData):
+        (WebCore::NodeRareData::ensureMutationObserverData):
+        (WebCore::NodeRareData::ensureMicroDataTokenLists):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseAttribute):
+
 2013-01-14  Ojan Vafai  <ojan@chromium.org>
 
         Remove unnecessary setNeedsLayoutAndPrefWidthsRecalc from RenderTable
index c5b347393715a5831ed117013ee06d237c7eb72c..f79aa323877bb82f9cd88e1fe981454b9bbb0635 100644 (file)
@@ -228,6 +228,27 @@ PassOwnPtr<NodeRareData> Element::createRareData()
     return adoptPtr(new ElementRareData());
 }
 
+void Element::clearTabIndexExplicitlyIfNeeded()
+{
+    if (hasRareData())
+        elementRareData()->clearTabIndexExplicitly();
+}
+
+void Element::setTabIndexExplicitly(short tabIndex)
+{
+    ensureElementRareData()->setTabIndexExplicitly(tabIndex);
+}
+
+bool Element::supportsFocus() const
+{
+    return hasRareData() && elementRareData()->tabIndexSetExplicitly();
+}
+
+short Element::tabIndex() const
+{
+    return hasRareData() ? elementRareData()->tabIndex() : 0;
+}
+
 DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, blur);
 DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, error);
 DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(Element, focus);
index b9673699cc7ceca6ad10d24cab8ed7c12700e2c4..685de35fa23f68481b0cfb4aa00a112064f6a026 100644 (file)
@@ -515,6 +515,11 @@ protected:
     virtual bool shouldRegisterAsNamedItem() const { return false; }
     virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
 
+    void clearTabIndexExplicitlyIfNeeded();    
+    void setTabIndexExplicitly(short);
+    virtual bool supportsFocus() const OVERRIDE;
+    virtual short tabIndex() const OVERRIDE;
+
     PassRefPtr<HTMLCollection> ensureCachedHTMLCollection(CollectionType);
     HTMLCollection* cachedHTMLCollection(CollectionType);
 
index 92c1b2b39a8fc6fe465fc19292d306dc5bb42f3b..f2bfb702fe6661caebbfce3915f30ef523d9376a 100644 (file)
@@ -44,6 +44,11 @@ public:
 
     void resetComputedStyle();
     void resetDynamicRestyleObservations();
+    
+    short tabIndex() const { return m_tabIndex; }
+    void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; }
+    bool tabIndexSetExplicitly() const { return m_tabIndexWasSetExplicitly; }
+    void clearTabIndexExplicitly() { m_tabIndex = 0; m_tabIndexWasSetExplicitly = false; }
 
     bool needsFocusAppearanceUpdateSoonAfterAttach() const { return m_needsFocusAppearanceUpdateSoonAfterAttach; }
     void setNeedsFocusAppearanceUpdateSoonAfterAttach(bool needs) { m_needsFocusAppearanceUpdateSoonAfterAttach = needs; }
@@ -124,7 +129,36 @@ public:
 #endif
 
 private:
-    // Many fields are in NodeRareData for better packing.
+    short m_tabIndex;
+    unsigned short m_childIndex;
+    unsigned m_tabIndexWasSetExplicitly : 1;
+    unsigned m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
+    unsigned m_styleAffectedByEmpty : 1;
+    unsigned m_isInCanvasSubtree : 1;
+#if ENABLE(FULLSCREEN_API)
+    unsigned m_containsFullScreenElement : 1;
+#endif
+#if ENABLE(DIALOG_ELEMENT)
+    unsigned m_isInTopLayer : 1;
+#endif
+#if ENABLE(SVG)
+    unsigned m_hasPendingResources : 1;
+#endif
+    unsigned m_childrenAffectedByHover : 1;
+    unsigned m_childrenAffectedByActive : 1;
+    unsigned m_childrenAffectedByDrag : 1;
+    // Bits for dynamic child matching.
+    // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
+    // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
+    unsigned m_childrenAffectedByFirstChildRules : 1;
+    unsigned m_childrenAffectedByLastChildRules : 1;
+    unsigned m_childrenAffectedByDirectAdjacentRules : 1;
+    unsigned m_childrenAffectedByForwardPositionalRules : 1;
+    unsigned m_childrenAffectedByBackwardPositionalRules : 1;
+#if ENABLE(VIDEO_TRACK)
+    unsigned m_webVTTNodeType : 2; // WebVTTNodeType
+#endif
+
     LayoutSize m_minimumSizeForResizing;
     RefPtr<RenderStyle> m_computedStyle;
 
@@ -148,7 +182,33 @@ inline IntSize defaultMinimumSizeForResizing()
 }
 
 inline ElementRareData::ElementRareData()
-    : m_minimumSizeForResizing(defaultMinimumSizeForResizing())
+    : m_tabIndex(0)
+    , m_childIndex(0)
+    , m_tabIndexWasSetExplicitly(false)
+    , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
+    , m_styleAffectedByEmpty(false)
+    , m_isInCanvasSubtree(false)
+#if ENABLE(FULLSCREEN_API)
+    , m_containsFullScreenElement(false)
+#endif
+#if ENABLE(DIALOG_ELEMENT)
+    , m_isInTopLayer(false)
+#endif
+#if ENABLE(SVG)
+    , m_hasPendingResources(false)
+#endif
+    , m_childrenAffectedByHover(false)
+    , m_childrenAffectedByActive(false)
+    , m_childrenAffectedByDrag(false)
+    , m_childrenAffectedByFirstChildRules(false)
+    , m_childrenAffectedByLastChildRules(false)
+    , m_childrenAffectedByDirectAdjacentRules(false)
+    , m_childrenAffectedByForwardPositionalRules(false)
+    , m_childrenAffectedByBackwardPositionalRules(false)
+#if ENABLE(VIDEO_TRACK)
+    , m_webVTTNodeType(WebVTTNodeTypeNone)
+#endif
+    , m_minimumSizeForResizing(defaultMinimumSizeForResizing())
 {
 }
 
index f9db2f86f3d30b37ef442142965ba5ed58154b72..e8c802726b93e5e8be77ecdc06338d4908f04d2a 100644 (file)
@@ -492,17 +492,7 @@ HTMLInputElement* Node::toInputElement()
 
 short Node::tabIndex() const
 {
-    return hasRareData() ? rareData()->tabIndex() : 0;
-}
-    
-void Node::setTabIndexExplicitly(short i)
-{
-    ensureRareData()->setTabIndexExplicitly(i);
-}
-
-void Node::clearTabIndexExplicitly()
-{
-    ensureRareData()->clearTabIndexExplicitly();
+    return 0;
 }
 
 String Node::nodeValue() const
@@ -863,7 +853,7 @@ void Node::lazyAttach(ShouldSetAttached shouldSetAttached)
 
 bool Node::supportsFocus() const
 {
-    return hasRareData() && rareData()->tabIndexSetExplicitly();
+    return false;
 }
     
 bool Node::isFocusable() const
@@ -2192,12 +2182,22 @@ void Node::clearEventTargetData()
 
 Vector<OwnPtr<MutationObserverRegistration> >* Node::mutationObserverRegistry()
 {
-    return hasRareData() ? rareData()->mutationObserverRegistry() : 0;
+    if (!hasRareData())
+        return 0;
+    NodeMutationObserverData* data = rareData()->mutationObserverData();
+    if (!data)
+        return 0;
+    return &data->registry;
 }
 
 HashSet<MutationObserverRegistration*>* Node::transientMutationObserverRegistry()
 {
-    return hasRareData() ? rareData()->transientMutationObserverRegistry() : 0;
+    if (!hasRareData())
+        return 0;
+    NodeMutationObserverData* data = rareData()->mutationObserverData();
+    if (!data)
+        return 0;
+    return &data->transientRegistry;
 }
 
 template<typename Registry>
@@ -2230,17 +2230,17 @@ void Node::getRegisteredMutationObserversOfType(HashMap<MutationObserver*, Mutat
 void Node::registerMutationObserver(MutationObserver* observer, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
 {
     MutationObserverRegistration* registration = 0;
-    Vector<OwnPtr<MutationObserverRegistration> >* registry = ensureRareData()->ensureMutationObserverRegistry();
-    for (size_t i = 0; i < registry->size(); ++i) {
-        if (registry->at(i)->observer() == observer) {
-            registration = registry->at(i).get();
+    Vector<OwnPtr<MutationObserverRegistration> >& registry = ensureRareData()->ensureMutationObserverData()->registry;
+    for (size_t i = 0; i < registry.size(); ++i) {
+        if (registry[i]->observer() == observer) {
+            registration = registry[i].get();
             registration->resetObservation(options, attributeFilter);
         }
     }
 
     if (!registration) {
-        registry->append(MutationObserverRegistration::create(observer, this, options, attributeFilter));
-        registration = registry->last().get();
+        registry.append(MutationObserverRegistration::create(observer, this, options, attributeFilter));
+        registration = registry.last().get();
     }
 
     document()->addMutationObserverTypes(registration->mutationTypes());
@@ -2263,7 +2263,7 @@ void Node::unregisterMutationObserver(MutationObserverRegistration* registration
 
 void Node::registerTransientMutationObserver(MutationObserverRegistration* registration)
 {
-    ensureRareData()->ensureTransientMutationObserverRegistry()->add(registration);
+    ensureRareData()->ensureMutationObserverData()->transientRegistry.add(registration);
 }
 
 void Node::unregisterTransientMutationObserver(MutationObserverRegistration* registration)
@@ -2518,32 +2518,32 @@ bool Node::willRespondToTouchEvents()
 #if ENABLE(MICRODATA)
 DOMSettableTokenList* Node::itemProp()
 {
-    return ensureRareData()->itemProp();
+    return ensureRareData()->ensureMicroDataTokenLists()->itemProp();
 }
 
 void Node::setItemProp(const String& value)
 {
-    ensureRareData()->setItemProp(value);
+    ensureRareData()->ensureMicroDataTokenLists()->itemProp()->setValue(value);
 }
 
 DOMSettableTokenList* Node::itemRef()
 {
-    return ensureRareData()->itemRef();
+    return ensureRareData()->ensureMicroDataTokenLists()->itemRef();
 }
 
 void Node::setItemRef(const String& value)
 {
-    ensureRareData()->setItemRef(value);
+    ensureRareData()->ensureMicroDataTokenLists()->itemRef()->setValue(value);
 }
 
 DOMSettableTokenList* Node::itemType()
 {
-    return ensureRareData()->itemType();
+    return ensureRareData()->ensureMicroDataTokenLists()->itemType();
 }
 
 void Node::setItemType(const String& value)
 {
-    ensureRareData()->setItemType(value);
+    ensureRareData()->ensureMicroDataTokenLists()->itemType()->setValue(value);
 }
 
 PassRefPtr<PropertyNodeList> Node::propertyNodeList(const String& name)
index 1a011cba70626ae417d69db59541e23289d6d157..259933ede1b24da8fddbbe780785c3ffbb0fd8b1 100644 (file)
@@ -748,9 +748,7 @@ protected:
     virtual void didMoveToNewDocument(Document* oldDocument);
     
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
-    void setTabIndexExplicitly(short);
-    void clearTabIndexExplicitly();
-    
+
     bool hasRareData() const { return getFlag(HasRareDataFlag); }
 
     NodeRareData* rareData() const;
index b111c7b1829f04467cbdfa83a1c9a57b59286d28..2bdfc94c894ebb7f33a9c74025b5d347418e0cc5 100644 (file)
@@ -40,8 +40,6 @@ namespace WebCore {
 
 struct SameSizeAsNodeRareData {
     void* m_pointer[4];
-    unsigned m_indicesAndBitfields[2];
-
 #if ENABLE(MICRODATA)
     void* m_microData;
 #endif
index dfec92e67a3e320b590feff87ed867721c097088..aa058b75e5e61348a0211783756783b14873b15e 100644 (file)
@@ -226,61 +226,63 @@ private:
     TagNodeListCacheNS m_tagNodeListCacheNS;
 };
 
-class NodeRareData : public NodeRareDataBase {
-    WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
+class NodeMutationObserverData {
+    WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); WTF_MAKE_FAST_ALLOCATED;
+public:
+    Vector<OwnPtr<MutationObserverRegistration> > registry;
+    HashSet<MutationObserverRegistration*> transientRegistry;
 
-    struct NodeMutationObserverData {
-        Vector<OwnPtr<MutationObserverRegistration> > m_registry;
-        HashSet<MutationObserverRegistration*> m_transientRegistry;
+    static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new NodeMutationObserverData); }
 
-        static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new NodeMutationObserverData); }
-    };
+private:
+    NodeMutationObserverData() { }
+};
 
 #if ENABLE(MICRODATA)
-    struct NodeMicroDataTokenLists {
-        RefPtr<DOMSettableTokenList> m_itemProp;
-        RefPtr<DOMSettableTokenList> m_itemRef;
-        RefPtr<DOMSettableTokenList> m_itemType;
+class NodeMicroDataTokenLists {
+    WTF_MAKE_NONCOPYABLE(NodeMicroDataTokenLists); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassOwnPtr<NodeMicroDataTokenLists> create() { return adoptPtr(new NodeMicroDataTokenLists); }
 
-        static PassOwnPtr<NodeMicroDataTokenLists> create() { return adoptPtr(new NodeMicroDataTokenLists); }
-    };
-#endif
+    DOMSettableTokenList* itemProp() const
+    {
+        if (!m_itemProp)
+            m_itemProp = DOMSettableTokenList::create();
+        return m_itemProp.get();
+    }
 
-public:    
-    NodeRareData()
-        : m_tabIndex(0)
-        , m_childIndex(0)
-        , m_tabIndexWasSetExplicitly(false)
-        , m_needsFocusAppearanceUpdateSoonAfterAttach(false)
-        , m_styleAffectedByEmpty(false)
-        , m_isInCanvasSubtree(false)
-#if ENABLE(FULLSCREEN_API)
-        , m_containsFullScreenElement(false)
-#endif
-#if ENABLE(DIALOG_ELEMENT)
-        , m_isInTopLayer(false)
-#endif
-#if ENABLE(SVG)
-        , m_hasPendingResources(false)
-#endif
-        , m_childrenAffectedByHover(false)
-        , m_childrenAffectedByActive(false)
-        , m_childrenAffectedByDrag(false)
-        , m_childrenAffectedByFirstChildRules(false)
-        , m_childrenAffectedByLastChildRules(false)
-        , m_childrenAffectedByDirectAdjacentRules(false)
-        , m_childrenAffectedByForwardPositionalRules(false)
-        , m_childrenAffectedByBackwardPositionalRules(false)
-#if ENABLE(VIDEO_TRACK)
-        , m_webVTTNodeType(WebVTTNodeTypeNone)
-#endif
+    DOMSettableTokenList* itemRef() const
     {
+        if (!m_itemRef)
+            m_itemRef = DOMSettableTokenList::create();
+        return m_itemRef.get();
     }
 
-    virtual ~NodeRareData()
+    DOMSettableTokenList* itemType() const
     {
+        if (!m_itemType)
+            m_itemType = DOMSettableTokenList::create();
+        return m_itemType.get();
     }
 
+private:
+    DOMSettableTokenList() { }
+
+    mutable RefPtr<DOMSettableTokenList> m_itemProp;
+    mutable RefPtr<DOMSettableTokenList> m_itemRef;
+    mutable RefPtr<DOMSettableTokenList> m_itemType;
+};
+#endif
+
+class NodeRareData : public NodeRareDataBase {
+    WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
+public:    
+    NodeRareData()
+    { }
+
+    virtual ~NodeRareData()
+    { }
+
     void clearNodeLists() { m_nodeLists.clear(); }
     NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
     NodeListsNodeData* ensureNodeLists()
@@ -290,25 +292,12 @@ public:
         return m_nodeLists.get();
     }
 
-    short tabIndex() const { return m_tabIndex; }
-    void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; }
-    bool tabIndexSetExplicitly() const { return m_tabIndexWasSetExplicitly; }
-    void clearTabIndexExplicitly() { m_tabIndex = 0; m_tabIndexWasSetExplicitly = false; }
-
-    Vector<OwnPtr<MutationObserverRegistration> >* mutationObserverRegistry() { return m_mutationObserverData ? &m_mutationObserverData->m_registry : 0; }
-    Vector<OwnPtr<MutationObserverRegistration> >* ensureMutationObserverRegistry()
+    NodeMutationObserverData* mutationObserverData() { return m_mutationObserverData.get(); }
+    NodeMutationObserverData* ensureMutationObserverData()
     {
         if (!m_mutationObserverData)
             m_mutationObserverData = NodeMutationObserverData::create();
-        return &m_mutationObserverData->m_registry;
-    }
-
-    HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry() { return m_mutationObserverData ? &m_mutationObserverData->m_transientRegistry : 0; }
-    HashSet<MutationObserverRegistration*>* ensureTransientMutationObserverRegistry()
-    {
-        if (!m_mutationObserverData)
-            m_mutationObserverData = NodeMutationObserverData::create();
-        return &m_mutationObserverData->m_transientRegistry;
+        return m_mutationObserverData.get();
     }
 
 #if ENABLE(MICRODATA)
@@ -318,89 +307,10 @@ public:
             m_microDataTokenLists = NodeMicroDataTokenLists::create();
         return m_microDataTokenLists.get();
     }
-
-    DOMSettableTokenList* itemProp() const
-    {
-        if (!ensureMicroDataTokenLists()->m_itemProp)
-            m_microDataTokenLists->m_itemProp = DOMSettableTokenList::create();
-
-        return m_microDataTokenLists->m_itemProp.get();
-    }
-
-    void setItemProp(const String& value)
-    {
-        if (!ensureMicroDataTokenLists()->m_itemProp)
-            m_microDataTokenLists->m_itemProp = DOMSettableTokenList::create();
-
-        m_microDataTokenLists->m_itemProp->setValue(value);
-    }
-
-    DOMSettableTokenList* itemRef() const
-    {
-        if (!ensureMicroDataTokenLists()->m_itemRef)
-            m_microDataTokenLists->m_itemRef = DOMSettableTokenList::create();
-
-        return m_microDataTokenLists->m_itemRef.get();
-    }
-
-    void setItemRef(const String& value)
-    {
-        if (!ensureMicroDataTokenLists()->m_itemRef)
-            m_microDataTokenLists->m_itemRef = DOMSettableTokenList::create();
-
-        m_microDataTokenLists->m_itemRef->setValue(value);
-    }
-
-    DOMSettableTokenList* itemType() const
-    {
-        if (!ensureMicroDataTokenLists()->m_itemType)
-            m_microDataTokenLists->m_itemType = DOMSettableTokenList::create();
-
-        return m_microDataTokenLists->m_itemType.get();
-    }
-
-    void setItemType(const String& value)
-    {
-        if (!ensureMicroDataTokenLists()->m_itemType)
-            m_microDataTokenLists->m_itemType = DOMSettableTokenList::create();
-
-        m_microDataTokenLists->m_itemType->setValue(value);
-    }
 #endif
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const;
 
-protected:
-    short m_tabIndex;
-    unsigned short m_childIndex;
-    unsigned m_tabIndexWasSetExplicitly : 1;
-    unsigned m_needsFocusAppearanceUpdateSoonAfterAttach : 1;
-    unsigned m_styleAffectedByEmpty : 1;
-    unsigned m_isInCanvasSubtree : 1;
-#if ENABLE(FULLSCREEN_API)
-    unsigned m_containsFullScreenElement : 1;
-#endif
-#if ENABLE(DIALOG_ELEMENT)
-    unsigned m_isInTopLayer : 1;
-#endif
-#if ENABLE(SVG)
-    unsigned m_hasPendingResources : 1;
-#endif
-    unsigned m_childrenAffectedByHover : 1;
-    unsigned m_childrenAffectedByActive : 1;
-    unsigned m_childrenAffectedByDrag : 1;
-    // Bits for dynamic child matching.
-    // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
-    // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
-    unsigned m_childrenAffectedByFirstChildRules : 1;
-    unsigned m_childrenAffectedByLastChildRules : 1;
-    unsigned m_childrenAffectedByDirectAdjacentRules : 1;
-    unsigned m_childrenAffectedByForwardPositionalRules : 1;
-    unsigned m_childrenAffectedByBackwardPositionalRules : 1;
-#if ENABLE(VIDEO_TRACK)
-    unsigned m_webVTTNodeType : 2; // WebVTTNodeType
-#endif
-
 private:
     OwnPtr<NodeListsNodeData> m_nodeLists;
     OwnPtr<NodeMutationObserverData> m_mutationObserverData;
index 721ef4279a4bb01d7c7783a45c393edb8e43a6ba..284ac13b9ee4105a32f984501d4ef29e69e0de41 100644 (file)
@@ -223,7 +223,7 @@ void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString&
     else if (name == tabindexAttr) {
         int tabindex = 0;
         if (value.isEmpty())
-            clearTabIndexExplicitly();
+            clearTabIndexExplicitlyIfNeeded();
         else if (parseHTMLInteger(value, tabindex)) {
             // Clamp tabindex to the range of 'short' to match Firefox's behavior.
             setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));