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

Side by Side Diff: Source/core/rendering/RenderReplaced.cpp

Issue 16688004: Large canvas does not honor containing div's border radius (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 LayoutPoint adjustedPaintOffset = paintOffset + location(); 113 LayoutPoint adjustedPaintOffset = paintOffset + location();
114 114
115 if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paint Info.phase == PaintPhaseSelection)) 115 if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paint Info.phase == PaintPhaseSelection))
116 paintBoxDecorations(paintInfo, adjustedPaintOffset); 116 paintBoxDecorations(paintInfo, adjustedPaintOffset);
117 117
118 if (paintInfo.phase == PaintPhaseMask) { 118 if (paintInfo.phase == PaintPhaseMask) {
119 paintMask(paintInfo, adjustedPaintOffset); 119 paintMask(paintInfo, adjustedPaintOffset);
120 return; 120 return;
121 } 121 }
122 122
123 if (paintInfo.phase == PaintPhaseBorderRadiusMask && (!hasLayer() || !layer( )->hasCompositedBorderRadiusMask()))
124 return;
125
123 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); 126 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
124 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && style()->outlineWidth()) 127 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe lfOutline) && style()->outlineWidth())
125 paintOutline(paintInfo, paintRect); 128 paintOutline(paintInfo, paintRect);
126 129
127 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !canHaveChildren()) 130 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && !canHaveChildren() && paintInfo.phase != PaintPhaseBorderRadiusMask )
128 return; 131 return;
129 132
130 if (!paintInfo.shouldPaintWithinRoot(this)) 133 if (!paintInfo.shouldPaintWithinRoot(this))
131 return; 134 return;
132 135
133 bool drawSelectionTint = selectionState() != SelectionNone && !document()->p rinting(); 136 bool drawSelectionTint = selectionState() != SelectionNone && !document()->p rinting();
134 if (paintInfo.phase == PaintPhaseSelection) { 137 if (paintInfo.phase == PaintPhaseSelection) {
135 if (selectionState() == SelectionNone) 138 if (selectionState() == SelectionNone)
136 return; 139 return;
137 drawSelectionTint = false; 140 drawSelectionTint = false;
138 } 141 }
139 142
140 bool completelyClippedOut = false; 143 bool completelyClippedOut = false;
141 if (style()->hasBorderRadius()) { 144 if (style()->hasBorderRadius()) {
142 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); 145 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
143 146
144 if (borderRect.isEmpty()) 147 if (borderRect.isEmpty())
145 completelyClippedOut = true; 148 completelyClippedOut = true;
146 else { 149 else {
147 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted. 150 // Push a clip if we have a border radius, since we want to round th e foreground content that gets painted.
148 paintInfo.context->save(); 151 paintInfo.context->save();
149 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect, 152 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai ntRect,
150 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); 153 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
151 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ; 154 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect) ;
152 } 155 }
153 } 156 }
154 157
155 if (!completelyClippedOut) { 158 if (!completelyClippedOut) {
156 paintReplaced(paintInfo, adjustedPaintOffset); 159 if (paintInfo.phase == PaintPhaseBorderRadiusMask) {
160 paintInfo.context->fillRect(pixelSnappedIntRect(paintRect), Color::b lack);
161 } else {
162 paintReplaced(paintInfo, adjustedPaintOffset);
163 }
157 164
158 if (style()->hasBorderRadius()) 165 if (style()->hasBorderRadius())
159 paintInfo.context->restore(); 166 paintInfo.context->restore();
160 } 167 }
161 168
162 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of 169 // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
163 // surrounding content. 170 // surrounding content.
164 if (drawSelectionTint) { 171 if (drawSelectionTint) {
165 LayoutRect selectionPaintingRect = localSelectionRect(); 172 LayoutRect selectionPaintingRect = localSelectionRect();
166 selectionPaintingRect.moveBy(adjustedPaintOffset); 173 selectionPaintingRect.moveBy(adjustedPaintOffset);
167 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor()); 174 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
168 } 175 }
169 } 176 }
170 177
171 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 178 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
172 { 179 {
173 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Outline && paintInfo.phase != PaintPhaseSelfOutline 180 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Outline && paintInfo.phase != PaintPhaseSelfOutline
174 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != Pain tPhaseMask) 181 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != Pain tPhaseMask && paintInfo.phase != PaintPhaseBorderRadiusMask)
175 return false; 182 return false;
176 183
177 if (!paintInfo.shouldPaintWithinRoot(this)) 184 if (!paintInfo.shouldPaintWithinRoot(this))
178 return false; 185 return false;
179 186
180 // if we're invisible or haven't received a layout yet, then just bail. 187 // if we're invisible or haven't received a layout yet, then just bail.
181 if (style()->visibility() != VISIBLE) 188 if (style()->visibility() != VISIBLE)
182 return false; 189 return false;
183 190
184 LayoutPoint adjustedPaintOffset = paintOffset + location(); 191 LayoutPoint adjustedPaintOffset = paintOffset + location();
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 return r; 588 return r;
582 } 589 }
583 590
584 void RenderReplaced::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 591 void RenderReplaced::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
585 { 592 {
586 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 593 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
587 RenderBox::reportMemoryUsage(memoryObjectInfo); 594 RenderBox::reportMemoryUsage(memoryObjectInfo);
588 } 595 }
589 596
590 } 597 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698