Title: [201377] trunk/Source/WebCore
Revision
201377
Author
[email protected]
Date
2016-05-25 04:13:32 -0700 (Wed, 25 May 2016)

Log Message

Purge PassRefPtr from TouchList
https://bugs.webkit.org/show_bug.cgi?id=157985

Patch by Nael Ouedraogo <[email protected]> on 2016-05-25
Reviewed by Darin Adler.

Use RefPtr&& argument instead of PassRefPtr in append()

* dom/TouchList.h:
(WebCore::TouchList::append):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201376 => 201377)


--- trunk/Source/WebCore/ChangeLog	2016-05-25 10:59:06 UTC (rev 201376)
+++ trunk/Source/WebCore/ChangeLog	2016-05-25 11:13:32 UTC (rev 201377)
@@ -1,3 +1,17 @@
+2016-05-25  Nael Ouedraogo  <[email protected]>
+
+        Purge PassRefPtr from TouchList
+        https://bugs.webkit.org/show_bug.cgi?id=157985
+
+        Reviewed by Darin Adler.
+
+        Use RefPtr&& argument instead of PassRefPtr in append()
+
+        * dom/TouchList.h:
+        (WebCore::TouchList::append):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleTouchEvent):
+
 2016-05-25  Antoine Quint  <[email protected]>
 
         Elements with backdrop-filter cannot be clipped with clip-path or mask

Modified: trunk/Source/WebCore/dom/TouchList.h (201376 => 201377)


--- trunk/Source/WebCore/dom/TouchList.h	2016-05-25 10:59:06 UTC (rev 201376)
+++ trunk/Source/WebCore/dom/TouchList.h	2016-05-25 11:13:32 UTC (rev 201377)
@@ -22,10 +22,8 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#pragma once
 
-#ifndef TouchList_h
-#define TouchList_h
-
 #if ENABLE(IOS_TOUCH_EVENTS)
 #include <WebKitAdditions/TouchListIOS.h>
 #elif ENABLE(TOUCH_EVENTS)
@@ -48,16 +46,15 @@
     Touch* item(unsigned);
     const Touch* item(unsigned) const;
 
-    void append(const PassRefPtr<Touch> touch) { m_values.append(touch); }
+    void append(RefPtr<Touch>&& touch) { m_values.append(WTFMove(touch)); }
 
 private:
     TouchList() {}
 
-    Vector<RefPtr<Touch> > m_values;
+    Vector<RefPtr<Touch>> m_values;
 };
 
 } // namespace WebCore
 
 #endif // ENABLE(TOUCH_EVENTS)
 
-#endif /* TouchList_h */

Modified: trunk/Source/WebCore/page/EventHandler.cpp (201376 => 201377)


--- trunk/Source/WebCore/page/EventHandler.cpp	2016-05-25 10:59:06 UTC (rev 201376)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2016-05-25 11:13:32 UTC (rev 201377)
@@ -3908,10 +3908,9 @@
         int adjustedPageX = lroundf(pagePoint.x() / scaleFactor);
         int adjustedPageY = lroundf(pagePoint.y() / scaleFactor);
 
-        RefPtr<Touch> touch = Touch::create(targetFrame, touchTarget.get(), point.id(),
-                                            point.screenPos().x(), point.screenPos().y(),
-                                            adjustedPageX, adjustedPageY,
-                                            point.radiusX(), point.radiusY(), point.rotationAngle(), point.force());
+        auto touch = Touch::create(targetFrame, touchTarget.get(), point.id(),
+            point.screenPos().x(), point.screenPos().y(), adjustedPageX, adjustedPageY,
+            point.radiusX(), point.radiusY(), point.rotationAngle(), point.force());
 
         // Ensure this target's touch list exists, even if it ends up empty, so it can always be passed to TouchEvent::Create below.
         TargetTouchesMap::iterator targetTouchesIterator = touchesByTarget.find(touchTarget.get());
@@ -3921,8 +3920,8 @@
         // touches and targetTouches should only contain information about touches still on the screen, so if this point is
         // released or cancelled it will only appear in the changedTouches list.
         if (pointState != PlatformTouchPoint::TouchReleased && pointState != PlatformTouchPoint::TouchCancelled) {
-            touches->append(touch);
-            targetTouchesIterator->value->append(touch);
+            touches->append(touch.copyRef());
+            targetTouchesIterator->value->append(touch.copyRef());
         }
 
         // Now build up the correct list for changedTouches.
@@ -3935,7 +3934,7 @@
             ASSERT(pointState < PlatformTouchPoint::TouchStateEnd);
             if (!changedTouches[pointState].m_touches)
                 changedTouches[pointState].m_touches = TouchList::create();
-            changedTouches[pointState].m_touches->append(touch);
+            changedTouches[pointState].m_touches->append(WTFMove(touch));
             changedTouches[pointState].m_targets.add(touchTarget);
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to