Diff
Modified: trunk/Source/WTF/ChangeLog (201212 => 201213)
--- trunk/Source/WTF/ChangeLog 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Source/WTF/ChangeLog 2016-05-20 14:42:45 UTC (rev 201213)
@@ -1,3 +1,16 @@
+2016-05-20 Rawinder Singh <[email protected]>
+
+ Implement operator== for WeakPtr
+ https://bugs.webkit.org/show_bug.cgi?id=157883
+
+ Reviewed by Chris Dumez.
+
+ Implement operator== and operator!= for WeakPtr and update code to use the operators.
+
+ * wtf/WeakPtr.h:
+ (WTF::operator==):
+ (WTF::operator!=):
+
2016-05-19 Chris Dumez <[email protected]>
Improve compile-time assertions in is<>() / downcast<>()
Modified: trunk/Source/WTF/wtf/WeakPtr.h (201212 => 201213)
--- trunk/Source/WTF/wtf/WeakPtr.h 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Source/WTF/wtf/WeakPtr.h 2016-05-20 14:42:45 UTC (rev 201213)
@@ -136,6 +136,36 @@
Ref<WeakReference<T>> m_ref;
};
+template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, const WeakPtr<U>& b)
+{
+ return a.get() == b.get();
+}
+
+template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const WeakPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const WeakPtr<T>& a, const WeakPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const WeakPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const WeakPtr<U>& b)
+{
+ return a != b.get();
+}
+
} // namespace WTF
using WTF::WeakPtr;
Modified: trunk/Source/WebCore/ChangeLog (201212 => 201213)
--- trunk/Source/WebCore/ChangeLog 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Source/WebCore/ChangeLog 2016-05-20 14:42:45 UTC (rev 201213)
@@ -1,3 +1,18 @@
+2016-05-20 Rawinder Singh <[email protected]>
+
+ Implement operator== for WeakPtr
+ https://bugs.webkit.org/show_bug.cgi?id=157883
+
+ Reviewed by Chris Dumez.
+
+ Implement operator== and operator!= for WeakPtr and update code to use the operators.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::updateLastScrollbarUnderMouse):
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::platformCompleteWheelEvent):
+
2016-05-19 Tim Horton <[email protected]>
REGRESSION (r200638): -[DOMHTMLVideoElement play] disappeared from ObjC bindings
Modified: trunk/Source/WebCore/page/EventHandler.cpp (201212 => 201213)
--- trunk/Source/WebCore/page/EventHandler.cpp 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2016-05-20 14:42:45 UTC (rev 201213)
@@ -1709,9 +1709,9 @@
// If the hit testing originally determined the event was in a scrollbar, refetch the MouseEventWithHitTestResults
// in case the scrollbar widget was destroyed when the mouse event was handled.
if (mouseEvent.scrollbar()) {
- const bool wasLastScrollBar = mouseEvent.scrollbar() == m_lastScrollbarUnderMouse.get();
+ const bool wasLastScrollBar = mouseEvent.scrollbar() == m_lastScrollbarUnderMouse;
mouseEvent = m_frame.document()->prepareMouseEvent(HitTestRequest(), documentPoint, platformMouseEvent);
- if (wasLastScrollBar && mouseEvent.scrollbar() != m_lastScrollbarUnderMouse.get())
+ if (wasLastScrollBar && mouseEvent.scrollbar() != m_lastScrollbarUnderMouse)
m_lastScrollbarUnderMouse = nullptr;
}
@@ -3705,7 +3705,7 @@
// last to scrollbar if setLast is true; else set last to nullptr.
void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setLast)
{
- if (m_lastScrollbarUnderMouse.get() != scrollbar) {
+ if (m_lastScrollbarUnderMouse != scrollbar) {
// Send mouse exited to the old scrollbar.
if (m_lastScrollbarUnderMouse)
m_lastScrollbarUnderMouse->mouseExited();
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (201212 => 201213)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2016-05-20 14:42:45 UTC (rev 201213)
@@ -1049,7 +1049,7 @@
m_isHandlingWheelEvent = false;
// WebKit2 code path
- if (!frameHasPlatformWidget(m_frame) && !latchingState->startedGestureAtScrollLimit() && scrollableContainer == latchingState->scrollableContainer() && scrollableArea && view != scrollableArea.get()) {
+ if (!frameHasPlatformWidget(m_frame) && !latchingState->startedGestureAtScrollLimit() && scrollableContainer == latchingState->scrollableContainer() && scrollableArea && view != scrollableArea) {
// If we did not start at the scroll limit, do not pass the event on to be handled by enclosing scrollable regions.
return true;
}
@@ -1067,7 +1067,7 @@
}
// If the platform widget is handling the event, we always want to return false.
- if (scrollableArea.get() == view && view->platformWidget())
+ if (scrollableArea == view && view->platformWidget())
didHandleWheelEvent = false;
return didHandleWheelEvent;
Modified: trunk/Tools/ChangeLog (201212 => 201213)
--- trunk/Tools/ChangeLog 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Tools/ChangeLog 2016-05-20 14:42:45 UTC (rev 201213)
@@ -1,3 +1,15 @@
+2016-05-20 Rawinder Singh <[email protected]>
+
+ Implement operator== for WeakPtr
+ https://bugs.webkit.org/show_bug.cgi?id=157883
+
+ Reviewed by Chris Dumez.
+
+ Implement operator== and operator!= for WeakPtr and update code to use the operators.
+
+ * TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
+ (TestWebKitAPI::TEST):
+
2016-05-19 Srinivasan Vijayaraghavan <[email protected]>
Add JSON results to 32-bit and CLoop JSC tests
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp (201212 => 201213)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2016-05-20 06:35:24 UTC (rev 201212)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp 2016-05-20 14:42:45 UTC (rev 201213)
@@ -43,6 +43,9 @@
EXPECT_TRUE(weakPtr1);
EXPECT_TRUE(weakPtr2);
EXPECT_TRUE(weakPtr3);
+ EXPECT_TRUE(weakPtr1 == weakPtr2);
+ EXPECT_TRUE(weakPtr1 == &dummy);
+ EXPECT_TRUE(&dummy == weakPtr2);
delete factory;
EXPECT_NULL(weakPtr1.get());
EXPECT_NULL(weakPtr2.get());
@@ -80,6 +83,9 @@
EXPECT_EQ(weakPtr2.get(), &dummy2);
delete factory2;
EXPECT_NULL(weakPtr2.get());
+ EXPECT_TRUE(weakPtr1 != weakPtr2);
+ EXPECT_TRUE(weakPtr1 != &dummy2);
+ EXPECT_TRUE(&dummy1 != weakPtr2);
}
TEST(WTF_WeakPtr, RevokeAll)