Index: third_party/WebKit/Source/core/frame/RootFrameViewport.cpp |
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp |
index fee7310bad65be23c40f23f626111291570a1801..3077ec5d8257e7059731fc138da82316843c3bf4 100644 |
--- a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp |
+++ b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp |
@@ -5,7 +5,11 @@ |
#include "core/frame/RootFrameViewport.h" |
#include "core/frame/FrameView.h" |
+#include "core/frame/LocalFrame.h" |
#include "core/layout/ScrollAlignment.h" |
+#include "core/layout/compositing/CompositedLayerMapping.h" |
+#include "core/page/Page.h" |
+#include "core/paint/PaintLayer.h" |
#include "platform/geometry/DoubleRect.h" |
#include "platform/geometry/FloatRect.h" |
#include "platform/geometry/LayoutRect.h" |
@@ -86,6 +90,35 @@ LayoutBox* RootFrameViewport::layoutBox() const |
return layoutViewport().layoutBox(); |
} |
+LocalFrame* RootFrameViewport::mainFrame() const |
+{ |
+ if (!layoutBox()) |
+ return 0; |
+ |
+ LocalFrame* frame = layoutBox()->frame(); |
+ if (!frame && !frame->page()) |
+ return 0; |
+ |
+ return frame->page()->mainFrame() && frame->page()->mainFrame()->isLocalFrame() ? frame->page()->deprecatedLocalMainFrame() : 0; |
+} |
+ |
+CompositedLayerMapping* RootFrameViewport::compositedLayerMapping() const |
+{ |
+ |
+ LocalFrame* frame = mainFrame(); |
+ |
+ if (!frame || !frame->view()) |
+ return 0; |
+ |
+ if (frame && frame->view()) { |
+ FrameView* view = frame->view(); |
+ if (!view->layoutViewItem().isNull() && view->layoutViewItem().layer()->hasCompositedLayerMapping()) |
+ return view->layoutViewItem().layer()->compositedLayerMapping(); |
+ } |
+ |
+ return 0; |
+} |
+ |
void RootFrameViewport::updateScrollAnimator() |
{ |
scrollAnimator().setCurrentPosition(toFloatPoint(scrollOffsetFromScrollAnimators())); |
@@ -294,12 +327,50 @@ GraphicsLayer* RootFrameViewport::layerForScrolling() const |
GraphicsLayer* RootFrameViewport::layerForHorizontalScrollbar() const |
{ |
- return layoutViewport().layerForHorizontalScrollbar(); |
+ LocalFrame* frame = mainFrame(); |
bokan
2016/09/02 16:01:54
I don't think you need any of the changes in this
MuVen
2016/09/02 16:36:12
so as i understand its better to retain the old de
MuVen
2016/09/06 10:07:29
Done.
|
+ |
+ if (!frame || !frame->view()) |
+ return 0; |
+ |
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
+ if (CompositedLayerMapping* m_compositedLayerMapping = compositedLayerMapping()) { |
+ return m_compositedLayerMapping->layerForHorizontalScrollbar(); |
+ } |
+ } |
+ |
+ return frame->view()->layerForHorizontalScrollbar(); |
} |
GraphicsLayer* RootFrameViewport::layerForVerticalScrollbar() const |
{ |
- return layoutViewport().layerForVerticalScrollbar(); |
+ LocalFrame* frame = mainFrame(); |
+ |
+ if (!frame || !frame->view()) |
+ return 0; |
+ |
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
+ if (CompositedLayerMapping* m_compositedLayerMapping = compositedLayerMapping()) { |
+ return m_compositedLayerMapping->layerForVerticalScrollbar(); |
+ } |
+ } |
+ |
+ return frame->view()->layerForVerticalScrollbar(); |
+} |
+ |
+GraphicsLayer* RootFrameViewport::layerForScrollCorner() const |
+{ |
+ LocalFrame* frame = mainFrame(); |
+ |
+ if (!frame || !frame->view()) |
+ return 0; |
+ |
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
+ if (CompositedLayerMapping* m_compositedLayerMapping = compositedLayerMapping()) { |
+ return m_compositedLayerMapping->layerForScrollCorner(); |
+ } |
+ } |
+ |
+ return frame->view()->layerForScrollCorner(); |
} |
ScrollResult RootFrameViewport::userScroll(ScrollGranularity granularity, const FloatSize& delta) |