Title: [246905] trunk/Source
Revision
246905
Author
[email protected]
Date
2019-06-27 14:11:13 -0700 (Thu, 27 Jun 2019)

Log Message

Move WebKitLegacy off of a couple AppKit ivars.
https://bugs.webkit.org/show_bug.cgi?id=199279
rdar://problem/34983438

Reviewed by Tim Horton.

Source/WebKitLegacy/mac:

* WebView/WebHTMLView.mm:
(-[NSView _setSubviewsIvar:]): Added. Implement on older systems.
(-[NSView _subviewsIvar]): Added. Ditto.
(needsCursorRectsSupportAtPoint): Use _borderView property.
(-[WebHTMLView _setAsideSubviews]): Use _subviewsIvar property.
(-[NSWindow _web_borderView]): Deleted.

Source/WTF:

* wtf/Platform.h: Added HAVE_SUBVIEWS_IVAR_SPI.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (246904 => 246905)


--- trunk/Source/WTF/ChangeLog	2019-06-27 20:57:10 UTC (rev 246904)
+++ trunk/Source/WTF/ChangeLog	2019-06-27 21:11:13 UTC (rev 246905)
@@ -1,3 +1,13 @@
+2019-06-27  Timothy Hatcher  <[email protected]>
+
+        Move WebKitLegacy off of a couple AppKit ivars.
+        https://bugs.webkit.org/show_bug.cgi?id=199279
+        rdar://problem/34983438
+
+        Reviewed by Tim Horton.
+
+        * wtf/Platform.h: Added HAVE_SUBVIEWS_IVAR_SPI.
+
 2019-06-27  Beth Dakin  <[email protected]>
 
         Upstream use of MACCATALYST

Modified: trunk/Source/WTF/wtf/Platform.h (246904 => 246905)


--- trunk/Source/WTF/wtf/Platform.h	2019-06-27 20:57:10 UTC (rev 246904)
+++ trunk/Source/WTF/wtf/Platform.h	2019-06-27 21:11:13 UTC (rev 246905)
@@ -1599,3 +1599,7 @@
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101300
 #define USE_INTEL_METAL_WORKAROUND 1
 #endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+#define HAVE_SUBVIEWS_IVAR_SPI 1
+#endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (246904 => 246905)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-06-27 20:57:10 UTC (rev 246904)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-06-27 21:11:13 UTC (rev 246905)
@@ -1,3 +1,18 @@
+2019-06-27  Timothy Hatcher  <[email protected]>
+
+        Move WebKitLegacy off of a couple AppKit ivars.
+        https://bugs.webkit.org/show_bug.cgi?id=199279
+        rdar://problem/34983438
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebHTMLView.mm:
+        (-[NSView _setSubviewsIvar:]): Added. Implement on older systems.
+        (-[NSView _subviewsIvar]): Added. Ditto.
+        (needsCursorRectsSupportAtPoint): Use _borderView property.
+        (-[WebHTMLView _setAsideSubviews]): Use _subviewsIvar property.
+        (-[NSWindow _web_borderView]): Deleted.
+
 2019-06-27  Beth Dakin  <[email protected]>
 
         Upstream use of MACCATALYST

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (246904 => 246905)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-06-27 20:57:10 UTC (rev 246904)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-06-27 21:11:13 UTC (rev 246905)
@@ -213,13 +213,33 @@
 @end
 
 @interface NSWindow ()
+@property (readonly) __kindof NSView *_borderView;
+
 - (id)_newFirstResponderAfterResigning;
 @end
 
-@interface NSWindow (WebBorderViewAccess)
-- (NSView *)_web_borderView;
+@interface NSView (SubviewsIvar)
+@property (nullable, assign, setter=_setSubviewsIvar:) NSMutableArray<__kindof NSView *> *_subviewsIvar;
 @end
 
+#if !HAVE(SUBVIEWS_IVAR_SPI)
+@implementation NSView (SubviewsIvar)
+
+- (void)_setSubviewsIvar:(NSMutableArray<__kindof NSView *> *)subviews {
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    _subviews = subviews;
+    ALLOW_DEPRECATED_DECLARATIONS_END
+}
+
+- (NSMutableArray<__kindof NSView *> *)_subviewsIvar {
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    return (NSMutableArray *)_subviews;
+    ALLOW_DEPRECATED_DECLARATIONS_END
+}
+
+@end
+#endif
+
 using WebEvent = NSEvent;
 const auto WebEventMouseDown = NSEventTypeLeftMouseDown;
 
@@ -626,17 +646,6 @@
 
 @end
 
-@implementation NSWindow (WebBorderViewAccess)
-
-- (NSView *)_web_borderView
-{
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    return _borderView;
-    ALLOW_DEPRECATED_DECLARATIONS_END
-}
-
-@end
-
 @interface WebResponderChainSink : NSResponder {
     NSResponder* _lastResponderInChain;
     BOOL _receivedUnhandledCommand;
@@ -685,7 +694,7 @@
 static bool needsCursorRectsSupportAtPoint(NSWindow* window, NSPoint point)
 {
     forceNSViewHitTest = YES;
-    NSView* view = [[window _web_borderView] hitTest:point];
+    NSView* view = [window._borderView hitTest:point];
     forceNSViewHitTest = NO;
 
     // WebHTMLView doesn't use cursor rects.
@@ -1544,17 +1553,13 @@
 #if PLATFORM(MAC)
     ASSERT(!_private->subviewsSetAside);
     ASSERT(_private->savedSubviews == nil);
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    _private->savedSubviews = _subviews;
-    ALLOW_DEPRECATED_DECLARATIONS_END
+    _private->savedSubviews = self._subviewsIvar;
     // We need to keep the layer-hosting view in the subviews, otherwise the layers flash.
     if (_private->layerHostingView) {
-        NSArray* newSubviews = [[NSArray alloc] initWithObjects:_private->layerHostingView, nil];
-        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        _subviews = newSubviews;
+        NSMutableArray* newSubviews = [[NSMutableArray alloc] initWithObjects:_private->layerHostingView, nil];
+        self._subviewsIvar = newSubviews;
     } else
-        _subviews = nil;
-    ALLOW_DEPRECATED_DECLARATIONS_END
+        self._subviewsIvar = nil;
     _private->subviewsSetAside = YES;
 #endif
  }
@@ -1564,13 +1569,11 @@
 #if PLATFORM(MAC)
     ASSERT(_private->subviewsSetAside);
     if (_private->layerHostingView) {
-        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        [_subviews release];
-        _subviews = _private->savedSubviews;
+        [self._subviewsIvar release];
+        self._subviewsIvar = _private->savedSubviews;
     } else {
-        ASSERT(_subviews == nil);
-        _subviews = _private->savedSubviews;
-        ALLOW_DEPRECATED_DECLARATIONS_END
+        ASSERT(self._subviewsIvar == nil);
+        self._subviewsIvar = _private->savedSubviews;
     }
     _private->savedSubviews = nil;
     _private->subviewsSetAside = NO;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to