| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // yet so all we can do is update our intrinsic size. Once we're inserted | 106 // yet so all we can do is update our intrinsic size. Once we're inserted |
| 107 // the resulting layout will do the rest of the work. | 107 // the resulting layout will do the rest of the work. |
| 108 if (!parent()) { | 108 if (!parent()) { |
| 109 updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize()); | 109 updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize()); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (hasBoxDecorationBackground() || hasMask()) | 113 if (hasBoxDecorationBackground() || hasMask()) |
| 114 RenderReplaced::imageChanged(newImage, rect); | 114 RenderReplaced::imageChanged(newImage, rect); |
| 115 | 115 |
| 116 paintInvalidationOrMarkForLayout(rect); | |
| 117 } | |
| 118 | |
| 119 void RenderImage::updateIntrinsicSizeIfNeeded(const LayoutSize& newSize) | |
| 120 { | |
| 121 if (m_imageResource->errorOccurred() || !m_imageResource->hasImage()) | |
| 122 return; | |
| 123 setIntrinsicSize(newSize); | |
| 124 } | |
| 125 | |
| 126 void RenderImage::updateInnerContentRect() | |
| 127 { | |
| 128 // Propagate container size to the image resource. | |
| 129 LayoutRect containerRect = replacedContentRect(); | |
| 130 IntSize containerSize(containerRect.width(), containerRect.height()); | |
| 131 if (!containerSize.isEmpty()) | |
| 132 m_imageResource->setContainerSizeForRenderer(containerSize); | |
| 133 } | |
| 134 | |
| 135 void RenderImage::paintInvalidationOrMarkForLayout(const IntRect* rect) | |
| 136 { | |
| 137 ASSERT(isRooted()); | 116 ASSERT(isRooted()); |
| 138 | 117 |
| 139 LayoutSize oldIntrinsicSize = intrinsicSize(); | 118 LayoutSize oldIntrinsicSize = intrinsicSize(); |
| 140 LayoutSize newIntrinsicSize = m_imageResource->intrinsicSize(); | 119 LayoutSize newIntrinsicSize = m_imageResource->intrinsicSize(); |
| 141 updateIntrinsicSizeIfNeeded(newIntrinsicSize); | 120 updateIntrinsicSizeIfNeeded(newIntrinsicSize); |
| 142 | 121 |
| 143 bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize; | 122 bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize; |
| 144 if (imageSourceHasChangedSize) | 123 if (imageSourceHasChangedSize) |
| 145 setPreferredLogicalWidthsDirty(); | 124 setPreferredLogicalWidthsDirty(); |
| 146 | 125 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 160 // The image hasn't changed in size or its style constrains its size, so a p
aint invalidation will suffice. | 139 // The image hasn't changed in size or its style constrains its size, so a p
aint invalidation will suffice. |
| 161 if (everHadLayout() && !selfNeedsLayout()) { | 140 if (everHadLayout() && !selfNeedsLayout()) { |
| 162 // The inner content rectangle is calculated during layout, but may need
an update now | 141 // The inner content rectangle is calculated during layout, but may need
an update now |
| 163 // (unless the box has already been scheduled for layout). In order to c
alculate it, we | 142 // (unless the box has already been scheduled for layout). In order to c
alculate it, we |
| 164 // may need values from the containing block, though, so make sure that
we're not too | 143 // may need values from the containing block, though, so make sure that
we're not too |
| 165 // early. It may be that layout hasn't even taken place once yet. | 144 // early. It may be that layout hasn't even taken place once yet. |
| 166 updateInnerContentRect(); | 145 updateInnerContentRect(); |
| 167 } | 146 } |
| 168 } | 147 } |
| 169 | 148 |
| 149 void RenderImage::updateIntrinsicSizeIfNeeded(const LayoutSize& newSize) |
| 150 { |
| 151 if (m_imageResource->errorOccurred() || !m_imageResource->hasImage()) |
| 152 return; |
| 153 setIntrinsicSize(newSize); |
| 154 } |
| 155 |
| 156 void RenderImage::updateInnerContentRect() |
| 157 { |
| 158 // Propagate container size to the image resource. |
| 159 LayoutRect containerRect = replacedContentRect(); |
| 160 IntSize containerSize(containerRect.width(), containerRect.height()); |
| 161 if (!containerSize.isEmpty()) |
| 162 m_imageResource->setContainerSizeForRenderer(containerSize); |
| 163 } |
| 164 |
| 170 void RenderImage::notifyFinished(Resource* newImage) | 165 void RenderImage::notifyFinished(Resource* newImage) |
| 171 { | 166 { |
| 172 if (!m_imageResource) | 167 if (!m_imageResource) |
| 173 return; | 168 return; |
| 174 | 169 |
| 175 if (documentBeingDestroyed()) | 170 if (documentBeingDestroyed()) |
| 176 return; | 171 return; |
| 177 | 172 |
| 178 invalidateBackgroundObscurationStatus(); | 173 invalidateBackgroundObscurationStatus(); |
| 179 } | 174 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return; | 318 return; |
| 324 } | 319 } |
| 325 } | 320 } |
| 326 | 321 |
| 327 bool RenderImage::needsPreferredWidthsRecalculation() const | 322 bool RenderImage::needsPreferredWidthsRecalculation() const |
| 328 { | 323 { |
| 329 return RenderReplaced::needsPreferredWidthsRecalculation(); | 324 return RenderReplaced::needsPreferredWidthsRecalculation(); |
| 330 } | 325 } |
| 331 | 326 |
| 332 } // namespace blink | 327 } // namespace blink |
| OLD | NEW |