| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 // If the actual area occupied by the image has changed and it is not constr
ained by style then a layout is required. | 151 // If the actual area occupied by the image has changed and it is not constr
ained by style then a layout is required. |
| 152 bool imageSizeIsConstrained = style()->logicalWidth().isSpecified() && style
()->logicalHeight().isSpecified(); | 152 bool imageSizeIsConstrained = style()->logicalWidth().isSpecified() && style
()->logicalHeight().isSpecified(); |
| 153 | 153 |
| 154 // FIXME: We only need to recompute the containing block's preferred size if
the containing block's size | 154 // FIXME: We only need to recompute the containing block's preferred size if
the containing block's size |
| 155 // depends on the image's size (i.e., the container uses shrink-to-fit sizin
g). | 155 // depends on the image's size (i.e., the container uses shrink-to-fit sizin
g). |
| 156 // There's no easy way to detect that shrink-to-fit is needed, always force
a layout. | 156 // There's no easy way to detect that shrink-to-fit is needed, always force
a layout. |
| 157 bool containingBlockNeedsToRecomputePreferredSize = style()->logicalWidth().
isPercent() || style()->logicalMaxWidth().isPercent() || style()->logicalMinWid
th().isPercent(); | 157 bool containingBlockNeedsToRecomputePreferredSize = style()->logicalWidth().
isPercent() || style()->logicalMaxWidth().isPercent() || style()->logicalMinWid
th().isPercent(); |
| 158 | 158 |
| 159 if (imageSourceHasChangedSize && (!imageSizeIsConstrained || containingBlock
NeedsToRecomputePreferredSize)) { | 159 if (imageSourceHasChangedSize && (!imageSizeIsConstrained || containingBlock
NeedsToRecomputePreferredSize)) { |
| 160 setNeedsLayoutAndFullPaintInvalidation(); | 160 setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::SizeCha
nged); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // The image hasn't changed in size or its style constrains its size, so a p
aint invalidation will suffice. | 164 // The image hasn't changed in size or its style constrains its size, so a p
aint invalidation will suffice. |
| 165 if (everHadLayout() && !selfNeedsLayout()) { | 165 if (everHadLayout() && !selfNeedsLayout()) { |
| 166 // The inner content rectangle is calculated during layout, but may need
an update now | 166 // The inner content rectangle is calculated during layout, but may need
an update now |
| 167 // (unless the box has already been scheduled for layout). In order to c
alculate it, we | 167 // (unless the box has already been scheduled for layout). In order to c
alculate it, we |
| 168 // may need values from the containing block, though, so make sure that
we're not too | 168 // may need values from the containing block, though, so make sure that
we're not too |
| 169 // early. It may be that layout hasn't even taken place once yet. | 169 // early. It may be that layout hasn't even taken place once yet. |
| 170 updateInnerContentRect(); | 170 updateInnerContentRect(); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 return 0; | 388 return 0; |
| 389 | 389 |
| 390 ImageResource* cachedImage = m_imageResource->cachedImage(); | 390 ImageResource* cachedImage = m_imageResource->cachedImage(); |
| 391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 391 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
| 392 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 392 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
| 393 | 393 |
| 394 return 0; | 394 return 0; |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace blink | 397 } // namespace blink |
| OLD | NEW |