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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e7bdf2dd346cc4876f2c59ec4bce9e226881c52c
--- /dev/null
+++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerUtil.cpp
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/page/scrolling/RootScrollerUtil.h"
+
+#include "core/dom/Document.h"
+#include "core/dom/Element.h"
+#include "core/frame/FrameView.h"
+#include "core/layout/LayoutBox.h"
+#include "core/layout/LayoutObject.h"
+#include "core/paint/PaintLayerScrollableArea.h"
+
+namespace blink {
+
+namespace RootScrollerUtil {
+
+ScrollableArea* scrollableAreaFor(const Element& element)
+{
+ if (!element.layoutObject() || !element.layoutObject()->isBox())
+ return nullptr;
+
+ LayoutBox* box = toLayoutBox(element.layoutObject());
+
+ // For a FrameView, we use the layoutViewport rather than the
+ // getScrollableArea() since that could be the RootFrameViewport. The
+ // rootScroller's ScrollableArea will be swapped in as the layout viewport
+ // in RootFrameViewport so we need to ensure we get the layout viewport.
+ if (box->isDocumentElement())
+ return element.document().view()->layoutViewportScrollableArea();
+
+ return static_cast<PaintInvalidationCapableScrollableArea*>(
+ box->getScrollableArea());
+}
+
+} // namespace RootScrollerUtil
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698