Index: Source/core/paint/BoxClipper.cpp |
diff --git a/Source/core/paint/BoxClipper.cpp b/Source/core/paint/BoxClipper.cpp |
index e9ad1b3894cdccf3d4cbe5c71541fd723396a040..b1e665501f9b931405d65286b7ff178c7da7cf03 100644 |
--- a/Source/core/paint/BoxClipper.cpp |
+++ b/Source/core/paint/BoxClipper.cpp |
@@ -15,12 +15,10 @@ |
namespace blink { |
-BoxClipper::BoxClipper(LayoutBox& box, const PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) |
- : m_pushedClip(false) |
- , m_accumulatedOffset(accumulatedOffset) |
+BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) |
+ : m_box(box) |
, m_paintInfo(paintInfo) |
- , m_box(box) |
- , m_clipType(DisplayItem::ClipBoxPaintPhaseFirst) |
+ , m_clipType(DisplayItem::UninitializedType) |
{ |
if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == PaintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
return; |
@@ -31,11 +29,11 @@ BoxClipper::BoxClipper(LayoutBox& box, const PaintInfo& paintInfo, const LayoutP |
if (!isControlClip && !isOverflowClip) |
return; |
- LayoutRect clipRect = isControlClip ? m_box.controlClipRect(m_accumulatedOffset) : m_box.overflowClipRect(m_accumulatedOffset); |
+ LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffset) : m_box.overflowClipRect(accumulatedOffset); |
FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
if (hasBorderRadius) |
- clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(m_accumulatedOffset, m_box.size())); |
+ clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, m_box.size())); |
if (contentsClipBehavior == SkipContentsClipIfPossible) { |
LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); |
@@ -45,50 +43,53 @@ BoxClipper::BoxClipper(LayoutBox& box, const PaintInfo& paintInfo, const LayoutP |
LayoutRect conservativeClipRect = clipRect; |
if (hasBorderRadius) |
conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCenterRect())); |
- conservativeClipRect.moveBy(-m_accumulatedOffset); |
+ conservativeClipRect.moveBy(-accumulatedOffset); |
if (m_box.hasLayer()) |
conservativeClipRect.move(m_box.scrolledContentOffset()); |
if (conservativeClipRect.contains(contentsVisualOverflow)) |
return; |
} |
- OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
- if (hasBorderRadius) { |
- roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
- roundedRects->append(clipRoundedRect); |
- } |
- |
- OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); |
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
- m_clipType = m_paintInfo.displayItemTypeForClipping(); |
ASSERT(m_paintInfo.context->displayItemList()); |
- if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled()) |
- m_paintInfo.context->displayItemList()->add(clipDisplayItem.release()); |
+ if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled()) { |
+ m_clipType = m_paintInfo.displayItemTypeForClipping(); |
+ OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
jbroman
2015/06/29 18:11:56
This code is used in both paths; suggest lifting i
jbroman
2015/06/29 18:11:56
Not introduced in this change, but why the double
|
+ if (hasBorderRadius) { |
+ roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
+ roundedRects->append(clipRoundedRect); |
+ } |
+ m_paintInfo.context->displayItemList()->createAndAppend<ClipDisplayItem>(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); |
+ } |
} else { |
- clipDisplayItem->replay(*paintInfo.context); |
+ m_clipType = m_paintInfo.displayItemTypeForClipping(); |
+ OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
+ if (hasBorderRadius) { |
+ roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
+ roundedRects->append(clipRoundedRect); |
+ } |
+ ClipDisplayItem clipDisplayItem(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); |
+ clipDisplayItem.replay(*paintInfo.context); |
} |
- |
- m_pushedClip = true; |
} |
BoxClipper::~BoxClipper() |
{ |
- if (!m_pushedClip) |
+ if (m_clipType == DisplayItem::UninitializedType) |
danakj
2015/06/29 17:43:51
now the assert below will not run if slimming pain
|
return; |
ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()->isSelfPaintingLayer())); |
- DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); |
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
ASSERT(m_paintInfo.context->displayItemList()); |
if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled()) { |
if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBegin()) |
m_paintInfo.context->displayItemList()->removeLastDisplayItem(); |
else |
- m_paintInfo.context->displayItemList()->add(EndClipDisplayItem::create(m_box, endType)); |
+ m_paintInfo.context->displayItemList()->createAndAppend<EndClipDisplayItem>(m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
} |
} else { |
- EndClipDisplayItem endClipDisplayItem(m_box, endType); |
+ EndClipDisplayItem endClipDisplayItem(m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
endClipDisplayItem.replay(*m_paintInfo.context); |
} |
} |