Title: [234412] releases/WebKitGTK/webkit-2.20/Source/WebCore
- Revision
- 234412
- Author
- [email protected]
- Date
- 2018-07-31 02:24:32 -0700 (Tue, 31 Jul 2018)
Log Message
Merge r231335 - Widgets should hold a WeakPtr to their parents
https://bugs.webkit.org/show_bug.cgi?id=185239
<rdar://problem/39741250>
Reviewed by Zalan Bujtas.
* platform/ScrollView.h:
(WebCore::ScrollView::weakPtrFactory): Added.
* platform/Widget.cpp:
(WebCore::Widget::init): Don't perform an unnecessary assignment.
(WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
* platform/Widget.h:
(WebCore::Widget::parent const): Change type to a WeakPtr.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (234411 => 234412)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-07-31 09:20:57 UTC (rev 234411)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-07-31 09:24:32 UTC (rev 234412)
@@ -1,3 +1,19 @@
+2018-05-02 Brent Fulgham <[email protected]>
+
+ Widgets should hold a WeakPtr to their parents
+ https://bugs.webkit.org/show_bug.cgi?id=185239
+ <rdar://problem/39741250>
+
+ Reviewed by Zalan Bujtas.
+
+ * platform/ScrollView.h:
+ (WebCore::ScrollView::weakPtrFactory): Added.
+ * platform/Widget.cpp:
+ (WebCore::Widget::init): Don't perform an unnecessary assignment.
+ (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
+ * platform/Widget.h:
+ (WebCore::Widget::parent const): Change type to a WeakPtr.
+
2018-06-04 Brent Fulgham <[email protected]>
REGRESSION(r231291): InputType should hold a WeakPtr to its HTMLInputElement
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/ScrollView.h (234411 => 234412)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/ScrollView.h 2018-07-31 09:20:57 UTC (rev 234411)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/ScrollView.h 2018-07-31 09:24:32 UTC (rev 234412)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
* Copyright (C) 2009 Holger Hans Peter Freyther
*
* Redistribution and use in source and binary forms, with or without
@@ -33,6 +33,7 @@
#include "ScrollTypes.h"
#include "Widget.h"
#include <wtf/HashSet.h>
+#include <wtf/WeakPtr.h>
#if PLATFORM(IOS)
@@ -371,6 +372,8 @@
void setAllowsUnclampedScrollPositionForTesting(bool allowsUnclampedScrollPosition) { m_allowsUnclampedScrollPosition = allowsUnclampedScrollPosition; }
bool allowsUnclampedScrollPosition() const { return m_allowsUnclampedScrollPosition; }
+ auto& weakPtrFactory() const { return m_weakPtrFactory; }
+
protected:
ScrollView();
@@ -457,6 +460,8 @@
IntPoint m_panScrollIconPoint;
+ WeakPtrFactory<ScrollView> m_weakPtrFactory;
+
bool m_horizontalScrollbarLock { false };
bool m_verticalScrollbarLock { false };
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.cpp (234411 => 234412)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.cpp 2018-07-31 09:20:57 UTC (rev 234411)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.cpp 2018-07-31 09:24:32 UTC (rev 234412)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,7 +34,6 @@
void Widget::init(PlatformWidget widget)
{
- m_parent = 0;
m_selfVisible = false;
m_parentVisible = false;
m_widget = widget;
@@ -47,7 +46,7 @@
ASSERT(!view || !m_parent);
if (!view || !view->isVisible())
setParentVisible(false);
- m_parent = view;
+ m_parent = view ? makeWeakPtr(*view) : nullptr;
if (view && view->isVisible())
setParentVisible(true);
}
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.h (234411 => 234412)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.h 2018-07-31 09:20:57 UTC (rev 234411)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/Widget.h 2018-07-31 09:24:32 UTC (rev 234412)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
* Copyright (C) 2008 Collabora Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -140,7 +140,7 @@
WEBCORE_EXPORT void removeFromParent();
WEBCORE_EXPORT virtual void setParent(ScrollView* view);
- ScrollView* parent() const { return m_parent; }
+ ScrollView* parent() const { return m_parent.get(); }
FrameView* root() const;
virtual void handleEvent(Event&) { }
@@ -204,7 +204,7 @@
static IntPoint convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint&);
private:
- ScrollView* m_parent;
+ WeakPtr<ScrollView> m_parent;
#if !PLATFORM(COCOA)
PlatformWidget m_widget;
#else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes