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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2519163003: LayoutView's paint layer should clip to the full viewport size. (Closed)
Patch Set: Add test Created 4 years 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 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 if (layerBounds.intersects(damageRect)) 2420 if (layerBounds.intersects(damageRect))
2421 return true; 2421 return true;
2422 } 2422 }
2423 2423
2424 // Otherwise we need to compute the bounding box of this single layer and see 2424 // Otherwise we need to compute the bounding box of this single layer and see
2425 // if it intersects the damage rect. 2425 // if it intersects the damage rect.
2426 return physicalBoundingBox(offsetFromRoot).intersects(damageRect); 2426 return physicalBoundingBox(offsetFromRoot).intersects(damageRect);
2427 } 2427 }
2428 2428
2429 LayoutRect PaintLayer::logicalBoundingBox() const { 2429 LayoutRect PaintLayer::logicalBoundingBox() const {
2430 return layoutObject()->visualOverflowRect(); 2430 LayoutRect rect = layoutObject()->visualOverflowRect();
2431
2432 if (isRootLayer()) {
2433 rect.unite(
2434 LayoutRect(rect.location(), layoutObject()->view()->viewRect().size()));
2435 }
2436
2437 return rect;
2431 } 2438 }
2432 2439
2433 static inline LayoutRect flippedLogicalBoundingBox( 2440 static inline LayoutRect flippedLogicalBoundingBox(
2434 LayoutRect boundingBox, 2441 LayoutRect boundingBox,
2435 LayoutObject* layoutObjects) { 2442 LayoutObject* layoutObjects) {
2436 LayoutRect result = boundingBox; 2443 LayoutRect result = boundingBox;
2437 if (layoutObjects->isBox()) 2444 if (layoutObjects->isBox())
2438 toLayoutBox(layoutObjects)->flipForWritingMode(result); 2445 toLayoutBox(layoutObjects)->flipForWritingMode(result);
2439 else 2446 else
2440 layoutObjects->containingBlock()->flipForWritingMode(result); 2447 layoutObjects->containingBlock()->flipForWritingMode(result);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 2541
2535 if (!ancestorLayer) 2542 if (!ancestorLayer)
2536 ancestorLayer = this; 2543 ancestorLayer = this;
2537 2544
2538 // FIXME: This could be improved to do a check like 2545 // FIXME: This could be improved to do a check like
2539 // hasVisibleNonCompositingDescendantLayers() (bug 92580). 2546 // hasVisibleNonCompositingDescendantLayers() (bug 92580).
2540 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()) 2547 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant())
2541 return LayoutRect(); 2548 return LayoutRect();
2542 2549
2543 // Without composited scrolling, the root layer is the size of the document. 2550 // Without composited scrolling, the root layer is the size of the document.
2544 if (isRootLayer() && !needsCompositedScrolling()) 2551 if (isRootLayer() && !needsCompositedScrolling()) {
2545 return LayoutRect(m_layoutObject->view()->documentRect()); 2552 IntRect documentRect = layoutObject()->view()->documentRect();
2553
2554 if (FrameView* frameView = layoutObject()->document().view()) {
2555 documentRect.unite(IntRect(IntPoint(), frameView->visibleContentSize()));
2556 }
2557
2558 return LayoutRect(documentRect);
2559 }
2546 2560
2547 // The layer created for the LayoutFlowThread is just a helper for painting 2561 // The layer created for the LayoutFlowThread is just a helper for painting
2548 // and hit-testing, and should not contribute to the bounding box. The 2562 // and hit-testing, and should not contribute to the bounding box. The
2549 // LayoutMultiColumnSets will contribute the correct size for the layout 2563 // LayoutMultiColumnSets will contribute the correct size for the layout
2550 // content of the multicol container. 2564 // content of the multicol container.
2551 if (layoutObject()->isLayoutFlowThread()) 2565 if (layoutObject()->isLayoutFlowThread())
2552 return LayoutRect(); 2566 return LayoutRect();
2553 2567
2554 // If there is a clip applied by an ancestor to this PaintLayer but below or 2568 // If there is a clip applied by an ancestor to this PaintLayer but below or
2555 // equal to |ancestorLayer|, use that clip as the bounds rather than the 2569 // equal to |ancestorLayer|, use that clip as the bounds rather than the
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 } 3264 }
3251 3265
3252 void showLayerTree(const blink::LayoutObject* layoutObject) { 3266 void showLayerTree(const blink::LayoutObject* layoutObject) {
3253 if (!layoutObject) { 3267 if (!layoutObject) {
3254 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3268 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3255 return; 3269 return;
3256 } 3270 }
3257 showLayerTree(layoutObject->enclosingLayer()); 3271 showLayerTree(layoutObject->enclosingLayer());
3258 } 3272 }
3259 #endif 3273 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698