Title: [86924] trunk/Source
- Revision
- 86924
- Author
- [email protected]
- Date
- 2011-05-19 22:31:07 -0700 (Thu, 19 May 2011)
Log Message
2011-05-19 Jer Noble <[email protected]>
Reviewed by Maciej Stachowiak.
WebKit2: Flashing when entering and exiting full screen mode
https://bugs.webkit.org/show_bug.cgi?id=56957
Guard against the parameter of setAnimating() matching the ivar value it's
setting, thus avoiding tearing down the renderer's layer backing.
* rendering/RenderFullScreen.cpp:
(RenderFullScreen::setAnimating):
2011-05-19 Jer Noble <[email protected]>
Reviewed by Maciej Stachowiak.
WebKit2: Flashing when entering and exiting full screen mode
https://bugs.webkit.org/show_bug.cgi?id=56957
In the WKFullscreenWindowController, when exiting accelerated compositing mode,
force a repaint, and don't actually remove the animation layer until the repaint
completes. Also, move back to parenting the WebView in a layer-backed view, and
work around the SnowLeopard bug which causes a crash in those situations. We no
longer need to do a bunch of work in finishedEnterFullScreenAnimation, because
the animation layer is "hiding" all the drawing happening in the webView underneath.
In the WebFullScreenManagerMac, when asked to tear down the root layer, instead
remove all its children, and set its contents to a flattened image of the full
screen element and its children. This helps patch over the time where everything
is re-rendering and helps give the appearance of continuousness in the animation.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
(-[WKFullScreenWindowController beganExitFullScreenAnimation]):
(-[WKFullScreenWindowController enterAcceleratedCompositingMode:WebKit::]):
(-[WKFullScreenWindowController exitAcceleratedCompositingMode]):
(-[WKFullScreenWindowController exitCompositedModeRepaintCompleted]):
(exitCompositedModeRepaintCompleted):
(-[WKFullScreenWindowController _page]):
(-[WKFullScreenWindowController _manager]):
(-[WKFullScreenWindow initWithContentRect:styleMask:backing:defer:]):
* WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
(WebKit::WebFullScreenManagerMac::setRootFullScreenLayer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (86923 => 86924)
--- trunk/Source/WebCore/ChangeLog 2011-05-20 05:27:48 UTC (rev 86923)
+++ trunk/Source/WebCore/ChangeLog 2011-05-20 05:31:07 UTC (rev 86924)
@@ -1,3 +1,16 @@
+2011-05-19 Jer Noble <[email protected]>
+
+ Reviewed by Maciej Stachowiak.
+
+ WebKit2: Flashing when entering and exiting full screen mode
+ https://bugs.webkit.org/show_bug.cgi?id=56957
+
+ Guard against the parameter of setAnimating() matching the ivar value it's
+ setting, thus avoiding tearing down the renderer's layer backing.
+
+ * rendering/RenderFullScreen.cpp:
+ (RenderFullScreen::setAnimating):
+
2011-05-19 Julien Chaffraix <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.cpp (86923 => 86924)
--- trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2011-05-20 05:27:48 UTC (rev 86923)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2011-05-20 05:31:07 UTC (rev 86924)
@@ -38,6 +38,9 @@
void RenderFullScreen::setAnimating(bool animating)
{
+ if (m_isAnimating == animating)
+ return;
+
m_isAnimating = animating;
#if USE(ACCELERATED_COMPOSITING)
if (layer()) {
Modified: trunk/Source/WebKit2/ChangeLog (86923 => 86924)
--- trunk/Source/WebKit2/ChangeLog 2011-05-20 05:27:48 UTC (rev 86923)
+++ trunk/Source/WebKit2/ChangeLog 2011-05-20 05:31:07 UTC (rev 86924)
@@ -1,3 +1,35 @@
+2011-05-19 Jer Noble <[email protected]>
+
+ Reviewed by Maciej Stachowiak.
+
+ WebKit2: Flashing when entering and exiting full screen mode
+ https://bugs.webkit.org/show_bug.cgi?id=56957
+
+ In the WKFullscreenWindowController, when exiting accelerated compositing mode,
+ force a repaint, and don't actually remove the animation layer until the repaint
+ completes. Also, move back to parenting the WebView in a layer-backed view, and
+ work around the SnowLeopard bug which causes a crash in those situations. We no
+ longer need to do a bunch of work in finishedEnterFullScreenAnimation, because
+ the animation layer is "hiding" all the drawing happening in the webView underneath.
+
+ In the WebFullScreenManagerMac, when asked to tear down the root layer, instead
+ remove all its children, and set its contents to a flattened image of the full
+ screen element and its children. This helps patch over the time where everything
+ is re-rendering and helps give the appearance of continuousness in the animation.
+
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
+ (-[WKFullScreenWindowController beganExitFullScreenAnimation]):
+ (-[WKFullScreenWindowController enterAcceleratedCompositingMode:WebKit::]):
+ (-[WKFullScreenWindowController exitAcceleratedCompositingMode]):
+ (-[WKFullScreenWindowController exitCompositedModeRepaintCompleted]):
+ (exitCompositedModeRepaintCompleted):
+ (-[WKFullScreenWindowController _page]):
+ (-[WKFullScreenWindowController _manager]):
+ (-[WKFullScreenWindow initWithContentRect:styleMask:backing:defer:]):
+ * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
+ (WebKit::WebFullScreenManagerMac::setRootFullScreenLayer):
+
2011-05-19 Anders Carlsson <[email protected]>
Address a review comment by Sam Weinig.
Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (86923 => 86924)
--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2011-05-20 05:27:48 UTC (rev 86923)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2011-05-20 05:31:07 UTC (rev 86924)
@@ -46,6 +46,8 @@
using namespace WebKit;
using namespace WebCore;
+static void exitCompositedModeRepaintCompleted(WKErrorRef, void* context);
+
#if defined(BUILDING_ON_LEOPARD)
@interface CATransaction(SnowLeopardConvenienceFunctions)
+ (void)setDisableActions:(BOOL)flag;
@@ -82,6 +84,7 @@
- (WKFullScreenWindow *)_fullScreenWindow;
- (CFTimeInterval)_animationDuration;
- (void)_swapView:(NSView*)view with:(NSView*)otherView;
+- (WebPageProxy*)_page;
- (WebFullScreenManagerProxy*)_manager;
@end
@@ -241,8 +244,6 @@
if (!_isEnteringFullScreen)
return;
_isEnteringFullScreen = NO;
-
- NSDisableScreenUpdates();
if (completed) {
// Swap the webView placeholder into place.
@@ -252,13 +253,8 @@
// Then insert the WebView into the full screen window
NSView* contentView = [[self _fullScreenWindow] contentView];
- [contentView addSubview:_webView positioned:NSWindowBelow relativeTo:_layerHostingView.get()];
+ [contentView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
[_webView setFrame:[contentView bounds]];
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
- [[[self _fullScreenWindow] backgroundLayer] setHidden:YES];
- [CATransaction commit];
NSWindow *webWindow = [_webViewPlaceholder.get() window];
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
@@ -271,11 +267,8 @@
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
[webWindow setAnimationBehavior:animationBehavior];
#endif
- [[self window] makeKeyAndOrderFront:self];
+ [self _manager]->didEnterFullScreen();
}
-
- [self _manager]->didEnterFullScreen();
- NSEnableScreenUpdates();
}
- (void)exitFullScreen
@@ -305,6 +298,16 @@
// Swap the webView back into its original position:
if ([_webView window] == [self window]) {
+#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
+ // Work around a bug in AppKit <rdar://problem/9443385> where moving a
+ // layer-hosted view from a layer-backed view to a non-layer-backed view
+ // generates an exception.
+ if (![_webView wantsLayer] && [_webView layer]) {
+ [_webView removeFromSuperview];
+ for (NSView* child in [_webView subviews])
+ [[child layer] removeFromSuperlayer];
+ }
+#endif
[self _swapView:_webViewPlaceholder.get() with:_webView];
NSWindow* webWindow = [_webView window];
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
@@ -364,7 +367,7 @@
[CATransaction begin];
[CATransaction setDisableActions:YES];
WKFullScreenWindow* window = [self _fullScreenWindow];
- [[window contentView] addSubview:_layerHostingView.get() positioned:NSWindowAbove relativeTo:[window animationView]];
+ [[window contentView] addSubview:_layerHostingView.get() positioned:NSWindowAbove relativeTo:nil];
// Create a root layer that will back the NSView.
RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]);
@@ -385,7 +388,13 @@
{
if (!_layerHostingView)
return;
-
+
+ NSDisableScreenUpdates();
+ [self _page]->forceRepaint(VoidCallback::create(self, exitCompositedModeRepaintCompleted));
+}
+
+- (void)exitCompositedModeRepaintCompleted
+{
[CATransaction begin];
[CATransaction setDisableActions:YES];
[_layerHostingView.get() removeFromSuperview];
@@ -395,8 +404,14 @@
[CATransaction commit];
_layerHostingView = 0;
+ NSEnableScreenUpdates();
}
+static void exitCompositedModeRepaintCompleted(WKErrorRef, void* context)
+{
+ [(WKFullScreenWindowController*)context exitCompositedModeRepaintCompleted];
+}
+
- (WebCore::IntRect)getFullScreenRect
{
return enclosingIntRect([[self window] frame]);
@@ -500,9 +515,14 @@
}
}
+- (WebPageProxy*)_page
+{
+ return toImpl([_webView pageRef]);
+}
+
- (WebFullScreenManagerProxy*)_manager
{
- WebPageProxy* webPage = toImpl([_webView pageRef]);
+ WebPageProxy* webPage = [self _page];
if (!webPage)
return 0;
return webPage->fullScreenManager();
@@ -582,6 +602,7 @@
#endif
NSView* contentView = [self contentView];
+ [contentView setWantsLayer:YES];
_animationView = [[NSView alloc] initWithFrame:[contentView bounds]];
CALayer* contentLayer = [[CALayer alloc] init];
Modified: trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm (86923 => 86924)
--- trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm 2011-05-20 05:27:48 UTC (rev 86923)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm 2011-05-20 05:31:07 UTC (rev 86924)
@@ -137,11 +137,20 @@
if (!layer) {
m_page->send(Messages::WebFullScreenManagerProxy::ExitAcceleratedCompositingMode());
[[NSNotificationCenter defaultCenter] postNotificationName:@"WebKitLayerHostChanged" object:m_rootLayer->platformLayer() userInfo:nil];
+
+ Frame* frame = m_element->document()->frame();
+ DragImageRef dragImage = frame ? frame->nodeImage(m_element.get()) : 0;
+
if (m_rootLayer) {
+ [CATransaction begin];
+ PlatformLayer* rootPlatformLayer = m_rootLayer->platformLayer();
m_rootLayer->removeAllChildren();
+ m_rootLayer->syncCompositingStateForThisLayerOnly();
m_rootLayer = nullptr;
+ [rootPlatformLayer setContents:dragImage.get()];
+ [CATransaction commit];
}
-
+
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes