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

Side by Side Diff: Source/core/layout/LayoutBox.cpp

Issue 1200263004: Should not crash when background image a display:none presents on the root (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revise test 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 | « LayoutTests/fast/backgrounds/root-background-display-none-no-crash-expected.txt ('k') | no next file » | 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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 void LayoutBox::paintBoxDecorationBackground(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset) 1139 void LayoutBox::paintBoxDecorationBackground(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset)
1140 { 1140 {
1141 BoxPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); 1141 BoxPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset);
1142 } 1142 }
1143 1143
1144 1144
1145 bool LayoutBox::getBackgroundPaintedExtent(LayoutRect& paintedExtent) 1145 bool LayoutBox::getBackgroundPaintedExtent(LayoutRect& paintedExtent)
1146 { 1146 {
1147 ASSERT(hasBackground()); 1147 ASSERT(hasBackground());
1148
1149 // LayoutView is special in the sense that it expands to the whole canvas,
1150 // thus can't be handled by this function.
1151 ASSERT(!isLayoutView());
1152
1148 LayoutRect backgroundRect(enclosingIntRect(borderBoxRect())); 1153 LayoutRect backgroundRect(enclosingIntRect(borderBoxRect()));
1149 1154
1150 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); 1155 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
1151 if (backgroundColor.alpha()) { 1156 if (backgroundColor.alpha()) {
1152 paintedExtent = backgroundRect; 1157 paintedExtent = backgroundRect;
1153 return true; 1158 return true;
1154 } 1159 }
1155 1160
1156 if (!style()->backgroundLayers().image() || style()->backgroundLayers().next ()) { 1161 if (!style()->backgroundLayers().image() || style()->backgroundLayers().next ()) {
1157 paintedExtent = backgroundRect; 1162 paintedExtent = backgroundRect;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 return false; 1266 return false;
1262 } 1267 }
1263 1268
1264 bool LayoutBox::computeBackgroundIsKnownToBeObscured() 1269 bool LayoutBox::computeBackgroundIsKnownToBeObscured()
1265 { 1270 {
1266 // Test to see if the children trivially obscure the background. 1271 // Test to see if the children trivially obscure the background.
1267 // FIXME: This test can be much more comprehensive. 1272 // FIXME: This test can be much more comprehensive.
1268 if (!hasBackground()) 1273 if (!hasBackground())
1269 return false; 1274 return false;
1270 // Table and root background painting is special. 1275 // Table and root background painting is special.
1271 if (isTable() || isDocumentElement()) 1276 if (isTable() || isLayoutView())
1272 return false; 1277 return false;
1273 // FIXME: box-shadow is painted while background painting. 1278 // FIXME: box-shadow is painted while background painting.
1274 if (style()->boxShadow()) 1279 if (style()->boxShadow())
1275 return false; 1280 return false;
1276 LayoutRect backgroundRect; 1281 LayoutRect backgroundRect;
1277 if (!getBackgroundPaintedExtent(backgroundRect)) 1282 if (!getBackgroundPaintedExtent(backgroundRect))
1278 return false; 1283 return false;
1279 return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurati onTestMaxDepth); 1284 return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurati onTestMaxDepth);
1280 } 1285 }
1281 1286
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4769 bool LayoutBox::canRenderBorderImage() const 4774 bool LayoutBox::canRenderBorderImage() const
4770 { 4775 {
4771 if (!style()->hasBorderDecoration()) 4776 if (!style()->hasBorderDecoration())
4772 return false; 4777 return false;
4773 4778
4774 StyleImage* borderImage = style()->borderImage().image(); 4779 StyleImage* borderImage = style()->borderImage().image();
4775 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4780 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4776 } 4781 }
4777 4782
4778 } // namespace blink 4783 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/backgrounds/root-background-display-none-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698