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

Unified Diff: Source/WebCore/rendering/RenderBoxModelObject.cpp

Issue 7585032: Merge 92529 - Introduced fast path for border rendering when all visible sides are solid, same rg... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderBoxModelObject.cpp
===================================================================
--- Source/WebCore/rendering/RenderBoxModelObject.cpp (revision 92583)
+++ Source/WebCore/rendering/RenderBoxModelObject.cpp (working copy)
@@ -1298,6 +1298,23 @@
}
}
+static LayoutRect calculateSideRect(const RoundedRect& outerBorder, const BorderEdge edges[], int side)
+{
+ LayoutRect sideRect = outerBorder.rect();
+ int width = edges[side].width;
+
+ if (side == BSTop)
+ sideRect.setHeight(width);
+ else if (side == BSBottom)
+ sideRect.shiftYEdgeTo(sideRect.maxY() - width);
+ else if (side == BSLeft)
+ sideRect.setWidth(width);
+ else
+ sideRect.shiftXEdgeTo(sideRect.maxX() - width);
+
+ return sideRect;
+}
+
void RenderBoxModelObject::paintBorderSides(GraphicsContext* graphicsContext, const RenderStyle* style, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const BorderEdge edges[], BorderEdgeFlags edgeSet, BackgroundBleedAvoidance bleedAvoidance,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor)
@@ -1309,32 +1326,28 @@
roundedPath.addRoundedRect(outerBorder);
if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) {
- LayoutRect sideRect = outerBorder.rect();
- sideRect.setHeight(edges[BSTop].width);
+ LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSTop);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].style) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorder.radii().topRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSTop, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
}
if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) {
- LayoutRect sideRect = outerBorder.rect();
- sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width);
+ LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSBottom);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().bottomRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSBottom, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
}
if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) {
- LayoutRect sideRect = outerBorder.rect();
- sideRect.setWidth(edges[BSLeft].width);
+ LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSLeft);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().topLeft()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSLeft, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
}
if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) {
- LayoutRect sideRect = outerBorder.rect();
- sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width);
+ LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSRight);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight].style) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), innerBorder.radii().topRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSRight, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
@@ -1453,6 +1466,7 @@
const BorderEdge& currEdge = edges[i];
if (currEdge.presentButInvisible()) {
allEdgesVisible = false;
+ allEdgesShareColor = false;
continue;
}
@@ -1479,9 +1493,9 @@
unroundClippedCorners(outerBorder, info.rect);
// isRenderable() check avoids issue described in https://bugs.webkit.org/show_bug.cgi?id=38787
- if (haveAllSolidEdges && allEdgesVisible && allEdgesShareColor && innerBorder.isRenderable()) {
+ if (haveAllSolidEdges && allEdgesShareColor && innerBorder.isRenderable()) {
// Fast path for drawing all solid edges.
- if (outerBorder.isRounded() || haveAlphaColor) {
+ if (allEdgesVisible && (outerBorder.isRounded() || haveAlphaColor)) {
Path path;
if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedUseTransparencyLayer)
@@ -1497,10 +1511,25 @@
graphicsContext->setFillRule(RULE_EVENODD);
graphicsContext->setFillColor(edges[firstVisibleEdge].color, style->colorSpace());
graphicsContext->fillPath(path);
- } else
- paintBorderSides(graphicsContext, style, outerBorder, innerBorder, edges, AllBorderEdges, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias);
-
- return;
+ return;
+ }
+ // Avoid creating transparent layers
+ if (!allEdgesVisible && !outerBorder.isRounded() && haveAlphaColor) {
+ Path path;
+
+ for (int i = BSTop; i <= BSLeft; ++i) {
+ const BorderEdge& currEdge = edges[i];
+ if (currEdge.shouldRender()) {
+ LayoutRect sideRect = calculateSideRect(outerBorder, edges, i);
+ path.addRect(sideRect);
+ }
+ }
+
+ graphicsContext->setFillRule(RULE_NONZERO);
+ graphicsContext->setFillColor(edges[firstVisibleEdge].color, style->colorSpace());
+ graphicsContext->fillPath(path);
+ return;
+ }
}
bool clipToOuterBorder = outerBorder.isRounded();
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698