Title: [218880] trunk/Source/WebKit/mac
- Revision
- 218880
- Author
- [email protected]
- Date
- 2017-06-28 09:57:06 -0700 (Wed, 28 Jun 2017)
Log Message
Mark the GraphicsContext as accelerated when the WebHTMLView's layer is drawing asynchronously
https://bugs.webkit.org/show_bug.cgi?id=173899
rdar://problem/32994474
Reviewed by Tim Horton.
When the WebHTMLView is layer-backed, and -drawsAsynchronously on its layer is YES,
then mark the GraphicsContext that WebCore is using for drawing as accelerated, so
that ImageBuffer::createCompatibleBuffer() creates appropriately matched buffers.
Also clean up WebFrame a little, sharing code that checks whether the WebFrame's
documentView is a WebHTMLView.
* WebView/WebFrame.mm:
(-[WebFrame _webHTMLDocumentView]):
(-[WebFrame _paintBehaviorForDestinationContext:]):
(-[WebFrame _drawRect:contentsOnly:]):
(-[WebFrame setTimeoutsPaused:]):
(-[WebFrame prepareForPause]):
(-[WebFrame resumeFromPause]):
(-[WebFrame resetTextAutosizingBeforeLayout]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView drawLayer:inContext:]):
(-[WebHTMLView _web_isDrawingIntoAcceleratedLayer]):
* WebView/WebHTMLViewInternal.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (218879 => 218880)
--- trunk/Source/WebKit/mac/ChangeLog 2017-06-28 16:45:14 UTC (rev 218879)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-06-28 16:57:06 UTC (rev 218880)
@@ -1,3 +1,31 @@
+2017-06-28 Simon Fraser <[email protected]>
+
+ Mark the GraphicsContext as accelerated when the WebHTMLView's layer is drawing asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=173899
+ rdar://problem/32994474
+
+ Reviewed by Tim Horton.
+
+ When the WebHTMLView is layer-backed, and -drawsAsynchronously on its layer is YES,
+ then mark the GraphicsContext that WebCore is using for drawing as accelerated, so
+ that ImageBuffer::createCompatibleBuffer() creates appropriately matched buffers.
+
+ Also clean up WebFrame a little, sharing code that checks whether the WebFrame's
+ documentView is a WebHTMLView.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _webHTMLDocumentView]):
+ (-[WebFrame _paintBehaviorForDestinationContext:]):
+ (-[WebFrame _drawRect:contentsOnly:]):
+ (-[WebFrame setTimeoutsPaused:]):
+ (-[WebFrame prepareForPause]):
+ (-[WebFrame resumeFromPause]):
+ (-[WebFrame resetTextAutosizingBeforeLayout]):
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView drawLayer:inContext:]):
+ (-[WebHTMLView _web_isDrawingIntoAcceleratedLayer]):
+ * WebView/WebHTMLViewInternal.h:
+
2017-06-27 Wenson Hsieh <[email protected]>
[iOS DnD] Support dragging out of contenteditable areas without a prior selection
Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (218879 => 218880)
--- trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-06-28 16:45:14 UTC (rev 218879)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-06-28 16:57:06 UTC (rev 218880)
@@ -416,6 +416,12 @@
_private->coreFrame = 0;
}
+- (WebHTMLView *)_webHTMLDocumentView
+{
+ id documentView = [_private->webFrameView documentView];
+ return [documentView isKindOfClass:[WebHTMLView class]] ? (WebHTMLView *)documentView : nil;
+}
+
- (void)_updateBackgroundAndUpdatesWhileOffscreen
{
WebView *webView = getWebView(self);
@@ -583,7 +589,6 @@
return plainText(core(range), TextIteratorDefaultBehavior, true);
}
-
- (PaintBehavior)_paintBehaviorForDestinationContext:(CGContextRef)context
{
#if !PLATFORM(IOS)
@@ -597,13 +602,12 @@
return 0;
// If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view.
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if (WebHTMLView *htmlDocumentView = [self _webHTMLDocumentView]) {
#if PLATFORM(IOS)
- if ([[documentView window] isInSnapshottingPaint])
+ if ([[htmlDocumentView window] isInSnapshottingPaint])
return PaintBehaviorSnapshotting;
#endif
- if ([(WebHTMLView *)documentView _web_isDrawingIntoLayer])
+ if ([htmlDocumentView _web_isDrawingIntoLayer])
return 0;
}
@@ -622,10 +626,12 @@
GraphicsContext context(ctx);
#if PLATFORM(IOS)
- // FIXME: when <rdar://problem/9034977> is fixed there will be no need to do this here.
WebCore::Frame *frame = core(self);
if (WebCore::Page* page = frame->page())
context.setIsAcceleratedContext(page->settings().acceleratedDrawingEnabled());
+#elif PLATFORM(MAC)
+ if (WebHTMLView *htmlDocumentView = [self _webHTMLDocumentView])
+ context.setIsAcceleratedContext([htmlDocumentView _web_isDrawingIntoAcceleratedLayer]);
#endif
FrameView* view = _private->coreFrame->view();
@@ -1188,8 +1194,7 @@
- (void)setTimeoutsPaused:(BOOL)flag
{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if ([self _webHTMLDocumentView]) {
if (Frame* coreFrame = _private->coreFrame)
coreFrame->setTimersPaused(flag);
}
@@ -1209,8 +1214,7 @@
- (void)prepareForPause
{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if ([self _webHTMLDocumentView]) {
if (Frame* coreFrame = _private->coreFrame)
coreFrame->dispatchPageHideEventBeforePause();
}
@@ -1218,8 +1222,7 @@
- (void)resumeFromPause
{
- id documentView = [_private->webFrameView documentView];
- if ([documentView isKindOfClass:[WebHTMLView class]]) {
+ if ([self _webHTMLDocumentView]) {
if (Frame* coreFrame = _private->coreFrame)
coreFrame->dispatchPageShowEventBeforeResume();
}
@@ -1897,8 +1900,7 @@
#if ENABLE(TEXT_AUTOSIZING)
- (void)resetTextAutosizingBeforeLayout
{
- id documentView = [_private->webFrameView documentView];
- if (![documentView isKindOfClass:[WebHTMLView class]])
+ if (![self _webHTMLDocumentView])
return;
Frame* coreFrame = core(self);
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (218879 => 218880)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-06-28 16:45:14 UTC (rev 218879)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-06-28 16:57:06 UTC (rev 218880)
@@ -931,6 +931,7 @@
NSView *layerHostingView;
BOOL drawingIntoLayer;
+ BOOL drawingIntoAcceleratedLayer;
#if !PLATFORM(IOS)
NSEvent *mouseDownEvent; // Kept after handling the event.
@@ -6693,12 +6694,15 @@
if (_private) {
ASSERT(!_private->drawingIntoLayer);
_private->drawingIntoLayer = YES;
+ _private->drawingIntoAcceleratedLayer = [layer drawsAsynchronously];
}
[super drawLayer:layer inContext:ctx];
- if (_private)
+ if (_private) {
_private->drawingIntoLayer = NO;
+ _private->drawingIntoAcceleratedLayer = NO;
+ }
}
#endif
@@ -6711,6 +6715,11 @@
#endif
}
+- (BOOL)_web_isDrawingIntoAcceleratedLayer
+{
+ return _private->drawingIntoAcceleratedLayer;
+}
+
#if PLATFORM(MAC)
- (void)_changeSpellingToWord:(NSString *)newWord
{
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h (218879 => 218880)
--- trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h 2017-06-28 16:45:14 UTC (rev 218879)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLViewInternal.h 2017-06-28 16:57:06 UTC (rev 218880)
@@ -72,6 +72,7 @@
- (void)attachRootLayer:(CALayer*)layer;
- (void)detachRootLayer;
- (BOOL)_web_isDrawingIntoLayer;
+- (BOOL)_web_isDrawingIntoAcceleratedLayer;
#if PLATFORM(IOS)
- (void)_layoutIfNeeded;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes