Title: [173765] trunk/Source
Revision
173765
Author
[email protected]
Date
2014-09-19 11:33:16 -0700 (Fri, 19 Sep 2014)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (173764 => 173765)


--- trunk/Source/WTF/ChangeLog	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/ChangeLog	2014-09-19 18:33:16 UTC (rev 173765)
@@ -1,3 +1,36 @@
+2014-09-19  Chris Dumez  <[email protected]>
+
+        Allow DOM methods to return references instead of pointers
+        https://bugs.webkit.org/show_bug.cgi?id=136931
+
+        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.
+
 2014-09-19  Daniel Bates  <[email protected]>
 
         Always assume internal SDK when building configuration Production

Modified: trunk/Source/WTF/wtf/GetPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/GetPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/GetPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -23,11 +23,39 @@
 
 namespace WTF {
 
-    template <typename T> inline T* getPtr(T* p)
-    {
-        return p;
-    }
+template <typename T> inline T* getPtr(T* p) { return p; }
 
+template <typename T> struct IsSmartPtr {
+    static const bool value = false;
+};
+
+template <typename T, bool isSmartPtr>
+struct GetPtrHelper;
+
+template <typename T>
+struct GetPtrHelper<T, false /* isSmartPtr */> {
+    typedef T* PtrType;
+    static T* getPtr(T& p) { return &p; }
+};
+
+template <typename T>
+struct GetPtrHelper<T, true /* isSmartPtr */> {
+    typedef typename T::PtrType PtrType;
+    static PtrType getPtr(const T& p) { return p.get(); }
+};
+
+template <typename T>
+inline typename GetPtrHelper<T, IsSmartPtr<T>::value>::PtrType getPtr(T& p)
+{
+    return GetPtrHelper<T, IsSmartPtr<T>::value>::getPtr(p);
+}
+
+template <typename T>
+inline typename GetPtrHelper<T, IsSmartPtr<T>::value>::PtrType getPtr(const T& p)
+{
+    return GetPtrHelper<T, IsSmartPtr<T>::value>::getPtr(p);
+}
+
 } // namespace WTF
 
 #endif // WTF_GetPtr_h

Modified: trunk/Source/WTF/wtf/OwnPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/OwnPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/OwnPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -23,6 +23,7 @@
 
 #include <wtf/Assertions.h>
 #include <wtf/Atomics.h>
+#include <wtf/GetPtr.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/OwnPtrCommon.h>
 #include <algorithm>
@@ -193,10 +194,9 @@
         return a != b.get(); 
     }
 
-    template<typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p)
-    {
-        return p.get();
-    }
+    template <typename T> struct IsSmartPtr<OwnPtr<T>> {
+        static const bool value = true;
+    };
 
     template<typename T> template<typename... Args> inline void OwnPtr<T>::createTransactionally(Args... args)
     {

Modified: trunk/Source/WTF/wtf/PassOwnPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/PassOwnPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/PassOwnPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -28,6 +28,7 @@
 
 #include <cstddef>
 #include <wtf/Assertions.h>
+#include <wtf/GetPtr.h>
 #include <wtf/OwnPtrCommon.h>
 #include <type_traits>
 
@@ -156,10 +157,9 @@
         return adoptPtr(static_cast<T*>(p.leakPtr()));
     }
 
-    template<typename T> inline T* getPtr(const PassOwnPtr<T>& p)
-    {
-        return p.get();
-    }
+    template <typename T> struct IsSmartPtr<PassOwnPtr<T>> {
+        static const bool value = true;
+    };
 
 } // namespace WTF
 

Modified: trunk/Source/WTF/wtf/PassRefPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/PassRefPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/PassRefPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -21,7 +21,8 @@
 #ifndef WTF_PassRefPtr_h
 #define WTF_PassRefPtr_h
 
