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

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

Issue 1284203004: Generate scroll/clip display item hierarchy for SPv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix assertion failure 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/paint/LayerDescendantClipRecorder.h"
7
8 #include "core/layout/LayoutBox.h"
9 #include "platform/RuntimeEnabledFeatures.h"
10 #include "platform/geometry/IntRect.h"
11 #include "platform/geometry/LayoutPoint.h"
12 #include "platform/graphics/GraphicsContext.h"
13 #include "platform/graphics/paint/ClipDisplayItem.h"
14 #include "platform/graphics/paint/DisplayItemList.h"
15
16 namespace blink {
17
18 LayerDescendantClipRecorder::LayerDescendantClipRecorder(GraphicsContext& contex t, const LayoutBox& layoutBox, const LayoutPoint& paintOffset)
19 : m_graphicsContext(context)
20 , m_layoutObject(layoutBox)
21 {
22 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
23 ASSERT(layoutBox.hasOverflowClip());
24
25 LayoutRect clipRect = layoutBox.overflowClipRect(paintOffset);
26 Vector<FloatRoundedRect> roundedRects;
27 if (layoutBox.style()->hasBorderRadius())
28 roundedRects.append(layoutBox.style()->getRoundedInnerBorderFor(LayoutRe ct(paintOffset, layoutBox.size())));
29
30 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
31 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed())
32 return;
33 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(m_ layoutObject, DisplayItem::ClipDescendantStackingContext, pixelSnappedIntRect(cl ipRect), roundedRects);
34 } else {
35 ClipDisplayItem clipDisplayItem(m_layoutObject, DisplayItem::ClipDescend antStackingContext, pixelSnappedIntRect(clipRect), roundedRects);
36 clipDisplayItem.replay(m_graphicsContext);
37 }
38 }
39
40 LayerDescendantClipRecorder::~LayerDescendantClipRecorder()
41 {
42 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
43 ASSERT(m_graphicsContext.displayItemList());
44 if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDisab led()) {
45 if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin( ))
46 m_graphicsContext.displayItemList()->removeLastDisplayItem();
47 else
48 m_graphicsContext.displayItemList()->createAndAppend<EndClipDisp layItem>(m_layoutObject, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipDes cendantStackingContext));
49 }
50 } else {
51 m_graphicsContext.restore();
52 }
53 }
54
55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698