Title: [231541] branches/safari-605-branch/Source/WebCore
- Revision
- 231541
- Author
- [email protected]
- Date
- 2018-05-08 22:01:14 -0700 (Tue, 08 May 2018)
Log Message
Cherry-pick r231335. rdar://problem/40050807
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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (231540 => 231541)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-05-09 05:01:12 UTC (rev 231540)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-05-09 05:01:14 UTC (rev 231541)
@@ -1,5 +1,41 @@
2018-05-08 Jason Marcell <[email protected]>
+ Cherry-pick r231335. rdar://problem/40050807
+
+ 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.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-05-08 Jason Marcell <[email protected]>
+
Cherry-pick r231291. rdar://problem/40050729
Use RetainPtr for form input type
Modified: branches/safari-605-branch/Source/WebCore/platform/ScrollView.h (231540 => 231541)
--- branches/safari-605-branch/Source/WebCore/platform/ScrollView.h 2018-05-09 05:01:12 UTC (rev 231540)
+++ branches/safari-605-branch/Source/WebCore/platform/ScrollView.h 2018-05-09 05:01:14 UTC (rev 231541)
@@ -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: branches/safari-605-branch/Source/WebCore/platform/Widget.cpp (231540 => 231541)
--- branches/safari-605-branch/Source/WebCore/platform/Widget.cpp 2018-05-09 05:01:12 UTC (rev 231540)
+++ branches/safari-605-branch/Source/WebCore/platform/Widget.cpp 2018-05-09 05:01:14 UTC (rev 231541)
@@ -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: branches/safari-605-branch/Source/WebCore/platform/Widget.h (231540 => 231541)
--- branches/safari-605-branch/Source/WebCore/platform/Widget.h 2018-05-09 05:01:12 UTC (rev 231540)
+++ branches/safari-605-branch/Source/WebCore/platform/Widget.h 2018-05-09 05:01:14 UTC (rev 231541)
@@ -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