Title: [208001] trunk/Source/WebCore
Revision
208001
Author
cdu...@apple.com
Date
2016-10-27 13:23:06 -0700 (Thu, 27 Oct 2016)

Log Message

Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations
https://bugs.webkit.org/show_bug.cgi?id=164063

Reviewed by Sam Weinig.

Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations now
that we support having IDL string enumerations in their own IDL file.

No new tests, no Web-exposed behavior change.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::collectMatchingRules):
(WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
(WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
* dom/CustomElementRegistry.cpp:
(WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
* dom/Element.cpp:
(WebCore::Element::bindingsOffsetParent):
(WebCore::Element::addShadowRoot):
(WebCore::Element::attachShadow):
(WebCore::Element::shadowRootForBindings):
(WebCore::Element::userAgentShadowRoot):
(WebCore::Element::ensureUserAgentShadowRoot):
* dom/Element.h:
* dom/Element.idl:
* dom/InlineStyleSheetOwner.cpp:
(WebCore::parserContextForElement):
* dom/Node.cpp:
(WebCore::Node::isUnclosedNode):
(WebCore::Node::assignedSlotForBindings):
(WebCore::Node::isInUserAgentShadowTree):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::ShadowRoot):
* dom/ShadowRoot.h:
* dom/ShadowRoot.idl:
* dom/ShadowRootMode.h: Added.
* dom/ShadowRootMode.idl: Copied from Source/WebCore/dom/ShadowRoot.idl.
* dom/SlotAssignment.cpp:
(WebCore::SlotAssignment::didChangeSlot):
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::create):
* inspector/InspectorDOMAgent.cpp:
(WebCore::shadowRootType):
* rendering/HitTestResult.cpp:
(WebCore::moveOutOfUserAgentShadowTree):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionPseudoStyle):
* rendering/RenderLayer.cpp:
(WebCore::rendererForScrollbar):
* style/StyleScope.cpp:
(WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver):
(WebCore::Style::Scope::didChangeStyleSheetEnvironment):
* svg/SVGElement.cpp:
(WebCore::SVGElement::correspondingUseElement):
* testing/Internals.cpp:
(WebCore::Internals::shadowRootType):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (208000 => 208001)


--- trunk/Source/WebCore/CMakeLists.txt	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-10-27 20:23:06 UTC (rev 208001)
@@ -445,6 +445,7 @@
     dom/RequestAnimationFrameCallback.idl
     dom/SecurityPolicyViolationEvent.idl
     dom/ShadowRoot.idl
+    dom/ShadowRootMode.idl
     dom/Slotable.idl
     dom/StaticRange.idl
     dom/StringCallback.idl

Modified: trunk/Source/WebCore/ChangeLog (208000 => 208001)


--- trunk/Source/WebCore/ChangeLog	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/ChangeLog	2016-10-27 20:23:06 UTC (rev 208001)
@@ -1,5 +1,70 @@
 2016-10-27  Chris Dumez  <cdu...@apple.com>
 
+        Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations
+        https://bugs.webkit.org/show_bug.cgi?id=164063
+
+        Reviewed by Sam Weinig.
+
+        Merge Element::ShadowRootMode and ShadowRoot::Mode enumerations now
+        that we support having IDL string enumerations in their own IDL file.
+
+        No new tests, no Web-exposed behavior change.
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/ElementRuleCollector.cpp:
+        (WebCore::ElementRuleCollector::collectMatchingRules):
+        (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
+        (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::matchRecursively):
+        * dom/CustomElementRegistry.cpp:
+        (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
+        * dom/Element.cpp:
+        (WebCore::Element::bindingsOffsetParent):
+        (WebCore::Element::addShadowRoot):
+        (WebCore::Element::attachShadow):
+        (WebCore::Element::shadowRootForBindings):
+        (WebCore::Element::userAgentShadowRoot):
+        (WebCore::Element::ensureUserAgentShadowRoot):
+        * dom/Element.h:
+        * dom/Element.idl:
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::parserContextForElement):
+        * dom/Node.cpp:
+        (WebCore::Node::isUnclosedNode):
+        (WebCore::Node::assignedSlotForBindings):
+        (WebCore::Node::isInUserAgentShadowTree):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::ShadowRoot):
+        * dom/ShadowRoot.h:
+        * dom/ShadowRoot.idl:
+        * dom/ShadowRootMode.h: Added.
+        * dom/ShadowRootMode.idl: Copied from Source/WebCore/dom/ShadowRoot.idl.
+        * dom/SlotAssignment.cpp:
+        (WebCore::SlotAssignment::didChangeSlot):
+        * html/HTMLSummaryElement.cpp:
+        (WebCore::HTMLSummaryElement::create):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::shadowRootType):
+        * rendering/HitTestResult.cpp:
+        (WebCore::moveOutOfUserAgentShadowTree):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::selectionPseudoStyle):
+        * rendering/RenderLayer.cpp:
+        (WebCore::rendererForScrollbar):
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::shouldUseSharedUserAgentShadowTreeStyleResolver):
+        (WebCore::Style::Scope::didChangeStyleSheetEnvironment):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::correspondingUseElement):
+        * testing/Internals.cpp:
+        (WebCore::Internals::shadowRootType):
+
+2016-10-27  Chris Dumez  <cdu...@apple.com>
+
         Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable
         https://bugs.webkit.org/show_bug.cgi?id=164062
 

