Title: [141075] trunk/Source/WebCore
Revision
141075
Author
espr...@chromium.org
Date
2013-01-29 00:33:33 -0800 (Tue, 29 Jan 2013)

Log Message

Store ShadowRootType inside the bitfield
https://bugs.webkit.org/show_bug.cgi?id=108147

Reviewed by Dimitri Glazkov.

We can simplify the interface to ShadowRoot by storing the enum value of
ShadowRootType inside the bitfield like we do in the rest of WebCore.

No new tests, just refactoring.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::ShadowRoot):
(WebCore::ShadowRoot::create):
* dom/ShadowRoot.h:
(WebCore::ShadowRoot::type):
(ShadowRoot):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141074 => 141075)


--- trunk/Source/WebCore/ChangeLog	2013-01-29 08:31:49 UTC (rev 141074)
+++ trunk/Source/WebCore/ChangeLog	2013-01-29 08:33:33 UTC (rev 141075)
@@ -1,3 +1,22 @@
+2013-01-29  Elliott Sprehn  <espr...@chromium.org>
+
+        Store ShadowRootType inside the bitfield
+        https://bugs.webkit.org/show_bug.cgi?id=108147
+
+        Reviewed by Dimitri Glazkov.
+
+        We can simplify the interface to ShadowRoot by storing the enum value of
+        ShadowRootType inside the bitfield like we do in the rest of WebCore.
+
+        No new tests, just refactoring.
+
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::ShadowRoot):
+        (WebCore::ShadowRoot::create):
+        * dom/ShadowRoot.h:
+        (WebCore::ShadowRoot::type):
+        (ShadowRoot):
+
 2013-01-29  Jochen Eisinger  <joc...@chromium.org>
 
         REGRESSION(r141070): Broke debug build

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (141074 => 141075)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2013-01-29 08:31:49 UTC (rev 141074)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2013-01-29 08:33:33 UTC (rev 141075)
@@ -63,7 +63,7 @@
 
 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_should_stay_small);
 
-ShadowRoot::ShadowRoot(Document* document)
+ShadowRoot::ShadowRoot(Document* document, ShadowRootType type)
     : DocumentFragment(document, CreateShadowRoot)
     , TreeScope(this, document)
     , m_prev(0)
@@ -71,7 +71,7 @@
     , m_numberOfStyles(0)
     , m_applyAuthorStyles(false)
     , m_resetStyleInheritance(false)
-    , m_isAuthorShadowRoot(false)
+    , m_type(type)
     , m_registeredWithParentShadowRoot(false)
 {
     ASSERT(document);
@@ -142,8 +142,7 @@
         return 0;
     }
 
-    RefPtr<ShadowRoot> shadowRoot = adoptRef(new ShadowRoot(element->document()));
-    shadowRoot->setType(type);
+    RefPtr<ShadowRoot> shadowRoot = adoptRef(new ShadowRoot(element->document(), type));
 
     ec = 0;
     element->ensureShadow()->addShadowRoot(element, shadowRoot, type, ec);

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (141074 => 141075)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2013-01-29 08:31:49 UTC (rev 141074)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2013-01-29 08:33:33 UTC (rev 141075)
@@ -53,7 +53,7 @@
     // in several elements for a while.
     // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs.
     enum ShadowRootType {
-        UserAgentShadowRoot,
+        UserAgentShadowRoot = 0,
         AuthorShadowRoot
     };
     static PassRefPtr<ShadowRoot> create(Element*, ShadowRootType, ExceptionCode& = ASSERT_NO_EXCEPTION);
@@ -92,28 +92,26 @@
     const ScopeContentDistribution* scopeDistribution() const { return m_scopeDistribution.get(); }
     ScopeContentDistribution* ensureScopeDistribution();
 
-    ShadowRootType type() const { return m_isAuthorShadowRoot ? AuthorShadowRoot : UserAgentShadowRoot; }
+    ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
 
     PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
 
 private:
-    explicit ShadowRoot(Document*);
+    ShadowRoot(Document*, ShadowRootType);
     virtual ~ShadowRoot();
     virtual PassRefPtr<Node> cloneNode(bool deep);
     virtual bool childTypeAllowed(NodeType) const;
     virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
 
-    void setType(ShadowRootType type) { m_isAuthorShadowRoot = type == AuthorShadowRoot; }
-
     ShadowRoot* m_prev;
     ShadowRoot* m_next;
     OwnPtr<ScopeContentDistribution> m_scopeDistribution;
     unsigned m_numberOfStyles : 28;
     unsigned m_applyAuthorStyles : 1;
     unsigned m_resetStyleInheritance : 1;
-    unsigned m_isAuthorShadowRoot : 1;
+    unsigned m_type : 1;
     unsigned m_registeredWithParentShadowRoot : 1;
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to