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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (newSize == intrinsicSize() && !imageSizeChanged) | 192 if (newSize == intrinsicSize() && !imageSizeChanged) |
193 return false; | 193 return false; |
194 if (m_imageResource->errorOccurred() || !m_imageResource->hasImage()) | 194 if (m_imageResource->errorOccurred() || !m_imageResource->hasImage()) |
195 return imageSizeChanged; | 195 return imageSizeChanged; |
196 setIntrinsicSize(newSize); | 196 setIntrinsicSize(newSize); |
197 return true; | 197 return true; |
198 } | 198 } |
199 | 199 |
200 void RenderImage::updateInnerContentRect() | 200 void RenderImage::updateInnerContentRect() |
201 { | 201 { |
202 // Propagate container size to image resource. | 202 // Propagate container size to the image resource. |
203 LayoutRect paintRect = replacedContentRect(); | 203 LayoutRect containerRect = replacedContentRect(); |
204 IntSize containerSize(paintRect.width(), paintRect.height()); | 204 IntSize containerSize(containerRect.width(), containerRect.height()); |
205 if (!containerSize.isEmpty()) | 205 if (!containerSize.isEmpty()) |
206 m_imageResource->setContainerSizeForRenderer(containerSize); | 206 m_imageResource->setContainerSizeForRenderer(containerSize); |
207 } | 207 } |
208 | 208 |
209 void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* r
ect) | 209 void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* r
ect) |
210 { | 210 { |
211 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->int
rinsicSize(style()->effectiveZoom()), imageSizeChanged); | 211 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->int
rinsicSize(style()->effectiveZoom()), imageSizeChanged); |
212 | 212 |
213 // In the case of generated image content using :before/:after/content, we m
ight not be | 213 // In the case of generated image content using :before/:after/content, we m
ight not be |
214 // in the render tree yet. In that case, we just need to update our intrinsi
c size. | 214 // in the render tree yet. In that case, we just need to update our intrinsi
c size. |
(...skipping 24 matching lines...) Expand all Loading... |
239 bool containingBlockNeedsToRecomputePreferredSize = | 239 bool containingBlockNeedsToRecomputePreferredSize = |
240 style()->logicalWidth().isPercent() | 240 style()->logicalWidth().isPercent() |
241 || style()->logicalMaxWidth().isPercent() | 241 || style()->logicalMaxWidth().isPercent() |
242 || style()->logicalMinWidth().isPercent(); | 242 || style()->logicalMinWidth().isPercent(); |
243 | 243 |
244 if (imageSizeChanged || hasOverrideSize || containingBlockNeedsToRecompu
tePreferredSize) { | 244 if (imageSizeChanged || hasOverrideSize || containingBlockNeedsToRecompu
tePreferredSize) { |
245 shouldRepaint = false; | 245 shouldRepaint = false; |
246 if (!selfNeedsLayout()) | 246 if (!selfNeedsLayout()) |
247 setNeedsLayout(); | 247 setNeedsLayout(); |
248 } | 248 } |
| 249 } |
249 | 250 |
250 if (everHadLayout() && !selfNeedsLayout()) { | 251 if (everHadLayout() && !selfNeedsLayout()) { |
251 // The inner content rectangle is calculated during layout, but may
need an update now | 252 // The inner content rectangle is calculated during layout, but may need
an update now |
252 // (unless the box has already been scheduled for layout). In order
to calculate it, we | 253 // (unless the box has already been scheduled for layout). In order to c
alculate it, we |
253 // may need values from the containing block, though, so make sure t
hat we're not too | 254 // may need values from the containing block, though, so make sure that
we're not too |
254 // early. It may be that layout hasn't even taken place once yet. | 255 // early. It may be that layout hasn't even taken place once yet. |
255 updateInnerContentRect(); | 256 updateInnerContentRect(); |
256 } | |
257 } | 257 } |
258 | 258 |
259 if (shouldRepaint) { | 259 if (shouldRepaint) { |
260 LayoutRect repaintRect; | 260 LayoutRect repaintRect; |
261 if (rect) { | 261 if (rect) { |
262 // The image changed rect is in source image coordinates (pre-zoomin
g), | 262 // The image changed rect is in source image coordinates (pre-zoomin
g), |
263 // so map from the bounds of the image to the contentsBox. | 263 // so map from the bounds of the image to the contentsBox. |
264 repaintRect = enclosingIntRect(mapRect(*rect, FloatRect(FloatPoint()
, m_imageResource->imageSize(1.0f)), contentBoxRect())); | 264 repaintRect = enclosingIntRect(mapRect(*rect, FloatRect(FloatPoint()
, m_imageResource->imageSize(1.0f)), contentBoxRect())); |
265 // Guard against too-large changed rects. | 265 // Guard against too-large changed rects. |
266 repaintRect.intersect(contentBoxRect()); | 266 repaintRect.intersect(contentBoxRect()); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 return 0; | 620 return 0; |
621 | 621 |
622 ImageResource* cachedImage = m_imageResource->cachedImage(); | 622 ImageResource* cachedImage = m_imageResource->cachedImage(); |
623 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) | 623 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage(
)) |
624 return toSVGImage(cachedImage->image())->embeddedContentBox(); | 624 return toSVGImage(cachedImage->image())->embeddedContentBox(); |
625 | 625 |
626 return 0; | 626 return 0; |
627 } | 627 } |
628 | 628 |
629 } // namespace WebCore | 629 } // namespace WebCore |
OLD | NEW |