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

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: Added top_controls_content_offset 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
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 , m_fullscreenController(FullscreenController::create(this)) 403 , m_fullscreenController(FullscreenController::create(this))
404 , m_showFPSCounter(false) 404 , m_showFPSCounter(false)
405 , m_showPaintRects(false) 405 , m_showPaintRects(false)
406 , m_showDebugBorders(false) 406 , m_showDebugBorders(false)
407 , m_continuousPaintingEnabled(false) 407 , m_continuousPaintingEnabled(false)
408 , m_showScrollBottleneckRects(false) 408 , m_showScrollBottleneckRects(false)
409 , m_baseBackgroundColor(Color::white) 409 , m_baseBackgroundColor(Color::white)
410 , m_backgroundColorOverride(Color::transparent) 410 , m_backgroundColorOverride(Color::transparent)
411 , m_zoomFactorOverride(0) 411 , m_zoomFactorOverride(0)
412 , m_userGestureObserved(false) 412 , m_userGestureObserved(false)
413 , m_topControlsContentOffset(0)
413 { 414 {
414 Page::PageClients pageClients; 415 Page::PageClients pageClients;
415 pageClients.chromeClient = &m_chromeClientImpl; 416 pageClients.chromeClient = &m_chromeClientImpl;
416 pageClients.contextMenuClient = &m_contextMenuClientImpl; 417 pageClients.contextMenuClient = &m_contextMenuClientImpl;
417 pageClients.editorClient = &m_editorClientImpl; 418 pageClients.editorClient = &m_editorClientImpl;
418 pageClients.dragClient = &m_dragClientImpl; 419 pageClients.dragClient = &m_dragClientImpl;
419 pageClients.inspectorClient = &m_inspectorClientImpl; 420 pageClients.inspectorClient = &m_inspectorClientImpl;
420 pageClients.backForwardClient = &m_backForwardClientImpl; 421 pageClients.backForwardClient = &m_backForwardClientImpl;
421 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 422 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
422 pageClients.storageClient = &m_storageClientImpl; 423 pageClients.storageClient = &m_storageClientImpl;
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 // usually set equal to the view size. These values are not considered viewp ort-dependent 1648 // usually set equal to the view size. These values are not considered viewp ort-dependent
1648 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de pendent in emulation mode, 1649 // (see MediaQueryExp::isViewportDependent), since they are only viewport-de pendent in emulation mode,
1649 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|. 1650 // and thus will not be invalidated in |FrameView::performPreLayoutTasks|.
1650 // Therefore we should force explicit media queries invalidation here. 1651 // Therefore we should force explicit media queries invalidation here.
1651 if (page()->inspectorController().deviceEmulationEnabled()) { 1652 if (page()->inspectorController().deviceEmulationEnabled()) {
1652 if (Document* document = localFrameRootTemporary()->frame()->document()) 1653 if (Document* document = localFrameRootTemporary()->frame()->document())
1653 document->mediaQueryAffectingValueChanged(); 1654 document->mediaQueryAffectingValueChanged();
1654 } 1655 }
1655 } 1656 }
1656 1657
1658 void WebViewImpl::setTopControlsContentOffset(float offset)
1659 {
1660 m_topControlsContentOffset = offset;
1661 m_layerTreeView->setTopControlsContentOffset(offset);
1662 }
1663
1657 void WebViewImpl::resize(const WebSize& newSize) 1664 void WebViewImpl::resize(const WebSize& newSize)
1658 { 1665 {
1659 if (m_shouldAutoResize || m_size == newSize) 1666 if (m_shouldAutoResize || m_size == newSize)
1660 return; 1667 return;
1661 1668
1662 FrameView* view = localFrameRootTemporary()->frameView(); 1669 FrameView* view = localFrameRootTemporary()->frameView();
1663 if (!view) 1670 if (!view)
1664 return; 1671 return;
1665 1672
1666 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() 1673 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges()
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 4094
4088 if (frameView->scrollPosition() == scrollPosition) 4095 if (frameView->scrollPosition() == scrollPosition)
4089 return; 4096 return;
4090 4097
4091 bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); 4098 bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
4092 frameView->setInProgrammaticScroll(programmaticScroll); 4099 frameView->setInProgrammaticScroll(programmaticScroll);
4093 frameView->notifyScrollPositionChanged(scrollPosition); 4100 frameView->notifyScrollPositionChanged(scrollPosition);
4094 frameView->setInProgrammaticScroll(oldProgrammaticScroll); 4101 frameView->setInProgrammaticScroll(oldProgrammaticScroll);
4095 } 4102 }
4096 4103
4097 void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal eDelta) 4104 void WebViewImpl::applyViewportProperties(const WebSize& scrollDelta, float page ScaleDelta, float topControlsDelta)
4098 { 4105 {
4099 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4106 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4100 return; 4107 return;
4101 4108
4109 setTopControlsContentOffset(m_topControlsContentOffset + topControlsDelta);
4110
4102 if (pinchVirtualViewportEnabled()) { 4111 if (pinchVirtualViewportEnabled()) {
4103 if (pageScaleDelta != 1) { 4112 if (pageScaleDelta != 1) {
4104 // When the virtual viewport is enabled, offsets are already set for us. 4113 // When the virtual viewport is enabled, offsets are already set for us.
4105 setPageScaleFactor(pageScaleFactor() * pageScaleDelta); 4114 setPageScaleFactor(pageScaleFactor() * pageScaleDelta);
4106 m_doubleTapZoomPending = false; 4115 m_doubleTapZoomPending = false;
4107 } 4116 }
4108 4117
4109 return; 4118 return;
4110 } 4119 }
4111 4120
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4277 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4269 4278
4270 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4279 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4271 return false; 4280 return false;
4272 4281
4273 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4282 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4274 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4283 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4275 } 4284 }
4276 4285
4277 } // namespace blink 4286 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698