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

Side by Side Diff: Source/core/paint/LayerClipRecorder.cpp

Issue 1284203004: Generate scroll/clip display item hierarchy for SPv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix failing test. Update test expectation. Created 5 years, 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/LayerClipRecorder.h" 6 #include "core/paint/LayerClipRecorder.h"
7 7
8 #include "core/layout/ClipRect.h" 8 #include "core/layout/ClipRect.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 10 #include "core/paint/DeprecatedPaintLayer.h"
(...skipping 21 matching lines...) Expand all
32 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 32 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
33 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed()) 33 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed())
34 return; 34 return;
35 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(la youtObject, m_clipType, snappedClipRect, roundedRects); 35 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(la youtObject, m_clipType, snappedClipRect, roundedRects);
36 } else { 36 } else {
37 ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, snappedClipRec t, roundedRects); 37 ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, snappedClipRec t, roundedRects);
38 clipDisplayItem.replay(graphicsContext); 38 clipDisplayItem.replay(graphicsContext);
39 } 39 }
40 } 40 }
41 41
42 LayerClipRecorder::LayerClipRecorder(GraphicsContext& context, const LayoutBox& layoutBox, const LayoutPoint& paintOffset)
43 : m_graphicsContext(context)
44 , m_layoutObject(layoutBox)
45 , m_clipType(DisplayItem::ClipDescendantStackingContext)
46 {
47 ASSERT(layoutBox.hasOverflowClip());
pdr. 2015/09/03 06:16:59 Can you assert spv2 here? ASSERT(RuntimeEnabledFea
trchen 2015/09/04 06:10:15 Done.
48
49 LayoutRect clipRect = layoutBox.overflowClipRect(paintOffset);
50 Vector<FloatRoundedRect> roundedRects;
51 if (layoutBox.style()->hasBorderRadius())
52 roundedRects.append(layoutBox.style()->getRoundedInnerBorderFor(LayoutRe ct(paintOffset, layoutBox.size())));
53
54 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
55 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed())
56 return;
57 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(m_ layoutObject, m_clipType, pixelSnappedIntRect(clipRect), roundedRects);
58 } else {
59 ClipDisplayItem clipDisplayItem(m_layoutObject, m_clipType, pixelSnapped IntRect(clipRect), roundedRects);
60 clipDisplayItem.replay(m_graphicsContext);
61 }
62 }
63
42 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP aintLayer* endLayer) 64 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP aintLayer* endLayer)
43 { 65 {
44 if (startLayer == endLayer) 66 if (startLayer == endLayer)
45 return true; 67 return true;
46 68
47 LayoutView* view = startLayer->layoutObject()->view(); 69 LayoutView* view = startLayer->layoutObject()->view();
48 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock (); currentBlock && currentBlock != view; currentBlock = currentBlock->containin gBlock()) { 70 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock (); currentBlock && currentBlock != view; currentBlock = currentBlock->containin gBlock()) {
49 if (currentBlock->layer() == endLayer) 71 if (currentBlock->layer() == endLayer)
50 return true; 72 return true;
51 } 73 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 m_graphicsContext.displayItemList()->removeLastDisplayItem(); 109 m_graphicsContext.displayItemList()->removeLastDisplayItem();
88 else 110 else
89 m_graphicsContext.displayItemList()->createAndAppend<EndClipDisp layItem>(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType)); 111 m_graphicsContext.displayItemList()->createAndAppend<EndClipDisp layItem>(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType));
90 } 112 }
91 } else { 113 } else {
92 m_graphicsContext.restore(); 114 m_graphicsContext.restore();
93 } 115 }
94 } 116 }
95 117
96 } // namespace blink 118 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698