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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * version of this file under any of the LGPL, the MPL or the GPL. 42 * version of this file under any of the LGPL, the MPL or the GPL.
43 */ 43 */
44 44
45 #include "core/paint/PaintLayer.h" 45 #include "core/paint/PaintLayer.h"
46 46
47 #include "core/CSSPropertyNames.h" 47 #include "core/CSSPropertyNames.h"
48 #include "core/HTMLNames.h" 48 #include "core/HTMLNames.h"
49 #include "core/css/PseudoStyleRequest.h" 49 #include "core/css/PseudoStyleRequest.h"
50 #include "core/dom/Document.h" 50 #include "core/dom/Document.h"
51 #include "core/dom/shadow/ShadowRoot.h" 51 #include "core/dom/shadow/ShadowRoot.h"
52 #include "core/frame/FrameHost.h"
52 #include "core/frame/FrameView.h" 53 #include "core/frame/FrameView.h"
53 #include "core/frame/LocalFrame.h" 54 #include "core/frame/LocalFrame.h"
54 #include "core/frame/Settings.h" 55 #include "core/frame/Settings.h"
55 #include "core/layout/FragmentainerIterator.h" 56 #include "core/layout/FragmentainerIterator.h"
56 #include "core/layout/HitTestRequest.h" 57 #include "core/layout/HitTestRequest.h"
57 #include "core/layout/HitTestResult.h" 58 #include "core/layout/HitTestResult.h"
58 #include "core/layout/HitTestingTransformState.h" 59 #include "core/layout/HitTestingTransformState.h"
59 #include "core/layout/LayoutFlowThread.h" 60 #include "core/layout/LayoutFlowThread.h"
60 #include "core/layout/LayoutInline.h" 61 #include "core/layout/LayoutInline.h"
61 #include "core/layout/LayoutPart.h" 62 #include "core/layout/LayoutPart.h"
62 #include "core/layout/LayoutTreeAsText.h" 63 #include "core/layout/LayoutTreeAsText.h"
63 #include "core/layout/LayoutView.h" 64 #include "core/layout/LayoutView.h"
64 #include "core/layout/api/LayoutPartItem.h" 65 #include "core/layout/api/LayoutPartItem.h"
65 #include "core/layout/api/LayoutViewItem.h" 66 #include "core/layout/api/LayoutViewItem.h"
66 #include "core/layout/compositing/CompositedLayerMapping.h" 67 #include "core/layout/compositing/CompositedLayerMapping.h"
67 #include "core/layout/compositing/PaintLayerCompositor.h" 68 #include "core/layout/compositing/PaintLayerCompositor.h"
68 #include "core/layout/svg/LayoutSVGResourceClipper.h" 69 #include "core/layout/svg/LayoutSVGResourceClipper.h"
69 #include "core/layout/svg/LayoutSVGRoot.h" 70 #include "core/layout/svg/LayoutSVGRoot.h"
70 #include "core/page/Page.h" 71 #include "core/page/Page.h"
71 #include "core/page/scrolling/RootScrollerController.h" 72 #include "core/page/scrolling/RootScrollerController.h"
72 #include "core/page/scrolling/ScrollingCoordinator.h" 73 #include "core/page/scrolling/ScrollingCoordinator.h"
74 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
73 #include "core/paint/BoxReflectionUtils.h" 75 #include "core/paint/BoxReflectionUtils.h"
74 #include "core/paint/FilterEffectBuilder.h" 76 #include "core/paint/FilterEffectBuilder.h"
75 #include "core/paint/ObjectPaintInvalidator.h" 77 #include "core/paint/ObjectPaintInvalidator.h"
76 #include "platform/LengthFunctions.h" 78 #include "platform/LengthFunctions.h"
77 #include "platform/RuntimeEnabledFeatures.h" 79 #include "platform/RuntimeEnabledFeatures.h"
78 #include "platform/geometry/FloatPoint3D.h" 80 #include "platform/geometry/FloatPoint3D.h"
79 #include "platform/geometry/FloatRect.h" 81 #include "platform/geometry/FloatRect.h"
80 #include "platform/geometry/TransformState.h" 82 #include "platform/geometry/TransformState.h"
81 #include "platform/graphics/CompositorFilterOperations.h" 83 #include "platform/graphics/CompositorFilterOperations.h"
82 #include "platform/graphics/filters/Filter.h" 84 #include "platform/graphics/filters/Filter.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 207 }
206 208
207 String PaintLayer::debugName() const { 209 String PaintLayer::debugName() const {
208 return layoutObject()->debugName(); 210 return layoutObject()->debugName();
209 } 211 }
210 212
211 LayoutRect PaintLayer::visualRect() const { 213 LayoutRect PaintLayer::visualRect() const {
212 return m_layoutObject->visualRect(); 214 return m_layoutObject->visualRect();
213 } 215 }
214 216
217 bool PaintLayer::isRootScrollerLayer() const {
218 return this ==
219 layoutObject()
220 ->document()
221 .rootScrollerController()
222 .rootScrollerPaintLayer();
223 }
224
215 PaintLayerCompositor* PaintLayer::compositor() const { 225 PaintLayerCompositor* PaintLayer::compositor() const {
216 if (!layoutObject()->view()) 226 if (!layoutObject()->view())
217 return 0; 227 return 0;
218 return layoutObject()->view()->compositor(); 228 return layoutObject()->view()->compositor();
219 } 229 }
220 230
221 void PaintLayer::contentChanged(ContentChangeType changeType) { 231 void PaintLayer::contentChanged(ContentChangeType changeType) {
222 // updateLayerCompositingState will query compositingReasons for accelerated 232 // updateLayerCompositingState will query compositingReasons for accelerated
223 // overflow scrolling. This is tripped by 233 // overflow scrolling. This is tripped by
224 // LayoutTests/compositing/content-changed-chicken-egg.html 234 // LayoutTests/compositing/content-changed-chicken-egg.html
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 fragment.intersect(fragment.paginationClip); 1703 fragment.intersect(fragment.paginationClip);
1694 1704
1695 // TODO(mstensho): Don't add empty fragments. We've always done that in some 1705 // TODO(mstensho): Don't add empty fragments. We've always done that in some
1696 // cases, but there should be no reason to do so. Either filter them out 1706 // cases, but there should be no reason to do so. Either filter them out
1697 // here, or, even better: pass a better clip rectangle to the fragmentainer 1707 // here, or, even better: pass a better clip rectangle to the fragmentainer
1698 // iterator, so that we won't end up with empty fragments here. 1708 // iterator, so that we won't end up with empty fragments here.
1699 fragments.push_back(fragment); 1709 fragments.push_back(fragment);
1700 } 1710 }
1701 } 1711 }
1702 1712
1703 static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject) { 1713 static inline LayoutRect frameVisibleRect(PaintLayer* layer) {
1704 FrameView* frameView = layoutObject->document().view(); 1714 LayoutObject* layoutObject = layer->layoutObject();
1715 DCHECK(layoutObject);
1716
1717 Document& doc = layoutObject->document();
1718
1719 FrameView* frameView = doc.view();
1705 if (!frameView) 1720 if (!frameView)
1706 return LayoutRect(); 1721 return LayoutRect();
1707 1722
1708 return LayoutRect(frameView->visibleContentRect()); 1723 IntRect frameRect = frameView->visibleContentRect(ExcludeScrollbars);
1724
1725 FrameHost* host = doc.frameHost();
1726 DCHECK(host);
1727 if (host->globalRootScrollerController().isRootScrollerAncestor(doc)) {
chrishtr 2017/01/21 02:06:47 This adjustment in hit-testing code doesn't also a
1728 frameRect.setSize(host->globalRootScrollerController()
1729 .visibleContentRect(ExcludeScrollbars)
1730 .size());
1731 }
1732
1733 return LayoutRect(frameRect);
1709 } 1734 }
1710 1735
1711 bool PaintLayer::hitTest(HitTestResult& result) { 1736 bool PaintLayer::hitTest(HitTestResult& result) {
1712 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); 1737 DCHECK(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
1713 1738
1714 // LayoutView should make sure to update layout before entering hit testing 1739 // LayoutView should make sure to update layout before entering hit testing
1715 DCHECK(!layoutObject()->frame()->view()->layoutPending()); 1740 DCHECK(!layoutObject()->frame()->view()->layoutPending());
1716 DCHECK(!layoutObject()->document().layoutViewItem().needsLayout()); 1741 DCHECK(!layoutObject()->document().layoutViewItem().needsLayout());
1717 1742
1718 const HitTestRequest& request = result.hitTestRequest(); 1743 const HitTestRequest& request = result.hitTestRequest();
1719 const HitTestLocation& hitTestLocation = result.hitTestLocation(); 1744 const HitTestLocation& hitTestLocation = result.hitTestLocation();
1720 1745
1721 // Start with frameVisibleRect to ensure we include the scrollbars. 1746 // Start with frameVisibleRect to ensure we include the scrollbars.
1722 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); 1747 LayoutRect hitTestArea = frameVisibleRect(this);
1723 if (request.ignoreClipping()) 1748 if (request.ignoreClipping())
1724 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); 1749 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect()));
1725 1750
1726 PaintLayer* insideLayer = 1751 PaintLayer* insideLayer =
1727 hitTestLayer(this, 0, result, hitTestArea, hitTestLocation, false); 1752 hitTestLayer(this, 0, result, hitTestArea, hitTestLocation, false);
1728 if (!insideLayer && isRootLayer()) { 1753 if (!insideLayer && isRootLayer()) {
1729 IntRect hitRect = hitTestLocation.boundingBox(); 1754 IntRect hitRect = hitTestLocation.boundingBox();
1730 bool fallback = false; 1755 bool fallback = false;
1731 // If we didn't hit any layers but are still inside the document 1756 // If we didn't hit any layers but are still inside the document
1732 // bounds, then we should fallback to hitting the document. 1757 // bounds, then we should fallback to hitting the document.
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 } 3246 }
3222 3247
3223 void showLayerTree(const blink::LayoutObject* layoutObject) { 3248 void showLayerTree(const blink::LayoutObject* layoutObject) {
3224 if (!layoutObject) { 3249 if (!layoutObject) {
3225 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3250 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3226 return; 3251 return;
3227 } 3252 }
3228 showLayerTree(layoutObject->enclosingLayer()); 3253 showLayerTree(layoutObject->enclosingLayer());
3229 } 3254 }
3230 #endif 3255 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698