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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxClipper.cpp

Issue 1817463004: Always apply parent clips to selection rects when painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/selection/text-selection-newline-clipped-by-overflow-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/paint/BoxClipper.h" 5 #include "core/paint/BoxClipper.h"
6 6
7 #include "core/layout/LayoutBox.h" 7 #include "core/layout/LayoutBox.h"
8 #include "core/paint/ObjectPaintProperties.h" 8 #include "core/paint/ObjectPaintProperties.h"
9 #include "core/paint/PaintInfo.h" 9 #include "core/paint/PaintInfo.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 30 matching lines...) Expand all
41 41
42 if (!isControlClip && !isOverflowOrContainmentClip) 42 if (!isControlClip && !isOverflowOrContainmentClip)
43 return; 43 return;
44 44
45 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse t) : m_box.overflowClipRect(accumulatedOffset); 45 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse t) : m_box.overflowClipRect(accumulatedOffset);
46 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); 46 FloatRoundedRect clipRoundedRect(0, 0, 0, 0);
47 bool hasBorderRadius = m_box.style()->hasBorderRadius(); 47 bool hasBorderRadius = m_box.style()->hasBorderRadius();
48 if (hasBorderRadius) 48 if (hasBorderRadius)
49 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc umulatedOffset, m_box.size())); 49 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc umulatedOffset, m_box.size()));
50 50
51 if (contentsClipBehavior == SkipContentsClipIfPossible) { 51 // Selection does not affect visual overflow, so this optimization is invali d if selection
52 // is present.
53 if (contentsClipBehavior == SkipContentsClipIfPossible && box.getSelectionSt ate() == SelectionNone) {
52 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); 54 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect();
53 if (contentsVisualOverflow.isEmpty()) 55 if (contentsVisualOverflow.isEmpty())
54 return; 56 return;
55 57
56 LayoutRect conservativeClipRect = clipRect; 58 LayoutRect conservativeClipRect = clipRect;
57 if (hasBorderRadius) 59 if (hasBorderRadius)
58 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent erRect())); 60 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent erRect()));
59 conservativeClipRect.moveBy(-accumulatedOffset); 61 conservativeClipRect.moveBy(-accumulatedOffset);
60 if (m_box.hasLayer()) 62 if (m_box.hasLayer())
61 conservativeClipRect.move(m_box.scrolledContentOffset()); 63 conservativeClipRect.move(m_box.scrolledContentOffset());
(...skipping 13 matching lines...) Expand all
75 BoxClipper::~BoxClipper() 77 BoxClipper::~BoxClipper()
76 { 78 {
77 if (m_clipType == DisplayItem::UninitializedType) 79 if (m_clipType == DisplayItem::UninitializedType)
78 return; 80 return;
79 81
80 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer()) || m_box.style()->containsPaint()); 82 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()- >isSelfPaintingLayer()) || m_box.style()->containsPaint());
81 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); 83 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box, DisplayItem::clipTypeToEndClipType(m_clipType));
82 } 84 }
83 85
84 } // namespace blink 86 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/selection/text-selection-newline-clipped-by-overflow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698