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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2128363002: Moved viewport layer registration into WebViewImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rootScrollerPinchedIn2
Patch Set: Moved visual viewport layer registration into WebViewImpl Created 4 years, 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/page/scrolling/ScrollingCoordinator.h" 46 #include "core/page/scrolling/ScrollingCoordinator.h"
47 #include "platform/Histogram.h" 47 #include "platform/Histogram.h"
48 #include "platform/TraceEvent.h" 48 #include "platform/TraceEvent.h"
49 #include "platform/geometry/DoubleRect.h" 49 #include "platform/geometry/DoubleRect.h"
50 #include "platform/geometry/FloatSize.h" 50 #include "platform/geometry/FloatSize.h"
51 #include "platform/graphics/CompositorMutableProperties.h" 51 #include "platform/graphics/CompositorMutableProperties.h"
52 #include "platform/graphics/GraphicsLayer.h" 52 #include "platform/graphics/GraphicsLayer.h"
53 #include "platform/scroll/Scrollbar.h" 53 #include "platform/scroll/Scrollbar.h"
54 #include "platform/scroll/ScrollbarThemeOverlay.h" 54 #include "platform/scroll/ScrollbarThemeOverlay.h"
55 #include "public/platform/WebCompositorSupport.h" 55 #include "public/platform/WebCompositorSupport.h"
56 #include "public/platform/WebLayer.h"
57 #include "public/platform/WebLayerTreeView.h"
58 #include "public/platform/WebScrollbar.h" 56 #include "public/platform/WebScrollbar.h"
59 #include "public/platform/WebScrollbarLayer.h" 57 #include "public/platform/WebScrollbarLayer.h"
60 #include <memory> 58 #include <memory>
61 59
62 using blink::WebLayer;
63 using blink::WebLayerTreeView;
64 using blink::WebScrollbar;
65 using blink::WebScrollbarLayer;
66 using blink::FrameHost;
67 using blink::GraphicsLayer;
68
69 namespace blink { 60 namespace blink {
70 61
71 VisualViewport::VisualViewport(FrameHost& owner) 62 VisualViewport::VisualViewport(FrameHost& owner)
72 : m_frameHost(&owner) 63 : m_frameHost(&owner)
73 , m_scale(1) 64 , m_scale(1)
74 , m_topControlsAdjustment(0) 65 , m_topControlsAdjustment(0)
75 , m_maxPageScale(-1) 66 , m_maxPageScale(-1)
76 , m_trackPinchZoomStatsForPage(false) 67 , m_trackPinchZoomStatsForPage(false)
77 { 68 {
78 reset(); 69 reset();
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height( ) - scrollbarThickness : 0; 460 int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height( ) - scrollbarThickness : 0;
470 int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - s crollbarThickness : scrollbarThickness; 461 int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - s crollbarThickness : scrollbarThickness;
471 int height = isHorizontal ? scrollbarThickness : m_innerViewportContainerLay er->size().height() - scrollbarThickness; 462 int height = isHorizontal ? scrollbarThickness : m_innerViewportContainerLay er->size().height() - scrollbarThickness;
472 463
473 // Use the GraphicsLayer to position the scrollbars. 464 // Use the GraphicsLayer to position the scrollbars.
474 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition)); 465 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition));
475 scrollbarGraphicsLayer->setSize(FloatSize(width, height)); 466 scrollbarGraphicsLayer->setSize(FloatSize(width, height));
476 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height)); 467 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height));
477 } 468 }
478 469
479 void VisualViewport::registerLayersWithTreeView(WebLayerTreeView* layerTreeView) const 470 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const
480 { 471 {
481 TRACE_EVENT0("blink", "VisualViewport::registerLayersWithTreeView"); 472 // TODO(bokan): This is currently done while registering viewport layers
482 ASSERT(layerTreeView); 473 // with the compositor but could it actually be done earlier, like in
483 474 // setupScrollbars? Then we wouldn't need this method.
484 if (!mainFrame())
485 return;
486
487 ASSERT(!frameHost().page().deprecatedLocalMainFrame()->contentLayoutItem().i sNull());
488
489 PaintLayerCompositor* compositor = frameHost().page().deprecatedLocalMainFra me()->contentLayoutItem().compositor();
490 // Get the outer viewport scroll layer.
491 WebLayer* scrollLayer = compositor->scrollLayer() ? compositor->scrollLayer( )->platformLayer() : 0;
492
493 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); 475 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer);
494 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); 476 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer);
495
496 ASSERT(compositor);
497 layerTreeView->registerViewportLayers(
498 m_overscrollElasticityLayer->platformLayer(),
499 m_pageScaleLayer->platformLayer(),
500 m_innerViewportScrollLayer->platformLayer(),
501 scrollLayer);
502 } 477 }
503 478
504 bool VisualViewport::visualViewportSuppliesScrollbars() const 479 bool VisualViewport::visualViewportSuppliesScrollbars() const
505 { 480 {
506 return frameHost().settings().viewportEnabled(); 481 return frameHost().settings().viewportEnabled();
507 } 482 }
508 483
509 bool VisualViewport::scrollAnimatorEnabled() const 484 bool VisualViewport::scrollAnimatorEnabled() const
510 { 485 {
511 return frameHost().settings().scrollAnimatorEnabled(); 486 return frameHost().settings().scrollAnimatorEnabled();
512 } 487 }
513 488
514 void VisualViewport::clearLayersForTreeView(WebLayerTreeView* layerTreeView) con st
515 {
516 ASSERT(layerTreeView);
517
518 layerTreeView->clearViewportLayers();
519 }
520
521 HostWindow* VisualViewport::getHostWindow() const 489 HostWindow* VisualViewport::getHostWindow() const
522 { 490 {
523 return &frameHost().chromeClient(); 491 return &frameHost().chromeClient();
524 } 492 }
525 493
526 DoubleRect VisualViewport::visibleContentRectDouble(IncludeScrollbarsInRect) con st 494 DoubleRect VisualViewport::visibleContentRectDouble(IncludeScrollbarsInRect) con st
527 { 495 {
528 return visibleRect(); 496 return visibleRect();
529 } 497 }
530 498
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } else if (graphicsLayer == m_rootTransformLayer.get()) { 800 } else if (graphicsLayer == m_rootTransformLayer.get()) {
833 name = "Root Transform Layer"; 801 name = "Root Transform Layer";
834 } else { 802 } else {
835 ASSERT_NOT_REACHED(); 803 ASSERT_NOT_REACHED();
836 } 804 }
837 805
838 return name; 806 return name;
839 } 807 }
840 808
841 } // namespace blink 809 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | third_party/WebKit/Source/web/ChromeClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698