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

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

Issue 1193433004: Blink-side contiguous allocation of display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ready for review Created 5 years, 6 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 // 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/BoxClipper.h" 6 #include "core/paint/BoxClipper.h"
7 7
8 #include "core/layout/LayoutBox.h" 8 #include "core/layout/LayoutBox.h"
9 #include "core/paint/DeprecatedPaintLayer.h" 9 #include "core/paint/DeprecatedPaintLayer.h"
10 #include "core/paint/PaintInfo.h" 10 #include "core/paint/PaintInfo.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 LayoutRect conservativeClipRect = clipRect; 45 LayoutRect conservativeClipRect = clipRect;
46 if (hasBorderRadius) 46 if (hasBorderRadius)
47 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent erRect())); 47 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent erRect()));
48 conservativeClipRect.moveBy(-m_accumulatedOffset); 48 conservativeClipRect.moveBy(-m_accumulatedOffset);
49 if (m_box.hasLayer()) 49 if (m_box.hasLayer())
50 conservativeClipRect.move(m_box.scrolledContentOffset()); 50 conservativeClipRect.move(m_box.scrolledContentOffset());
51 if (conservativeClipRect.contains(contentsVisualOverflow)) 51 if (conservativeClipRect.contains(contentsVisualOverflow))
52 return; 52 return;
53 } 53 }
54 54
55 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
56 m_clipType = m_paintInfo.displayItemTypeForClipping();
57
58 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_box, m_c lipType, pixelSnappedIntRect(clipRect));
59 if (hasBorderRadius)
60 clipDisplayItem->roundedRectClips().append(clipRoundedRect);
61
62 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
63 ASSERT(m_paintInfo.context->displayItemList()); 56 ASSERT(m_paintInfo.context->displayItemList());
64 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi sabled()) 57 m_clipType = m_paintInfo.displayItemTypeForClipping();
65 m_paintInfo.context->displayItemList()->add(clipDisplayItem.release( )); 58 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi sabled()) {
59 if (hasBorderRadius)
60 m_paintInfo.context->displayItemList()->createAndAppendIfNeeded< ClipDisplayItem>(m_box, m_clipType, pixelSnappedIntRect(clipRect), clipRoundedRe ct);
61 else
62 m_paintInfo.context->displayItemList()->createAndAppendIfNeeded< ClipDisplayItem>(m_box, m_clipType, pixelSnappedIntRect(clipRect));
63 }
66 } else { 64 } else {
67 clipDisplayItem->replay(*paintInfo.context); 65 if (hasBorderRadius) {
66 ClipDisplayItem clipDisplayItem(m_box, m_clipType, pixelSnappedIntRe ct(clipRect), clipRoundedRect);
67 clipDisplayItem.replay(*paintInfo.context);
68 } else {
69 ClipDisplayItem clipDisplayItem(m_box, m_clipType, pixelSnappedIntRe ct(clipRect));
70 clipDisplayItem.replay(*paintInfo.context);
71 }
68 } 72 }
69 73
70 m_pushedClip = true; 74 m_pushedClip = true;
71 } 75 }
72 76
73 BoxClipper::~BoxClipper() 77 BoxClipper::~BoxClipper()
74 { 78 {
75 if (!m_pushedClip) 79 if (!m_pushedClip)
76 return; 80 return;
77 81
78 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer())); 82 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer()));
79 83
80 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); 84 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType);
81 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 85 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
82 if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDis abled()) 86 if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDis abled())
83 return; 87 return;
84 OwnPtr<EndClipDisplayItem> endClipDisplayItem = EndClipDisplayItem::crea te(m_box, endType);
85 ASSERT(m_paintInfo.context->displayItemList()); 88 ASSERT(m_paintInfo.context->displayItemList());
86 m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release() ); 89 m_paintInfo.context->displayItemList()->createAndAppendIfNeeded<EndClipD isplayItem>(m_box, endType);
87 } else { 90 } else {
88 EndClipDisplayItem endClipDisplayItem(m_box, endType); 91 EndClipDisplayItem endClipDisplayItem(m_box, endType);
89 endClipDisplayItem.replay(*m_paintInfo.context); 92 endClipDisplayItem.replay(*m_paintInfo.context);
90 } 93 }
91 } 94 }
92 95
93 } // namespace blink 96 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698