OLD | NEW |
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 , m_showFPSCounter(false) | 406 , m_showFPSCounter(false) |
407 , m_showPaintRects(false) | 407 , m_showPaintRects(false) |
408 , m_showDebugBorders(false) | 408 , m_showDebugBorders(false) |
409 , m_continuousPaintingEnabled(false) | 409 , m_continuousPaintingEnabled(false) |
410 , m_showScrollBottleneckRects(false) | 410 , m_showScrollBottleneckRects(false) |
411 , m_baseBackgroundColor(Color::white) | 411 , m_baseBackgroundColor(Color::white) |
412 , m_backgroundColorOverride(Color::transparent) | 412 , m_backgroundColorOverride(Color::transparent) |
413 , m_zoomFactorOverride(0) | 413 , m_zoomFactorOverride(0) |
414 , m_userGestureObserved(false) | 414 , m_userGestureObserved(false) |
415 , m_topControlsContentOffset(0) | 415 , m_topControlsContentOffset(0) |
416 , m_topControlsLayoutHeight(0) | 416 , m_topControlsHeight(0) |
| 417 , m_topControlsShrinkLayoutSize(true) |
| 418 , m_topControlsOffsetIsNormalized(true) |
417 { | 419 { |
418 Page::PageClients pageClients; | 420 Page::PageClients pageClients; |
419 pageClients.chromeClient = &m_chromeClientImpl; | 421 pageClients.chromeClient = &m_chromeClientImpl; |
420 pageClients.contextMenuClient = &m_contextMenuClientImpl; | 422 pageClients.contextMenuClient = &m_contextMenuClientImpl; |
421 pageClients.editorClient = &m_editorClientImpl; | 423 pageClients.editorClient = &m_editorClientImpl; |
422 pageClients.dragClient = &m_dragClientImpl; | 424 pageClients.dragClient = &m_dragClientImpl; |
423 pageClients.inspectorClient = &m_inspectorClientImpl; | 425 pageClients.inspectorClient = &m_inspectorClientImpl; |
424 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; | 426 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; |
425 | 427 |
426 m_page = adoptPtrWillBeNoop(new Page(pageClients)); | 428 m_page = adoptPtrWillBeNoop(new Page(pageClients)); |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1721 |
1720 void WebViewImpl::setTopControlsContentOffset(float offset) | 1722 void WebViewImpl::setTopControlsContentOffset(float offset) |
1721 { | 1723 { |
1722 m_topControlsContentOffset = offset; | 1724 m_topControlsContentOffset = offset; |
1723 m_layerTreeView->setTopControlsContentOffset(offset); | 1725 m_layerTreeView->setTopControlsContentOffset(offset); |
1724 didUpdateTopControls(); | 1726 didUpdateTopControls(); |
1725 } | 1727 } |
1726 | 1728 |
1727 void WebViewImpl::setTopControlsLayoutHeight(float height) | 1729 void WebViewImpl::setTopControlsLayoutHeight(float height) |
1728 { | 1730 { |
1729 m_topControlsLayoutHeight = height; | 1731 m_topControlsOffsetIsNormalized = false; |
| 1732 setTopControlsHeight(height, true); |
| 1733 } |
| 1734 |
| 1735 void WebViewImpl::setTopControlsHeight(float height, bool topControlsShrinkLayou
tSize) |
| 1736 { |
| 1737 if (m_topControlsHeight == height && m_topControlsShrinkLayoutSize == topCon
trolsShrinkLayoutSize) |
| 1738 return; |
| 1739 |
| 1740 m_topControlsHeight = height; |
| 1741 m_topControlsShrinkLayoutSize = topControlsShrinkLayoutSize; |
1730 didUpdateTopControls(); | 1742 didUpdateTopControls(); |
1731 } | 1743 } |
1732 | 1744 |
1733 void WebViewImpl::didUpdateTopControls() | 1745 void WebViewImpl::didUpdateTopControls() |
1734 { | 1746 { |
1735 WebLocalFrameImpl* localFrameRoot = localFrameRootTemporary(); | 1747 WebLocalFrameImpl* localFrameRoot = localFrameRootTemporary(); |
1736 if (!localFrameRoot) | 1748 if (!localFrameRoot) |
1737 return; | 1749 return; |
1738 | 1750 |
1739 FrameView* view = localFrameRoot->frameView(); | 1751 FrameView* view = localFrameRoot->frameView(); |
1740 if (!view) | 1752 if (!view) |
1741 return; | 1753 return; |
1742 | 1754 |
1743 float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topContr
olsContentOffset; | 1755 float topControlsViewportAdjustment = 0; |
| 1756 if (m_topControlsShrinkLayoutSize) |
| 1757 topControlsViewportAdjustment += m_topControlsHeight; |
| 1758 topControlsViewportAdjustment -= m_topControlsContentOffset * (m_topControls
OffsetIsNormalized ? m_topControlsHeight : 1); |
| 1759 |
1744 if (!pinchVirtualViewportEnabled()) { | 1760 if (!pinchVirtualViewportEnabled()) { |
1745 // The viewport bounds were adjusted on the compositor by this much due
to top controls. Tell | 1761 // The viewport bounds were adjusted on the compositor by this much due
to top controls. Tell |
1746 // the FrameView about it so it can make correct scroll offset clamping
decisions during compositor | 1762 // the FrameView about it so it can make correct scroll offset clamping
decisions during compositor |
1747 // commits. | 1763 // commits. |
1748 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); | 1764 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment); |
1749 } else { | 1765 } else { |
1750 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); | 1766 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); |
1751 | 1767 |
1752 if (pinchViewport.visibleRect().isEmpty()) | 1768 if (pinchViewport.visibleRect().isEmpty()) |
1753 return; | 1769 return; |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4606 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4622 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4607 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4623 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4608 } | 4624 } |
4609 | 4625 |
4610 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4626 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4611 { | 4627 { |
4612 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4628 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4613 } | 4629 } |
4614 | 4630 |
4615 } // namespace blink | 4631 } // namespace blink |
OLD | NEW |