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

Side by Side Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 22419002: Set up clip and scroll parents on the blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips, 1744 // Return true if the given layer has some ancestor in the RenderLayer hierarchy that clips,
1745 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented 1745 // up to the enclosing compositing ancestor. This is required because compositin g layers are parented
1746 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy. 1746 // according to the z-order hierarchy, yet clipping goes down the renderer hiera rchy.
1747 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy, 1747 // Thus, a RenderLayer can be clipped by a RenderLayer that is an ancestor in th e renderer hierarchy,
1748 // but a sibling in the z-order hierarchy. 1748 // but a sibling in the z-order hierarchy.
1749 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const 1749 bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const
1750 { 1750 {
1751 if (!layer->isComposited() || !layer->parent()) 1751 if (!layer->isComposited() || !layer->parent())
1752 return false; 1752 return false;
1753 1753
1754 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); 1754 // Scroll children use their scrolling ancestor as their clip root.
1755 RenderLayer* compositingAncestor = clippedByScrollingAncestor(layer)
enne (OOO) 2013/08/22 20:54:30 clippedByScrollingAncestor seems like a bunch of w
1756 ? layer->ancestorScrollingLayer()
1757 : layer->ancestorCompositingLayer();
1758
1755 if (!compositingAncestor) 1759 if (!compositingAncestor)
1756 return false; 1760 return false;
1757 1761
1758 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(), 1762 // If the compositingAncestor clips, that will be taken care of by clipsComp ositingDescendants(),
1759 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot), 1763 // so we only care about clipping between its first child that is our ancest or (the computeClipRoot),
1760 // and layer. 1764 // and layer.
1761 RenderLayer* computeClipRoot = 0; 1765 RenderLayer* computeClipRoot = 0;
1762 RenderLayer* curr = layer; 1766 RenderLayer* curr = layer;
1763 while (curr) { 1767 while (curr) {
1764 RenderLayer* next = curr->parent(); 1768 RenderLayer* next = curr->parent();
1765 if (next == compositingAncestor) { 1769 if (next == compositingAncestor) {
1766 computeClipRoot = curr; 1770 computeClipRoot = curr;
1767 break; 1771 break;
1768 } 1772 }
1769 curr = next; 1773 curr = next;
1770 } 1774 }
1771 1775
1772 if (!computeClipRoot || computeClipRoot == layer) 1776 if (!computeClipRoot || computeClipRoot == layer)
1773 return false; 1777 return false;
1774 1778
1775 return layer->backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRo ot, 0, TemporaryClipRects)).rect() != PaintInfo::infiniteRect(); // FIXME: Incor rect for CSS regions. 1779 return layer->backgroundClipRect(RenderLayer::ClipRectsContext(computeClipRo ot, 0, TemporaryClipRects)).rect() != PaintInfo::infiniteRect(); // FIXME: Incor rect for CSS regions.
1776 } 1780 }
1777 1781
1782 bool RenderLayerCompositor::clippedByScrollingAncestor(RenderLayer* layer) const
1783 {
1784 if (!layer->isComposited() || !layer->parent())
1785 return false;
1786
1787 if (!requiresCompositingForOverflowScrollingParent(layer))
1788 return false;
1789
1790 RenderLayer* compositingAncestor = layer->ancestorCompositingLayer();
1791 if (!compositingAncestor)
1792 return false;
1793
1794 RenderLayer* scrollingAncestor = layer->ancestorScrollingLayer();
1795 if (!scrollingAncestor)
1796 return false;
1797
1798 if (!scrollingAncestor->hasAncestor(compositingAncestor))
1799 return false;
1800
1801 // FIXME: Incorrect for CSS regions.
1802 RenderLayer::ClipRectsContext clipRectsContext(compositingAncestor, 0, Tempo raryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip, scrollingAncestor );
1803 LayoutRect clipRect = layer->backgroundClipRect(clipRectsContext).rect();
1804 return clipRect != PaintInfo::infiniteRect() && !clipRect.isEmpty();
1805 }
1806
1778 // Return true if the given layer is a stacking context and has compositing chil d 1807 // Return true if the given layer is a stacking context and has compositing chil d
1779 // layers that it needs to clip. In this case we insert a clipping GraphicsLayer 1808 // layers that it needs to clip. In this case we insert a clipping GraphicsLayer
1780 // into the hierarchy between this layer and its children in the z-order hierarc hy. 1809 // into the hierarchy between this layer and its children in the z-order hierarc hy.
1781 bool RenderLayerCompositor::clipsCompositingDescendants(const RenderLayer* layer ) const 1810 bool RenderLayerCompositor::clipsCompositingDescendants(const RenderLayer* layer ) const
1782 { 1811 {
1783 return layer->hasCompositingDescendant() && layer->renderer()->hasClipOrOver flowClip(); 1812 return layer->hasCompositingDescendant() && layer->renderer()->hasClipOrOver flowClip();
1784 } 1813 }
1785 1814
1786 bool RenderLayerCompositor::requiresCompositingForScrollableFrame() const 1815 bool RenderLayerCompositor::requiresCompositingForScrollableFrame() const
1787 { 1816 {
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 } else if (graphicsLayer == m_scrollLayer.get()) { 2742 } else if (graphicsLayer == m_scrollLayer.get()) {
2714 name = "Frame Scrolling Layer"; 2743 name = "Frame Scrolling Layer";
2715 } else { 2744 } else {
2716 ASSERT_NOT_REACHED(); 2745 ASSERT_NOT_REACHED();
2717 } 2746 }
2718 2747
2719 return name; 2748 return name;
2720 } 2749 }
2721 2750
2722 } // namespace WebCore 2751 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698