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

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

Issue 513053003: Made Blink aware of top controls offset (Blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 , m_fullscreenController(FullscreenController::create(this)) 405 , m_fullscreenController(FullscreenController::create(this))
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 { 416 {
416 Page::PageClients pageClients; 417 Page::PageClients pageClients;
417 pageClients.chromeClient = &m_chromeClientImpl; 418 pageClients.chromeClient = &m_chromeClientImpl;
418 pageClients.contextMenuClient = &m_contextMenuClientImpl; 419 pageClients.contextMenuClient = &m_contextMenuClientImpl;
419 pageClients.editorClient = &m_editorClientImpl; 420 pageClients.editorClient = &m_editorClientImpl;
420 pageClients.dragClient = &m_dragClientImpl; 421 pageClients.dragClient = &m_dragClientImpl;
421 pageClients.inspectorClient = &m_inspectorClientImpl; 422 pageClients.inspectorClient = &m_inspectorClientImpl;
422 pageClients.backForwardClient = &m_backForwardClientImpl; 423 pageClients.backForwardClient = &m_backForwardClientImpl;
423 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 424 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
424 pageClients.storageClient = &m_storageClientImpl; 425 pageClients.storageClient = &m_storageClientImpl;
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 // usually set equal to the view size. These values are not considered viewp ort-dependent 1655 // usually set equal to the view size. These values are not considered viewp ort-dependent
1655 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de pendent in emulation mode, 1656 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de pendent in emulation mode,
1656 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. 1657 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|.
1657 // Therefore we should force explicit media queries invalidation here. 1658 // Therefore we should force explicit media queries invalidation here.
1658 if (page()->inspectorController().deviceEmulationEnabled()) { 1659 if (page()->inspectorController().deviceEmulationEnabled()) {
1659 if (Document* document = localFrameRootTemporary()->frame()->document()) 1660 if (Document* document = localFrameRootTemporary()->frame()->document())
1660 document->mediaQueryAffectingValueChanged(); 1661 document->mediaQueryAffectingValueChanged();
1661 } 1662 }
1662 } 1663 }
1663 1664
1665 void WebViewImpl::setTopControlsContentOffset(float offset)
1666 {
1667 m_topControlsContentOffset = offset;
1668 m_layerTreeView->setTopControlsContentOffset(offset);
1669 }
1670
1664 void WebViewImpl::resize(const WebSize& newSize) 1671 void WebViewImpl::resize(const WebSize& newSize)
1665 { 1672 {
1666 if (m_shouldAutoResize || m_size == newSize) 1673 if (m_shouldAutoResize || m_size == newSize)
1667 return; 1674 return;
1668 1675
1669 FrameView* view = localFrameRootTemporary()->frameView(); 1676 FrameView* view = localFrameRootTemporary()->frameView();
1670 if (!view) 1677 if (!view)
1671 return; 1678 return;
1672 1679
1673 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() 1680 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges()
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
4093 4100
4094 if (frameView->scrollPosition() == scrollPosition) 4101 if (frameView->scrollPosition() == scrollPosition)
4095 return; 4102 return;
4096 4103
4097 bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); 4104 bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
4098 frameView->setInProgrammaticScroll(programmaticScroll); 4105 frameView->setInProgrammaticScroll(programmaticScroll);
4099 frameView->notifyScrollPositionChanged(scrollPosition); 4106 frameView->notifyScrollPositionChanged(scrollPosition);
4100 frameView->setInProgrammaticScroll(oldProgrammaticScroll); 4107 frameView->setInProgrammaticScroll(oldProgrammaticScroll);
4101 } 4108 }
4102 4109
4103 void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal eDelta) 4110 void WebViewImpl::applyViewportDeltas(const WebSize& scrollDelta, float pageScal eDelta, float topControlsDelta)
4104 { 4111 {
4105 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4112 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4106 return; 4113 return;
4107 4114
4115 setTopControlsContentOffset(m_topControlsContentOffset + topControlsDelta);
4116
4108 if (pinchVirtualViewportEnabled()) { 4117 if (pinchVirtualViewportEnabled()) {
4109 if (pageScaleDelta != 1) { 4118 if (pageScaleDelta != 1) {
4110 // When the virtual viewport is enabled, offsets are already set for us. 4119 // When the virtual viewport is enabled, offsets are already set for us.
4111 setPageScaleFactor(pageScaleFactor() * pageScaleDelta); 4120 setPageScaleFactor(pageScaleFactor() * pageScaleDelta);
4112 m_doubleTapZoomPending = false; 4121 m_doubleTapZoomPending = false;
4113 } 4122 }
4114 4123
4115 return; 4124 return;
4116 } 4125 }
4117 4126
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4278 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4287 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4279 4288
4280 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4289 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4281 return false; 4290 return false;
4282 4291
4283 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4292 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4284 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4293 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4285 } 4294 }
4286 4295
4287 } // namespace blink 4296 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698