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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2623213002: Expand PaintLayer clip to account for hidden URL bar with document.rootScroller (Closed)
Patch Set: Rebase Created 3 years, 11 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
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 10 matching lines...) Expand all
21 * along with this library; see the file COPYING.LIB. If not, write to 21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 * 24 *
25 */ 25 */
26 26
27 #include "core/layout/LayoutBox.h" 27 #include "core/layout/LayoutBox.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/editing/EditingUtilities.h" 30 #include "core/editing/EditingUtilities.h"
31 #include "core/frame/FrameHost.h"
31 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
32 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
33 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
34 #include "core/html/HTMLElement.h" 35 #include "core/html/HTMLElement.h"
35 #include "core/html/HTMLFrameElementBase.h" 36 #include "core/html/HTMLFrameElementBase.h"
36 #include "core/html/HTMLFrameOwnerElement.h" 37 #include "core/html/HTMLFrameOwnerElement.h"
37 #include "core/input/EventHandler.h" 38 #include "core/input/EventHandler.h"
38 #include "core/layout/HitTestResult.h" 39 #include "core/layout/HitTestResult.h"
39 #include "core/layout/LayoutAnalyzer.h" 40 #include "core/layout/LayoutAnalyzer.h"
40 #include "core/layout/LayoutDeprecatedFlexibleBox.h" 41 #include "core/layout/LayoutDeprecatedFlexibleBox.h"
41 #include "core/layout/LayoutFlexibleBox.h" 42 #include "core/layout/LayoutFlexibleBox.h"
42 #include "core/layout/LayoutGrid.h" 43 #include "core/layout/LayoutGrid.h"
43 #include "core/layout/LayoutInline.h" 44 #include "core/layout/LayoutInline.h"
44 #include "core/layout/LayoutListMarker.h" 45 #include "core/layout/LayoutListMarker.h"
45 #include "core/layout/LayoutMultiColumnFlowThread.h" 46 #include "core/layout/LayoutMultiColumnFlowThread.h"
46 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" 47 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
47 #include "core/layout/LayoutPart.h" 48 #include "core/layout/LayoutPart.h"
48 #include "core/layout/LayoutTableCell.h" 49 #include "core/layout/LayoutTableCell.h"
49 #include "core/layout/LayoutView.h" 50 #include "core/layout/LayoutView.h"
50 #include "core/layout/api/LayoutAPIShim.h" 51 #include "core/layout/api/LayoutAPIShim.h"
51 #include "core/layout/api/LayoutPartItem.h" 52 #include "core/layout/api/LayoutPartItem.h"
52 #include "core/layout/api/LineLayoutBlockFlow.h" 53 #include "core/layout/api/LineLayoutBlockFlow.h"
53 #include "core/layout/api/LineLayoutBox.h" 54 #include "core/layout/api/LineLayoutBox.h"
54 #include "core/layout/compositing/PaintLayerCompositor.h" 55 #include "core/layout/compositing/PaintLayerCompositor.h"
55 #include "core/layout/shapes/ShapeOutsideInfo.h" 56 #include "core/layout/shapes/ShapeOutsideInfo.h"
57 #include "core/layout/svg/LayoutSVGRoot.h"
56 #include "core/page/AutoscrollController.h" 58 #include "core/page/AutoscrollController.h"
57 #include "core/page/Page.h" 59 #include "core/page/Page.h"
60 #include "core/page/scrolling/RootScrollerController.h"
58 #include "core/page/scrolling/ScrollingCoordinator.h" 61 #include "core/page/scrolling/ScrollingCoordinator.h"
59 #include "core/page/scrolling/SnapCoordinator.h" 62 #include "core/page/scrolling/SnapCoordinator.h"
63 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
60 #include "core/paint/BackgroundImageGeometry.h" 64 #include "core/paint/BackgroundImageGeometry.h"
61 #include "core/paint/BoxPaintInvalidator.h" 65 #include "core/paint/BoxPaintInvalidator.h"
62 #include "core/paint/BoxPainter.h" 66 #include "core/paint/BoxPainter.h"
63 #include "core/paint/PaintLayer.h" 67 #include "core/paint/PaintLayer.h"
64 #include "core/style/ShadowList.h" 68 #include "core/style/ShadowList.h"
65 #include "platform/LengthFunctions.h" 69 #include "platform/LengthFunctions.h"
66 #include "platform/geometry/DoubleRect.h" 70 #include "platform/geometry/DoubleRect.h"
67 #include "platform/geometry/FloatQuad.h" 71 #include "platform/geometry/FloatQuad.h"
68 #include "platform/geometry/FloatRoundedRect.h" 72 #include "platform/geometry/FloatRoundedRect.h"
69 #include "wtf/PtrUtil.h" 73 #include "wtf/PtrUtil.h"
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 return std::max(LayoutUnit(), result); 1376 return std::max(LayoutUnit(), result);
1373 } 1377 }
1374 1378
1375 // Hit Testing 1379 // Hit Testing
1376 bool LayoutBox::nodeAtPoint(HitTestResult& result, 1380 bool LayoutBox::nodeAtPoint(HitTestResult& result,
1377 const HitTestLocation& locationInContainer, 1381 const HitTestLocation& locationInContainer,
1378 const LayoutPoint& accumulatedOffset, 1382 const LayoutPoint& accumulatedOffset,
1379 HitTestAction action) { 1383 HitTestAction action) {
1380 LayoutPoint adjustedLocation = accumulatedOffset + location(); 1384 LayoutPoint adjustedLocation = accumulatedOffset + location();
1381 1385
1382 if (!isLayoutView()) { 1386 if (this !=
1387 document()
1388 .rootScrollerController()
1389 .effectiveRootScroller()
1390 .layoutObject()) {
1383 // Check if we need to do anything at all. 1391 // Check if we need to do anything at all.
1384 // If we have clipping, then we can't have any spillout. 1392 // If we have clipping, then we can't have any spillout.
1385 LayoutRect overflowBox = 1393 LayoutRect overflowBox =
1386 hasOverflowClip() ? borderBoxRect() : visualOverflowRect(); 1394 hasOverflowClip() ? borderBoxRect() : visualOverflowRect();
1387 flipForWritingMode(overflowBox); 1395 flipForWritingMode(overflowBox);
1388 overflowBox.moveBy(adjustedLocation); 1396 overflowBox.moveBy(adjustedLocation);
1389 if (!locationInContainer.intersects(overflowBox)) 1397 if (!locationInContainer.intersects(overflowBox))
1390 return false; 1398 return false;
1391 } 1399 }
1392 1400
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 } 1790 }
1783 1791
1784 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded( 1792 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(
1785 const PaintInvalidatorContext& context) const { 1793 const PaintInvalidatorContext& context) const {
1786 return BoxPaintInvalidator(*this, context).invalidatePaintIfNeeded(); 1794 return BoxPaintInvalidator(*this, context).invalidatePaintIfNeeded();
1787 } 1795 }
1788 1796
1789 LayoutRect LayoutBox::overflowClipRect( 1797 LayoutRect LayoutBox::overflowClipRect(
1790 const LayoutPoint& location, 1798 const LayoutPoint& location,
1791 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { 1799 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
1800 // If this box is the global root scroller, it's clip rect needs to match the
1801 // viewport. This might be larger than the ordinary overflow rect since hiding
1802 // the URL bar can expose more content without changing the box size.
1803 if (FrameHost* host = document().frameHost()) {
1804 Element* globalRootScroller =
1805 host->globalRootScrollerController().globalRootScroller();
1806 bool applySVGViewportClip =
chrishtr 2017/01/21 02:06:47 overflowClipRect is a virtual method. You can put
1807 isSVGRoot() && toLayoutSVGRoot(this)->shouldApplyViewportClip();
1808 if (!applySVGViewportClip && node() && node() == globalRootScroller) {
chrishtr 2017/01/21 02:06:47 Is it possible for the rootScroller to not have a
1809 LayoutView* topView = document().topDocument().layoutView();
1810 // If the view rect is empty, LayoutView::overflowClipRect will fallback
1811 // to the LayoutBox implementation so prevent infinitely recursing.
1812 if (!topView->viewRect().isEmpty()) {
chrishtr 2017/01/21 02:06:47 How about just adjusting overflowClipRect() for La
1813 return topView->overflowClipRect(location,
1814 overlayScrollbarClipBehavior);
1815 }
1816 }
1817 }
1818
1792 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property 1819 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
1793 // here. 1820 // here.
1794 LayoutRect clipRect = borderBoxRect(); 1821 LayoutRect clipRect = borderBoxRect();
1795 clipRect.setLocation(location + clipRect.location() + 1822 clipRect.setLocation(location + clipRect.location() +
1796 LayoutSize(borderLeft(), borderTop())); 1823 LayoutSize(borderLeft(), borderTop()));
1797 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), 1824 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
1798 borderTop() + borderBottom())); 1825 borderTop() + borderBottom()));
1799 1826
1800 if (hasOverflowClip()) 1827 if (hasOverflowClip())
1801 excludeScrollbars(clipRect, overlayScrollbarClipBehavior); 1828 excludeScrollbars(clipRect, overlayScrollbarClipBehavior);
(...skipping 3893 matching lines...) Expand 10 before | Expand all | Expand 10 after
5695 block->adjustChildDebugRect(rect); 5722 block->adjustChildDebugRect(rect);
5696 5723
5697 return rect; 5724 return rect;
5698 } 5725 }
5699 5726
5700 bool LayoutBox::shouldClipOverflow() const { 5727 bool LayoutBox::shouldClipOverflow() const {
5701 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5728 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5702 } 5729 }
5703 5730
5704 } // namespace blink 5731 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698