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

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

Issue 2285253003: Move TopDocumentRootScrollerController to a separate object on FrameHost (Closed)
Patch Set: Rebase Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/page/scrolling/RootScrollerUtil.h"
6
7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h"
9 #include "core/frame/FrameView.h"
10 #include "core/layout/LayoutBox.h"
11 #include "core/layout/LayoutObject.h"
12 #include "core/paint/PaintLayerScrollableArea.h"
13
14 namespace blink {
15
16 namespace RootScrollerUtil {
17
18 ScrollableArea* scrollableAreaFor(const Element& element)
19 {
20 if (!element.layoutObject() || !element.layoutObject()->isBox())
21 return nullptr;
22
23 LayoutBox* box = toLayoutBox(element.layoutObject());
24
25 // For a FrameView, we use the layoutViewport rather than the
26 // getScrollableArea() since that could be the RootFrameViewport. The
27 // rootScroller's ScrollableArea will be swapped in as the layout viewport
28 // in RootFrameViewport so we need to ensure we get the layout viewport.
29 if (box->isDocumentElement())
30 return element.document().view()->layoutViewportScrollableArea();
31
32 return static_cast<PaintInvalidationCapableScrollableArea*>(
33 box->getScrollableArea());
34 }
35
36 } // namespace RootScrollerUtil
37
38 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698