Change Element::didAddUserAgentShadowRoot() to take a reference instead of a pointer
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 04:13:18 +0000 (04:13 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 04:13:18 +0000 (04:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179153

Reviewed by Ryosuke Niwa.

Element::didAddUserAgentShadowRoot() is always passed a non-null pointer to the added
ShadowRoot. Therefore we should have didAddUserAgentShadowRoot() take a lvalue reference
to a ShadowRoot.

No functionality changed. So, no new tests.

* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
* dom/Element.h:
(WebCore::Element::didAddUserAgentShadowRoot):
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot):
* html/HTMLDetailsElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
* html/HTMLInputElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
* html/HTMLMediaElement.h:
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
* html/HTMLMeterElement.h:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
* html/HTMLPlugInElement.h:
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
* html/HTMLPlugInImageElement.h:
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::didAddUserAgentShadowRoot):
* html/HTMLProgressElement.h:
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot):
* html/HTMLSummaryElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot):
* html/HTMLTextAreaElement.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@224316 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/html/HTMLDetailsElement.cpp
Source/WebCore/html/HTMLDetailsElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMeterElement.cpp
Source/WebCore/html/HTMLMeterElement.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLPlugInElement.h
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.h
Source/WebCore/html/HTMLProgressElement.cpp
Source/WebCore/html/HTMLProgressElement.h
Source/WebCore/html/HTMLSummaryElement.cpp
Source/WebCore/html/HTMLSummaryElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h

index 828d46f..52c2ecd 100644 (file)
@@ -1,3 +1,48 @@
+2017-11-01  Daniel Bates  <dabates@apple.com>
+
+        Change Element::didAddUserAgentShadowRoot() to take a reference instead of a pointer
+        https://bugs.webkit.org/show_bug.cgi?id=179153
+
+        Reviewed by Ryosuke Niwa.
+
+        Element::didAddUserAgentShadowRoot() is always passed a non-null pointer to the added
+        ShadowRoot. Therefore we should have didAddUserAgentShadowRoot() take a lvalue reference
+        to a ShadowRoot.
+
+        No functionality changed. So, no new tests.
+
+        * dom/Element.cpp:
+        (WebCore::Element::addShadowRoot):
+        * dom/Element.h:
+        (WebCore::Element::didAddUserAgentShadowRoot):
+        * html/HTMLDetailsElement.cpp:
+        (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot):
+        * html/HTMLDetailsElement.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
+        * html/HTMLInputElement.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
+        * html/HTMLMediaElement.h:
+        * html/HTMLMeterElement.cpp:
+        (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
+        * html/HTMLMeterElement.h:
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
+        * html/HTMLPlugInElement.h:
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
+        * html/HTMLPlugInImageElement.h:
+        * html/HTMLProgressElement.cpp:
+        (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot):
+        * html/HTMLProgressElement.h:
+        * html/HTMLSummaryElement.cpp:
+        (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot):
+        * html/HTMLSummaryElement.h:
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot):
+        * html/HTMLTextAreaElement.h:
+
 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
 
         Implement WKFullscreenWindowController for iOS.
index e25152f..3cc494c 100644 (file)
@@ -1792,7 +1792,7 @@ void Element::addShadowRoot(Ref<ShadowRoot>&& newShadowRoot)
     InspectorInstrumentation::didPushShadowRoot(*this, shadowRoot);
 
     if (shadowRoot.mode() == ShadowRootMode::UserAgent)
-        didAddUserAgentShadowRoot(&shadowRoot);
+        didAddUserAgentShadowRoot(shadowRoot);
 }
 
 void Element::removeShadowRoot()
index 87427fb..53a51cc 100644 (file)
@@ -579,7 +579,7 @@ private:
     bool isUserActionElementFocused() const;
     bool isUserActionElementHovered() const;
 
-    virtual void didAddUserAgentShadowRoot(ShadowRoot*) { }
+    virtual void didAddUserAgentShadowRoot(ShadowRoot&) { }
 
     // FIXME: Remove the need for Attr to call willModifyAttribute/didModifyAttribute.
     friend class Attr;
