| OLD | NEW |
| 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/rendering/PaintInfo.h" | 8 #include "core/rendering/PaintInfo.h" |
| 9 #include "core/rendering/RenderBox.h" | 9 #include "core/rendering/RenderBox.h" |
| 10 #include "core/rendering/RenderLayer.h" | 10 #include "core/rendering/RenderLayer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) | 24 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
| 25 return; | 25 return; |
| 26 | 26 |
| 27 bool isControlClip = m_box.hasControlClip(); | 27 bool isControlClip = m_box.hasControlClip(); |
| 28 bool isOverflowClip = m_box.hasOverflowClip() && !m_box.layer()->isSelfPaint
ingLayer(); | 28 bool isOverflowClip = m_box.hasOverflowClip() && !m_box.layer()->isSelfPaint
ingLayer(); |
| 29 | 29 |
| 30 if (!isControlClip && !isOverflowClip) | 30 if (!isControlClip && !isOverflowClip) |
| 31 return; | 31 return; |
| 32 | 32 |
| 33 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(m_accumulatedOff
set) : m_box.overflowClipRect(m_accumulatedOffset); | 33 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(m_accumulatedOff
set) : m_box.overflowClipRect(m_accumulatedOffset); |
| 34 RoundedRect clipRoundedRect(0, 0, 0, 0); | 34 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
| 35 bool hasBorderRadius = m_box.style()->hasBorderRadius(); | 35 bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
| 36 if (hasBorderRadius) | 36 if (hasBorderRadius) |
| 37 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(m_a
ccumulatedOffset, m_box.size())); | 37 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(m_a
ccumulatedOffset, m_box.size())); |
| 38 | 38 |
| 39 if (contentsClipBehavior == SkipContentsClipIfPossible) { | 39 if (contentsClipBehavior == SkipContentsClipIfPossible) { |
| 40 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); | 40 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); |
| 41 if (contentsVisualOverflow.isEmpty()) | 41 if (contentsVisualOverflow.isEmpty()) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 LayoutRect conservativeClipRect = clipRect; | 44 LayoutRect conservativeClipRect = clipRect; |
| 45 if (hasBorderRadius) | 45 if (hasBorderRadius) |
| 46 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); | 46 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); |
| 47 conservativeClipRect.moveBy(-m_accumulatedOffset); | 47 conservativeClipRect.moveBy(-m_accumulatedOffset); |
| 48 if (m_box.hasLayer()) | 48 if (m_box.hasLayer()) |
| 49 conservativeClipRect.move(m_box.scrolledContentOffset()); | 49 conservativeClipRect.move(m_box.scrolledContentOffset()); |
| 50 if (conservativeClipRect.contains(contentsVisualOverflow)) | 50 if (conservativeClipRect.contains(contentsVisualOverflow)) |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 DisplayItem::Type clipType = DisplayItem::ClipBoxForeground; | 54 DisplayItem::Type clipType = DisplayItem::ClipBoxForeground; |
| 55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 56 clipType = m_paintInfo.displayItemTypeForClipping(); | 56 clipType = m_paintInfo.displayItemTypeForClipping(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 80 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 81 ASSERT(m_paintInfo.context->displayItemList()); | 81 ASSERT(m_paintInfo.context->displayItemList()); |
| 82 m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release()
); | 82 m_paintInfo.context->displayItemList()->add(endClipDisplayItem.release()
); |
| 83 } else { | 83 } else { |
| 84 endClipDisplayItem->replay(m_paintInfo.context); | 84 endClipDisplayItem->replay(m_paintInfo.context); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |