OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | 5 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 DEFINE_TRACE(TopDocumentRootScrollerController) { | 34 DEFINE_TRACE(TopDocumentRootScrollerController) { |
35 visitor->trace(m_viewportApplyScroll); | 35 visitor->trace(m_viewportApplyScroll); |
36 visitor->trace(m_globalRootScroller); | 36 visitor->trace(m_globalRootScroller); |
37 visitor->trace(m_frameHost); | 37 visitor->trace(m_frameHost); |
38 } | 38 } |
39 | 39 |
40 void TopDocumentRootScrollerController::didChangeRootScroller() { | 40 void TopDocumentRootScrollerController::didChangeRootScroller() { |
41 recomputeGlobalRootScroller(); | 41 recomputeGlobalRootScroller(); |
42 } | 42 } |
43 | 43 |
| 44 void TopDocumentRootScrollerController::mainFrameViewResized() { |
| 45 Element* rootScroller = globalRootScroller(); |
| 46 if (!rootScroller) |
| 47 return; |
| 48 |
| 49 ScrollableArea* area = RootScrollerUtil::scrollableAreaFor(*rootScroller); |
| 50 |
| 51 if (!area) |
| 52 return; |
| 53 |
| 54 if (PaintLayer* layer = area->layer()) { |
| 55 layer->setNeedsCompositingInputsUpdate(); |
| 56 |
| 57 // This is needed if the root scroller is an iframe, since the iframe |
| 58 // doesn't have a scrolling/clip layer, its PLC has a container layer that |
| 59 // needs to be resized instead. |
| 60 layer->compositor()->frameViewDidChangeSize(); |
| 61 } |
| 62 } |
| 63 |
44 Element* TopDocumentRootScrollerController::findGlobalRootScrollerElement() { | 64 Element* TopDocumentRootScrollerController::findGlobalRootScrollerElement() { |
45 if (!topDocument()) | 65 if (!topDocument()) |
46 return nullptr; | 66 return nullptr; |
47 | 67 |
48 DCHECK(topDocument()->rootScrollerController()); | 68 DCHECK(topDocument()->rootScrollerController()); |
49 Element* element = | 69 Element* element = |
50 topDocument()->rootScrollerController()->effectiveRootScroller(); | 70 topDocument()->rootScrollerController()->effectiveRootScroller(); |
51 | 71 |
52 while (element && element->isFrameOwnerElement()) { | 72 while (element && element->isFrameOwnerElement()) { |
53 HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(element); | 73 HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(element); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 192 |
173 GraphicsLayer* graphicsLayer = area->layerForScrolling(); | 193 GraphicsLayer* graphicsLayer = area->layerForScrolling(); |
174 | 194 |
175 // TODO(bokan): We should assert graphicsLayer here and | 195 // TODO(bokan): We should assert graphicsLayer here and |
176 // RootScrollerController should do whatever needs to happen to ensure | 196 // RootScrollerController should do whatever needs to happen to ensure |
177 // the root scroller gets composited. | 197 // the root scroller gets composited. |
178 | 198 |
179 return graphicsLayer; | 199 return graphicsLayer; |
180 } | 200 } |
181 | 201 |
| 202 PaintLayer* TopDocumentRootScrollerController::rootScrollerPaintLayer() const { |
| 203 return RootScrollerUtil::paintLayerFor(m_globalRootScroller); |
| 204 } |
| 205 |
182 Element* TopDocumentRootScrollerController::globalRootScroller() const { | 206 Element* TopDocumentRootScrollerController::globalRootScroller() const { |
183 return m_globalRootScroller.get(); | 207 return m_globalRootScroller.get(); |
184 } | 208 } |
185 | 209 |
186 } // namespace blink | 210 } // namespace blink |
OLD | NEW |