Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r173765 - Allow DOM methods to return references instead of poi…
…nters https://bugs.webkit.org/show_bug.cgi?id=136931 Source/WebCore: Reviewed by Sam Weinig. It is common practice in WebKit to have methods return a reference instead of a pointer if the pointer can never be null. However, this unfortunately did not work for DOM methods (functions called by JS bindings). This prevented further refactoring. This patch brings support for having DOM methods to return references instead of pointers when the pointer cannot be null. The generated bindings were calling WTF::getPtr() on the pointer type returned by the implementation already (in case it was a smart pointer type). This patch leverages this by having WTF::getPtr() convert reference arguments into raw pointers. This patch also updates a few DOM methods on Document and Element classes to return a reference instead of a pointer, to test the change. There are likely more DOM methods that can be updated though. No new tests, no behavior change. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::classList): * bindings/js/JSDOMBinding.h: (WTF::getPtr): Deleted. * dom/Document.cpp: (WebCore::Document::implementation): (WebCore::Document::webkitGetNamedFlows): (WebCore::Document::namedFlows): (WebCore::Document::setXMLVersion): (WebCore::Document::setXMLStandalone): (WebCore::Document::securityPolicy): (WebCore::Document::styleSheets): * dom/Document.h: (WebCore::Document::timing): * dom/Element.cpp: (WebCore::Element::classList): (WebCore::Element::dataset): * dom/Element.h: * html/shadow/MediaControlElements.cpp: (WebCore::MediaControlPanelElement::setPosition): (WebCore::MediaControlPanelElement::resetPosition): (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay): * html/track/VTTRegion.cpp: (WebCore::VTTRegion::displayLastTextTrackCueBox): (WebCore::VTTRegion::willRemoveTextTrackCueBox): * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getAllStyleSheets): (WebCore::InspectorCSSAgent::getNamedFlowCollection): * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::documentTiming): * rendering/FlowThreadController.cpp: (WebCore::FlowThreadController::ensureRenderFlowThreadWithName): Source/WTF: Add support for having WTF::getPtr() transform reference arguments into raw pointers so that DOM methods can now return references when appropriate and so that the generated bindings code can handle this via WTF::getPtr(). This patch had to alter the way getPtr() was overloaded for smart pointer types so that we don't call &p on smart pointers but p.get(). This was needed because the new WTF::getPtr(T&) was being called for RefPtr<T> arguments instead of the getPtr(const RefPtr<T>&) overload. This was addressed using traits and template specialization to distinguish WTF smart pointers from other types. Reviewed by Sam Weinig. * wtf/GetPtr.h: (WTF::getPtr): * wtf/OwnPtr.h: (WTF::getPtr): Deleted. * wtf/PassOwnPtr.h: (WTF::getPtr): Deleted. * wtf/PassRefPtr.h: (WTF::getPtr): Deleted. * wtf/Ref.h: * wtf/RefPtr.h: (WTF::getPtr): Deleted. * wtf/gobject/GRefPtr.h: (WTF::getPtr): Deleted. Canonical link: https://commits.webkit.org/154760.131@webkitgtk/2.6 git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
95ec178
commit 76f8476
Showing
20 changed files
with
207 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.