-#include "PassRef.h"
+#include <wtf/GetPtr.h>
+#include <wtf/PassRef.h>
 
 namespace WTF {
 
@@ -41,6 +42,9 @@
 
     template<typename T> class PassRefPtr {
     public:
+        typedef T ValueType;
+        typedef ValueType* PtrType;
+
         PassRefPtr() : m_ptr(nullptr) { }
         PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
         // It somewhat breaks the type system to allow transfer of ownership out of
@@ -153,10 +157,9 @@
         return adoptRef(static_cast<T*>(p.leakRef())); 
     }
 
-    template<typename T> inline T* getPtr(const PassRefPtr<T>& p)
-    {
-        return p.get();
-    }
+    template <typename T> struct IsSmartPtr<PassRefPtr<T>> {
+        static const bool value = true;
+    };
 
 } // namespace WTF
 

Modified: trunk/Source/WTF/wtf/Ref.h (173764 => 173765)


--- trunk/Source/WTF/wtf/Ref.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/Ref.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -26,7 +26,8 @@
 #ifndef WTF_Ref_h
 #define WTF_Ref_h
 
-#include "Noncopyable.h"
+#include <wtf/GetPtr.h>
+#include <wtf/Noncopyable.h>
 
 namespace WTF {
 
@@ -73,6 +74,12 @@
     return oldReference;
 }
 
+template <typename T>
+struct GetPtrHelper<Ref<T>, false /* isSmartPtr */> {
+    typedef T* PtrType;
+    static T* getPtr(const Ref<T>& p) { return const_cast<T*>(&p.get()); }
+};
+
 } // namespace WTF
 
 using WTF::Ref;

Modified: trunk/Source/WTF/wtf/RefPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/RefPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/RefPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -23,10 +23,11 @@
 #ifndef WTF_RefPtr_h
 #define WTF_RefPtr_h
 
-#include "FastMalloc.h"
-#include "PassRefPtr.h"
 #include <algorithm>
 #include <utility>
+#include <wtf/FastMalloc.h>
+#include <wtf/GetPtr.h>
+#include <wtf/PassRefPtr.h>
 
 namespace WTF {
 
@@ -35,6 +36,9 @@
     template<typename T> class RefPtr {
         WTF_MAKE_FAST_ALLOCATED;
     public:
+        typedef T ValueType;
+        typedef ValueType* PtrType;
+
         ALWAYS_INLINE RefPtr() : m_ptr(nullptr) { }
         ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
         ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
@@ -204,10 +208,9 @@
         return RefPtr<T>(static_cast<T*>(p.get())); 
     }
 
-    template<typename T> inline T* getPtr(const RefPtr<T>& p)
-    {
-        return p.get();
-    }
+    template <typename T> struct IsSmartPtr<RefPtr<T>> {
+        static const bool value = true;
+    };
 
 } // namespace WTF
 

Modified: trunk/Source/WTF/wtf/gobject/GRefPtr.h (173764 => 173765)


--- trunk/Source/WTF/wtf/gobject/GRefPtr.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WTF/wtf/gobject/GRefPtr.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -25,6 +25,7 @@
 
 #if USE(GLIB)
 
+#include <wtf/GetPtr.h>
 #include <wtf/RefPtr.h>
 #include <algorithm>
 
@@ -41,6 +42,9 @@
 
 template <typename T> class GRefPtr {
 public:
+    typedef T ValueType;
+    typedef ValueType* PtrType;
+
     GRefPtr() : m_ptr(0) { }
 
     GRefPtr(T* ptr)
@@ -204,10 +208,9 @@
     return GRefPtr<T>(const_cast<T*>(p.get()));
 }
 
-template <typename T> inline T* getPtr(const GRefPtr<T>& p)
-{
-    return p.get();
-}
+template <typename T> struct IsSmartPtr<GRefPtr<T>> {
+    static const bool value = true;
+};
 
 template <typename T> GRefPtr<T> adoptGRef(T* p)
 {

Modified: trunk/Source/WebCore/ChangeLog (173764 => 173765)


--- trunk/Source/WebCore/ChangeLog	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/ChangeLog	2014-09-19 18:33:16 UTC (rev 173765)
@@ -1,3 +1,61 @@
+2014-09-19  Chris Dumez  <[email protected]>
+
+        Allow DOM methods to return references instead of pointers
+        https://bugs.webkit.org/show_bug.cgi?id=136931
+
+        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):
+
 2014-09-19  Daniel Bates  <[email protected]>
 
         Always assume internal SDK when building configuration Production

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (173764 => 173765)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -2057,12 +2057,10 @@
         return;
     
     Element* element = toElement(node);
