Title: [154264] trunk/Source
Revision
154264
Author
[email protected]
Date
2013-08-18 23:40:25 -0700 (Sun, 18 Aug 2013)

Log Message

<https://webkit.org/b/119989> Make use of Node::ownerDocument a compile time error

Reviewed by Sam Weinig.

Source/WebCore:

* dom/Element.h: Deleted the ownerDocument function. For compilers that don't support
deleted functions, it is instead overrides the base class function with one that is
private and not defined, which accomplishes almost the same thing: An error, either
at compile time or link time.

* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::JSHTMLElement::pushEventHandlerScope): Use document instead of ownerDocument.
* dom/Document.cpp:
(WebCore::Document::~Document): Added a comment about this clearly-incorrect code.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didPushShadowRoot): Use document instead of ownerDocument.
(WebCore::InspectorInstrumentation::willPopShadowRoot): Ditto.
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
* plugins/PluginView.cpp:
(WebCore::getFrame): Removed ineffective call to ownerDocument after document when it
returns 0. It will never return anything other than 0 in that case.
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::calculateIntrinsicSize): Use document instead of ownerDocument.
Did not remove the null check at this time, although I'm pretty sure it's bogus. We can
fix that when/if we change the return type of Element::document to a reference.
* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::requestImageResource): Use document instead of ownerDocument.

Source/WebKit2:

* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Use document instead of
ownerDocument.
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::PDFPluginTextAnnotation::createAnnotationElement): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154263 => 154264)


--- trunk/Source/WebCore/ChangeLog	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/ChangeLog	2013-08-19 06:40:25 UTC (rev 154264)
@@ -1,5 +1,35 @@
 2013-08-18  Darin Adler  <[email protected]>
 
+        <https://webkit.org/b/119989> Make use of Node::ownerDocument a compile time error
+
+        Reviewed by Sam Weinig.
+
+        * dom/Element.h: Deleted the ownerDocument function. For compilers that don't support
+        deleted functions, it is instead overrides the base class function with one that is
+        private and not defined, which accomplishes almost the same thing: An error, either
+        at compile time or link time.
+
+        * bindings/js/JSHTMLElementCustom.cpp:
+        (WebCore::JSHTMLElement::pushEventHandlerScope): Use document instead of ownerDocument.
+        * dom/Document.cpp:
+        (WebCore::Document::~Document): Added a comment about this clearly-incorrect code.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didPushShadowRoot): Use document instead of ownerDocument.
+        (WebCore::InspectorInstrumentation::willPopShadowRoot): Ditto.
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
+        * plugins/PluginView.cpp:
+        (WebCore::getFrame): Removed ineffective call to ownerDocument after document when it
+        returns 0. It will never return anything other than 0 in that case.
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::calculateIntrinsicSize): Use document instead of ownerDocument.
+        Did not remove the null check at this time, although I'm pretty sure it's bogus. We can
+        fix that when/if we change the return type of Element::document to a reference.
+        * svg/SVGFEImageElement.cpp:
+        (WebCore::SVGFEImageElement::requestImageResource): Use document instead of ownerDocument.
+
+2013-08-18  Darin Adler  <[email protected]>
+
         <https://webkit.org/b/119993> Remove most remaining platform-specific code from Clipboard class
 
         Reviewed by Sam Weinig.

Modified: trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp (154263 => 154264)


--- trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -39,7 +39,7 @@
     HTMLElement* element = impl();
 
     // The document is put on first, fall back to searching it only after the element and form.
-    scope = JSWithScope::create(exec, asObject(toJS(exec, globalObject(), element->ownerDocument())), scope);
+    scope = JSWithScope::create(exec, asObject(toJS(exec, globalObject(), element->document())), scope);
 
     // The form is next, searched before the document, but after the element itself.
     if (HTMLFormElement* form = element->form())

Modified: trunk/Source/WebCore/dom/Document.cpp (154263 => 154264)


--- trunk/Source/WebCore/dom/Document.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -554,9 +554,11 @@
 #endif
 
 #if ENABLE(TOUCH_EVENT_TRACKING)
+    // FIXME: This is dead code. The ownerDocument function returns 0 when called on a document.
     if (Document* ownerDocument = this->ownerDocument())
         ownerDocument->didRemoveEventTargetNode(this);
 #endif
+
     // FIXME: Should we reset m_domWindow when we detach from the Frame?
     if (m_domWindow)
         m_domWindow->resetUnlessSuspendedForPageCache();

