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

Unified Diff: Source/core/rendering/RenderBoxClipper.cpp

Issue 732093002: Move RenderBoxClipper to core/paint/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/core/rendering/RenderBoxClipper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxClipper.cpp
diff --git a/Source/core/rendering/RenderBoxClipper.cpp b/Source/core/rendering/RenderBoxClipper.cpp
deleted file mode 100644
index c358886355db9d179cd38e17e4d47efdb7371002..0000000000000000000000000000000000000000
--- a/Source/core/rendering/RenderBoxClipper.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2014 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/rendering/RenderBoxClipper.h"
-
-#include "core/rendering/PaintInfo.h"
-#include "core/rendering/RenderBox.h"
-#include "core/rendering/RenderLayer.h"
-
-namespace blink {
-
-RenderBoxClipper::RenderBoxClipper(RenderBox& box, PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)
- : m_pushedClip(false)
- , m_accumulatedOffset(accumulatedOffset)
- , m_paintInfo(paintInfo)
- , m_originalPhase(paintInfo.phase)
- , m_box(box)
-{
- if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == PaintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask)
- return;
-
- bool isControlClip = m_box.hasControlClip();
- bool isOverflowClip = m_box.hasOverflowClip() && !m_box.layer()->isSelfPaintingLayer();
-
- if (!isControlClip && !isOverflowClip)
- return;
-
- LayoutRect clipRect = isControlClip ? m_box.controlClipRect(m_accumulatedOffset) : m_box.overflowClipRect(m_accumulatedOffset);
- RoundedRect clipRoundedRect(0, 0, 0, 0);
- bool hasBorderRadius = m_box.style()->hasBorderRadius();
- if (hasBorderRadius)
- clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(m_accumulatedOffset, m_box.size()));
-
- if (contentsClipBehavior == SkipContentsClipIfPossible) {
- LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect();
- if (contentsVisualOverflow.isEmpty())
- return;
-
- LayoutRect conservativeClipRect = clipRect;
- if (hasBorderRadius)
- conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect());
- conservativeClipRect.moveBy(-m_accumulatedOffset);
- if (m_box.hasLayer())
- conservativeClipRect.move(m_box.scrolledContentOffset());
- if (conservativeClipRect.contains(contentsVisualOverflow))
- return;
- }
-
- if (m_paintInfo.phase == PaintPhaseOutline) {
- m_paintInfo.phase = PaintPhaseChildOutlines;
- } else if (m_paintInfo.phase == PaintPhaseChildBlockBackground) {
- m_paintInfo.phase = PaintPhaseBlockBackground;
- m_box.paintObject(m_paintInfo, m_accumulatedOffset);
- m_paintInfo.phase = PaintPhaseChildBlockBackgrounds;
- }
- m_paintInfo.context->save();
- if (hasBorderRadius)
- m_paintInfo.context->clipRoundedRect(clipRoundedRect);
- m_paintInfo.context->clip(pixelSnappedIntRect(clipRect));
- m_pushedClip = true;
-}
-
-RenderBoxClipper::~RenderBoxClipper()
-{
- if (!m_pushedClip)
- return;
-
- ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()->isSelfPaintingLayer()));
-
- m_paintInfo.context->restore();
- if (m_originalPhase == PaintPhaseOutline) {
- m_paintInfo.phase = PaintPhaseSelfOutline;
- m_box.paintObject(m_paintInfo, m_accumulatedOffset);
- m_paintInfo.phase = m_originalPhase;
- } else if (m_originalPhase == PaintPhaseChildBlockBackground) {
- m_paintInfo.phase = m_originalPhase;
- }
-}
-
-} // namespace blink
« no previous file with comments | « Source/core/rendering/RenderBoxClipper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698