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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutImage.cpp

Issue 2225033003: Separate backgroundObscurationStatus and hasBoxDecorationBackground (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 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 unified diff | Download patch
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
10 * 10 *
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return; 202 return;
203 203
204 invalidatePaintAndMarkForLayoutIfNeeded(); 204 invalidatePaintAndMarkForLayoutIfNeeded();
205 } 205 }
206 206
207 bool LayoutImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, const InlineFlowBox*) const 207 bool LayoutImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, const InlineFlowBox*) const
208 { 208 {
209 if (!LayoutBoxModelObject::boxShadowShouldBeAppliedToBackground(bleedAvoidan ce)) 209 if (!LayoutBoxModelObject::boxShadowShouldBeAppliedToBackground(bleedAvoidan ce))
210 return false; 210 return false;
211 211
212 return !const_cast<LayoutImage*>(this)->boxDecorationBackgroundIsKnownToBeOb scured(); 212 return !const_cast<LayoutImage*>(this)->backgroundIsKnownToBeObscured();
213 } 213 }
214 214
215 bool LayoutImage::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned) const 215 bool LayoutImage::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned) const
216 { 216 {
217 if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) 217 if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
218 return false; 218 return false;
219 if (m_imageResource->cachedImage() && !m_imageResource->cachedImage()->isLoa ded()) 219 if (m_imageResource->cachedImage() && !m_imageResource->cachedImage()->isLoa ded())
220 return false; 220 return false;
221 if (!contentBoxRect().contains(localRect)) 221 if (!contentBoxRect().contains(localRect))
222 return false; 222 return false;
(...skipping 13 matching lines...) Expand all
236 return false; 236 return false;
237 if (!m_imageResource->cachedImage()) 237 if (!m_imageResource->cachedImage())
238 return false; 238 return false;
239 // Check for image with alpha. 239 // Check for image with alpha.
240 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data", InspectorPaintImageEvent::data(this, *m_imageResource->cachedImage())); 240 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data", InspectorPaintImageEvent::data(this, *m_imageResource->cachedImage()));
241 return m_imageResource->cachedImage()->getImage()->currentFrameKnownToBeOpaq ue(Image::PreCacheMetadata); 241 return m_imageResource->cachedImage()->getImage()->currentFrameKnownToBeOpaq ue(Image::PreCacheMetadata);
242 } 242 }
243 243
244 bool LayoutImage::computeBackgroundIsKnownToBeObscured() const 244 bool LayoutImage::computeBackgroundIsKnownToBeObscured() const
245 { 245 {
246 if (!hasBackground()) 246 if (!styleRef().hasBackground())
247 return false; 247 return false;
248 248
249 LayoutRect paintedExtent; 249 LayoutRect paintedExtent;
250 if (!getBackgroundPaintedExtent(paintedExtent)) 250 if (!getBackgroundPaintedExtent(paintedExtent))
251 return false; 251 return false;
252 return foregroundIsKnownToBeOpaqueInRect(paintedExtent, 0); 252 return foregroundIsKnownToBeOpaqueInRect(paintedExtent, 0);
253 } 253 }
254 254
255 LayoutUnit LayoutImage::minimumReplacedHeight() const 255 LayoutUnit LayoutImage::minimumReplacedHeight() const
256 { 256 {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return nullptr; 309 return nullptr;
310 310
311 ImageResource* cachedImage = m_imageResource->cachedImage(); 311 ImageResource* cachedImage = m_imageResource->cachedImage();
312 if (cachedImage && cachedImage->getImage() && cachedImage->getImage()->isSVG Image()) 312 if (cachedImage && cachedImage->getImage() && cachedImage->getImage()->isSVG Image())
313 return toSVGImage(cachedImage->getImage())->embeddedReplacedContent(); 313 return toSVGImage(cachedImage->getImage())->embeddedReplacedContent();
314 314
315 return nullptr; 315 return nullptr;
316 } 316 }
317 317
318 } // namespace blink 318 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698