Changeset 87102 in webkit
- Timestamp:
- May 23, 2011 3:22:27 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87101 r87102 1 2011-05-20 Jeremy Noble <jer.noble@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Video looks squished when animating to full screen. 6 https://bugs.webkit.org/show_bug.cgi?id=61220 7 8 No new tests, because DumpRenderTree does not currently "animate" the full-screen transition. 9 10 There are three issues animating video content to full screen which this patch is meant to 11 address: 12 1) The animation scales between the client sizes of the element before and after full-screen. 13 Because these sizes have different aspect ratios, the video appears "squished" for part of 14 the animation. Instead, we will animate between the content box sizes before and after full 15 screen which, in the case of video now and object-fit content in the future, will have the 16 same aspect ratio before and after full screen. 17 2) Now that we are animating the full-screen video element's content box, the black letterbox 18 bars appear above and below the video (depending on the video's aspect ratio) as soon as the 19 animation begins. This is extremely jarring, so set the background color to clear. The 20 full-screen renderer's background color will serve the same purpose (providing the letterbox 21 background) once the animation completes. 22 3) Now that the letterbox color is gone, the full screen controls can appear to float in thin 23 air beneath the video (again, depending on aspect ratio) during the animation, so to avoid 24 that effect and to make the animation consistent with the old webkitenterfullscreen() 25 animation, we will hide the controls during the animation by adding a new CSS pseudo class 26 -webkit-animating-full-screen-transition. 27 28 Added a new css pseudo-class: -webkit-animating-full-screen. During the transition animation, this 29 pseudo-class will be applied to the current full-screen element. Styles have been added to 30 fullscreenQuickTime.css to hide the video element's built-in controller during the full-screen 31 animation. 32 33 To accomplish this, the ivar tracking whether the full-screen animation is taking place has been moved 34 from the RenderFullScreen renderer, to the current full-screen Document. Because changing 35 isAnimatingFullScreen causes style changes, make sure to call recalcStyle on the full-screen element 36 after changing. 37 38 This extra transition caused assertions in HTMLFormControlElement::updateFromElementCallback. A 39 full-screen media control's renderer is disabled during the style recalculation when exiting full 40 screen. This assertion was exposed by the extra recalcStyle() issued during the exit transition, and 41 has been removed. 42 43 * WebCore.exp.in: 44 * css/CSSSelector.cpp: 45 (WebCore::CSSSelector::pseudoId): Add support for new pseudo class -webkit-animate-full-screen-transition. 46 (WebCore::nameToPseudoTypeMap): Ditto. 47 (WebCore::CSSSelector::extractPseudoType): Ditto. 48 * css/CSSSelector.h: 49 * css/CSSStyleSelector.cpp: 50 (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): Ditto. 51 * css/fullscreen.css: 52 (video:-webkit-full-screen): Set full screen video background color to clear. 53 * css/fullscreenQuickTime.css: 54 (video:-webkit-full-screen::-webkit-media-controls-panel): Set a default opacity transition. 55 (video:-webkit-animating-full-screen::-webkit-media-controls-panel): Set the opacity to 0 and 56 disable the transition. 57 * dom/Document.cpp: 58 (WebCore::Document::Document): 59 (WebCore::Document::webkitWillEnterFullScreenForElement): Call our new setAnimatingFullScreen function. 60 (WebCore::Document::webkitDidEnterFullScreenForElement): Ditto. 61 (WebCore::Document::webkitWillExitFullScreenForElement): Ditto. 62 (WebCore::Document::webkitDidExitFullScreenForElement): Ditto. 63 (WebCore::Document::isAnimatingFullScreen): Moved here from RenderFullScreen. 64 (WebCore::Document::setAnimatingFullScreen): Ditto. 65 * dom/Document.h: 66 * html/HTMLFormControlElement.cpp: 67 (WebCore::updateFromElementCallback): Use the Document's isAnimatingFullScreen function. 68 * page/FrameView.cpp: 69 (WebCore::isDocumentRunningFullScreenAnimation): Ditto. 70 * rendering/RenderFullScreen.cpp: 71 * rendering/RenderFullScreen.h: 72 * rendering/RenderLayerCompositor.cpp: 73 (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Ditto. 74 (WebCore::RenderLayerCompositor::requiresCompositingForFullScreen): Ditto. 75 * rendering/style/RenderStyleConstants.h: 76 1 77 2011-05-23 Emil A Eklund <eae@chromium.org> 2 78 -
trunk/Source/WebCore/WebCore.exp.in
r86981 r87102 1480 1480 __ZN7WebCore13GraphicsLayer6createEPNS_19GraphicsLayerClientE 1481 1481 __ZNK7WebCore18RenderLayerBacking20compositingLayerTypeEv 1482 __ZNK7WebCore18RenderLayerBacking11contentsBoxEv 1482 1483 #endif 1483 1484 -
trunk/Source/WebCore/css/CSSSelector.cpp
r85811 r87102 168 168 case PseudoFullScreenMediaDocument: 169 169 return FULL_SCREEN_MEDIA_DOCUMENT; 170 case PseudoAnimatingFullScreenTransition: 171 return ANIMATING_FULL_SCREEN_TRANSITION; 170 172 #endif 171 173 … … 323 325 DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document")); 324 326 DEFINE_STATIC_LOCAL(AtomicString, fullScreenMediaDocument, ("-webkit-full-screen-media-document")); 327 DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition")); 325 328 #endif 326 329 DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range")); … … 411 414 nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFullScreenDocument); 412 415 nameToPseudoType->set(fullScreenMediaDocument.impl(), CSSSelector::PseudoFullScreenMediaDocument); 416 nameToPseudoType->set(animatingFullScreenTransition.impl(), CSSSelector::PseudoAnimatingFullScreenTransition); 413 417 #endif 414 418 nameToPseudoType->set(inRange.impl(), CSSSelector::PseudoInRange); … … 521 525 case PseudoFullScreenDocument: 522 526 case PseudoFullScreenMediaDocument: 527 case PseudoAnimatingFullScreenTransition: 523 528 #endif 524 529 case PseudoInRange: -
trunk/Source/WebCore/css/CSSSelector.h
r85811 r87102 191 191 PseudoFullScreenDocument, 192 192 PseudoFullScreenMediaDocument, 193 PseudoAnimatingFullScreenTransition, 193 194 #endif 194 195 PseudoInRange, -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r86929 r87102 2905 2905 if (!e->document()->webkitIsFullScreen()) 2906 2906 return false; 2907 return e == e->document()->webkitCurrentFullScreenElement(); 2908 case CSSSelector::PseudoAnimatingFullScreenTransition: 2907 2909 if (e != e->document()->webkitCurrentFullScreenElement()) 2908 2910 return false; 2909 return true;2911 return e->document()->isAnimatingFullScreen(); 2910 2912 case CSSSelector::PseudoFullScreenMediaDocument: 2911 2913 if (!e->document()->webkitIsFullScreen()) -
trunk/Source/WebCore/css/fullscreen.css
r85811 r87102 14 14 15 15 video:-webkit-full-screen { 16 background-color: black!important;16 background-color: transparent !important; 17 17 position: static !important; 18 18 margin: 0 !important; -
trunk/Source/WebCore/css/fullscreenQuickTime.css
r82053 r87102 55 55 0 0 0 1px rgba(0, 0, 0, 0.5); 56 56 -webkit-border-radius: 8px; 57 58 -webkit-transition: opacity 0.3s linear; 59 } 60 61 video:-webkit-animating-full-screen-transition::-webkit-media-controls-panel { 62 opacity: 0 ! important; 63 -webkit-transition: opacity 0 ! important; 57 64 } 58 65 -
trunk/Source/WebCore/dom/Document.cpp
r87022 r87102 416 416 , m_fullScreenRenderer(0) 417 417 , m_fullScreenChangeDelayTimer(this, &Document::fullScreenChangeDelayTimerFired) 418 , m_isAnimatingFullScreen(false) 418 419 #endif 419 420 , m_loadEventDelayCount(0) … … 4882 4883 4883 4884 if (m_fullScreenRenderer) { 4884 m_fullScreenRenderer->setAnimating(true);4885 setAnimatingFullScreen(true); 4885 4886 #if USE(ACCELERATED_COMPOSITING) 4886 4887 view()->updateCompositingLayers(); … … 4893 4894 void Document::webkitDidEnterFullScreenForElement(Element*) 4894 4895 { 4896 ASSERT(m_fullScreenElement); 4897 4895 4898 if (m_fullScreenRenderer) { 4896 4899 #if USE(ACCELERATED_COMPOSITING) 4897 4900 page()->chrome()->client()->setRootFullScreenLayer(0); 4898 4901 #endif 4899 m_fullScreenRenderer->setAnimating(false);4902 setAnimatingFullScreen(false); 4900 4903 #if USE(ACCELERATED_COMPOSITING) 4901 4904 view()->updateCompositingLayers(); … … 4911 4914 4912 4915 if (m_fullScreenRenderer) { 4913 m_fullScreenRenderer->setAnimating(true);4916 setAnimatingFullScreen(true); 4914 4917 #if USE(ACCELERATED_COMPOSITING) 4915 4918 view()->updateCompositingLayers(); … … 4923 4926 { 4924 4927 m_areKeysEnabledInFullScreen = false; 4928 setAnimatingFullScreen(false); 4925 4929 4926 4930 if (m_fullScreenRenderer) … … 4935 4939 page()->chrome()->client()->setRootFullScreenLayer(0); 4936 4940 #endif 4937 recalcStyle(Force);4941 scheduleForcedStyleRecalc(); 4938 4942 4939 4943 m_fullScreenChangeDelayTimer.startOneShot(0); … … 5015 5019 fullScreenElementRemoved(); 5016 5020 } 5021 5022 bool Document::isAnimatingFullScreen() const 5023 { 5024 return m_isAnimatingFullScreen; 5025 } 5026 5027 void Document::setAnimatingFullScreen(bool flag) 5028 { 5029 if (m_isAnimatingFullScreen == flag) 5030 return; 5031 m_isAnimatingFullScreen = flag; 5032 5033 if (m_fullScreenElement) { 5034 m_fullScreenElement->setNeedsStyleRecalc(); 5035 scheduleStyleRecalc(); 5036 } 5037 5038 #if USE(ACCELERATED_COMPOSITING) 5039 if (m_fullScreenRenderer && m_fullScreenRenderer->layer()) { 5040 m_fullScreenRenderer->layer()->contentChanged(RenderLayer::FullScreenChanged); 5041 // Clearing the layer's backing will force the compositor to reparent 5042 // the layer the next time layers are synchronized. 5043 m_fullScreenRenderer->layer()->clearBacking(); 5044 } 5045 #endif 5046 } 5017 5047 #endif 5018 5048 -
trunk/Source/WebCore/dom/Document.h
r86838 r87102 1074 1074 void fullScreenElementRemoved(); 1075 1075 void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false); 1076 bool isAnimatingFullScreen() const; 1077 void setAnimatingFullScreen(bool); 1076 1078 #endif 1077 1079 … … 1389 1391 Timer<Document> m_fullScreenChangeDelayTimer; 1390 1392 Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue; 1393 bool m_isAnimatingFullScreen; 1391 1394 #endif 1392 1395 -
trunk/Source/WebCore/page/FrameView.cpp
r86632 r87102 597 597 static bool isDocumentRunningFullScreenAnimation(Document* document) 598 598 { 599 return document->webkitIsFullScreen() && document->fullScreenRenderer() && document-> fullScreenRenderer()->isAnimating();599 return document->webkitIsFullScreen() && document->fullScreenRenderer() && document->isAnimatingFullScreen(); 600 600 } 601 601 #endif -
trunk/Source/WebCore/rendering/RenderFullScreen.cpp
r86924 r87102 37 37 using namespace WebCore; 38 38 39 void RenderFullScreen::setAnimating(bool animating)40 {41 if (m_isAnimating == animating)42 return;43 44 m_isAnimating = animating;45 #if USE(ACCELERATED_COMPOSITING)46 if (layer()) {47 layer()->contentChanged(RenderLayer::FullScreenChanged);48 // Clearing the layer's backing will force the compositor to reparent49 // the layer the next time layers are synchronized.50 layer()->clearBacking();51 }52 #endif53 }54 55 39 PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle() 56 40 { -
trunk/Source/WebCore/rendering/RenderFullScreen.h
r75450 r87102 38 38 virtual const char* renderName() const { return "RenderFullScreen"; } 39 39 40 bool isAnimating() const { return m_isAnimating; }41 void setAnimating(bool);42 43 40 static PassRefPtr<RenderStyle> createFullScreenStyle(); 44 41 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r86632 r87102 885 885 // the full screen layer out from under them if they're in the middle of 886 886 // animating. 887 if (layer->renderer()->isRenderFullScreen() && toRenderFullScreen(layer->renderer())->isAnimating())887 if (layer->renderer()->isRenderFullScreen() && m_renderView->document()->isAnimatingFullScreen()) 888 888 return; 889 889 #endif … … 1415 1415 { 1416 1416 #if ENABLE(FULLSCREEN_API) 1417 return renderer->isRenderFullScreen() && toRenderFullScreen(renderer)->isAnimating();1417 return renderer->isRenderFullScreen() && m_renderView->document()->isAnimatingFullScreen(); 1418 1418 #else 1419 1419 UNUSED_PARAM(renderer); -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r86929 r87102 75 75 METER_BAR, METER_OPTIMUM, METER_SUBOPTIMAL, METER_EVEN_LESS_GOOD, 76 76 AFTER_LAST_INTERNAL_PSEUDOID, 77 FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT, 77 FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_MEDIA_DOCUMENT, ANIMATING_FULL_SCREEN_TRANSITION, 78 78 FIRST_PUBLIC_PSEUDOID = FIRST_LINE, 79 79 FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON, -
trunk/Source/WebKit2/ChangeLog
r87093 r87102 1 2011-05-20 Jer Noble <jer.noble@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Video looks squished when animating to full screen. 6 https://bugs.webkit.org/show_bug.cgi?id=61220 7 8 Instead of scaling between the client sizes of the full-screen element before and after 9 entering full-screen, scale between their content boxes. The difference is that the client 10 sizes can have different aspect ratios, and thus the animation can end up "squishing" the 11 content at one end of the animation. When animating between the two content box sizes, their 12 aspect ratios (for the case of video) are equal, so the animation will appear to scale 13 smoothly between the two states without "squishing" the content. 14 15 * WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm: 16 (WebKit::WebFullScreenManagerMac::beginEnterFullScreenAnimation): Set the destination frame 17 to be the content box of the current full screen element. 18 (WebKit::WebFullScreenManagerMac::beginExitFullScreenAnimation): Ditto. 19 1 20 2011-05-23 Sam Weinig <sam@webkit.org> 2 21 -
trunk/Source/WebKit2/WebProcess/FullScreen/mac/WebFullScreenManagerMac.mm
r86924 r87102 39 39 #import <WebCore/GraphicsLayer.h> 40 40 #import <WebCore/Page.h> 41 #import <WebCore/RenderLayer.h> 42 #import <WebCore/RenderLayerBacking.h> 43 #import <WebCore/RenderObject.h> 41 44 #import <WebCore/Settings.h> 42 45 #import <WebKitSystemInterface.h> … … 196 199 m_element->document()->setFullScreenRendererSize(destinationFrame.size()); 197 200 m_rootLayer->syncCompositingState(); 201 202 RenderLayer* layer = m_element->renderer() ? m_element->renderer()->enclosingLayer() : 0; 203 RenderLayerBacking* backing = layer ? layer->backing() : 0; 204 if (backing) 205 destinationFrame.setSize(backing->contentsBox().size()); 198 206 199 207 // FIXME: Once we gain the ability to do native WebKit animations of generated … … 251 259 m_rootLayer->syncCompositingState(); 252 260 261 RenderLayer* layer = m_element->renderer() ? m_element->renderer()->enclosingLayer() : 0; 262 RenderLayerBacking* backing = layer ? layer->backing() : 0; 263 if (backing) 264 destinationFrame.setSize(backing->contentsBox().size()); 265 253 266 // FIXME: Once we gain the ability to do native WebKit animations of generated 254 267 // content, this can change to use them. Meanwhile, we'll have to animate the … … 261 274 // final one. 262 275 CGPoint destinationPosition = [presentationLayer position]; 263 CGRect destinationBounds = [presentationLayer bounds];264 276 CGPoint layerAnchor = [caLayer anchorPoint]; 265 277 CGPoint initialPosition = CGPointMake( … … 267 279 m_initialFrame.y() + m_initialFrame.height() * layerAnchor.y); 268 280 CATransform3D shrinkTransform = CATransform3DMakeScale( 269 static_cast<CGFloat>(m_initialFrame.width()) / destination Bounds.size.width,270 static_cast<CGFloat>(m_initialFrame.height()) / destination Bounds.size.height, 1);281 static_cast<CGFloat>(m_initialFrame.width()) / destinationFrame.width(), 282 static_cast<CGFloat>(m_initialFrame.height()) / destinationFrame.height(), 1); 271 283 CATransform3D shiftTransform = CATransform3DMakeTranslation( 272 284 initialPosition.x - destinationPosition.x,
Note: See TracChangeset
for help on using the changeset viewer.