Modified: trunk/Source/WebCore/DerivedSources.cpp (208000 => 208001)


--- trunk/Source/WebCore/DerivedSources.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/DerivedSources.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -581,6 +581,7 @@
 #include "JSSVGZoomAndPan.cpp"
 #include "JSSVGZoomEvent.cpp"
 #include "JSShadowRoot.cpp"
+#include "JSShadowRootMode.cpp"
 #include "JSStorage.cpp"
 #if ENABLE(QUOTA)
 #include "JSStorageErrorCallback.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (208000 => 208001)


--- trunk/Source/WebCore/DerivedSources.make	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/DerivedSources.make	2016-10-27 20:23:06 UTC (rev 208001)
@@ -356,6 +356,7 @@
     $(WebCore)/dom/RequestAnimationFrameCallback.idl \
     $(WebCore)/dom/SecurityPolicyViolationEvent.idl \
     $(WebCore)/dom/ShadowRoot.idl \
+    $(WebCore)/dom/ShadowRootMode.idl \
     $(WebCore)/dom/Slotable.idl \
     $(WebCore)/dom/StaticRange.idl \
     $(WebCore)/dom/StringCallback.idl \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (208000 => 208001)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-10-27 20:23:06 UTC (rev 208001)
@@ -1765,6 +1765,9 @@
 		46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46DB7D571B20FE46005651B2 /* VNodeTrackerCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46DB7D561B20FE3C005651B2 /* VNodeTrackerCocoa.cpp */; };
 		46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; };
+		46DFF4981DC2603100B80B48 /* ShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF4961DC2601300B80B48 /* ShadowRootMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		46DFF49B1DC2620B00B80B48 /* JSShadowRootMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46DFF4991DC261F900B80B48 /* JSShadowRootMode.cpp */; };
+		46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */; };
 		46EBEA021B7D4D6500BE4941 /* CollectionTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EBEA011B7D4D5D00BE4941 /* CollectionTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46F3E3F91B2109000087ED13 /* VNodeTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46DB7D581B20FE58005651B2 /* VNodeTracker.cpp */; };
 		46F3E3FA1B2109100087ED13 /* VNodeTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DB7D591B20FE58005651B2 /* VNodeTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8835,6 +8838,10 @@
 		46DB7D581B20FE58005651B2 /* VNodeTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VNodeTracker.cpp; sourceTree = "<group>"; };
 		46DB7D591B20FE58005651B2 /* VNodeTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VNodeTracker.h; sourceTree = "<group>"; };
 		46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
+		46DFF4961DC2601300B80B48 /* ShadowRootMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowRootMode.h; sourceTree = "<group>"; };
+		46DFF4971DC2601300B80B48 /* ShadowRootMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRootMode.idl; sourceTree = "<group>"; };
+		46DFF4991DC261F900B80B48 /* JSShadowRootMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSShadowRootMode.cpp; sourceTree = "<group>"; };
+		46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSShadowRootMode.h; sourceTree = "<group>"; };
 		46EBEA011B7D4D5D00BE4941 /* CollectionTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionTraversal.h; sourceTree = "<group>"; };
 		46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMNamedFlowCollectionCustom.cpp; sourceTree = "<group>"; };
 		490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
@@ -20115,6 +20122,8 @@
 				4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */,
 				9B6BC9601B975966005AE1F0 /* JSShadowRoot.cpp */,
 				9B6BC9611B975966005AE1F0 /* JSShadowRoot.h */,
+				46DFF4991DC261F900B80B48 /* JSShadowRootMode.cpp */,
+				46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */,
 				65DF31EF09D1CC60000BE325 /* JSText.cpp */,
 				65DF31F009D1CC60000BE325 /* JSText.h */,
 				D7613AC214753E5600DB8606 /* JSWebKitNamedFlow.cpp */,
@@ -23800,6 +23809,8 @@
 				A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
 				A6D169631346B4C1000EB770 /* ShadowRoot.h */,
 				9B19B67E1B964E5200348745 /* ShadowRoot.idl */,
+				46DFF4961DC2601300B80B48 /* ShadowRootMode.h */,
+				46DFF4971DC2601300B80B48 /* ShadowRootMode.idl */,
 				572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */,
 				572A7F201C6E5719009C6149 /* SimulatedClick.h */,
 				31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
@@ -24742,6 +24753,7 @@
 				BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */,
 				9393E600151A99F200066F06 /* CSSImageSetValue.h in Headers */,
 				A80E6CFA0A1989CA007FB8C5 /* CSSImageValue.h in Headers */,
+				46DFF4981DC2603100B80B48 /* ShadowRootMode.h in Headers */,
 				A80E6CF60A1989CA007FB8C5 /* CSSImportRule.h in Headers */,
 				A80E6D010A1989CA007FB8C5 /* CSSInheritedValue.h in Headers */,
 				A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */,
@@ -25958,6 +25970,7 @@
 				B2FA3D950AB75A6F000E5AC4 /* JSSVGFETurbulenceElement.h in Headers */,
 				B2FA3D970AB75A6F000E5AC4 /* JSSVGFilterElement.h in Headers */,
 				B27B28260CEF0C0700D39D54 /* JSSVGFontElement.h in Headers */,
+				46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */,
 				A83B79050CCAFF15000B0825 /* JSSVGFontFaceElement.h in Headers */,
 				A83B79000CCAFF15000B0825 /* JSSVGFontFaceFormatElement.h in Headers */,
 				A83B79020CCAFF15000B0825 /* JSSVGFontFaceNameElement.h in Headers */,
@@ -30616,6 +30629,7 @@
 				582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp in Sources */,
 				C5A1EA7C152BCF04004D00B6 /* SimplifyMarkupCommand.cpp in Sources */,
 				572A7F231C6E5A66009C6149 /* SimulatedClick.cpp in Sources */,
+				46DFF49B1DC2620B00B80B48 /* JSShadowRootMode.cpp in Sources */,
 				FD00D7A414A3F61900734011 /* SincResampler.cpp in Sources */,
 				51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */,
 				9444CBD51D860C8B0073A074 /* SizesAttributeParser.cpp in Sources */,

Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (208000 => 208001)


--- trunk/Source/WebCore/css/ElementRuleCollector.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -144,7 +144,7 @@
     ASSERT_WITH_MESSAGE(!(m_mode == SelectorChecker::Mode::CollectingRulesIgnoringVirtualPseudoElements && m_pseudoStyleRequest.pseudoId != NOPSEUDO), "When in StyleInvalidation or SharingRules, SelectorChecker does not try to match the pseudo ID. While ElementRuleCollector supports matching a particular pseudoId in this case, this would indicate a error at the call site since matching a particular element should be unnecessary.");
 
     auto* shadowRoot = m_element.containingShadowRoot();
