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

Side by Side Diff: sky/engine/core/rendering/RenderReplaced.cpp

Issue 786003002: Remove PaintPhaseClippingMask. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/rendering/RenderBox.cpp ('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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 LayoutPoint adjustedPaintOffset = paintOffset + location(); 98 LayoutPoint adjustedPaintOffset = paintOffset + location();
99 99
100 if (hasBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection)) 100 if (hasBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
101 paintBoxDecorationBackground(paintInfo, adjustedPaintOffset); 101 paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
102 102
103 if (paintInfo.phase == PaintPhaseMask) { 103 if (paintInfo.phase == PaintPhaseMask) {
104 paintMask(paintInfo, adjustedPaintOffset); 104 paintMask(paintInfo, adjustedPaintOffset);
105 return; 105 return;
106 } 106 }
107 107
108 if (paintInfo.phase == PaintPhaseClippingMask)
109 return;
110
111 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); 108 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
112 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && style()->outlineWidth()) 109 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && style()->outlineWidth())
113 paintOutline(paintInfo, paintRect); 110 paintOutline(paintInfo, paintRect);
114 111
115 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !canHaveChildren() && paintInfo.phase != PaintPhaseClippingMask) 112 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !canHaveChildren())
116 return; 113 return;
117 114
118 if (!paintInfo.shouldPaintWithinRoot(this)) 115 if (!paintInfo.shouldPaintWithinRoot(this))
119 return; 116 return;
120 117
121 bool drawSelectionTint = selectionState() != SelectionNone; 118 bool drawSelectionTint = selectionState() != SelectionNone;
122 if (paintInfo.phase == PaintPhaseSelection) { 119 if (paintInfo.phase == PaintPhaseSelection) {
123 if (selectionState() == SelectionNone) 120 if (selectionState() == SelectionNone)
124 return; 121 return;
125 drawSelectionTint = false; 122 drawSelectionTint = false;
126 } 123 }
127 124
128 bool completelyClippedOut = false; 125 bool completelyClippedOut = false;
129 if (style()->hasBorderRadius()) { 126 if (style()->hasBorderRadius()) {
130 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); 127 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
131 128
132 if (borderRect.isEmpty()) 129 if (borderRect.isEmpty())
133 completelyClippedOut = true; 130 completelyClippedOut = true;
134 else { 131 else {
135 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted. 132 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted.
136 paintInfo.context->save(); 133 paintInfo.context->save();
137 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect, 134 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect,
138 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); 135 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
139 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ; 136 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ;
140 } 137 }
141 } 138 }
142 139
143 if (!completelyClippedOut) { 140 if (!completelyClippedOut) {
144 if (paintInfo.phase == PaintPhaseClippingMask) { 141 paintReplaced(paintInfo, adjustedPaintOffset);
145 paintClippingMask(paintInfo, adjustedPaintOffset);
146 } else {
147 paintReplaced(paintInfo, adjustedPaintOffset);
148 }
149
150 if (style()->hasBorderRadius()) 142 if (style()->hasBorderRadius())
151 paintInfo.context->restore(); 143 paintInfo.context->restore();
152 } 144 }
153 145
154 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of 146 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
155 // surrounding content. 147 // surrounding content.
156 if (drawSelectionTint) { 148 if (drawSelectionTint) {
157 LayoutRect selectionPaintingRect = localSelectionRect(); 149 LayoutRect selectionPaintingRect = localSelectionRect();
158 selectionPaintingRect.moveBy(adjustedPaintOffset); 150 selectionPaintingRect.moveBy(adjustedPaintOffset);
159 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor()); 151 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
160 } 152 }
161 } 153 }
162 154
163 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 155 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
164 { 156 {
165 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Outline && paintInfo.phase != PaintPhaseSelfOutline 157 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Outline && paintInfo.phase != PaintPhaseSelfOutline
166 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask && paintInfo.phase != PaintPhaseClippingMask) 158 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha seMask)
167 return false; 159 return false;
168 160
169 if (!paintInfo.shouldPaintWithinRoot(this)) 161 if (!paintInfo.shouldPaintWithinRoot(this))
170 return false; 162 return false;
171 163
172 LayoutPoint adjustedPaintOffset = paintOffset + location(); 164 LayoutPoint adjustedPaintOffset = paintOffset + location();
173 165
174 // Early exit if the element touches the edges. 166 // Early exit if the element touches the edges.
175 LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y(); 167 LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y();
176 LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY(); 168 LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY();
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint InvalidationState) const 514 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint InvalidationState) const
523 { 515 {
524 // The selectionRect can project outside of the overflowRect, so take their union 516 // The selectionRect can project outside of the overflowRect, so take their union
525 // for paint invalidation to avoid selection painting glitches. 517 // for paint invalidation to avoid selection painting glitches.
526 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); 518 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect();
527 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState); 519 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState);
528 return r; 520 return r;
529 } 521 }
530 522
531 } 523 }
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698