Title: [109718] trunk/Source/WebCore
- Revision
- 109718
- Author
- [email protected]
- Date
- 2012-03-05 00:22:33 -0800 (Mon, 05 Mar 2012)
Log Message
Refactoring: Move HTMLContentElement::attach to InsertionPoint::attach.
https://bugs.webkit.org/show_bug.cgi?id=80243
Reviewed by Hajime Morita.
Since the current code in HTMLContentElement::attach() will be used for coming <shadow>
elements, it is natural that InsertionPoint::attach() has such code.
No new tests, no change in behavior.
* html/shadow/HTMLContentElement.cpp:
* html/shadow/HTMLContentElement.h:
(HTMLContentElement):
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::attach):
(WebCore):
(WebCore::InsertionPoint::detach):
* html/shadow/InsertionPoint.h:
(InsertionPoint):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (109717 => 109718)
--- trunk/Source/WebCore/ChangeLog 2012-03-05 08:18:11 UTC (rev 109717)
+++ trunk/Source/WebCore/ChangeLog 2012-03-05 08:22:33 UTC (rev 109718)
@@ -1,3 +1,25 @@
+2012-03-05 Shinya Kawanaka <[email protected]>
+
+ Refactoring: Move HTMLContentElement::attach to InsertionPoint::attach.
+ https://bugs.webkit.org/show_bug.cgi?id=80243
+
+ Reviewed by Hajime Morita.
+
+ Since the current code in HTMLContentElement::attach() will be used for coming <shadow>
+ elements, it is natural that InsertionPoint::attach() has such code.
+
+ No new tests, no change in behavior.
+
+ * html/shadow/HTMLContentElement.cpp:
+ * html/shadow/HTMLContentElement.h:
+ (HTMLContentElement):
+ * html/shadow/InsertionPoint.cpp:
+ (WebCore::InsertionPoint::attach):
+ (WebCore):
+ (WebCore::InsertionPoint::detach):
+ * html/shadow/InsertionPoint.h:
+ (InsertionPoint):
+
2012-03-05 Adam Barth <[email protected]>
allowDatabaseAccess and databaseExceededQuota should be part of DatabaseContext not ScriptExecutionContext
Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp (109717 => 109718)
--- trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp 2012-03-05 08:18:11 UTC (rev 109717)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp 2012-03-05 08:22:33 UTC (rev 109718)
@@ -68,40 +68,6 @@
{
}
-void HTMLContentElement::attach()
-{
- ShadowRoot* root = toShadowRoot(shadowTreeRootNode());
-
- // Before calling StyledElement::attach, selector must be calculated.
- if (root) {
- HTMLContentSelector* selector = root->tree()->ensureSelector();
- selector->unselect(&m_selections);
- selector->select(this, &m_selections);
- }
-
- InsertionPoint::attach();
-
- if (root) {
- for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next())
- selection->node()->attach();
- }
-}
-
-void HTMLContentElement::detach()
-{
- if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
- if (HTMLContentSelector* selector = root->tree()->selector())
- selector->unselect(&m_selections);
-
- // When content element is detached, shadow tree should be recreated to re-calculate selector for
- // other insertion points.
- root->tree()->setNeedsReattachHostChildrenAndShadow();
- }
-
- ASSERT(m_selections.isEmpty());
- InsertionPoint::detach();
-}
-
const AtomicString& HTMLContentElement::select() const
{
return getAttribute(selectAttr);
Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.h (109717 => 109718)
--- trunk/Source/WebCore/html/shadow/HTMLContentElement.h 2012-03-05 08:18:11 UTC (rev 109717)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.h 2012-03-05 08:22:33 UTC (rev 109718)
@@ -44,8 +44,6 @@
static PassRefPtr<HTMLContentElement> create(Document*);
virtual ~HTMLContentElement();
- virtual void attach();
- virtual void detach();
const AtomicString& select() const;
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (109717 => 109718)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-03-05 08:18:11 UTC (rev 109717)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-03-05 08:22:33 UTC (rev 109718)
@@ -32,6 +32,7 @@
#include "InsertionPoint.h"
#include "ShadowRoot.h"
+#include "ShadowTree.h"
namespace WebCore {
@@ -45,6 +46,39 @@
{
}
+void InsertionPoint::attach()
+{
+ ShadowRoot* root = toShadowRoot(shadowTreeRootNode());
+
+ if (root) {
+ HTMLContentSelector* selector = root->tree()->ensureSelector();
+ selector->unselect(&m_selections);
+ selector->select(this, &m_selections);
+ }
+
+ HTMLElement::attach();
+
+ if (root) {
+ for (HTMLContentSelection* selection = m_selections.first(); selection; selection = selection->next())
+ selection->node()->attach();
+ }
+}
+
+void InsertionPoint::detach()
+{
+ if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
+ if (HTMLContentSelector* selector = root->tree()->selector())
+ selector->unselect(&m_selections);
+
+ // When shadow element is detached, shadow tree should be recreated to re-calculate selector for
+ // other insertion points.
+ root->tree()->setNeedsReattachHostChildrenAndShadow();
+ }
+
+ ASSERT(m_selections.isEmpty());
+ HTMLElement::detach();
+}
+
bool InsertionPoint::isShadowBoundary() const
{
if (TreeScope* scope = treeScope())
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (109717 => 109718)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-03-05 08:18:11 UTC (rev 109717)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-03-05 08:22:33 UTC (rev 109718)
@@ -47,6 +47,9 @@
virtual const AtomicString& select() const = 0;
+ virtual void attach();
+ virtual void detach();
+
protected:
InsertionPoint(const QualifiedName&, Document*);
virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes