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/paint/BoxPainter.cpp

Issue 1154213013: Stateful BoxBorderPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor optimization Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BoxBorderPainter.cpp ('k') | Source/platform/geometry/FloatRoundedRect.h » ('j') | 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 "config.h" 5 #include "config.h"
6 #include "core/paint/BoxPainter.h" 6 #include "core/paint/BoxPainter.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLFrameOwnerElement.h" 10 #include "core/html/HTMLFrameOwnerElement.h"
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 1165
1166 LayoutRect bottomRightRect(boundingRect.location(), LayoutSize(radii.bottomR ight())); 1166 LayoutRect bottomRightRect(boundingRect.location(), LayoutSize(radii.bottomR ight()));
1167 bottomRightRect.setX(boundingRect.maxX() - bottomRightRect.width()); 1167 bottomRightRect.setX(boundingRect.maxX() - bottomRightRect.width());
1168 bottomRightRect.setY(boundingRect.maxY() - bottomRightRect.height()); 1168 bottomRightRect.setY(boundingRect.maxY() - bottomRightRect.height());
1169 if (clipRect.intersects(bottomRightRect)) 1169 if (clipRect.intersects(bottomRightRect))
1170 return false; 1170 return false;
1171 1171
1172 return true; 1172 return true;
1173 } 1173 }
1174 1174
1175 void BoxPainter::paintBorder(LayoutBoxModelObject& obj, const PaintInfo& info, c onst LayoutRect& rect, const ComputedStyle& style, BackgroundBleedAvoidance blee dAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1175 void BoxPainter::paintBorder(LayoutBoxModelObject& obj, const PaintInfo& info,
1176 const LayoutRect& rect, const ComputedStyle& style, BackgroundBleedAvoidance bleedAvoidance,
1177 bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
1176 { 1178 {
1177 BoxBorderPainter().paintBorder(obj, info, rect, style, bleedAvoidance, inclu deLogicalLeftEdge, includeLogicalRightEdge); 1179 // border-image is not affected by border-radius.
1180 if (paintNinePieceImage(obj, info.context, rect, style, style.borderImage()) )
1181 return;
1182
1183 const BoxBorderPainter borderPainter(rect, style, info.rect, bleedAvoidance,
1184 includeLogicalLeftEdge, includeLogicalRightEdge);
1185 borderPainter.paintBorder(info, rect);
1178 } 1186 }
1179 1187
1180 void BoxPainter::paintBoxShadow(const PaintInfo& info, const LayoutRect& paintRe ct, const ComputedStyle& style, ShadowStyle shadowStyle, bool includeLogicalLeft Edge, bool includeLogicalRightEdge) 1188 void BoxPainter::paintBoxShadow(const PaintInfo& info, const LayoutRect& paintRe ct, const ComputedStyle& style, ShadowStyle shadowStyle, bool includeLogicalLeft Edge, bool includeLogicalRightEdge)
1181 { 1189 {
1182 // FIXME: Deal with border-image. Would be great to use border-image as a ma sk. 1190 // FIXME: Deal with border-image. Would be great to use border-image as a ma sk.
1183 GraphicsContext* context = info.context; 1191 GraphicsContext* context = info.context;
1184 if (!style.boxShadow()) 1192 if (!style.boxShadow())
1185 return; 1193 return;
1186 FloatRoundedRect border = (shadowStyle == Inset) ? style.getRoundedInnerBord erFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge) 1194 FloatRoundedRect border = (shadowStyle == Inset) ? style.getRoundedInnerBord erFor(paintRect, includeLogicalLeftEdge, includeLogicalRightEdge)
1187 : style.getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLo gicalRightEdge); 1195 : style.getRoundedBorderFor(paintRect, includeLogicalLeftEdge, includeLo gicalRightEdge);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 else 1302 else
1295 clippedEdges |= GraphicsContext::BottomEdge; 1303 clippedEdges |= GraphicsContext::BottomEdge;
1296 } 1304 }
1297 // TODO: support non-integer shadows - crbug.com/334828 1305 // TODO: support non-integer shadows - crbug.com/334828
1298 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges); 1306 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges);
1299 } 1307 }
1300 } 1308 }
1301 } 1309 }
1302 1310
1303 } // namespace blink 1311 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BoxBorderPainter.cpp ('k') | Source/platform/geometry/FloatRoundedRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698