Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 308513002: Fix fullscreen media control position issue when switching orientation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/FullscreenController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 FrameView* view = mainFrameImpl()->frameView(); 1587 FrameView* view = mainFrameImpl()->frameView();
1588 if (!view) 1588 if (!view)
1589 return; 1589 return;
1590 1590
1591 WebSize oldSize = m_size; 1591 WebSize oldSize = m_size;
1592 float oldPageScaleFactor = pageScaleFactor(); 1592 float oldPageScaleFactor = pageScaleFactor();
1593 int oldContentsWidth = contentsSize().width(); 1593 int oldContentsWidth = contentsSize().width();
1594 1594
1595 m_size = newSize; 1595 m_size = newSize;
1596 1596
1597 bool isFullscreen = m_fullscreenController->isFullscreen();
1597 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() 1598 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges()
1598 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width; 1599 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width & & !isFullscreen;
1599 1600
1600 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); 1601 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler());
1601 if (shouldAnchorAndRescaleViewport) { 1602 if (shouldAnchorAndRescaleViewport) {
1602 viewportAnchor.setAnchor(view->visibleContentRect(), 1603 viewportAnchor.setAnchor(view->visibleContentRect(),
1603 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); 1604 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord));
1604 } 1605 }
1605 1606
1606 { 1607 {
1607 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated. 1608 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated.
1608 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); 1609 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
1609 1610
1610 m_pageScaleConstraintsSet.didChangeViewSize(m_size); 1611 m_pageScaleConstraintsSet.didChangeViewSize(m_size);
1611 1612
1612 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription()); 1613 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1613 updateMainFrameLayoutSize(); 1614 updateMainFrameLayoutSize();
1614 1615
1615 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1616 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1616 if (agentPrivate) 1617 if (agentPrivate)
1617 agentPrivate->webViewResized(newSize); 1618 agentPrivate->webViewResized(newSize);
1618 1619
1619 // If the virtual viewport pinch mode is enabled, the main frame will be resized 1620 // If the virtual viewport pinch mode is enabled, the main frame will be resized
1620 // after layout so it can be sized to the contentsSize. 1621 // after layout so it can be sized to the contentsSize.
1621 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) 1622 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
1622 mainFrameImpl()->frameView()->resize(m_size); 1623 mainFrameImpl()->frameView()->resize(m_size);
1623 1624
1624 if (pinchVirtualViewportEnabled()) 1625 if (pinchVirtualViewportEnabled())
1625 page()->frameHost().pinchViewport().setSize(m_size); 1626 page()->frameHost().pinchViewport().setSize(m_size);
1626 } 1627 }
1627 1628
1628 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1629 if (isFullscreen) {
1630 setPageScaleFactor(1.0f, IntPoint());
aelias_OOO_until_Jul13 2014/05/28 23:45:55 Why is this line needed?
trchen 2014/05/29 00:02:13 Maybe not. Just tried without this line. No advers
1631 } else if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
1629 // Relayout immediately to recalculate the minimum scale limit. 1632 // Relayout immediately to recalculate the minimum scale limit.
1630 if (view->needsLayout()) 1633 if (view->needsLayout())
1631 view->layout(); 1634 view->layout();
1632 1635
1633 if (shouldAnchorAndRescaleViewport) { 1636 if (shouldAnchorAndRescaleViewport) {
1634 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1637 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1635 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1638 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
1636 float scaleMultiplier = viewportWidthRatio / contentsWidthRatio; 1639 float scaleMultiplier = viewportWidthRatio / contentsWidthRatio;
1637 1640
1638 IntSize viewportSize = view->visibleContentRect().size(); 1641 IntSize viewportSize = view->visibleContentRect().size();
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
4074 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4077 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4075 4078
4076 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4079 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4077 return false; 4080 return false;
4078 4081
4079 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4082 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4080 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4083 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4081 } 4084 }
4082 4085
4083 } // namespace blink 4086 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/FullscreenController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698