Title: [127811] trunk/Source/WebCore
Revision
127811
Author
morr...@google.com
Date
2012-09-06 19:25:36 -0700 (Thu, 06 Sep 2012)

Log Message

[Shadow DOM][Refactoring] Element subclasses should have a way to reject author shadows.
https://bugs.webkit.org/show_bug.cgi?id=95831

Reviewed by Dimitri Glazkov.

Originally, the availability of author shadows was decided by ShadowRoot class.
This change moves that responsibility to each Element subclasses to make future
author shadow support improvement local to each replaced elements, rather than
touching ShadowRoot.cpp for reach.

No new tests. Should have no behavioral change.

* dom/Element.h:
* dom/ShadowRoot.cpp:
(WebCore::allowsAuthorShadowRoot):
* html/HTMLTextFormControlElement.h:
(HTMLTextFormControlElement):
* svg/SVGElement.h:
(SVGElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127810 => 127811)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 01:42:53 UTC (rev 127810)
+++ trunk/Source/WebCore/ChangeLog	2012-09-07 02:25:36 UTC (rev 127811)
@@ -1,3 +1,25 @@
+2012-09-06  MORITA Hajime  <morr...@google.com>
+
+        [Shadow DOM][Refactoring] Element subclasses should have a way to reject author shadows.
+        https://bugs.webkit.org/show_bug.cgi?id=95831
+
+        Reviewed by Dimitri Glazkov.
+
+        Originally, the availability of author shadows was decided by ShadowRoot class.
+        This change moves that responsibility to each Element subclasses to make future
+        author shadow support improvement local to each replaced elements, rather than
+        touching ShadowRoot.cpp for reach.
+
+        No new tests. Should have no behavioral change.
+
+        * dom/Element.h:
+        * dom/ShadowRoot.cpp:
+        (WebCore::allowsAuthorShadowRoot):
+        * html/HTMLTextFormControlElement.h:
+        (HTMLTextFormControlElement):
+        * svg/SVGElement.h:
+        (SVGElement):
+
 2012-09-06  Adam Barth  <aba...@chromium.org>
 
         [V8] Weave creationContext through toV8 and related functions

Modified: trunk/Source/WebCore/dom/Element.h (127810 => 127811)


--- trunk/Source/WebCore/dom/Element.h	2012-09-07 01:42:53 UTC (rev 127810)
+++ trunk/Source/WebCore/dom/Element.h	2012-09-07 02:25:36 UTC (rev 127811)
@@ -275,6 +275,7 @@
     ElementShadow* shadow() const;
     ElementShadow* ensureShadow();
     virtual void willAddAuthorShadowRoot() { }
+    virtual bool areAuthorShadowsAllowed() const { return true; }
 
     ShadowRoot* userAgentShadowRoot() const;
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (127810 => 127811)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-09-07 01:42:53 UTC (rev 127810)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-09-07 02:25:36 UTC (rev 127811)
@@ -82,23 +82,7 @@
     if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled())
         return true;
 #endif
-
-    // FIXME: The elements in Shadow DOM of an input element assumes that they have renderer if the input
-    // element has a renderer. However, this does not hold until input elemnet is AuthorShadowDOM-ready.
-    // So we would like to prohibit having a AuthorShadowDOM for a while. The same thing happens to
-    // textarea element also.
-    // https://bugs.webkit.org/show_bug.cgi?id=92608
-    if (isHTMLInputElement(element))
-        return false;
-
-    // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it.
-    // https://bugs.webkit.org/show_bug.cgi?id=78205
-    // Especially SVG TREF recreates shadow root dynamically.
-    // https://bugs.webkit.org/show_bug.cgi?id=77938
-    if (element->isSVGElement())
-        return false;
-
-    return true;
+    return element->areAuthorShadowsAllowed();
 }
 
 PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec)

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (127810 => 127811)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2012-09-07 01:42:53 UTC (rev 127810)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2012-09-07 02:25:36 UTC (rev 127811)
@@ -290,6 +290,9 @@
     HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
     void createShadowSubtree();
     virtual void defaultEventHandler(Event*);
+    // FIXME: Author shadows should be allowed
+    // https://bugs.webkit.org/show_bug.cgi?id=92608
+    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
 
 private:
     enum AutoCompleteSetting { Uninitialized, On, Off };

Modified: trunk/Source/WebCore/svg/SVGElement.h (127810 => 127811)


--- trunk/Source/WebCore/svg/SVGElement.h	2012-09-07 01:42:53 UTC (rev 127810)
+++ trunk/Source/WebCore/svg/SVGElement.h	2012-09-07 02:25:36 UTC (rev 127811)
@@ -136,6 +136,10 @@
 
     void reportAttributeParsingError(SVGParsingError, const Attribute&);
 
+    // FIXME: Author shadows should be allowed
+    // https://bugs.webkit.org/show_bug.cgi?id=77938
+    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
+
 private:
     friend class SVGElementInstance;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to