| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation()); | 277 HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation()); |
| 278 bool inside = LayoutReplaced::nodeAtPoint(tempResult, locationInContainer, a
ccumulatedOffset, hitTestAction); | 278 bool inside = LayoutReplaced::nodeAtPoint(tempResult, locationInContainer, a
ccumulatedOffset, hitTestAction); |
| 279 | 279 |
| 280 if (!inside && result.hitTestRequest().listBased()) | 280 if (!inside && result.hitTestRequest().listBased()) |
| 281 result.append(tempResult); | 281 result.append(tempResult); |
| 282 if (inside) | 282 if (inside) |
| 283 result = tempResult; | 283 result = tempResult; |
| 284 return inside; | 284 return inside; |
| 285 } | 285 } |
| 286 | 286 |
| 287 void LayoutImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, dou
ble& intrinsicRatio) const | 287 void LayoutImage::computeIntrinsicSizingInfo(IntrinsicSizingInfo& intrinsicSizin
gInfo) const |
| 288 { | 288 { |
| 289 LayoutReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRat
io); | 289 LayoutReplaced::computeIntrinsicSizingInfo(intrinsicSizingInfo); |
| 290 | 290 |
| 291 // Our intrinsicSize is empty if we're laying out generated images with rela
tive width/height. Figure out the right intrinsic size to use. | 291 // Our intrinsicSize is empty if we're laying out generated images with rela
tive width/height. Figure out the right intrinsic size to use. |
| 292 if (intrinsicSize.isEmpty() && m_imageResource->imageHasRelativeSize()) { | 292 if (intrinsicSizingInfo.size.isEmpty() && m_imageResource->imageHasRelativeS
ize()) { |
| 293 LayoutObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); | 293 LayoutObject* containingBlock = isOutOfFlowPositioned() ? container() :
this->containingBlock(); |
| 294 if (containingBlock->isBox()) { | 294 if (containingBlock->isBox()) { |
| 295 LayoutBox* box = toLayoutBox(containingBlock); | 295 LayoutBox* box = toLayoutBox(containingBlock); |
| 296 intrinsicSize.setWidth(box->availableLogicalWidth().toFloat()); | 296 intrinsicSizingInfo.size.setWidth(box->availableLogicalWidth().toFlo
at()); |
| 297 intrinsicSize.setHeight(box->availableLogicalHeight(IncludeMarginBor
derPadding).toFloat()); | 297 intrinsicSizingInfo.size.setHeight(box->availableLogicalHeight(Inclu
deMarginBorderPadding).toFloat()); |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. | 300 // Don't compute an intrinsic ratio to preserve historical WebKit behavior i
f we're painting alt text and/or a broken image. |
| 301 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. | 301 // Video is excluded from this behavior because video elements have a defaul
t aspect ratio that a failed poster image load should not override. |
| 302 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { | 302 if (m_imageResource && m_imageResource->errorOccurred() && !isVideo()) { |
| 303 intrinsicRatio = 1; | 303 intrinsicSizingInfo.aspectRatio = 1; |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool LayoutImage::needsPreferredWidthsRecalculation() const | 308 bool LayoutImage::needsPreferredWidthsRecalculation() const |
| 309 { | 309 { |
| 310 if (LayoutReplaced::needsPreferredWidthsRecalculation()) | 310 if (LayoutReplaced::needsPreferredWidthsRecalculation()) |
| 311 return true; | 311 return true; |
| 312 return embeddedContentBox(); | 312 return embeddedContentBox(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 LayoutBox* LayoutImage::embeddedContentBox() const | 315 LayoutBox* LayoutImage::embeddedContentBox() const |
| 316 { | 316 { |
| 317 if (!m_imageResource) | 317 if (!m_imageResource) |
| 318 return nullptr; | 318 return nullptr; |
| 319 | 319 |
| 320 ImageResource* cachedImage = m_imageResource->cachedImage(); | 320 ImageResource* cachedImage = m_imageResource->cachedImage(); |
| 321 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 321 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
| 322 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 322 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
| 323 | 323 |
| 324 return nullptr; | 324 return nullptr; |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace blink | 327 } // namespace blink |
| OLD | NEW |