- Revision
- 87102
- Author
- [email protected]
- Date
- 2011-05-23 15:22:27 -0700 (Mon, 23 May 2011)
Log Message
2011-05-20 Jeremy Noble <[email protected]>
Reviewed by Darin Adler.
Video looks squished when animating to full screen.
https://bugs.webkit.org/show_bug.cgi?id=61220
No new tests, because DumpRenderTree does not currently "animate" the full-screen transition.
There are three issues animating video content to full screen which this patch is meant to
address:
1) The animation scales between the client sizes of the element before and after full-screen.
Because these sizes have different aspect ratios, the video appears "squished" for part of
the animation. Instead, we will animate between the content box sizes before and after full
screen which, in the case of video now and object-fit content in the future, will have the
same aspect ratio before and after full screen.
2) Now that we are animating the full-screen video element's content box, the black letterbox
bars appear above and below the video (depending on the video's aspect ratio) as soon as the
animation begins. This is extremely jarring, so set the background color to clear. The
full-screen renderer's background color will serve the same purpose (providing the letterbox
background) once the animation completes.
3) Now that the letterbox color is gone, the full screen controls can appear to float in thin
air beneath the video (again, depending on aspect ratio) during the animation, so to avoid
that effect and to make the animation consistent with the old webkitenterfullscreen()
animation, we will hide the controls during the animation by adding a new CSS pseudo class
-webkit-animating-full-screen-transition.
Added a new css pseudo-class: -webkit-animating-full-screen. During the transition animation, this
pseudo-class will be applied to the current full-screen element. Styles have been added to
fullscreenQuickTime.css to hide the video element's built-in controller during the full-screen
animation.
To accomplish this, the ivar tracking whether the full-screen animation is taking place has been moved
from the RenderFullScreen renderer, to the current full-screen Document. Because changing
isAnimatingFullScreen causes style changes, make sure to call recalcStyle on the full-screen element
after changing.
This extra transition caused assertions in HTMLFormControlElement::updateFromElementCallback. A
full-screen media control's renderer is disabled during the style recalculation when exiting full
screen. This assertion was exposed by the extra recalcStyle() issued during the exit transition, and
has been removed.
* WebCore.exp.in:
* css/CSSSelector.cpp:
(WebCore::CSSSelector::pseudoId): Add support for new pseudo class -webkit-animate-full-screen-transition.
(WebCore::nameToPseudoTypeMap): Ditto.
(WebCore::CSSSelector::extractPseudoType): Ditto.
* css/CSSSelector.h:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Ditto.
* css/fullscreen.css:
(video:-webkit-full-screen): Set full screen video background color to clear.
* css/fullscreenQuickTime.css:
(video:-webkit-full-screen::-webkit-media-controls-panel): Set a default opacity transition.
(video:-webkit-animating-full-screen::-webkit-media-controls-panel): Set the opacity to 0 and
disable the transition.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::webkitWillEnterFullScreenForElement): Call our new setAnimatingFullScreen function.
(WebCore::Document::webkitDidEnterFullScreenForElement): Ditto.
(WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
(WebCore::Document::webkitDidExitFullScreenForElement): Ditto.
(WebCore::Document::isAnimatingFullScreen): Moved here from RenderFullScreen.
(WebCore::Document::setAnimatingFullScreen): Ditto.
* dom/Document.h:
* html/HTMLFormControlElement.cpp:
(WebCore::updateFromElementCallback): Use the Document's isAnimatingFullScreen function.
* page/FrameView.cpp:
(WebCore::isDocumentRunningFullScreenAnimation): Ditto.
* rendering/RenderFullScreen.cpp:
* rendering/RenderFullScreen.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Ditto.
(WebCore::RenderLayerCompositor::requiresCompositingForFullScreen): Ditto.
* rendering/style/RenderStyleConstants.h:
2011-05-20 Jer Noble <[email protected]>
Reviewed by Darin Adler.
Video looks squished when animating to full screen.
https://bugs.webkit.org/show_bug.cgi?id=61220
Instead of scaling between the client sizes of the full-screen element before and after
entering full-screen, scale between their content boxes. The difference is that the client
sizes can have different aspect ratios, and thus the animation can end up "squishing" the
content at one end of the animation. When animating between the two content box sizes, their
aspect ratios (for the case of video) are equal, so the animation will appear to scale
smoothly between the two states without "squishing" the content.
* WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
(WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation): Set the destination frame
to be the content box of the current full screen element.
(WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (87101 => 87102)
--- trunk/Source/WebCore/ChangeLog 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/ChangeLog 2011-05-23 22:22:27 UTC (rev 87102)
@@ -1,3 +1,79 @@
+2011-05-20 Jeremy Noble <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Video looks squished when animating to full screen.
+ https://bugs.webkit.org/show_bug.cgi?id=61220
+
+ No new tests, because DumpRenderTree does not currently "animate" the full-screen transition.
+
+ There are three issues animating video content to full screen which this patch is meant to
+ address:
+ 1) The animation scales between the client sizes of the element before and after full-screen.
+ Because these sizes have different aspect ratios, the video appears "squished" for part of
+ the animation. Instead, we will animate between the content box sizes before and after full
+ screen which, in the case of video now and object-fit content in the future, will have the
+ same aspect ratio before and after full screen.
+ 2) Now that we are animating the full-screen video element's content box, the black letterbox
+ bars appear above and below the video (depending on the video's aspect ratio) as soon as the
+ animation begins. This is extremely jarring, so set the background color to clear. The
+ full-screen renderer's background color will serve the same purpose (providing the letterbox
+ background) once the animation completes.
+ 3) Now that the letterbox color is gone, the full screen controls can appear to float in thin
+ air beneath the video (again, depending on aspect ratio) during the animation, so to avoid
+ that effect and to make the animation consistent with the old webkitenterfullscreen()
+ animation, we will hide the controls during the animation by adding a new CSS pseudo class
+ -webkit-animating-full-screen-transition.
+
+ Added a new css pseudo-class: -webkit-animating-full-screen. During the transition animation, this
+ pseudo-class will be applied to the current full-screen element. Styles have been added to
+ fullscreenQuickTime.css to hide the video element's built-in controller during the full-screen
+ animation.
+
+ To accomplish this, the ivar tracking whether the full-screen animation is taking place has been moved
+ from the RenderFullScreen renderer, to the current full-screen Document. Because changing
+ isAnimatingFullScreen causes style changes, make sure to call recalcStyle on the full-screen element
+ after changing.
+
+ This extra transition caused assertions in HTMLFormControlElement::updateFromElementCallback. A
+ full-screen media control's renderer is disabled during the style recalculation when exiting full
+ screen. This assertion was exposed by the extra recalcStyle() issued during the exit transition, and
+ has been removed.
+
+ * WebCore.exp.in:
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::pseudoId): Add support for new pseudo class -webkit-animate-full-screen-transition.
+ (WebCore::nameToPseudoTypeMap): Ditto.
+ (WebCore::CSSSelector::extractPseudoType): Ditto.
+ * css/CSSSelector.h:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Ditto.
+ * css/fullscreen.css:
+ (video:-webkit-full-screen): Set full screen video background color to clear.
+ * css/fullscreenQuickTime.css:
+ (video:-webkit-full-screen::-webkit-media-controls-panel): Set a default opacity transition.
+ (video:-webkit-animating-full-screen::-webkit-media-controls-panel): Set the opacity to 0 and
+ disable the transition.
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::webkitWillEnterFullScreenForElement): Call our new setAnimatingFullScreen function.
+ (WebCore::Document::webkitDidEnterFullScreenForElement): Ditto.
+ (WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
+ (WebCore::Document::webkitDidExitFullScreenForElement): Ditto.
+ (WebCore::Document::isAnimatingFullScreen): Moved here from RenderFullScreen.
+ (WebCore::Document::setAnimatingFullScreen): Ditto.
+ * dom/Document.h:
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::updateFromElementCallback): Use the Document's isAnimatingFullScreen function.
+ * page/FrameView.cpp:
+ (WebCore::isDocumentRunningFullScreenAnimation): Ditto.
+ * rendering/RenderFullScreen.cpp:
+ * rendering/RenderFullScreen.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Ditto.
+ (WebCore::RenderLayerCompositor::requiresCompositingForFullScreen): Ditto.
+ * rendering/style/RenderStyleConstants.h:
+
2011-05-23 Emil A Eklund <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/WebCore.exp.in (87101 => 87102)
--- trunk/Source/WebCore/WebCore.exp.in 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/WebCore.exp.in 2011-05-23 22:22:27 UTC (rev 87102)
@@ -1479,6 +1479,7 @@
__ZN7WebCore13GraphicsLayer17removeAllChildrenEv
__ZN7WebCore13GraphicsLayer6createEPNS_19GraphicsLayerClientE
__ZNK7WebCore18RenderLayerBacking20compositingLayerTypeEv
+__ZNK7WebCore18RenderLayerBacking11contentsBoxEv
#endif
#if ENABLE(CONTEXT_MENUS)
Modified: trunk/Source/WebCore/css/CSSSelector.cpp (87101 => 87102)
--- trunk/Source/WebCore/css/CSSSelector.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/css/CSSSelector.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -167,6 +167,8 @@
return FULL_SCREEN_DOCUMENT;
case PseudoFullScreenMediaDocument:
return FULL_SCREEN_MEDIA_DOCUMENT;
+ case PseudoAnimatingFullScreenTransition:
+ return ANIMATING_FULL_SCREEN_TRANSITION;
#endif
case PseudoInputListButton:
@@ -322,6 +324,7 @@
DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen"));
DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document"));
DEFINE_STATIC_LOCAL(AtomicString, fullScreenMediaDocument, ("-webkit-full-screen-media-document"));
+ DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition"));
#endif
DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range"));
DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range"));
@@ -410,6 +413,7 @@
nameToPseudoType->set(fullScreen.impl(), CSSSelector::PseudoFullScreen);
nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFullScreenDocument);
nameToPseudoType->set(fullScreenMediaDocument.impl(), CSSSelector::PseudoFullScreenMediaDocument);
+ nameToPseudoType->set(animatingFullScreenTransition.impl(), CSSSelector::PseudoAnimatingFullScreenTransition);
#endif
nameToPseudoType->set(inRange.impl(), CSSSelector::PseudoInRange);
nameToPseudoType->set(outOfRange.impl(), CSSSelector::PseudoOutOfRange);
@@ -520,6 +524,7 @@
case PseudoFullScreen:
case PseudoFullScreenDocument:
case PseudoFullScreenMediaDocument:
+ case PseudoAnimatingFullScreenTransition:
#endif
case PseudoInRange:
case PseudoOutOfRange:
Modified: trunk/Source/WebCore/css/CSSSelector.h (87101 => 87102)
--- trunk/Source/WebCore/css/CSSSelector.h 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/css/CSSSelector.h 2011-05-23 22:22:27 UTC (rev 87102)
@@ -190,6 +190,7 @@
PseudoFullScreen,
PseudoFullScreenDocument,
PseudoFullScreenMediaDocument,
+ PseudoAnimatingFullScreenTransition,
#endif
PseudoInRange,
PseudoOutOfRange,
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (87101 => 87102)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -2904,9 +2904,11 @@
return true;
if (!e->document()->webkitIsFullScreen())
return false;
+ return e == e->document()->webkitCurrentFullScreenElement();
+ case CSSSelector::PseudoAnimatingFullScreenTransition:
if (e != e->document()->webkitCurrentFullScreenElement())
return false;
- return true;
+ return e->document()->isAnimatingFullScreen();
case CSSSelector::PseudoFullScreenMediaDocument:
if (!e->document()->webkitIsFullScreen())
return false;
Modified: trunk/Source/WebCore/css/fullscreen.css (87101 => 87102)
--- trunk/Source/WebCore/css/fullscreen.css 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/css/fullscreen.css 2011-05-23 22:22:27 UTC (rev 87102)
@@ -13,7 +13,7 @@
}
video:-webkit-full-screen {
- background-color: black !important;
+ background-color: transparent !important;
position: static !important;
margin: 0 !important;
height: 100% !important;
Modified: trunk/Source/WebCore/css/fullscreenQuickTime.css (87101 => 87102)
--- trunk/Source/WebCore/css/fullscreenQuickTime.css 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/css/fullscreenQuickTime.css 2011-05-23 22:22:27 UTC (rev 87102)
@@ -54,8 +54,15 @@
inset 0 -1px 0 0px rgba(202, 202, 202, 0.09),
0 0 0 1px rgba(0, 0, 0, 0.5);
-webkit-border-radius: 8px;
+
+ -webkit-transition: opacity 0.3s linear;
}
+video:-webkit-animating-full-screen-transition::-webkit-media-controls-panel {
+ opacity: 0 ! important;
+ -webkit-transition: opacity 0 ! important;
+}
+
video:-webkit-full-screen::-webkit-media-controls-mute-button {
display: none;
}
Modified: trunk/Source/WebCore/dom/Document.cpp (87101 => 87102)
--- trunk/Source/WebCore/dom/Document.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -415,6 +415,7 @@
, m_areKeysEnabledInFullScreen(0)
, m_fullScreenRenderer(0)
, m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFired)
+ , m_isAnimatingFullScreen(false)
#endif
, m_loadEventDelayCount(0)
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
@@ -4881,7 +4882,7 @@
recalcStyle(Force);
if (m_fullScreenRenderer) {
- m_fullScreenRenderer->setAnimating(true);
+ setAnimatingFullScreen(true);
#if USE(ACCELERATED_COMPOSITING)
view()->updateCompositingLayers();
if (m_fullScreenRenderer->layer()->isComposited())
@@ -4892,11 +4893,13 @@
void Document::webkitDidEnterFullScreenForElement(Element*)
{
+ ASSERT(m_fullScreenElement);
+
if (m_fullScreenRenderer) {
#if USE(ACCELERATED_COMPOSITING)
page()->chrome()->client()->setRootFullScreenLayer(0);
#endif
- m_fullScreenRenderer->setAnimating(false);
+ setAnimatingFullScreen(false);
#if USE(ACCELERATED_COMPOSITING)
view()->updateCompositingLayers();
#endif
@@ -4910,7 +4913,7 @@
setContainsFullScreenElementRecursively(ownerElement(), false);
if (m_fullScreenRenderer) {
- m_fullScreenRenderer->setAnimating(true);
+ setAnimatingFullScreen(true);
#if USE(ACCELERATED_COMPOSITING)
view()->updateCompositingLayers();
if (m_fullScreenRenderer->layer()->isComposited())
@@ -4922,6 +4925,7 @@
void Document::webkitDidExitFullScreenForElement(Element*)
{
m_areKeysEnabledInFullScreen = false;
+ setAnimatingFullScreen(false);
if (m_fullScreenRenderer)
m_fullScreenRenderer->remove();
@@ -4934,7 +4938,7 @@
#if USE(ACCELERATED_COMPOSITING)
page()->chrome()->client()->setRootFullScreenLayer(0);
#endif
- recalcStyle(Force);
+ scheduleForcedStyleRecalc();
m_fullScreenChangeDelayTimer.startOneShot(0);
}
@@ -5014,7 +5018,33 @@
if (elementInSubtree)
fullScreenElementRemoved();
}
+
+bool Document::isAnimatingFullScreen() const
+{
+ return m_isAnimatingFullScreen;
+}
+
+void Document::setAnimatingFullScreen(bool flag)
+{
+ if (m_isAnimatingFullScreen == flag)
+ return;
+ m_isAnimatingFullScreen = flag;
+
+ if (m_fullScreenElement) {
+ m_fullScreenElement->setNeedsStyleRecalc();
+ scheduleStyleRecalc();
+ }
+
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_fullScreenRenderer && m_fullScreenRenderer->layer()) {
+ m_fullScreenRenderer->layer()->contentChanged(RenderLayer::FullScreenChanged);
+ // Clearing the layer's backing will force the compositor to reparent
+ // the layer the next time layers are synchronized.
+ m_fullScreenRenderer->layer()->clearBacking();
+ }
#endif
+}
+#endif
void Document::decrementLoadEventDelayCount()
{
Modified: trunk/Source/WebCore/dom/Document.h (87101 => 87102)
--- trunk/Source/WebCore/dom/Document.h 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/dom/Document.h 2011-05-23 22:22:27 UTC (rev 87102)
@@ -1073,6 +1073,8 @@
bool fullScreenIsAllowedForElement(Element*) const;
void fullScreenElementRemoved();
void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false);
+ bool isAnimatingFullScreen() const;
+ void setAnimatingFullScreen(bool);
#endif
// Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
@@ -1388,6 +1390,7 @@
RenderFullScreen* m_fullScreenRenderer;
Timer<Document> m_fullScreenChangeDelayTimer;
Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue;
+ bool m_isAnimatingFullScreen;
#endif
int m_loadEventDelayCount;
Modified: trunk/Source/WebCore/page/FrameView.cpp (87101 => 87102)
--- trunk/Source/WebCore/page/FrameView.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/page/FrameView.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -596,7 +596,7 @@
#if ENABLE(FULLSCREEN_API) && USE(ACCELERATED_COMPOSITING)
static bool isDocumentRunningFullScreenAnimation(Document* document)
{
- return document->webkitIsFullScreen() && document->fullScreenRenderer() && document->fullScreenRenderer()->isAnimating();
+ return document->webkitIsFullScreen() && document->fullScreenRenderer() && document->isAnimatingFullScreen();
}
#endif
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.cpp (87101 => 87102)
--- trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -36,22 +36,6 @@
using namespace WebCore;
-void RenderFullScreen::setAnimating(bool animating)
-{
- if (m_isAnimating == animating)
- return;
-
- m_isAnimating = animating;
-#if USE(ACCELERATED_COMPOSITING)
- if (layer()) {
- layer()->contentChanged(RenderLayer::FullScreenChanged);
- // Clearing the layer's backing will force the compositor to reparent
- // the layer the next time layers are synchronized.
- layer()->clearBacking();
- }
-#endif
-}
-
PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
{
RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle();
Modified: trunk/Source/WebCore/rendering/RenderFullScreen.h (87101 => 87102)
--- trunk/Source/WebCore/rendering/RenderFullScreen.h 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.h 2011-05-23 22:22:27 UTC (rev 87102)
@@ -37,9 +37,6 @@
virtual bool isRenderFullScreen() const { return true; }
virtual const char* renderName() const { return "RenderFullScreen"; }
- bool isAnimating() const { return m_isAnimating; }
- void setAnimating(bool);
-
static PassRefPtr<RenderStyle> createFullScreenStyle();
protected:
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (87101 => 87102)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-05-23 22:22:27 UTC (rev 87102)
@@ -884,7 +884,7 @@
// For the sake of clients of the full screen renderer, don't reparent
// the full screen layer out from under them if they're in the middle of
// animating.
- if (layer->renderer()->isRenderFullScreen() && toRenderFullScreen(layer->renderer())->isAnimating())
+ if (layer->renderer()->isRenderFullScreen() && m_renderView->document()->isAnimatingFullScreen())
return;
#endif
childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
@@ -1414,7 +1414,7 @@
bool RenderLayerCompositor::requiresCompositingForFullScreen(RenderObject* renderer) const
{
#if ENABLE(FULLSCREEN_API)
- return renderer->isRenderFullScreen() && toRenderFullScreen(renderer)->isAnimating();
+ return renderer->isRenderFullScreen() && m_renderView->document()->isAnimatingFullScreen();
#else
UNUSED_PARAM(renderer);
return false;
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (87101 => 87102)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2011-05-23 22:22:27 UTC (rev 87102)
@@ -74,7 +74,7 @@
INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK,
METER_BAR, METER_OPTIMUM, METER_SUBOPTIMAL, METER_EVEN_LESS_GOOD,
AFTER_LAST_INTERNAL_PSEUDOID,
- FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT,
+ FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT, ANIMATING_FULL_SCREEN_TRANSITION,
FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON,
PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
Modified: trunk/Source/WebKit2/ChangeLog (87101 => 87102)
--- trunk/Source/WebKit2/ChangeLog 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebKit2/ChangeLog 2011-05-23 22:22:27 UTC (rev 87102)
@@ -1,3 +1,22 @@
+2011-05-20 Jer Noble <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Video looks squished when animating to full screen.
+ https://bugs.webkit.org/show_bug.cgi?id=61220
+
+ Instead of scaling between the client sizes of the full-screen element before and after
+ entering full-screen, scale between their content boxes. The difference is that the client
+ sizes can have different aspect ratios, and thus the animation can end up "squishing" the
+ content at one end of the animation. When animating between the two content box sizes, their
+ aspect ratios (for the case of video) are equal, so the animation will appear to scale
+ smoothly between the two states without "squishing" the content.
+
+ * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm:
+ (WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation): Set the destination frame
+ to be the content box of the current full screen element.
+ (WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation): Ditto.
+
2011-05-23 Sam Weinig <[email protected]>
Reviewed by Darin Adler.
Modified: trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm (87101 => 87102)
--- trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm 2011-05-23 22:15:19 UTC (rev 87101)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm 2011-05-23 22:22:27 UTC (rev 87102)
@@ -38,6 +38,9 @@
#import <WebCore/FrameView.h>
#import <WebCore/GraphicsLayer.h>
#import <WebCore/Page.h>
+#import <WebCore/RenderLayer.h>
+#import <WebCore/RenderLayerBacking.h>
+#import <WebCore/RenderObject.h>
#import <WebCore/Settings.h>
#import <WebKitSystemInterface.h>
@@ -196,6 +199,11 @@
m_element->document()->setFullScreenRendererSize(destinationFrame.size());
m_rootLayer->syncCompositingState();
+ RenderLayer* layer = m_element->renderer() ? m_element->renderer()->enclosingLayer() : 0;
+ RenderLayerBacking* backing = layer ? layer->backing() : 0;
+ if (backing)
+ destinationFrame.setSize(backing->contentsBox().size());
+
// FIXME: Once we gain the ability to do native WebKit animations of generated
// content, this can change to use them. Meanwhile, we'll have to animate the
// CALayer directly:
@@ -250,6 +258,11 @@
m_element->document()->setFullScreenRendererSize(destinationFrame.size());
m_rootLayer->syncCompositingState();
+ RenderLayer* layer = m_element->renderer() ? m_element->renderer()->enclosingLayer() : 0;
+ RenderLayerBacking* backing = layer ? layer->backing() : 0;
+ if (backing)
+ destinationFrame.setSize(backing->contentsBox().size());
+
// FIXME: Once we gain the ability to do native WebKit animations of generated
// content, this can change to use them. Meanwhile, we'll have to animate the
// CALayer directly:
@@ -260,14 +273,13 @@
// the fullscreen element appears to move from its starting position and size to its
// final one.
CGPoint destinationPosition = [presentationLayer position];
- CGRect destinationBounds = [presentationLayer bounds];
CGPoint layerAnchor = [caLayer anchorPoint];
CGPoint initialPosition = CGPointMake(
m_initialFrame.x() + m_initialFrame.width() * layerAnchor.x,
m_initialFrame.y() + m_initialFrame.height() * layerAnchor.y);
CATransform3D shrinkTransform = CATransform3DMakeScale(
- static_cast<CGFloat>(m_initialFrame.width()) / destinationBounds.size.width,
- static_cast<CGFloat>(m_initialFrame.height()) / destinationBounds.size.height, 1);
+ static_cast<CGFloat>(m_initialFrame.width()) / destinationFrame.width(),
+ static_cast<CGFloat>(m_initialFrame.height()) / destinationFrame.height(), 1);
CATransform3D shiftTransform = CATransform3DMakeTranslation(
initialPosition.x - destinationPosition.x,
// Drawing is flipped here, and so must be the translation transformation