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

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

Issue 165213005: Avoid using transparency layer for fancy borders. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: expanded test expectations Created 6 years, 9 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 | « LayoutTests/TestExpectations ('k') | Source/core/rendering/RenderBoxModelObject.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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 if (contextScaling.width() > 1) 1197 if (contextScaling.width() > 1)
1198 contextScaling.setWidth(1); 1198 contextScaling.setWidth(1);
1199 if (contextScaling.height() > 1) 1199 if (contextScaling.height() > 1)
1200 contextScaling.setHeight(1); 1200 contextScaling.setHeight(1);
1201 1201
1202 if (borderObscuresBackgroundEdge(contextScaling)) 1202 if (borderObscuresBackgroundEdge(contextScaling))
1203 return BackgroundBleedShrinkBackground; 1203 return BackgroundBleedShrinkBackground;
1204 if (!style->hasAppearance() && borderObscuresBackground() && backgroundHasOp aqueTopLayer()) 1204 if (!style->hasAppearance() && borderObscuresBackground() && backgroundHasOp aqueTopLayer())
1205 return BackgroundBleedBackgroundOverBorder; 1205 return BackgroundBleedBackgroundOverBorder;
1206 1206
1207 return BackgroundBleedUseTransparencyLayer; 1207 return BackgroundBleedClipBackground;
1208 } 1208 }
1209 1209
1210 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai ntOffset) 1210 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai ntOffset)
1211 { 1211 {
1212 if (!paintInfo.shouldPaintWithinRoot(this)) 1212 if (!paintInfo.shouldPaintWithinRoot(this))
1213 return; 1213 return;
1214 1214
1215 LayoutRect paintRect = borderBoxRect(); 1215 LayoutRect paintRect = borderBoxRect();
1216 paintRect.moveBy(paintOffset); 1216 paintRect.moveBy(paintOffset);
1217 paintBoxDecorationsWithRect(paintInfo, paintOffset, paintRect); 1217 paintBoxDecorationsWithRect(paintInfo, paintOffset, paintRect);
1218 } 1218 }
1219 1219
1220 void RenderBox::paintBoxDecorationsWithRect(PaintInfo& paintInfo, const LayoutPo int& paintOffset, const LayoutRect& paintRect) 1220 void RenderBox::paintBoxDecorationsWithRect(PaintInfo& paintInfo, const LayoutPo int& paintOffset, const LayoutRect& paintRect)
1221 { 1221 {
1222 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context); 1222 BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance( paintInfo.context);
1223 1223
1224 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have 1224 // FIXME: Should eventually give the theme control over whether the box shad ow should paint, since controls could have
1225 // custom shadows of their own. 1225 // custom shadows of their own.
1226 if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance)) 1226 if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance))
1227 paintBoxShadow(paintInfo, paintRect, style(), Normal); 1227 paintBoxShadow(paintInfo, paintRect, style(), Normal);
1228 1228
1229 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); 1229 GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
1230 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) { 1230 if (bleedAvoidance == BackgroundBleedClipBackground) {
1231 // To avoid the background color bleeding out behind the border, we'll r ender background and border 1231 stateSaver.save();
1232 // into a transparency layer, and then clip that in one go (which requir es setting up the clip before
1233 // beginning the layer).
1234 RoundedRect border = style()->getRoundedBorderFor(paintRect); 1232 RoundedRect border = style()->getRoundedBorderFor(paintRect);
1235 stateSaver.save();
1236 paintInfo.context->clipRoundedRect(border); 1233 paintInfo.context->clipRoundedRect(border);
1237 paintInfo.context->beginTransparencyLayer(1);
1238 } 1234 }
1239 1235
1240 paintBackgroundWithBorderAndBoxShadow(paintInfo, paintRect, bleedAvoidance); 1236 paintBackgroundWithBorderAndBoxShadow(paintInfo, paintRect, bleedAvoidance);
1241
1242 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
1243 paintInfo.context->endLayer();
1244 } 1237 }
1245 1238
1246 void RenderBox::paintBackgroundWithBorderAndBoxShadow(PaintInfo& paintInfo, cons t LayoutRect& paintRect, BackgroundBleedAvoidance bleedAvoidance) 1239 void RenderBox::paintBackgroundWithBorderAndBoxShadow(PaintInfo& paintInfo, cons t LayoutRect& paintRect, BackgroundBleedAvoidance bleedAvoidance)
1247 { 1240 {
1248 // If we have a native theme appearance, paint that before painting our back ground. 1241 // If we have a native theme appearance, paint that before painting our back ground.
1249 // The theme will tell us whether or not we should also paint the CSS backgr ound. 1242 // The theme will tell us whether or not we should also paint the CSS backgr ound.
1250 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); 1243 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect));
1251 bool themePainted = style()->hasAppearance() && !RenderTheme::theme().paint( this, paintInfo, snappedPaintRect); 1244 bool themePainted = style()->hasAppearance() && !RenderTheme::theme().paint( this, paintInfo, snappedPaintRect);
1252 if (!themePainted) { 1245 if (!themePainted) {
1253 if (bleedAvoidance == BackgroundBleedBackgroundOverBorder) 1246 if (bleedAvoidance == BackgroundBleedBackgroundOverBorder)
(...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4699 return 0; 4692 return 0;
4700 4693
4701 if (!layoutState && !flowThreadContainingBlock()) 4694 if (!layoutState && !flowThreadContainingBlock())
4702 return 0; 4695 return 0;
4703 4696
4704 RenderBlock* containerBlock = containingBlock(); 4697 RenderBlock* containerBlock = containingBlock();
4705 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4698 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4706 } 4699 }
4707 4700
4708 } // namespace WebCore 4701 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698