index c3f4984..484bcb7 100644 (file)
@@ -104,7 +104,7 @@ RenderPtr<RenderElement> HTMLDetailsElement::createElementRenderer(RenderStyle&&
     return createRenderer<RenderBlockFlow>(*this, WTFMove(style));
 }
 
-void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     auto summarySlot = HTMLSlotElement::create(slotTag, document());
     summarySlot->setAttributeWithoutSynchronization(nameAttr, summarySlotName());
@@ -115,7 +115,7 @@ void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     m_defaultSummary = defaultSummary.ptr();
 
     summarySlot->appendChild(defaultSummary);
-    root->appendChild(summarySlot);
+    root.appendChild(summarySlot);
 
     m_defaultSlot = HTMLSlotElement::create(slotTag, document());
     ASSERT(!m_isOpen);
index f1c46ff..e483657 100644 (file)
@@ -47,7 +47,7 @@ private:
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
     void parseAttribute(const QualifiedName&, const AtomicString&) final;
 
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
     bool hasCustomFocusLogic() const final { return true; }
 
     bool m_isOpen { false };
index f5ea733..a8577a1 100644 (file)
@@ -141,7 +141,7 @@ HTMLImageLoader& HTMLInputElement::ensureImageLoader()
     return *m_imageLoader;
 }
 
-void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*)
+void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot&)
 {
     m_inputType->createShadowSubtree();
     updateInnerTextElementEditability();
index eca803d..8ab6534 100644 (file)
@@ -346,7 +346,7 @@ protected:
 private:
     enum AutoCompleteSetting { Uninitialized, On, Off };
 
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
     void willChangeForm() final;
     void didChangeForm() final;
index 0afaa0b..0bda75c 100644 (file)
@@ -7030,7 +7030,7 @@ void HTMLMediaElement::setControllerJSProperty(const char* propertyName, JSC::JS
     controllerObject->methodTable(vm)->put(controllerObject, exec, JSC::Identifier::fromString(exec, propertyName), propertyValue, propertySlot);
 }
 
-void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     DEBUG_LOG(LOGIDENTIFIER);
 
index 62edbc2..9149550 100644 (file)
@@ -838,7 +838,7 @@ private:
     SleepType shouldDisableSleep() const;
 
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    void didAddUserAgentShadowRoot(ShadowRoot&) override;
     DOMWrapperWorld& ensureIsolatedWorld();
     bool ensureMediaControlsInjectedScript();
 #endif
index 498cb50..0d44a67 100644 (file)
@@ -220,7 +220,7 @@ RenderMeter* HTMLMeterElement::renderMeter() const
     return nullptr;
 }
 
-void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     ASSERT(!m_value);
 
@@ -228,13 +228,13 @@ void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 
     auto style = HTMLStyleElement::create(HTMLNames::styleTag, document(), false);
     style->setTextContent(shadowStyle);
-    root->appendChild(style);
+    root.appendChild(style);
 
     // Pseudos are set to allow author styling.
     auto inner = HTMLDivElement::create(document());
     inner->setIdAttribute("inner");
     inner->setPseudo("-webkit-meter-inner-element");
-    root->appendChild(inner);
+    root.appendChild(inner);
 
     auto bar = HTMLDivElement::create(document());
     bar->setIdAttribute("bar");
index 604a65a..4865a6d 100644 (file)
@@ -75,7 +75,7 @@ private:
     void parseAttribute(const QualifiedName&, const AtomicString&) final;
 
     void didElementStateChange();
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
     RefPtr<HTMLElement> m_value;
 };
index 4d52e80..2c1c274 100644 (file)
@@ -292,13 +292,13 @@ void HTMLPlugInElement::setDisplayState(DisplayState state)
         m_swapRendererTimer.startOneShot(0_s);
 }
 
-void HTMLPlugInElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLPlugInElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     if (!m_pluginReplacement || !document().page() || displayState() != PreparingPluginReplacement)
         return;
     
-    root->setResetStyleInheritance(true);
-    if (m_pluginReplacement->installReplacement(*root)) {
+    root.setResetStyleInheritance(true);
+    if (m_pluginReplacement->installReplacement(root)) {
         setDisplayState(DisplayingPluginReplacement);
         invalidateStyleAndRenderersForSubtree();
     }
index 52a292a..11fe602 100644 (file)
@@ -98,7 +98,7 @@ protected:
 
     virtual bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues);
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
-    void didAddUserAgentShadowRoot(ShadowRoot*) override;
+    void didAddUserAgentShadowRoot(ShadowRoot&) override;
 
     // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
     bool guardedDispatchBeforeLoadEvent(const String& sourceURL);
index ef34ded..07bde13 100644 (file)
@@ -341,7 +341,7 @@ static DOMWrapperWorld& plugInImageElementIsolatedWorld()
     return isolatedWorld;
 }
 
-void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     HTMLPlugInElement::didAddUserAgentShadowRoot(root);
     if (displayState() >= PreparingPluginReplacement)
@@ -354,7 +354,7 @@ void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     // Reset any author styles that may apply as we only want explicit
     // styles defined in the injected user agents stylesheets to specify
     // the look-and-feel of the snapshotted plug-in overlay. 
-    root->setResetStyleInheritance(true);
+    root.setResetStyleInheritance(true);
     
     String mimeType = loadedMimeType();
 
index e941f57..e3f0396 100644 (file)
@@ -106,7 +106,7 @@ private:
 
     bool allowedToLoadPluginContent(const String& url, const String& mimeType) const;
 
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
     bool childShouldCreateRenderer(const Node&) const override;
index f65a054..987b573 100644 (file)
@@ -134,12 +134,12 @@ void HTMLProgressElement::didElementStateChange()
     }
 }
 
-void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
     ASSERT(!m_value);
 
     auto inner = ProgressInnerElement::create(document());
-    root->appendChild(inner);
+    root.appendChild(inner);
 
     auto bar = ProgressBarElement::create(document());
     auto value = ProgressValueElement::create(document());
index bd33aa1..826736d 100644 (file)
@@ -58,7 +58,7 @@ private:
     void didAttachRenderers() final;
 
     void didElementStateChange();
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
     bool isDeterminate() const;
 
     bool canContainRangeEndPoint() const final { return false; }
index 7d40091..1271026 100644 (file)
@@ -65,10 +65,10 @@ RenderPtr<RenderElement> HTMLSummaryElement::createElementRenderer(RenderStyle&&
     return createRenderer<RenderBlockFlow>(*this, WTFMove(style));
 }
 
-void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
-    root->appendChild(DetailsMarkerControl::create(document()));
-    root->appendChild(HTMLSlotElement::create(slotTag, document()));
+    root.appendChild(DetailsMarkerControl::create(document()));
+    root.appendChild(HTMLSlotElement::create(slotTag, document()));
 }
 
 HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
index 127a546..6b74505 100644 (file)
@@ -39,7 +39,7 @@ private:
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
     void defaultEventHandler(Event&) final;
 
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
     bool hasCustomFocusLogic() const final { return true; }
 
index 3c7fd7b..5a0ca42 100644 (file)
@@ -100,9 +100,9 @@ Ref<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& tagNam
     return textArea;
 }
 
-void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
+void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root)
 {
-    root->appendChild(TextControlInnerTextElement::create(document()));
+    root.appendChild(TextControlInnerTextElement::create(document()));
     updateInnerTextElementEditability();
 }
 
index facff9a..0346806 100644 (file)
@@ -71,7 +71,7 @@ private:
 
     enum WrapMethod { NoWrap, SoftWrap, HardWrap };
 
-    void didAddUserAgentShadowRoot(ShadowRoot*) final;
+    void didAddUserAgentShadowRoot(ShadowRoot&) final;
 
     void maxLengthAttributeChanged(const AtomicString& newValue);
     void minLengthAttributeChanged(const AtomicString& newValue);