-    if (shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+    if (shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent)
         collectMatchingShadowPseudoElementRules(matchRequest, ruleRange);
 
     // We need to collect the rules for id, class, tag, and everything else into a buffer and
@@ -228,7 +228,7 @@
 {
     ASSERT(m_element.isInShadowTree());
     auto& shadowRoot = *m_element.containingShadowRoot();
-    if (shadowRoot.mode() != ShadowRoot::Mode::UserAgent)
+    if (shadowRoot.mode() != ShadowRootMode::UserAgent)
         return;
     // Look up shadow pseudo elements also from the host scope author style as they are web-exposed.
     auto& hostAuthorRules = Style::Scope::forNode(*shadowRoot.host()).resolver().ruleSets().authorStyle();
@@ -294,7 +294,7 @@
 void ElementRuleCollector::collectMatchingShadowPseudoElementRules(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange)
 {
     ASSERT(matchRequest.ruleSet);
-    ASSERT(m_element.containingShadowRoot()->mode() == ShadowRoot::Mode::UserAgent);
+    ASSERT(m_element.containingShadowRoot()->mode() == ShadowRootMode::UserAgent);
 
     auto& rules = *matchRequest.ruleSet;
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (208000 => 208001)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -292,7 +292,7 @@
                 if (context.element->shadowPseudoId() != context.selector->value())
                     return MatchResult::fails(Match::SelectorFailsLocally);
 
-                if (context.selector->isWebKitCustomPseudoElement() && root->mode() != ShadowRoot::Mode::UserAgent)
+                if (context.selector->isWebKitCustomPseudoElement() && root->mode() != ShadowRootMode::UserAgent)
                     return MatchResult::fails(Match::SelectorFailsLocally);
             } else
                 return MatchResult::fails(Match::SelectorFailsLocally);

Modified: trunk/Source/WebCore/dom/CustomElementRegistry.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/CustomElementRegistry.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -62,7 +62,7 @@
         if (element->isCustomElementUpgradeCandidate() && element->tagQName() == elementInterface.name())
             element->enqueueToUpgrade(elementInterface);
         if (auto* shadowRoot = element->shadowRoot()) {
-            if (shadowRoot->mode() != ShadowRoot::Mode::UserAgent)
+            if (shadowRoot->mode() != ShadowRootMode::UserAgent)
                 enqueueUpgradeInShadowIncludingTreeOrder(*shadowRoot, elementInterface);
         }
     }

Modified: trunk/Source/WebCore/dom/Element.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/Element.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/Element.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -852,7 +852,7 @@
     Element* element = offsetParent();
     if (!element || !element->isInShadowTree())
         return element;
-    return element->containingShadowRoot()->mode() == ShadowRoot::Mode::UserAgent ? nullptr : element;
+    return element->containingShadowRoot()->mode() == ShadowRootMode::UserAgent ? nullptr : element;
 }
 
 Element* Element::offsetParent()
@@ -1778,7 +1778,7 @@
 
     InspectorInstrumentation::didPushShadowRoot(*this, shadowRoot);
 
-    if (shadowRoot.mode() == ShadowRoot::Mode::UserAgent)
+    if (shadowRoot.mode() == ShadowRootMode::UserAgent)
         didAddUserAgentShadowRoot(&shadowRoot);
 }
 
@@ -1857,7 +1857,12 @@
         return nullptr;
     }
 
-    auto shadow = ShadowRoot::create(document(), init.mode == ShadowRootMode::Open ? ShadowRoot::Mode::Open : ShadowRoot::Mode::Closed);
+    if (init.mode == ShadowRootMode::UserAgent) {
+        ec = TypeError;
+        return nullptr;
+    }
+
+    auto shadow = ShadowRoot::create(document(), init.mode);
     addShadowRoot(shadow.copyRef());
     return WTFMove(shadow);
 }
@@ -1868,7 +1873,7 @@
     if (!root)
         return nullptr;
 
