Title: [113991] trunk/Source/WebCore
- Revision
- 113991
- Author
- [email protected]
- Date
- 2012-04-12 09:04:08 -0700 (Thu, 12 Apr 2012)
Log Message
Optimize non-rounded double border rendering to avoid transparency layers
https://bugs.webkit.org/show_bug.cgi?id=83745
Patch by David Barr <[email protected]> on 2012-04-12
Reviewed by Simon Fraser.
No functional change, painting optimization only.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113990 => 113991)
--- trunk/Source/WebCore/ChangeLog 2012-04-12 16:02:25 UTC (rev 113990)
+++ trunk/Source/WebCore/ChangeLog 2012-04-12 16:04:08 UTC (rev 113991)
@@ -1,3 +1,15 @@
+2012-04-12 David Barr <[email protected]>
+
+ Optimize non-rounded double border rendering to avoid transparency layers
+ https://bugs.webkit.org/show_bug.cgi?id=83745
+
+ Reviewed by Simon Fraser.
+
+ No functional change, painting optimization only.
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintBorder):
+
2012-04-12 Julien Chaffraix <[email protected]>
Reduce the use of RenderLayer outside of the rendering code
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (113990 => 113991)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-04-12 16:02:25 UTC (rev 113990)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-04-12 16:04:08 UTC (rev 113991)
@@ -1794,6 +1794,7 @@
bool haveAlphaColor = false;
bool haveAllSolidEdges = true;
+ bool haveAllDoubleEdges = true;
bool allEdgesVisible = true;
bool allEdgesShareColor = true;
int firstVisibleEdge = -1;
@@ -1821,6 +1822,9 @@
if (currEdge.style != SOLID)
haveAllSolidEdges = false;
+
+ if (currEdge.style != DOUBLE)
+ haveAllDoubleEdges = false;
}
// If no corner intersects the clip region, we can pretend outerBorder is
@@ -1829,9 +1833,10 @@
outerBorder.setRadii(RoundedRect::Radii());
// isRenderable() check avoids issue described in https://bugs.webkit.org/show_bug.cgi?id=38787
- if (haveAllSolidEdges && allEdgesShareColor && innerBorder.isRenderable()) {
- // Fast path for drawing all solid edges.
- if (allEdgesVisible && (outerBorder.isRounded() || haveAlphaColor)) {
+ if ((haveAllSolidEdges || haveAllDoubleEdges) && allEdgesShareColor && innerBorder.isRenderable()) {
+ // Fast path for drawing all solid edges and all unrounded double edges
+ if (allEdgesVisible && (outerBorder.isRounded() || haveAlphaColor)
+ && (haveAllSolidEdges || (!outerBorder.isRounded() && !innerBorder.isRounded()))) {
Path path;
if (outerBorder.isRounded() && bleedAvoidance != BackgroundBleedUseTransparencyLayer)
@@ -1839,6 +1844,45 @@
else
path.addRect(outerBorder.rect());
+ if (haveAllDoubleEdges) {
+ LayoutRect innerThirdRect = outerBorder.rect();
+ LayoutRect outerThirdRect = outerBorder.rect();
+ for (int side = BSTop; side <= BSLeft; ++side) {
+ int outerWidth;
+ int innerWidth;
+ edges[side].getDoubleBorderStripeWidths(outerWidth, innerWidth);
+
+ if (side == BSTop) {
+ innerThirdRect.shiftYEdgeTo(innerThirdRect.y() + innerWidth);
+ outerThirdRect.shiftYEdgeTo(outerThirdRect.y() + outerWidth);
+ } else if (side == BSBottom) {
+ innerThirdRect.setHeight(innerThirdRect.height() - innerWidth);
+ outerThirdRect.setHeight(outerThirdRect.height() - outerWidth);
+ } else if (side == BSLeft) {
+ innerThirdRect.shiftXEdgeTo(innerThirdRect.x() + innerWidth);
+ outerThirdRect.shiftXEdgeTo(outerThirdRect.x() + outerWidth);
+ } else {
+ innerThirdRect.setWidth(innerThirdRect.width() - innerWidth);
+ outerThirdRect.setWidth(outerThirdRect.width() - outerWidth);
+ }
+ }
+
+ RoundedRect outerThird = outerBorder;
+ RoundedRect innerThird = innerBorder;
+ innerThird.setRect(innerThirdRect);
+ outerThird.setRect(outerThirdRect);
+
+ if (outerThird.isRounded() && bleedAvoidance != BackgroundBleedUseTransparencyLayer)
+ path.addRoundedRect(outerThird);
+ else
+ path.addRect(outerThird.rect());
+
+ if (innerThird.isRounded() && bleedAvoidance != BackgroundBleedUseTransparencyLayer)
+ path.addRoundedRect(innerThird);
+ else
+ path.addRect(innerThird.rect());
+ }
+
if (innerBorder.isRounded())
path.addRoundedRect(innerBorder);
else
@@ -1850,7 +1894,7 @@
return;
}
// Avoid creating transparent layers
- if (!allEdgesVisible && !outerBorder.isRounded() && haveAlphaColor) {
+ if (haveAllSolidEdges && !allEdgesVisible && !outerBorder.isRounded() && haveAlphaColor) {
Path path;
for (int i = BSTop; i <= BSLeft; ++i) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes