Merge r173765 - Allow DOM methods to return references instead of pointers
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.

git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Merge r173857 - Move nodeFromPoint() back to Document where it belongs
https://bugs.webkit.org/show_bug.cgi?id=137012

Reviewed by Zalan Bujtas.
Source/WebCore:

nodeFromPoint() was moved into TreeScope for ShadowDOM work, but now we can move
it back to its logical place.

Make versions of elementFromPoint and caretRangeFromPoint that take LayoutPoints,
and change the current scale/offset code to be in layout units (which results
in a small behavior change).

elementFromPoint(int, int) and caretRangeFromPoint(int, int) are still required
for bindings code.

* dom/Document.cpp:
(WebCore::Document::nodeFromPoint):
(WebCore::Document::elementFromPoint):
(WebCore::Document::caretRangeFromPoint):
* dom/Document.h:
(WebCore::Document::elementFromPoint): Move logic from TreeScope::elementFromPoint()
here.
* dom/TreeScope.cpp:
(WebCore::nodeFromPoint): Deleted.
(WebCore::TreeScope::elementFromPoint): Deleted.
* dom/TreeScope.h:

LayoutTests:

All platforms use subpixel layout now, so remove the conditional behavior in this test.
Fix the test to account for scaling now being done in layout units.

* fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport-expected.txt:
* fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport.html:
* platform/mac/fast/dom/Document/CaretRangeFromPoint/hittest-relative-to-viewport-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175749 268f45cc-cd09-0410-ab3c-d52691b4dbfc