-    if (root->mode() != ShadowRoot::Mode::Open) {
+    if (root->mode() != ShadowRootMode::Open) {
         if (!JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->world().shadowRootIsAlwaysOpen())
             return nullptr;
     }
@@ -1879,7 +1884,7 @@
 ShadowRoot* Element::userAgentShadowRoot() const
 {
     if (ShadowRoot* shadowRoot = this->shadowRoot()) {
-        ASSERT(shadowRoot->mode() == ShadowRoot::Mode::UserAgent);
+        ASSERT(shadowRoot->mode() == ShadowRootMode::UserAgent);
         return shadowRoot;
     }
     return nullptr;
@@ -1889,7 +1894,7 @@
 {
     ShadowRoot* shadowRoot = userAgentShadowRoot();
     if (!shadowRoot) {
-        addShadowRoot(ShadowRoot::create(document(), ShadowRoot::Mode::UserAgent));
+        addShadowRoot(ShadowRoot::create(document(), ShadowRootMode::UserAgent));
         shadowRoot = userAgentShadowRoot();
     }
     return *shadowRoot;

Modified: trunk/Source/WebCore/dom/Element.h (208000 => 208001)


--- trunk/Source/WebCore/dom/Element.h	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/Element.h	2016-10-27 20:23:06 UTC (rev 208001)
@@ -32,6 +32,7 @@
 #include "RegionOversetState.h"
 #include "ScrollToOptions.h"
 #include "ScrollTypes.h"
+#include "ShadowRootMode.h"
 #include "SimulatedClickOptions.h"
 #include "StyleChange.h"
 
@@ -270,7 +271,6 @@
     WEBCORE_EXPORT ShadowRoot* shadowRoot() const;
     WEBCORE_EXPORT ShadowRoot* createShadowRoot(ExceptionCode&);
 
-    enum class ShadowRootMode { Open, Closed };
     struct ShadowRootInit {
         ShadowRootMode mode;
     };

Modified: trunk/Source/WebCore/dom/Element.idl (208000 => 208001)


--- trunk/Source/WebCore/dom/Element.idl	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/Element.idl	2016-10-27 20:23:06 UTC (rev 208001)
@@ -180,8 +180,6 @@
     [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitplaybacktargetavailabilitychanged;
 };
 
-enum ShadowRootMode { "open", "closed" };
-
 dictionary ShadowRootInit {
     required ShadowRootMode mode;
 };

Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -48,10 +48,10 @@
 {
     auto* shadowRoot = element.containingShadowRoot();
     // User agent shadow trees can't contain document-relative URLs. Use blank URL as base allowing cross-document sharing.
-    auto& baseURL = shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent ? blankURL() : element.document().baseURL();
+    auto& baseURL = shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent ? blankURL() : element.document().baseURL();
 
     CSSParserContext result = CSSParserContext { element.document(), baseURL, element.document().encoding() };
-    if (shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+    if (shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent)
         result.mode = UASheetMode;
     return result;
 }

Modified: trunk/Source/WebCore/dom/Node.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/Node.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/Node.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -1086,7 +1086,7 @@
                 return true; // treeScopeThatCanAccessOtherNode is a shadow-including inclusive ancestor of this node.
         }
         auto& root = treeScopeThatCanAccessOtherNode->rootNode();
-        if (is<ShadowRoot>(root) && downcast<ShadowRoot>(root).mode() != ShadowRoot::Mode::Open)
+        if (is<ShadowRoot>(root) && downcast<ShadowRoot>(root).mode() != ShadowRootMode::Open)
             break;
     }
 
@@ -1110,7 +1110,7 @@
 HTMLSlotElement* Node::assignedSlotForBindings() const
 {
     auto* shadowRoot = parentShadowRoot(*this);
-    if (shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::Open)
+    if (shadowRoot && shadowRoot->mode() == ShadowRootMode::Open)
         return shadowRoot->findAssignedSlot(*this);
     return nullptr;
 }
@@ -1128,7 +1128,7 @@
 bool Node::isInUserAgentShadowTree() const
 {
     auto* shadowRoot = containingShadowRoot();
-    return shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent;
+    return shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent;
 }
 
 Node* Node::nonBoundaryShadowTreeRootNode()

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -48,7 +48,7 @@
 
 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_should_stay_small);
 
-ShadowRoot::ShadowRoot(Document& document, Mode type)
+ShadowRoot::ShadowRoot(Document& document, ShadowRootMode type)
     : DocumentFragment(document, CreateShadowRoot)
     , TreeScope(*this, document)
     , m_type(type)
@@ -60,7 +60,7 @@
 ShadowRoot::ShadowRoot(Document& document, std::unique_ptr<SlotAssignment>&& slotAssignment)
     : DocumentFragment(document, CreateShadowRoot)
     , TreeScope(*this, document)
-    , m_type(Mode::UserAgent)
+    , m_type(ShadowRootMode::UserAgent)
     , m_styleScope(std::make_unique<Style::Scope>(*this))
     , m_slotAssignment(WTFMove(slotAssignment))
 {

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (208000 => 208001)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2016-10-27 20:23:06 UTC (rev 208001)
@@ -32,6 +32,7 @@
 #include "DocumentFragment.h"
 #include "Element.h"
 #include "ExceptionCode.h"
+#include "ShadowRootMode.h"
 #include "TreeScope.h"
 
 namespace WebCore {
@@ -41,13 +42,7 @@
 
 class ShadowRoot final : public DocumentFragment, public TreeScope {
 public:
-    enum class Mode : uint8_t {
-        UserAgent = 0,
-        Closed,
-        Open,
-    };
-
-    static Ref<ShadowRoot> create(Document& document, Mode type)
+    static Ref<ShadowRoot> create(Document& document, ShadowRootMode type)
     {
         return adoptRef(*new ShadowRoot(document, type));
     }
@@ -74,7 +69,7 @@
 
     Element* activeElement() const;
 
-    Mode mode() const { return m_type; }
+    ShadowRootMode mode() const { return m_type; }
 
     void removeAllEventListeners() override;
 
@@ -92,7 +87,7 @@
     const Vector<Node*>* assignedNodesForSlot(const HTMLSlotElement&);
 
 protected:
-    ShadowRoot(Document&, Mode);
+    ShadowRoot(Document&, ShadowRootMode);
 
     ShadowRoot(Document&, std::unique_ptr<SlotAssignment>&&);
 
@@ -108,7 +103,7 @@
     void removedFrom(ContainerNode& insertionPoint) override;
 
     bool m_resetStyleInheritance { false };
-    Mode m_type { Mode::UserAgent };
+    ShadowRootMode m_type { ShadowRootMode::UserAgent };
 
     Element* m_host { nullptr };
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.idl (208000 => 208001)


--- trunk/Source/WebCore/dom/ShadowRoot.idl	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/ShadowRoot.idl	2016-10-27 20:23:06 UTC (rev 208001)
@@ -33,7 +33,4 @@
     [TreatNullAs=EmptyString, SetterMayThrowLegacyException] attribute DOMString innerHTML;
 };
 
-// "user-agent" is a WebKit extension that is not exposed to the Web.
-enum ShadowRootMode { "user-agent", "closed", "open" };
-
 ShadowRoot implements DocumentOrShadowRoot;

Added: trunk/Source/WebCore/dom/ShadowRootMode.h (0 => 208001)


--- trunk/Source/WebCore/dom/ShadowRootMode.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/ShadowRootMode.h	2016-10-27 20:23:06 UTC (rev 208001)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class ShadowRootMode : uint8_t {
+    UserAgent,
+    Closed,
+    Open
+};
+
+}

Copied: trunk/Source/WebCore/dom/ShadowRootMode.idl (from rev 208000, trunk/Source/WebCore/dom/ShadowRoot.idl) (0 => 208001)


--- trunk/Source/WebCore/dom/ShadowRootMode.idl	                        (rev 0)
+++ trunk/Source/WebCore/dom/ShadowRootMode.idl	2016-10-27 20:23:06 UTC (rev 208001)
@@ -0,0 +1,31 @@
+/*
+* Copyright (C) 2016 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// "user-agent" is a WebKit extension that is not exposed to the Web.
+enum ShadowRootMode {
+    "user-agent",
+    "closed",
+    "open"
+};

Modified: trunk/Source/WebCore/dom/SlotAssignment.cpp (208000 => 208001)


--- trunk/Source/WebCore/dom/SlotAssignment.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/dom/SlotAssignment.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -158,7 +158,7 @@
         m_slotAssignmentsIsValid = false;
     }
 
-    if (shadowRoot.mode() == ShadowRoot::Mode::UserAgent)
+    if (shadowRoot.mode() == ShadowRootMode::UserAgent)
         return;
 
     recursivelyFireSlotChangeEvent(*slotElement);

Modified: trunk/Source/WebCore/html/HTMLSummaryElement.cpp (208000 => 208001)


--- trunk/Source/WebCore/html/HTMLSummaryElement.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/html/HTMLSummaryElement.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -40,7 +40,7 @@
 Ref<HTMLSummaryElement> HTMLSummaryElement::create(const QualifiedName& tagName, Document& document)
 {
     Ref<HTMLSummaryElement> summary = adoptRef(*new HTMLSummaryElement(tagName, document));
-    summary->addShadowRoot(ShadowRoot::create(document, ShadowRoot::Mode::UserAgent));
+    summary->addShadowRoot(ShadowRoot::create(document, ShadowRootMode::UserAgent));
     return summary;
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (208000 => 208001)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -1289,14 +1289,14 @@
     }
 }
 
-static Inspector::Protocol::DOM::ShadowRootType shadowRootType(ShadowRoot::Mode mode)
+static Inspector::Protocol::DOM::ShadowRootType shadowRootType(ShadowRootMode mode)
 {
     switch (mode) {
-    case ShadowRoot::Mode::UserAgent:
+    case ShadowRootMode::UserAgent:
         return Inspector::Protocol::DOM::ShadowRootType::UserAgent;
-    case ShadowRoot::Mode::Closed:
+    case ShadowRootMode::Closed:
         return Inspector::Protocol::DOM::ShadowRootType::Closed;
-    case ShadowRoot::Mode::Open:
+    case ShadowRootMode::Open:
         return Inspector::Protocol::DOM::ShadowRootType::Open;
     }
 

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (208000 => 208001)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -127,7 +127,7 @@
 {
     if (node.isInShadowTree()) {
         if (ShadowRoot* root = node.containingShadowRoot()) {
-            if (root->mode() == ShadowRoot::Mode::UserAgent)
+            if (root->mode() == ShadowRootMode::UserAgent)
                 return root->host();
         }
     }

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (208000 => 208001)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -1619,7 +1619,7 @@
         return nullptr;
 
     if (ShadowRoot* root = element()->containingShadowRoot()) {
-        if (root->mode() == ShadowRoot::Mode::UserAgent) {
+        if (root->mode() == ShadowRootMode::UserAgent) {
             if (Element* shadowHost = element()->shadowHost())
                 return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
         }

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (208000 => 208001)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -3097,7 +3097,7 @@
 {
     if (Element* element = renderer.element()) {
         if (ShadowRoot* shadowRoot = element->containingShadowRoot()) {
-            if (shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+            if (shadowRoot->mode() == ShadowRootMode::UserAgent)
                 return shadowRoot->host()->renderer();
         }
     }

Modified: trunk/Source/WebCore/style/StyleScope.cpp (208000 => 208001)


--- trunk/Source/WebCore/style/StyleScope.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/style/StyleScope.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -79,7 +79,7 @@
 {
     if (!m_shadowRoot)
         return false;
-    if (m_shadowRoot->mode() != ShadowRoot::Mode::UserAgent)
+    if (m_shadowRoot->mode() != ShadowRootMode::UserAgent)
         return false;
     // If we have stylesheets in the user agent shadow tree use per-scope resolver.
     if (!m_styleSheetCandidateNodes.isEmpty())
@@ -520,7 +520,7 @@
     if (!m_shadowRoot) {
         for (auto* descendantShadowRoot : m_document.inDocumentShadowRoots()) {
             // Stylesheets is author shadow roots are are potentially affected.
-            if (descendantShadowRoot->mode() != ShadowRoot::Mode::UserAgent)
+            if (descendantShadowRoot->mode() != ShadowRootMode::UserAgent)
                 descendantShadowRoot->styleScope().scheduleUpdate(UpdateType::ContentsOrInterpretation);
         }
     }

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (208000 => 208001)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -432,7 +432,7 @@
     auto* root = containingShadowRoot();
     if (!root)
         return nullptr;
-    if (root->mode() != ShadowRoot::Mode::UserAgent)
+    if (root->mode() != ShadowRootMode::UserAgent)
         return nullptr;
     auto* host = root->host();
     if (!is<SVGUseElement>(host))

Modified: trunk/Source/WebCore/testing/Internals.cpp (208000 => 208001)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-10-27 20:08:51 UTC (rev 208000)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-10-27 20:23:06 UTC (rev 208001)
@@ -817,11 +817,11 @@
         return Exception { INVALID_ACCESS_ERR };
 
     switch (downcast<ShadowRoot>(root).mode()) {
-    case ShadowRoot::Mode::UserAgent:
+    case ShadowRootMode::UserAgent:
         return String("UserAgentShadowRoot");
-    case ShadowRoot::Mode::Closed:
+    case ShadowRootMode::Closed:
         return String("ClosedShadowRoot");
-    case ShadowRoot::Mode::Open:
+    case ShadowRootMode::Open:
         return String("OpenShadowRoot");
     default:
         ASSERT_NOT_REACHED();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to