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

Side by Side Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 2730573003: Moved FrameHost::m_visualViewport to Page (Closed)
Patch Set: Fixed some compile errors on mac and android Created 3 years, 9 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All
3 * Rights Reserved. 3 * Rights Reserved.
4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
5 * (http://www.torchmobile.com/) 5 * (http://www.torchmobile.com/)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 m_chromeClient(pageClients.chromeClient), 100 m_chromeClient(pageClients.chromeClient),
101 m_dragCaret(DragCaret::create()), 101 m_dragCaret(DragCaret::create()),
102 m_dragController(DragController::create(this)), 102 m_dragController(DragController::create(this)),
103 m_focusController(FocusController::create(this)), 103 m_focusController(FocusController::create(this)),
104 m_contextMenuController( 104 m_contextMenuController(
105 ContextMenuController::create(this, pageClients.contextMenuClient)), 105 ContextMenuController::create(this, pageClients.contextMenuClient)),
106 m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()), 106 m_pageScaleConstraintsSet(PageScaleConstraintsSet::create()),
107 m_pointerLockController(PointerLockController::create(this)), 107 m_pointerLockController(PointerLockController::create(this)),
108 m_browserControls(BrowserControls::create(*this)), 108 m_browserControls(BrowserControls::create(*this)),
109 m_eventHandlerRegistry(new EventHandlerRegistry(*this)), 109 m_eventHandlerRegistry(new EventHandlerRegistry(*this)),
110 m_visualViewport(VisualViewport::create(*this)),
110 m_mainFrame(nullptr), 111 m_mainFrame(nullptr),
111 m_editorClient(pageClients.editorClient), 112 m_editorClient(pageClients.editorClient),
112 m_spellCheckerClient(pageClients.spellCheckerClient), 113 m_spellCheckerClient(pageClients.spellCheckerClient),
113 m_useCounter(pageClients.chromeClient && 114 m_useCounter(pageClients.chromeClient &&
114 pageClients.chromeClient->isSVGImageChromeClient() 115 pageClients.chromeClient->isSVGImageChromeClient()
115 ? UseCounter::SVGImageContext 116 ? UseCounter::SVGImageContext
116 : UseCounter::DefaultContext), 117 : UseCounter::DefaultContext),
117 m_openedByDOM(false), 118 m_openedByDOM(false),
118 m_tabKeyCyclesThroughElements(true), 119 m_tabKeyCyclesThroughElements(true),
119 m_suspended(false), 120 m_suspended(false),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 175 }
175 176
176 EventHandlerRegistry& Page::eventHandlerRegistry() { 177 EventHandlerRegistry& Page::eventHandlerRegistry() {
177 return *m_eventHandlerRegistry; 178 return *m_eventHandlerRegistry;
178 } 179 }
179 180
180 const EventHandlerRegistry& Page::eventHandlerRegistry() const { 181 const EventHandlerRegistry& Page::eventHandlerRegistry() const {
181 return *m_eventHandlerRegistry; 182 return *m_eventHandlerRegistry;
182 } 183 }
183 184
185 VisualViewport& Page::visualViewport() {
186 return *m_visualViewport;
187 }
188
189 const VisualViewport& Page::visualViewport() const {
190 return *m_visualViewport;
191 }
192
184 ClientRectList* Page::nonFastScrollableRects(const LocalFrame* frame) { 193 ClientRectList* Page::nonFastScrollableRects(const LocalFrame* frame) {
185 DisableCompositingQueryAsserts disabler; 194 DisableCompositingQueryAsserts disabler;
186 if (ScrollingCoordinator* scrollingCoordinator = 195 if (ScrollingCoordinator* scrollingCoordinator =
187 this->scrollingCoordinator()) { 196 this->scrollingCoordinator()) {
188 // Hits in compositing/iframes/iframe-composited-scrolling.html 197 // Hits in compositing/iframes/iframe-composited-scrolling.html
189 scrollingCoordinator->updateAfterCompositingChangeIfNeeded(); 198 scrollingCoordinator->updateAfterCompositingChangeIfNeeded();
190 } 199 }
191 200
192 GraphicsLayer* layer = 201 GraphicsLayer* layer =
193 frame->view()->layoutViewportScrollableArea()->layerForScrolling(); 202 frame->view()->layoutViewportScrollableArea()->layerForScrolling();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 322
314 FrameView* rootView = deprecatedLocalMainFrame()->view(); 323 FrameView* rootView = deprecatedLocalMainFrame()->view();
315 324
316 if (!rootView) 325 if (!rootView)
317 return; 326 return;
318 327
319 rootView->setNeedsLayout(); 328 rootView->setNeedsLayout();
320 } 329 }
321 330
322 void Page::setPageScaleFactor(float scale) { 331 void Page::setPageScaleFactor(float scale) {
323 frameHost().visualViewport().setScale(scale); 332 visualViewport().setScale(scale);
324 } 333 }
325 334
326 float Page::pageScaleFactor() const { 335 float Page::pageScaleFactor() const {
327 return frameHost().visualViewport().scale(); 336 return visualViewport().scale();
328 } 337 }
329 338
330 void Page::setDeviceScaleFactorDeprecated(float scaleFactor) { 339 void Page::setDeviceScaleFactorDeprecated(float scaleFactor) {
331 if (m_deviceScaleFactor == scaleFactor) 340 if (m_deviceScaleFactor == scaleFactor)
332 return; 341 return;
333 342
334 m_deviceScaleFactor = scaleFactor; 343 m_deviceScaleFactor = scaleFactor;
335 344
336 if (mainFrame() && mainFrame()->isLocalFrame()) 345 if (mainFrame() && mainFrame()->isLocalFrame())
337 deprecatedLocalMainFrame()->deviceScaleFactorChanged(); 346 deprecatedLocalMainFrame()->deviceScaleFactorChanged();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (m_mainFrame == frame) { 524 if (m_mainFrame == frame) {
516 KURL url; 525 KURL url;
517 if (frame->document()) 526 if (frame->document())
518 url = frame->document()->url(); 527 url = frame->document()->url();
519 528
520 // TODO(rbyers): Most of this doesn't appear to take into account that each 529 // TODO(rbyers): Most of this doesn't appear to take into account that each
521 // SVGImage gets it's own Page instance. 530 // SVGImage gets it's own Page instance.
522 frameHost().consoleMessageStorage().clear(); 531 frameHost().consoleMessageStorage().clear();
523 useCounter().didCommitLoad(url); 532 useCounter().didCommitLoad(url);
524 deprecation().clearSuppression(); 533 deprecation().clearSuppression();
525 frameHost().visualViewport().sendUMAMetrics(); 534 visualViewport().sendUMAMetrics();
526 535
527 // Need to reset visual viewport position here since before commit load we 536 // Need to reset visual viewport position here since before commit load we
528 // would update the previous history item, Page::didCommitLoad is called 537 // would update the previous history item, Page::didCommitLoad is called
529 // after a new history item is created in FrameLoader. 538 // after a new history item is created in FrameLoader.
530 // See crbug.com/642279 539 // See crbug.com/642279
531 frameHost().visualViewport().setScrollOffset(ScrollOffset(), 540 visualViewport().setScrollOffset(ScrollOffset(), ProgrammaticScroll);
532 ProgrammaticScroll);
533 m_hostsUsingFeatures.updateMeasurementsAndClear(); 541 m_hostsUsingFeatures.updateMeasurementsAndClear();
534 } 542 }
535 } 543 }
536 544
537 void Page::acceptLanguagesChanged() { 545 void Page::acceptLanguagesChanged() {
538 HeapVector<Member<LocalFrame>> frames; 546 HeapVector<Member<LocalFrame>> frames;
539 547
540 // Even though we don't fire an event from here, the LocalDOMWindow's will 548 // Even though we don't fire an event from here, the LocalDOMWindow's will
541 // fire an event so we keep the frames alive until we are done. 549 // fire an event so we keep the frames alive until we are done.
542 for (Frame* frame = mainFrame(); frame; 550 for (Frame* frame = mainFrame(); frame;
(...skipping 11 matching lines...) Expand all
554 visitor->trace(m_autoscrollController); 562 visitor->trace(m_autoscrollController);
555 visitor->trace(m_chromeClient); 563 visitor->trace(m_chromeClient);
556 visitor->trace(m_dragCaret); 564 visitor->trace(m_dragCaret);
557 visitor->trace(m_dragController); 565 visitor->trace(m_dragController);
558 visitor->trace(m_focusController); 566 visitor->trace(m_focusController);
559 visitor->trace(m_contextMenuController); 567 visitor->trace(m_contextMenuController);
560 visitor->trace(m_pointerLockController); 568 visitor->trace(m_pointerLockController);
561 visitor->trace(m_scrollingCoordinator); 569 visitor->trace(m_scrollingCoordinator);
562 visitor->trace(m_browserControls); 570 visitor->trace(m_browserControls);
563 visitor->trace(m_eventHandlerRegistry); 571 visitor->trace(m_eventHandlerRegistry);
572 visitor->trace(m_visualViewport);
564 visitor->trace(m_mainFrame); 573 visitor->trace(m_mainFrame);
565 visitor->trace(m_validationMessageClient); 574 visitor->trace(m_validationMessageClient);
566 visitor->trace(m_useCounter); 575 visitor->trace(m_useCounter);
567 visitor->trace(m_frameHost); 576 visitor->trace(m_frameHost);
568 Supplementable<Page>::trace(visitor); 577 Supplementable<Page>::trace(visitor);
569 PageVisibilityNotifier::trace(visitor); 578 PageVisibilityNotifier::trace(visitor);
570 } 579 }
571 580
572 void Page::layerTreeViewInitialized(WebLayerTreeView& layerTreeView, 581 void Page::layerTreeViewInitialized(WebLayerTreeView& layerTreeView,
573 FrameView* view) { 582 FrameView* view) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 : chromeClient(nullptr), 614 : chromeClient(nullptr),
606 contextMenuClient(nullptr), 615 contextMenuClient(nullptr),
607 editorClient(nullptr), 616 editorClient(nullptr),
608 spellCheckerClient(nullptr) {} 617 spellCheckerClient(nullptr) {}
609 618
610 Page::PageClients::~PageClients() {} 619 Page::PageClients::~PageClients() {}
611 620
612 template class CORE_TEMPLATE_EXPORT Supplement<Page>; 621 template class CORE_TEMPLATE_EXPORT Supplement<Page>;
613 622
614 } // namespace blink 623 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698