Modified: trunk/Source/WebCore/dom/Element.h (108448 => 108449)
--- trunk/Source/WebCore/dom/Element.h 2012-02-22 07:15:46 UTC (rev 108448)
+++ trunk/Source/WebCore/dom/Element.h 2012-02-22 07:20:19 UTC (rev 108449)
@@ -394,6 +394,9 @@
const AtomicString& webkitRegionOverflow() const;
+ bool hasID() const;
+ bool hasClass() const;
+
protected:
Element(const QualifiedName& tagName, Document* document, ConstructionType type)
: ContainerNode(document, type)
@@ -697,6 +700,27 @@
return static_cast<Element*>(child);
}
+inline bool Element::hasID() const
+{
+ return attributeData() && attributeData()->hasID();
+}
+
+inline bool Element::hasClass() const
+{
+ return attributeData() && attributeData()->hasClass();
+}
+
+// Put here to make them inline.
+inline bool Node::hasID() const
+{
+ return isElementNode() && toElement(this)->hasID();
+}
+
+inline bool Node::hasClass() const
+{
+ return isElementNode() && toElement(this)->hasClass();
+}
+
} // namespace
#endif
Modified: trunk/Source/WebCore/dom/Node.h (108448 => 108449)
--- trunk/Source/WebCore/dom/Node.h 2012-02-22 07:15:46 UTC (rev 108448)
+++ trunk/Source/WebCore/dom/Node.h 2012-02-22 07:20:19 UTC (rev 108449)
@@ -90,7 +90,7 @@
typedef int ExceptionCode;
-const int nodeStyleChangeShift = 25;
+const int nodeStyleChangeShift = 23;
// SyntheticStyleChange means that we need to go through the entire style change logic even though
// no style property has actually changed. It is used to restructure the tree when, for instance,
@@ -301,8 +301,9 @@
bool attributeStyleDirty() const { return getFlag(AttributeStyleDirtyFlag); }
bool hasName() const { return getFlag(HasNameFlag); }
- bool hasID() const { return getFlag(HasIDFlag); }
- bool hasClass() const { return getFlag(HasClassFlag); }
+ bool hasID() const;
+ bool hasClass() const;
+
bool active() const { return getFlag(IsActiveFlag); }
bool inActiveChain() const { return getFlag(InActiveChainFlag); }
bool inDetach() const { return getFlag(InDetachFlag); }
@@ -319,8 +320,6 @@
void clearAttributeStyleDirty() { clearFlag(AttributeStyleDirtyFlag); }
void setHasName(bool f) { setFlag(f, HasNameFlag); }
- void setHasID(bool f) { setFlag(f, HasIDFlag); }
- void setHasClass(bool f) { setFlag(f, HasClassFlag); }
void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
void setInDocument() { setFlag(InDocumentFlag); }
@@ -654,37 +653,35 @@
IsStyledElementFlag = 1 << 4,
IsHTMLFlag = 1 << 5,
IsSVGFlag = 1 << 6,
- HasIDFlag = 1 << 7,
- HasClassFlag = 1 << 8,
- IsAttachedFlag = 1 << 9,
- ChildNeedsStyleRecalcFlag = 1 << 10,
- InDocumentFlag = 1 << 11,
- IsLinkFlag = 1 << 12,
- IsActiveFlag = 1 << 13,
- IsHoveredFlag = 1 << 14,
- InActiveChainFlag = 1 << 15,
- InDetachFlag = 1 << 16,
- HasRareDataFlag = 1 << 17,
- IsShadowRootOrSVGShadowRootFlag = 1 << 18,
+ IsAttachedFlag = 1 << 7,
+ ChildNeedsStyleRecalcFlag = 1 << 8,
+ InDocumentFlag = 1 << 9,
+ IsLinkFlag = 1 << 10,
+ IsActiveFlag = 1 << 11,
+ IsHoveredFlag = 1 << 12,
+ InActiveChainFlag = 1 << 13,
+ InDetachFlag = 1 << 14,
+ HasRareDataFlag = 1 << 15,
+ IsShadowRootOrSVGShadowRootFlag = 1 << 16,
// These bits are used by derived classes, pulled up here so they can
// be stored in the same memory word as the Node bits above.
- IsParsingChildrenFinishedFlag = 1 << 19, // Element
- IsStyleAttributeValidFlag = 1 << 20, // StyledElement
- IsSynchronizingStyleAttributeFlag = 1 << 21, // StyledElement
+ IsParsingChildrenFinishedFlag = 1 << 17, // Element
+ IsStyleAttributeValidFlag = 1 << 18, // StyledElement
+ IsSynchronizingStyleAttributeFlag = 1 << 19, // StyledElement
#if ENABLE(SVG)
- AreSVGAttributesValidFlag = 1 << 22, // Element
- IsSynchronizingSVGAttributesFlag = 1 << 23, // SVGElement
- HasSVGRareDataFlag = 1 << 24, // SVGElement
+ AreSVGAttributesValidFlag = 1 << 20, // Element
+ IsSynchronizingSVGAttributesFlag = 1 << 21, // SVGElement
+ HasSVGRareDataFlag = 1 << 22, // SVGElement
#endif
StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
- SelfOrAncestorHasDirAutoFlag = 1 << 27,
- HasCustomWillOrDidRecalcStyleFlag = 1 << 28,
- HasCustomStyleForRendererFlag = 1 << 29,
+ SelfOrAncestorHasDirAutoFlag = 1 << 25,
+ HasCustomWillOrDidRecalcStyleFlag = 1 << 26,
+ HasCustomStyleForRendererFlag = 1 << 27,
- HasNameFlag = 1 << 30,
+ HasNameFlag = 1 << 28,
AttributeStyleDirtyFlag = 1 << 31,
@@ -695,7 +692,7 @@
#endif
};
- // 1 bit remaining
+ // 3 bits remaining
bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }