Title: [108303] trunk/Source/WebCore
Revision
108303
Author
[email protected]
Date
2012-02-20 22:15:04 -0800 (Mon, 20 Feb 2012)

Log Message

Use InsertinonPoint instead of HTMLContentElement.
https://bugs.webkit.org/show_bug.cgi?id=78778

Reviewed by Hajime Morita.

Replace HTMLContentElement with InsertionPoint in NodeRenderingContext and HTMLContentSelection.
This is one of followup patches for r108207.

No new tests, no change in behavior.

* dom/NodeRenderingContext.cpp:
(WebCore::nextRendererOf):
(WebCore::previousRendererOf):
(WebCore::firstRendererOf):
(WebCore::lastRendererOf):
* dom/NodeRenderingContext.h:
(WebCore):
(NodeRenderingContext):
(WebCore::NodeRenderingContext::insertionPoint):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::insertionPointFor):
* dom/ShadowRoot.h:
(WebCore):
* html/shadow/HTMLContentElement.cpp:
(WebCore::HTMLContentElement::HTMLContentElement):
(WebCore::HTMLContentElement::attach):
(WebCore::HTMLContentElement::detach):
* html/shadow/HTMLContentElement.h:
(HTMLContentElement):
* html/shadow/HTMLContentSelector.cpp:
(WebCore::HTMLContentSelector::select):
* html/shadow/HTMLContentSelector.h:
(WebCore):
(HTMLContentSelection):
(WebCore::HTMLContentSelection::insertionPoint):
(WebCore::HTMLContentSelection::HTMLContentSelection):
(WebCore::HTMLContentSelection::create):
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::InsertionPoint):
* html/shadow/InsertionPoint.h:
(WebCore::InsertionPoint::selections):
(WebCore::InsertionPoint::hasSelection):
(InsertionPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108302 => 108303)


--- trunk/Source/WebCore/ChangeLog	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/ChangeLog	2012-02-21 06:15:04 UTC (rev 108303)
@@ -1,3 +1,49 @@
+2012-02-20  Hayato Ito  <[email protected]>
+
+        Use InsertinonPoint instead of HTMLContentElement.
+        https://bugs.webkit.org/show_bug.cgi?id=78778
+
+        Reviewed by Hajime Morita.
+
+        Replace HTMLContentElement with InsertionPoint in NodeRenderingContext and HTMLContentSelection.
+        This is one of followup patches for r108207.
+
+        No new tests, no change in behavior.
+
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::nextRendererOf):
+        (WebCore::previousRendererOf):
+        (WebCore::firstRendererOf):
+        (WebCore::lastRendererOf):
+        * dom/NodeRenderingContext.h:
+        (WebCore):
+        (NodeRenderingContext):
+        (WebCore::NodeRenderingContext::insertionPoint):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::insertionPointFor):
+        * dom/ShadowRoot.h:
+        (WebCore):
+        * html/shadow/HTMLContentElement.cpp:
+        (WebCore::HTMLContentElement::HTMLContentElement):
+        (WebCore::HTMLContentElement::attach):
+        (WebCore::HTMLContentElement::detach):
+        * html/shadow/HTMLContentElement.h:
+        (HTMLContentElement):
+        * html/shadow/HTMLContentSelector.cpp:
+        (WebCore::HTMLContentSelector::select):
+        * html/shadow/HTMLContentSelector.h:
+        (WebCore):
+        (HTMLContentSelection):
+        (WebCore::HTMLContentSelection::insertionPoint):
+        (WebCore::HTMLContentSelection::HTMLContentSelection):
+        (WebCore::HTMLContentSelection::create):
+        * html/shadow/InsertionPoint.cpp:
+        (WebCore::InsertionPoint::InsertionPoint):
+        * html/shadow/InsertionPoint.h:
+        (WebCore::InsertionPoint::selections):
+        (WebCore::InsertionPoint::hasSelection):
+        (InsertionPoint):
+
 2012-02-20  David Barton  <[email protected]>
 
         MathML internals - code clean-up for RenderMathMLSubSup

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (108302 => 108303)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-02-21 06:15:04 UTC (rev 108303)
@@ -119,7 +119,7 @@
     return m_style.release();
 }
 
-static RenderObject* nextRendererOf(HTMLContentElement* parent, Node* current)
+static RenderObject* nextRendererOf(InsertionPoint* parent, Node* current)
 {
     HTMLContentSelection* currentSelection = parent->selections()->find(current);
     if (!currentSelection)
@@ -133,7 +133,7 @@
     return 0;
 }
 
-static RenderObject* previousRendererOf(HTMLContentElement* parent, Node* current)
+static RenderObject* previousRendererOf(InsertionPoint* parent, Node* current)
 {
     RenderObject* lastRenderer = 0;
 
@@ -147,7 +147,7 @@
     return lastRenderer;
 }
 
-static RenderObject* firstRendererOf(HTMLContentElement* parent)
+static RenderObject* firstRendererOf(InsertionPoint* parent)
 {
     for (HTMLContentSelection* selection = parent->selections()->first(); selection; selection = selection->next()) {
         if (RenderObject* renderer = selection->node()->renderer())
@@ -157,7 +157,7 @@
     return 0;
 }
 
-static RenderObject* lastRendererOf(HTMLContentElement* parent)
+static RenderObject* lastRendererOf(InsertionPoint* parent)
 {
     for (HTMLContentSelection* selection = parent->selections()->last(); selection; selection = selection->previous()) {
         if (RenderObject* renderer = selection->node()->renderer())

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.h (108302 => 108303)


--- trunk/Source/WebCore/dom/NodeRenderingContext.h	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.h	2012-02-21 06:15:04 UTC (rev 108303)
@@ -34,11 +34,11 @@
 
 class ContainerNode;
 class Document;
+class InsertionPoint;
 class Node;
 class RenderFlowThread;
 class RenderObject;
 class RenderStyle;
-class HTMLContentElement;
 class ShadowRoot;
 
 class NodeRenderingContext {
@@ -52,7 +52,7 @@
     RenderObject* parentRenderer() const;
     RenderObject* nextRenderer() const;
     RenderObject* previousRenderer() const;
-    HTMLContentElement* insertionPoint() const;
+    InsertionPoint* insertionPoint() const;
 
     RenderStyle* style() const;
     void setStyle(PassRefPtr<RenderStyle>);
@@ -81,7 +81,7 @@
     Node* m_node;
     ContainerNode* m_parentNodeForRenderingAndStyle;
     ShadowRoot* m_visualParentShadowRoot;
-    HTMLContentElement* m_insertionPoint;
+    InsertionPoint* m_insertionPoint;
     RefPtr<RenderStyle> m_style;
     RenderFlowThread* m_parentFlowRenderer;
     AtomicString m_flowThread;
@@ -103,7 +103,7 @@
     return m_style.get();
 }
 
-inline HTMLContentElement* NodeRenderingContext::insertionPoint() const
+inline InsertionPoint* NodeRenderingContext::insertionPoint() const
 {
     return m_insertionPoint;
 }

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (108302 => 108303)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-02-21 06:15:04 UTC (rev 108303)
@@ -32,6 +32,7 @@
 #include "HTMLContentElement.h"
 #include "HTMLContentSelector.h"
 #include "HTMLNames.h"
+#include "InsertionPoint.h"
 #include "NodeRareData.h"
 #include "ShadowRootList.h"
 #include "SVGNames.h"
@@ -182,7 +183,7 @@
         shadowHost()->setNeedsStyleRecalc();
 }
 
-HTMLContentElement* ShadowRoot::insertionPointFor(Node* node) const
+InsertionPoint* ShadowRoot::insertionPointFor(Node* node) const
 {
     if (!m_selector)
         return 0;

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (108302 => 108303)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2012-02-21 06:15:04 UTC (rev 108303)
@@ -37,6 +37,7 @@
 class Document;
 class HTMLContentElement;
 class HTMLContentSelector;
+class InsertionPoint;
 
 class ShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
     friend class WTF::DoublyLinkedListNode<ShadowRoot>;
@@ -59,7 +60,7 @@
     void clearNeedsReattachHostChildrenAndShadow();
     bool needsReattachHostChildrenAndShadow();
 
-    HTMLContentElement* insertionPointFor(Node*) const;
+    InsertionPoint* insertionPointFor(Node*) const;
     void hostChildrenChanged();
     bool isSelectorActive() const;
 

Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp	2012-02-21 06:15:04 UTC (rev 108303)
@@ -60,7 +60,6 @@
 
 HTMLContentElement::HTMLContentElement(const QualifiedName& name, Document* document)
     : InsertionPoint(name, document)
-    , m_selections(adoptPtr(new HTMLContentSelectionList()))
 {
 }
 
@@ -75,14 +74,14 @@
     // Before calling StyledElement::attach, selector must be calculated.
     if (root) {
         HTMLContentSelector* selector = root->ensureSelector();
-        selector->unselect(m_selections.get());
-        selector->select(this, m_selections.get());
+        selector->unselect(&m_selections);
+        selector->select(this, &m_selections);
     }
 
     InsertionPoint::attach();
 
     if (root) {
-        for (HTMLContentSelection* selection = m_selections->first(); selection; selection = selection->next())
+        for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next())
             selection->node()->attach();
     }
 }
@@ -91,14 +90,14 @@
 {
     if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
         if (HTMLContentSelector* selector = root->selector())
-            selector->unselect(m_selections.get());
+            selector->unselect(&m_selections);
 
         // When content element is detached, shadow tree should be recreated to re-calculate selector for
         // other content elements.
         root->setNeedsReattachHostChildrenAndShadow();
     }
 
-    ASSERT(m_selections->isEmpty());
+    ASSERT(m_selections.isEmpty());
     InsertionPoint::detach();
 }
 

Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.h (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/HTMLContentElement.h	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.h	2012-02-21 06:15:04 UTC (rev 108303)
@@ -31,15 +31,11 @@
 #ifndef HTMLContentElement_h
 #define HTMLContentElement_h
 
-#include "HTMLContentSelector.h"
 #include "InsertionPoint.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
 
-class ContentSelectorQuery;
-class HTMLContentSelectionList;
-
 // NOTE: Current implementation doesn't support dynamic insertion/deletion of HTMLContentElement.
 // You should create HTMLContentElement during the host construction.
 class HTMLContentElement : public InsertionPoint {
@@ -60,9 +56,6 @@
     // See https://bugs.webkit.org/show_bug.cgi?id=76261
     void setSelect(const AtomicString&);
 
-    const HTMLContentSelectionList* selections() const { return m_selections.get(); }
-    bool hasSelection() const { return selections()->first(); }
-
     virtual bool isSelectValid() const;
 
 protected:
@@ -74,8 +67,6 @@
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; }
 
     virtual void parseAttribute(Attribute*) OVERRIDE;
-
-    OwnPtr<HTMLContentSelectionList> m_selections;
 };
 
 inline HTMLContentElement* toHTMLContentElement(Node* node)

Modified: trunk/Source/WebCore/html/shadow/HTMLContentSelector.cpp (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/HTMLContentSelector.cpp	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/HTMLContentSelector.cpp	2012-02-21 06:15:04 UTC (rev 108303)
@@ -121,6 +121,7 @@
             continue;
 
         RefPtr<HTMLContentSelection> selection = HTMLContentSelection::create(contentElement, child);
+
         selections->append(selection);
         m_selectionSet.add(selection.get());
         m_candidates[i] = 0;

Modified: trunk/Source/WebCore/html/shadow/HTMLContentSelector.h (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/HTMLContentSelector.h	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/HTMLContentSelector.h	2012-02-21 06:15:04 UTC (rev 108303)
@@ -40,14 +40,15 @@
 
 class Element;
 class HTMLContentElement;
+class InsertionPoint;
 class Node;
 class ShadowRoot;
 
 class HTMLContentSelection : public RefCounted<HTMLContentSelection> {
 public:
-    static PassRefPtr<HTMLContentSelection> create(HTMLContentElement*, Node*);
+    static PassRefPtr<HTMLContentSelection> create(InsertionPoint*, Node*);
 
-    HTMLContentElement* insertionPoint() const { return m_insertionPoint; }
+    InsertionPoint* insertionPoint() const { return m_insertionPoint; }
     Node* node() const { return m_node.get(); }
     HTMLContentSelection* next() const { return m_next.get(); }
     HTMLContentSelection* previous() const { return m_previous.get(); }
@@ -56,19 +57,19 @@
     void unlink();
 
 private:
-    HTMLContentSelection(HTMLContentElement*, Node*);
+    HTMLContentSelection(InsertionPoint*, Node*);
 
-    HTMLContentElement* m_insertionPoint;
+    InsertionPoint* m_insertionPoint;
     RefPtr<Node> m_node;
     RefPtr<HTMLContentSelection> m_next;
     RefPtr<HTMLContentSelection> m_previous;
 };
 
-inline HTMLContentSelection::HTMLContentSelection(HTMLContentElement* insertionPoint, Node* node)
+inline HTMLContentSelection::HTMLContentSelection(InsertionPoint* insertionPoint, Node* node)
     : m_insertionPoint(insertionPoint), m_node(node)
 { }
 
-inline PassRefPtr<HTMLContentSelection> HTMLContentSelection::create(HTMLContentElement* insertionPoint, Node* node)
+inline PassRefPtr<HTMLContentSelection> HTMLContentSelection::create(InsertionPoint* insertionPoint, Node* node)
 {
     return adoptRef(new HTMLContentSelection(insertionPoint, node));
 }

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-02-21 06:15:04 UTC (rev 108303)
@@ -31,14 +31,11 @@
 #include "config.h"
 #include "InsertionPoint.h"
 
-#include "HTMLNames.h"
-
 namespace WebCore {
 
-class Document;
-
 InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
     : HTMLElement(tagName, document)
+    , m_selections()
 {
 }
 

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (108302 => 108303)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-02-21 06:00:51 UTC (rev 108302)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-02-21 06:15:04 UTC (rev 108303)
@@ -31,6 +31,7 @@
 #ifndef InsertionPoint_h
 #define InsertionPoint_h
 
+#include "HTMLContentSelector.h"
 #include "HTMLElement.h"
 
 namespace WebCore {
@@ -39,8 +40,12 @@
 public:
     virtual ~InsertionPoint();
 
+    const HTMLContentSelectionList* selections() const { return &m_selections; }
+    bool hasSelection() const { return m_selections.first(); }
+
 protected:
     InsertionPoint(const QualifiedName&, Document*);
+    HTMLContentSelectionList m_selections;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to