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

Unified Diff: Source/core/paint/RoundedInnerRectClipper.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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/RoundedInnerRectClipper.cpp
diff --git a/Source/core/paint/RoundedInnerRectClipper.cpp b/Source/core/paint/RoundedInnerRectClipper.cpp
index 5f4274cc6bdedd8a7e88c758d4c57acecfb6c2de..5b56263ebf62c5a47d83482eea3de40b31e79a01 100644
--- a/Source/core/paint/RoundedInnerRectClipper.cpp
+++ b/Source/core/paint/RoundedInnerRectClipper.cpp
@@ -18,34 +18,33 @@ RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, con
, m_useDisplayItemList(RuntimeEnabledFeatures::slimmingPaintEnabled() && behavior == ApplyToDisplayListIfEnabled)
, m_clipType(m_useDisplayItemList ? m_paintInfo.displayItemTypeForClipping() : DisplayItem::ClipBoxPaintPhaseFirst)
{
- OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObject, m_clipType, LayoutRect::infiniteIntRect());
-
+ OwnPtr<Vector<FloatRoundedRect>> roundedRectClips = adoptPtr(new Vector<FloatRoundedRect>());
if (clipRect.isRenderable()) {
- clipDisplayItem->roundedRectClips().append(clipRect);
+ roundedRectClips->append(clipRect);
} else {
// We create a rounded rect for each of the corners and clip it, while making sure we clip opposing corners together.
if (!clipRect.radii().topLeft().isEmpty() || !clipRect.radii().bottomRight().isEmpty()) {
FloatRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.maxX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y());
FloatRoundedRect::Radii topCornerRadii;
topCornerRadii.setTopLeft(clipRect.radii().topLeft());
- clipDisplayItem->roundedRectClips().append(FloatRoundedRect(topCorner, topCornerRadii));
+ roundedRectClips->append(FloatRoundedRect(topCorner, topCornerRadii));
FloatRect bottomCorner(rect.x().toFloat(), rect.y().toFloat(), clipRect.rect().maxX() - rect.x().toFloat(), clipRect.rect().maxY() - rect.y().toFloat());
FloatRoundedRect::Radii bottomCornerRadii;
bottomCornerRadii.setBottomRight(clipRect.radii().bottomRight());
- clipDisplayItem->roundedRectClips().append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
+ roundedRectClips->append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
}
if (!clipRect.radii().topRight().isEmpty() || !clipRect.radii().bottomLeft().isEmpty()) {
FloatRect topCorner(rect.x().toFloat(), clipRect.rect().y(), clipRect.rect().maxX() - rect.x().toFloat(), rect.maxY() - clipRect.rect().y());
FloatRoundedRect::Radii topCornerRadii;
topCornerRadii.setTopRight(clipRect.radii().topRight());
- clipDisplayItem->roundedRectClips().append(FloatRoundedRect(topCorner, topCornerRadii));
+ roundedRectClips->append(FloatRoundedRect(topCorner, topCornerRadii));
FloatRect bottomCorner(clipRect.rect().x(), rect.y().toFloat(), rect.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y().toFloat());
FloatRoundedRect::Radii bottomCornerRadii;
bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft());
- clipDisplayItem->roundedRectClips().append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
+ roundedRectClips->append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
}
}
@@ -53,9 +52,10 @@ RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, con
ASSERT(m_paintInfo.context->displayItemList());
if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled())
return;
- m_paintInfo.context->displayItemList()->add(clipDisplayItem.release());
+ m_paintInfo.context->displayItemList()->createAndAppendIfNeeded<ClipDisplayItem>(layoutObject, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips.release());
} else {
- clipDisplayItem->replay(*paintInfo.context);
+ ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips.release());
+ clipDisplayItem.replay(*paintInfo.context);
}
}
@@ -66,8 +66,7 @@ RoundedInnerRectClipper::~RoundedInnerRectClipper()
ASSERT(m_paintInfo.context->displayItemList());
if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled())
return;
- OwnPtr<EndClipDisplayItem> endClipDisplayItem = EndClipDisplayItem::create(m_layoutObject, endType);
- m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release());
+ m_paintInfo.context->displayItemList()->createAndAppendIfNeeded<EndClipDisplayItem>(m_layoutObject, endType);
} else {
EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType);
endClipDisplayItem.replay(*m_paintInfo.context);

Powered by Google App Engine
This is Rietveld 408576698