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

Unified 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: stripped localPaintingInfo cleanup and fixed-pos workarounds 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/LayerDescendantClipRecorder.cpp
diff --git a/Source/core/paint/LayerDescendantClipRecorder.cpp b/Source/core/paint/LayerDescendantClipRecorder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..86b0db87e87d982a6bf93eaa94856b0b9d8b8449
--- /dev/null
+++ b/Source/core/paint/LayerDescendantClipRecorder.cpp
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/LayerDescendantClipRecorder.h"
+
+#include "core/layout/LayoutBox.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutPoint.h"
+#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/ClipDisplayItem.h"
+#include "platform/graphics/paint/DisplayItemList.h"
+
+namespace blink {
+
+LayerDescendantClipRecorder::LayerDescendantClipRecorder(GraphicsContext& context, const LayoutBox& layoutBox, const LayoutPoint& paintOffset)
+ : m_graphicsContext(context)
+ , m_layoutBox(layoutBox)
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ ASSERT(layoutBox.hasOverflowClip());
+
+ LayoutRect clipRect = layoutBox.overflowClipRect(paintOffset);
+ Vector<FloatRoundedRect> roundedRects;
+ if (layoutBox.style()->hasBorderRadius())
+ roundedRects.append(layoutBox.style()->getRoundedInnerBorderFor(LayoutRect(paintOffset, layoutBox.size())));
+
+ if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabled())
+ return;
+ m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(m_layoutBox, DisplayItem::ClipDescendantStackingContext, pixelSnappedIntRect(clipRect), roundedRects);
+}
+
+LayerDescendantClipRecorder::~LayerDescendantClipRecorder()
+{
+ ASSERT(m_graphicsContext.displayItemList());
+ if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDisabled()) {
+ if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin())
+ m_graphicsContext.displayItemList()->removeLastDisplayItem();
+ else
+ m_graphicsContext.displayItemList()->createAndAppend<EndClipDisplayItem>(m_layoutBox, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipDescendantStackingContext));
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698