Modified: trunk/Source/WebCore/dom/Element.h (154263 => 154264)


--- trunk/Source/WebCore/dom/Element.h	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/dom/Element.h	2013-08-19 06:40:25 UTC (rev 154264)
@@ -670,6 +670,9 @@
 
     bool isJavaScriptURLAttribute(const Attribute&) const;
 
+    // Anyone thinking of using this should call document instead of ownerDocument.
+    void ownerDocument() const WTF_DELETED_FUNCTION;
+
     QualifiedName m_tagName;
     RefPtr<ElementData> m_elementData;
 };

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (154263 => 154264)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-08-19 06:40:25 UTC (rev 154264)
@@ -665,7 +665,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->document()))
         didPushShadowRootImpl(instrumentingAgents, host, root);
 #else
     UNUSED_PARAM(host);
@@ -677,7 +677,7 @@
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->document()))
         willPopShadowRootImpl(instrumentingAgents, host, root);
 #else
     UNUSED_PARAM(host);

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (154263 => 154264)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -1484,7 +1484,7 @@
     ASSERT_UNUSED(style, style == inlineStyle());
 
     {
-        InspectorCSSAgent::InlineStyleOverrideScope overrideScope(m_element->ownerDocument());
+        InspectorCSSAgent::InlineStyleOverrideScope overrideScope(m_element->document());
         m_element->setAttribute("style", text, ec);
     }
 

Modified: trunk/Source/WebCore/plugins/PluginView.cpp (154263 => 154264)


--- trunk/Source/WebCore/plugins/PluginView.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/plugins/PluginView.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -1369,8 +1369,6 @@
         return parentFrame;
     
     Document* document = element->document();
-    if (!document)
-        document = element->ownerDocument();
     if (document)
         return document->frame();
     

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (154263 => 154264)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -128,7 +128,7 @@
     // size since they also have audio-only files. By setting the intrinsic
     // size to 300x1 the video will resize itself in these cases, and audio will
     // have the correct height (it needs to be > 0 for controls to render properly).
-    if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
+    if (video->document() && video->document()->isMediaDocument())
         return LayoutSize(defaultSize().width(), 1);
 
     return defaultSize();

Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (154263 => 154264)


--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp	2013-08-19 06:40:25 UTC (rev 154264)
@@ -82,7 +82,7 @@
 
 void SVGFEImageElement::requestImageResource()
 {
-    CachedResourceRequest request(ResourceRequest(ownerDocument()->completeURL(href())));
+    CachedResourceRequest request(ResourceRequest(document()->completeURL(href())));
     request.setInitiator(this);
     m_cachedImage = document()->cachedResourceLoader()->requestImage(request);
 

Modified: trunk/Source/WebKit2/ChangeLog (154263 => 154264)


--- trunk/Source/WebKit2/ChangeLog	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebKit2/ChangeLog	2013-08-19 06:40:25 UTC (rev 154264)
@@ -1,3 +1,15 @@
+2013-08-18  Darin Adler  <[email protected]>
+
+        <https://webkit.org/b/119989> Make use of Node::ownerDocument a compile time error
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
+        (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement): Use document instead of
+        ownerDocument.
+        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
+        (WebKit::PDFPluginTextAnnotation::createAnnotationElement): Ditto.
+
 2013-08-18  Dan Bernstein  <[email protected]>
 
         Fix clean engineering builds after r154251.

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm (154263 => 154264)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2013-08-19 06:40:25 UTC (rev 154264)
@@ -68,7 +68,7 @@
 
 PassRefPtr<Element> PDFPluginChoiceAnnotation::createAnnotationElement()
 {
-    Document* document = parent()->ownerDocument();
+    Document* document = parent()->document();
     PDFAnnotationChoiceWidget *choiceAnnotation = this->choiceAnnotation();
 
     RefPtr<Element> element = document->createElement(selectTag, false);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm (154263 => 154264)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2013-08-19 06:37:09 UTC (rev 154263)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm	2013-08-19 06:40:25 UTC (rev 154264)
@@ -83,7 +83,7 @@
 {
     RefPtr<Element> element;
 
-    Document* document = parent()->ownerDocument();
+    Document* document = parent()->document();
     PDFAnnotationTextWidget *textAnnotation = this->textAnnotation();
     bool isMultiline = textAnnotation.isMultiline;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to