Changeset 139955 in webkit
- Timestamp:
- Jan 16, 2013 7:52:52 PM (11 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/WebPage.cpp
r139787 r139955 3820 3820 3821 3821 #if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO) 3822 // When leaving fullscreen mode, restore the scale and scroll position 3823 // if needed. 3824 // FIXME: The cached values might get imprecise if user have rotated the 3825 // device while in fullscreen. 3822 // When leaving fullscreen mode, restore the scale and scroll position if needed. 3823 // We also need to make sure the scale and scroll position won't cause over scale or over scroll. 3826 3824 if (m_scaleBeforeFullScreen > 0 && !m_fullscreenVideoNode) { 3827 3825 // Restore the scale when leaving fullscreen. We can't use TransformationMatrix::scale(double) here, 3828 3826 // as it will multiply the scale rather than set the scale. 3829 3827 // FIXME: We can refactor this into setCurrentScale(double) if it is useful in the future. 3828 if (m_orientationBeforeFullScreen % 180 != orientation() % 180) { // Orientation changed 3829 if (m_actualVisibleWidth > contentsSize().width() * m_scaleBeforeFullScreen) { 3830 // Cached scale need to be adjusted after rotation. 3831 m_scaleBeforeFullScreen = double(m_actualVisibleWidth) / contentsSize().width(); 3832 } 3833 if (m_scaleBeforeFullScreen * contentsSize().height() < m_actualVisibleHeight) { 3834 // Use zoom to fit height scale in order to cover the screen height. 3835 m_scaleBeforeFullScreen = double(m_actualVisibleHeight) / contentsSize().height(); 3836 } 3837 3838 if (m_actualVisibleWidth > m_scaleBeforeFullScreen * (contentsSize().width() - m_scrollPositionBeforeFullScreen.x())) { 3839 // Cached scroll position over scrolls horizontally after rotation. 3840 m_scrollPositionBeforeFullScreen.setX(contentsSize().width() - m_actualVisibleWidth / m_scaleBeforeFullScreen); 3841 } 3842 if (m_actualVisibleHeight > m_scaleBeforeFullScreen * (contentsSize().height() - m_scrollPositionBeforeFullScreen.y())) { 3843 // Cached scroll position over scrolls vertically after rotation. 3844 m_scrollPositionBeforeFullScreen.setY(contentsSize().height() - m_actualVisibleHeight / m_scaleBeforeFullScreen); 3845 } 3846 } 3847 3830 3848 m_transformationMatrix->setM11(m_scaleBeforeFullScreen); 3831 3849 m_transformationMatrix->setM22(m_scaleBeforeFullScreen); … … 5809 5827 // once element leaves fullscreen. 5810 5828 m_scrollPositionBeforeFullScreen = m_mainFrame->view()->scrollPosition(); 5829 5830 // We need to remember the orientation before entering fullscreen, so that we can adjust 5831 // the scale and scroll position when exiting fullscreen if needed, because the scale and 5832 // scroll position may not apply (overscale and/or overscroll) in the other orientation. 5833 m_orientationBeforeFullScreen = orientation(); 5811 5834 } 5812 5835 -
trunk/Source/WebKit/blackberry/Api/WebPage_p.h
r139787 r139955 529 529 double m_scaleBeforeFullScreen; 530 530 WebCore::IntPoint m_scrollPositionBeforeFullScreen; 531 int m_orientationBeforeFullScreen; 531 532 #endif 532 533 #endif -
trunk/Source/WebKit/blackberry/ChangeLog
r139925 r139955 1 2013-01-16 Charles Wei <charles.wei@torchmobile.com.cn> 2 3 [BlackBerry] Need to adjust the scale and scroll position after leaving fullscreen mode if there's 4 device rotation in fullscreen mode 5 https://bugs.webkit.org/show_bug.cgi?id=107085 6 7 Reviewed by George STaikos. 8 Also internally reviewed by Jacky Jiang. 9 10 We saved the scale and scroll position before entering full screen mode, so that we can restore 11 them after leaving fullscreen mode, because entering fullscreen mode automatically changes the 12 scale to make the video to fit to the viewport. But if there's device rotation during the fullscreen, 13 the scale and scroll position saved before may or may not apply anymore, we need to adjust the 14 scale and/or scroll position if needed to make sure no over-scale or over-scroll in the new orientation. 15 16 * Api/WebPage.cpp: 17 (BlackBerry::WebKit::WebPagePrivate::setViewportSize): 18 (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement): 19 * Api/WebPage_p.h: 20 (WebPagePrivate): 21 1 22 2013-01-16 Joe Mason <jmason@rim.com> 2 23
Note: See TracChangeset
for help on using the changeset viewer.