Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| index 3ad08c2f8690a0b53c26c12ddbb85d11157304f1..5c44b4465a5bc2e3a6b25a5c16ce75dea78fbfca 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| @@ -28,6 +28,7 @@ |
| #include "core/dom/Document.h" |
| #include "core/editing/EditingUtilities.h" |
| +#include "core/frame/FrameHost.h" |
| #include "core/frame/FrameView.h" |
| #include "core/frame/LocalFrame.h" |
| #include "core/frame/Settings.h" |
| @@ -53,10 +54,13 @@ |
| #include "core/layout/api/LineLayoutBox.h" |
| #include "core/layout/compositing/PaintLayerCompositor.h" |
| #include "core/layout/shapes/ShapeOutsideInfo.h" |
| +#include "core/layout/svg/LayoutSVGRoot.h" |
| #include "core/page/AutoscrollController.h" |
| #include "core/page/Page.h" |
| +#include "core/page/scrolling/RootScrollerController.h" |
| #include "core/page/scrolling/ScrollingCoordinator.h" |
| #include "core/page/scrolling/SnapCoordinator.h" |
| +#include "core/page/scrolling/TopDocumentRootScrollerController.h" |
| #include "core/paint/BackgroundImageGeometry.h" |
| #include "core/paint/BoxPaintInvalidator.h" |
| #include "core/paint/BoxPainter.h" |
| @@ -1379,7 +1383,11 @@ bool LayoutBox::nodeAtPoint(HitTestResult& result, |
| HitTestAction action) { |
| LayoutPoint adjustedLocation = accumulatedOffset + location(); |
| - if (!isLayoutView()) { |
| + if (this != |
| + document() |
| + .rootScrollerController() |
| + .effectiveRootScroller() |
| + .layoutObject()) { |
| // Check if we need to do anything at all. |
| // If we have clipping, then we can't have any spillout. |
| LayoutRect overflowBox = |
| @@ -1789,6 +1797,25 @@ PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded( |
| LayoutRect LayoutBox::overflowClipRect( |
| const LayoutPoint& location, |
| OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { |
| + // If this box is the global root scroller, it's clip rect needs to match the |
| + // viewport. This might be larger than the ordinary overflow rect since hiding |
| + // the URL bar can expose more content without changing the box size. |
| + if (FrameHost* host = document().frameHost()) { |
| + Element* globalRootScroller = |
| + host->globalRootScrollerController().globalRootScroller(); |
| + bool applySVGViewportClip = |
|
chrishtr
2017/01/21 02:06:47
overflowClipRect is a virtual method. You can put
|
| + isSVGRoot() && toLayoutSVGRoot(this)->shouldApplyViewportClip(); |
| + if (!applySVGViewportClip && node() && node() == globalRootScroller) { |
|
chrishtr
2017/01/21 02:06:47
Is it possible for the rootScroller to not have a
|
| + LayoutView* topView = document().topDocument().layoutView(); |
| + // If the view rect is empty, LayoutView::overflowClipRect will fallback |
| + // to the LayoutBox implementation so prevent infinitely recursing. |
| + if (!topView->viewRect().isEmpty()) { |
|
chrishtr
2017/01/21 02:06:47
How about just adjusting overflowClipRect() for La
|
| + return topView->overflowClipRect(location, |
| + overlayScrollbarClipBehavior); |
| + } |
| + } |
| + } |
| + |
| // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property |
| // here. |
| LayoutRect clipRect = borderBoxRect(); |