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

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

Issue 886933002: Remove PaintPhaseSelection. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/rendering/PaintPhase.h ('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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (hasBoxDecorationBackground()) 101 if (hasBoxDecorationBackground())
102 paintBoxDecorationBackground(paintInfo, adjustedPaintOffset); 102 paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
103 103
104 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); 104 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
105 if (paintInfo.phase == PaintPhaseForeground && style()->outlineWidth()) 105 if (paintInfo.phase == PaintPhaseForeground && style()->outlineWidth())
106 paintOutline(paintInfo, paintRect); 106 paintOutline(paintInfo, paintRect);
107 107
108 if (paintInfo.phase == PaintPhaseMask && !canHaveChildren()) 108 if (paintInfo.phase == PaintPhaseMask && !canHaveChildren())
109 return; 109 return;
110 110
111 bool drawSelectionTint = selectionState() != SelectionNone;
112 if (paintInfo.phase == PaintPhaseSelection) {
113 if (selectionState() == SelectionNone)
114 return;
115 drawSelectionTint = false;
116 }
117
118 bool completelyClippedOut = false; 111 bool completelyClippedOut = false;
119 if (style()->hasBorderRadius()) { 112 if (style()->hasBorderRadius()) {
120 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); 113 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
121 114
122 if (borderRect.isEmpty()) 115 if (borderRect.isEmpty())
123 completelyClippedOut = true; 116 completelyClippedOut = true;
124 else { 117 else {
125 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted. 118 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted.
126 paintInfo.context->save(); 119 paintInfo.context->save();
127 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect, 120 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect,
128 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); 121 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
129 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ; 122 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ;
130 } 123 }
131 } 124 }
132 125
133 if (!completelyClippedOut) { 126 if (!completelyClippedOut) {
134 paintReplaced(paintInfo, adjustedPaintOffset); 127 paintReplaced(paintInfo, adjustedPaintOffset);
135 if (style()->hasBorderRadius()) 128 if (style()->hasBorderRadius())
136 paintInfo.context->restore(); 129 paintInfo.context->restore();
137 } 130 }
138 131
139 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of 132 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
140 // surrounding content. 133 // surrounding content.
141 if (drawSelectionTint) { 134 if (selectionState() != SelectionNone) {
142 LayoutRect selectionPaintingRect = localSelectionRect(); 135 LayoutRect selectionPaintingRect = localSelectionRect();
143 selectionPaintingRect.moveBy(adjustedPaintOffset); 136 selectionPaintingRect.moveBy(adjustedPaintOffset);
144 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor()); 137 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
145 } 138 }
146 } 139 }
147 140
148 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 141 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
149 { 142 {
150 LayoutPoint adjustedPaintOffset = paintOffset + location(); 143 LayoutPoint adjustedPaintOffset = paintOffset + location();
151 144
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (s == SelectionEnd) 463 if (s == SelectionEnd)
471 return selectionEnd == end; 464 return selectionEnd == end;
472 if (s == SelectionBoth) 465 if (s == SelectionBoth)
473 return selectionStart == 0 && selectionEnd == end; 466 return selectionStart == 0 && selectionEnd == end;
474 467
475 ASSERT(0); 468 ASSERT(0);
476 return false; 469 return false;
477 } 470 }
478 471
479 } 472 }
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/PaintPhase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698