-    DOMTokenList* list = element->classList();
-    if (!list)
-        return;
-    unsigned length = list->length();
+    DOMTokenList& list = element->classList();
+    unsigned length = list.length();
     for (unsigned k = 0; k < length; k++)
-        classList.append(list->item(k).string());
+        classList.append(list.item(k).string());
 }
 
     

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (173764 => 173765)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -45,6 +45,7 @@
 #include <runtime/TypedArrayInlines.h>
 #include <runtime/TypedArrays.h>
 #include <wtf/Forward.h>
+#include <wtf/GetPtr.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
@@ -52,17 +53,6 @@
 class HashEntry;
 }
 
-#if ENABLE(GAMEPAD)
-namespace WTF {
-
-template<typename T> inline T* getPtr(const Ref<T>& p)
-{
-    return const_cast<T*>(&p.get());
-}
-
-}
-#endif
-
 namespace WebCore {
 
 class CachedScript;

Modified: trunk/Source/WebCore/dom/Document.cpp (173764 => 173765)


--- trunk/Source/WebCore/dom/Document.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -805,11 +805,11 @@
     m_activeLinkColor.setNamedColor("red");
 }
 
-DOMImplementation* Document::implementation()
+DOMImplementation& Document::implementation()
 {
     if (!m_implementation)
         m_implementation = std::make_unique<DOMImplementation>(*this);
-    return m_implementation.get();
+    return *m_implementation;
 }
 
 bool Document::hasManifest() const
@@ -1122,17 +1122,17 @@
 
     updateStyleIfNeeded();
 
-    return namedFlows()->createCSSOMSnapshot();
+    return namedFlows().createCSSOMSnapshot();
 }
 
 #endif
 
-NamedFlowCollection* Document::namedFlows()
+NamedFlowCollection& Document::namedFlows()
 {
     if (!m_namedFlows)
         m_namedFlows = NamedFlowCollection::create(this);
 
-    return m_namedFlows.get();
+    return *m_namedFlows;
 }
 
 PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec)
@@ -1316,7 +1316,7 @@
 
 void Document::setXMLVersion(const String& version, ExceptionCode& ec)
 {
-    if (!implementation()->hasFeature("XML", String())) {
+    if (!implementation().hasFeature("XML", String())) {
         ec = NOT_SUPPORTED_ERR;
         return;
     }
@@ -1331,7 +1331,7 @@
 
 void Document::setXMLStandalone(bool standalone, ExceptionCode& ec)
 {
-    if (!implementation()->hasFeature("XML", String())) {
+    if (!implementation().hasFeature("XML", String())) {
         ec = NOT_SUPPORTED_ERR;
         return;
     }
@@ -1581,11 +1581,11 @@
 }
 
 #if ENABLE(CSP_NEXT)
-DOMSecurityPolicy* Document::securityPolicy()
+DOMSecurityPolicy& Document::securityPolicy()
 {
     if (!m_domSecurityPolicy)
         m_domSecurityPolicy = DOMSecurityPolicy::create(this);
-    return m_domSecurityPolicy.get();
+    return *m_domSecurityPolicy;
 }
 #endif
 
@@ -3172,11 +3172,11 @@
     setDecoder(other.decoder());
 }
 
-StyleSheetList* Document::styleSheets()
+StyleSheetList& Document::styleSheets()
 {
     if (!m_styleSheetList)
         m_styleSheetList = StyleSheetList::create(this);
-    return m_styleSheetList.get();
+    return *m_styleSheetList;
 }
 
 String Document::preferredStylesheetSet() const

Modified: trunk/Source/WebCore/dom/Document.h (173764 => 173765)


--- trunk/Source/WebCore/dom/Document.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/dom/Document.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -408,7 +408,7 @@
 
     DocumentType* doctype() const;
 
-    DOMImplementation* implementation();
+    DOMImplementation& implementation();
     
     Element* documentElement() const
     {
@@ -441,7 +441,7 @@
     PassRefPtr<DOMNamedFlowCollection> webkitGetNamedFlows();
 #endif
 
-    NamedFlowCollection* namedFlows();
+    NamedFlowCollection& namedFlows();
 
     Element* elementFromPoint(int x, int y) const;
     PassRefPtr<Range> caretRangeFromPoint(int x, int y);
@@ -492,7 +492,7 @@
     bool hidden() const;
 
 #if ENABLE(CSP_NEXT)
-    DOMSecurityPolicy* securityPolicy();
+    DOMSecurityPolicy& securityPolicy();
 #endif
 
     PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
@@ -543,7 +543,7 @@
     bool haveStylesheetsLoaded() const;
 
     // This is a DOM function.
-    StyleSheetList* styleSheets();
+    StyleSheetList& styleSheets();
 
     DocumentStyleSheetCollection& styleSheetCollection() { return m_styleSheetCollection; }
 
@@ -1177,7 +1177,7 @@
 #endif
 
 #if ENABLE(WEB_TIMING)
-    const DocumentTiming* timing() const { return &m_documentTiming; }
+    const DocumentTiming& timing() const { return m_documentTiming; }
 #endif
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)

Modified: trunk/Source/WebCore/dom/Element.cpp (173764 => 173765)


--- trunk/Source/WebCore/dom/Element.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -2326,20 +2326,20 @@
     return false;
 }
 
-DOMTokenList* Element::classList()
+DOMTokenList& Element::classList()
 {
     ElementRareData& data = ""
     if (!data.classList())
         data.setClassList(std::make_unique<ClassList>(*this));
-    return data.classList();
+    return *data.classList();
 }
 
-DatasetDOMStringMap* Element::dataset()
+DatasetDOMStringMap& Element::dataset()
 {
     ElementRareData& data = ""
     if (!data.dataset())
         data.setDataset(std::make_unique<DatasetDOMStringMap>(*this));
-    return data.dataset();
+    return *data.dataset();
 }
 
 URL Element::getURLAttribute(const QualifiedName& name) const

Modified: trunk/Source/WebCore/dom/Element.h (173764 => 173765)


--- trunk/Source/WebCore/dom/Element.h	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/dom/Element.h	2014-09-19 18:33:16 UTC (rev 173765)
@@ -454,9 +454,9 @@
     bool matches(const String& selectors, ExceptionCode&);
     virtual bool shouldAppearIndeterminate() const;
 
-    DOMTokenList* classList();
+    DOMTokenList& classList();
 
-    DatasetDOMStringMap* dataset();
+    DatasetDOMStringMap& dataset();
 
 #if ENABLE(VIDEO)
     virtual bool isMediaElement() const { return false; }

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (173764 => 173765)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -169,7 +169,7 @@
     setInlineStyleProperty(CSSPropertyMarginLeft, 0.0, CSSPrimitiveValue::CSS_PX);
     setInlineStyleProperty(CSSPropertyMarginTop, 0.0, CSSPrimitiveValue::CSS_PX);
 
-    classList()->add("dragged", IGNORE_EXCEPTION);
+    classList().add("dragged", IGNORE_EXCEPTION);
 }
 
 void MediaControlPanelElement::resetPosition()
@@ -179,7 +179,7 @@
     removeInlineStyleProperty(CSSPropertyMarginLeft);
     removeInlineStyleProperty(CSSPropertyMarginTop);
 
-    classList()->remove("dragged", IGNORE_EXCEPTION);
+    classList().remove("dragged", IGNORE_EXCEPTION);
 
     m_cumulativeDragOffset.setX(0);
     m_cumulativeDragOffset.setY(0);
@@ -764,24 +764,24 @@
 
         if (textTrack == TextTrack::captionMenuAutomaticItem()) {
             if (displayMode == CaptionUserPreferences::Automatic)
-                trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION);
+                trackItem->classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
             else
-                trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
+                trackItem->classList().remove(selectedClassValue, ASSERT_NO_EXCEPTION);
             continue;
         }
 
         if (displayMode != CaptionUserPreferences::Automatic && textTrack->mode() == TextTrack::showingKeyword()) {
             trackMenuItemSelected = true;
-            trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION);
+            trackItem->classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
         } else
-            trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
+            trackItem->classList().remove(selectedClassValue, ASSERT_NO_EXCEPTION);
     }
 
     if (offMenuItem) {
         if (displayMode == CaptionUserPreferences::ForcedOnly && !trackMenuItemSelected)
-            offMenuItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION);
+            offMenuItem->classList().add(selectedClassValue, ASSERT_NO_EXCEPTION);
         else
-            offMenuItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
+            offMenuItem->classList().remove(selectedClassValue, ASSERT_NO_EXCEPTION);
     }
 #endif
 }

Modified: trunk/Source/WebCore/html/track/VTTRegion.cpp (173764 => 173765)


--- trunk/Source/WebCore/html/track/VTTRegion.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/html/track/VTTRegion.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -368,7 +368,7 @@
 
     // If it's a scrolling region, add the scrolling class.
     if (isScrollingRegion())
-        m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
+        m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
 
     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
 
@@ -398,7 +398,7 @@
 
     double boxHeight = box->getBoundingClientRect()->bottom() - box->getBoundingClientRect()->top();
 
-    m_cueContainer->classList()->remove(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
+    m_cueContainer->classList().remove(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
 
     m_currentTop += boxHeight;
     m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrimitiveValue::CSS_PX);

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (173764 => 173765)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -681,9 +681,9 @@
     styleInfos = Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSStyleSheetHeader>::create();
     Vector<Document*> documents = m_domAgent->documents();
     for (Vector<Document*>::iterator it = documents.begin(); it != documents.end(); ++it) {
-        StyleSheetList* list = (*it)->styleSheets();
-        for (unsigned i = 0; i < list->length(); ++i) {
-            StyleSheet& styleSheet = *list->item(i);
+        StyleSheetList& list = (*it)->styleSheets();
+        for (unsigned i = 0; i < list.length(); ++i) {
+            StyleSheet& styleSheet = *list.item(i);
             if (styleSheet.isCSSStyleSheet())
                 collectStyleSheets(&toCSSStyleSheet(styleSheet), styleInfos.get());
         }
@@ -862,7 +862,7 @@
 
     m_namedFlowCollectionsRequested.add(documentNodeId);
 
-    Vector<RefPtr<WebKitNamedFlow>> namedFlowsVector = document->namedFlows()->namedFlows();
+    Vector<RefPtr<WebKitNamedFlow>> namedFlowsVector = document->namedFlows().namedFlows();
     RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::NamedFlow>> namedFlows = Inspector::Protocol::Array<Inspector::Protocol::CSS::NamedFlow>::create();
 
     for (Vector<RefPtr<WebKitNamedFlow>>::iterator it = namedFlowsVector.begin(); it != namedFlowsVector.end(); ++it)

Modified: trunk/Source/WebCore/page/PerformanceTiming.cpp (173764 => 173765)


--- trunk/Source/WebCore/page/PerformanceTiming.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/page/PerformanceTiming.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -319,7 +319,7 @@
     if (!document)
         return 0;
 
-    return document->timing();
+    return &document->timing();
 }
 
 DocumentLoadTiming* PerformanceTiming::documentLoadTiming() const

Modified: trunk/Source/WebCore/rendering/FlowThreadController.cpp (173764 => 173765)


--- trunk/Source/WebCore/rendering/FlowThreadController.cpp	2014-09-19 18:15:05 UTC (rev 173764)
+++ trunk/Source/WebCore/rendering/FlowThreadController.cpp	2014-09-19 18:33:16 UTC (rev 173765)
@@ -63,12 +63,12 @@
         }
     }
 
-    NamedFlowCollection* namedFlows = m_view->document().namedFlows();
+    NamedFlowCollection& namedFlows = m_view->document().namedFlows();
 
     // Sanity check for the absence of a named flow in the "CREATED" state with the same name.
-    ASSERT(!namedFlows->flowByName(name));
+    ASSERT(!namedFlows.flowByName(name));
 
-    auto flowRenderer = new RenderNamedFlowThread(m_view->document(), RenderFlowThread::createFlowThreadStyle(&m_view->style()), namedFlows->ensureFlowWithName(name));
+    auto flowRenderer = new RenderNamedFlowThread(m_view->document(), RenderFlowThread::createFlowThreadStyle(&m_view->style()), namedFlows.ensureFlowWithName(name));
     flowRenderer->initializeStyle();
     m_renderNamedFlowThreadList->add(flowRenderer);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to