| OLD | NEW |
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 void RenderImage::updateInnerContentRect() | 156 void RenderImage::updateInnerContentRect() |
| 157 { | 157 { |
| 158 // Propagate container size to the image resource. | 158 // Propagate container size to the image resource. |
| 159 LayoutRect containerRect = replacedContentRect(); | 159 LayoutRect containerRect = replacedContentRect(); |
| 160 IntSize containerSize(containerRect.width(), containerRect.height()); | 160 IntSize containerSize(containerRect.width(), containerRect.height()); |
| 161 if (!containerSize.isEmpty()) | 161 if (!containerSize.isEmpty()) |
| 162 m_imageResource->setContainerSizeForRenderer(containerSize); | 162 m_imageResource->setContainerSizeForRenderer(containerSize); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void RenderImage::notifyFinished(Resource* newImage) | |
| 166 { | |
| 167 if (!m_imageResource) | |
| 168 return; | |
| 169 | |
| 170 if (documentBeingDestroyed()) | |
| 171 return; | |
| 172 | |
| 173 invalidateBackgroundObscurationStatus(); | |
| 174 } | |
| 175 | |
| 176 void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 165 void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 177 { | 166 { |
| 178 GraphicsContext* context = paintInfo.context; | 167 GraphicsContext* context = paintInfo.context; |
| 179 | 168 |
| 180 if (m_imageResource->hasImage() && contentWidth() > 0 && contentHeight() > 0
) { | 169 if (m_imageResource->hasImage() && contentWidth() > 0 && contentHeight() > 0
) { |
| 181 LayoutRect contentRect = contentBoxRect(); | 170 LayoutRect contentRect = contentBoxRect(); |
| 182 contentRect.moveBy(paintOffset); | 171 contentRect.moveBy(paintOffset); |
| 183 LayoutRect paintRect = replacedContentRect(); | 172 LayoutRect paintRect = replacedContentRect(); |
| 184 paintRect.moveBy(paintOffset); | 173 paintRect.moveBy(paintOffset); |
| 185 bool clip = !contentRect.contains(paintRect); | 174 bool clip = !contentRect.contains(paintRect); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 Image* image = img.get(); | 209 Image* image = img.get(); |
| 221 InterpolationQuality interpolationQuality = chooseInterpolationQuality(conte
xt, image, image, alignedRect.size()); | 210 InterpolationQuality interpolationQuality = chooseInterpolationQuality(conte
xt, image, image, alignedRect.size()); |
| 222 | 211 |
| 223 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(*this)); | 212 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(*this)); |
| 224 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); | 213 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); |
| 225 context->setImageInterpolationQuality(interpolationQuality); | 214 context->setImageInterpolationQuality(interpolationQuality); |
| 226 context->drawImage(image, alignedRect, CompositeSourceOver, shouldRespectIma
geOrientation()); | 215 context->drawImage(image, alignedRect, CompositeSourceOver, shouldRespectIma
geOrientation()); |
| 227 context->setImageInterpolationQuality(previousInterpolationQuality); | 216 context->setImageInterpolationQuality(previousInterpolationQuality); |
| 228 } | 217 } |
| 229 | 218 |
| 230 bool RenderImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance
bleedAvoidance, InlineFlowBox*) const | |
| 231 { | |
| 232 if (!RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(bleedAvoidan
ce)) | |
| 233 return false; | |
| 234 | |
| 235 return !const_cast<RenderImage*>(this)->boxDecorationBackgroundIsKnownToBeOb
scured(); | |
| 236 } | |
| 237 | |
| 238 bool RenderImage::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
unsigned) const | |
| 239 { | |
| 240 if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) | |
| 241 return false; | |
| 242 if (m_imageResource->cachedImage() && !m_imageResource->cachedImage()->isLoa
ded()) | |
| 243 return false; | |
| 244 if (!contentBoxRect().contains(localRect)) | |
| 245 return false; | |
| 246 EFillBox backgroundClip = style()->backgroundClip(); | |
| 247 // Background paints under borders. | |
| 248 if (backgroundClip == BorderFillBox && style()->hasBorder() && !borderObscur
esBackground()) | |
| 249 return false; | |
| 250 // Background shows in padding area. | |
| 251 if ((backgroundClip == BorderFillBox || backgroundClip == PaddingFillBox) &&
style()->hasPadding()) | |
| 252 return false; | |
| 253 // Object-position may leave parts of the content box empty, regardless of t
he value of object-fit. | |
| 254 if (style()->objectPosition() != RenderStyle::initialObjectPosition()) | |
| 255 return false; | |
| 256 // Object-fit may leave parts of the content box empty. | |
| 257 ObjectFit objectFit = style()->objectFit(); | |
| 258 if (objectFit != ObjectFitFill && objectFit != ObjectFitCover) | |
| 259 return false; | |
| 260 // Check for image with alpha. | |
| 261 return m_imageResource->cachedImage() && m_imageResource->cachedImage()->cur
rentFrameKnownToBeOpaque(this); | |
| 262 } | |
| 263 | |
| 264 bool RenderImage::computeBackgroundIsKnownToBeObscured() | |
| 265 { | |
| 266 if (!hasBackground()) | |
| 267 return false; | |
| 268 | |
| 269 LayoutRect paintedExtent; | |
| 270 if (!getBackgroundPaintedExtent(paintedExtent)) | |
| 271 return false; | |
| 272 return foregroundIsKnownToBeOpaqueInRect(paintedExtent, 0); | |
| 273 } | |
| 274 | |
| 275 LayoutUnit RenderImage::minimumReplacedHeight() const | 219 LayoutUnit RenderImage::minimumReplacedHeight() const |
| 276 { | 220 { |
| 277 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU
nit(); | 221 return m_imageResource->errorOccurred() ? intrinsicSize().height() : LayoutU
nit(); |
| 278 } | 222 } |
| 279 | 223 |
| 280 bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, HitTestAction hitTestAction) | 224 bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
lt, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOf
fset, HitTestAction hitTestAction) |
| 281 { | 225 { |
| 282 HitTestResult tempResult(result.hitTestLocation()); | 226 HitTestResult tempResult(result.hitTestLocation()); |
| 283 bool inside = RenderReplaced::nodeAtPoint(request, tempResult, locationInCon
tainer, accumulatedOffset, hitTestAction); | 227 bool inside = RenderReplaced::nodeAtPoint(request, tempResult, locationInCon
tainer, accumulatedOffset, hitTestAction); |
| 284 | 228 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 return; | 262 return; |
| 319 } | 263 } |
| 320 } | 264 } |
| 321 | 265 |
| 322 bool RenderImage::needsPreferredWidthsRecalculation() const | 266 bool RenderImage::needsPreferredWidthsRecalculation() const |
| 323 { | 267 { |
| 324 return RenderReplaced::needsPreferredWidthsRecalculation(); | 268 return RenderReplaced::needsPreferredWidthsRecalculation(); |
| 325 } | 269 } |
| 326 | 270 |
| 327 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |