Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 bool StyleFetchedImageSet::isLoaded() const | 86 bool StyleFetchedImageSet::isLoaded() const |
| 87 { | 87 { |
| 88 return m_bestFitImage->isLoaded(); | 88 return m_bestFitImage->isLoaded(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool StyleFetchedImageSet::errorOccurred() const | 91 bool StyleFetchedImageSet::errorOccurred() const |
| 92 { | 92 { |
| 93 return m_bestFitImage->errorOccurred(); | 93 return m_bestFitImage->errorOccurred(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 LayoutSize StyleFetchedImageSet::imageSize(const LayoutObject* layoutObject, flo at multiplier) const | 96 LayoutSize StyleFetchedImageSet::imageSize(const LayoutObject* layoutObject, flo at multiplier, const LayoutSize& defaultObjectSize) const |
| 97 { | 97 { |
| 98 LayoutSize scaledImageSize = m_bestFitImage->imageSize(LayoutObject::shouldR espectImageOrientation(layoutObject), multiplier); | 98 if (m_bestFitImage->image() && m_bestFitImage->image()->isSVGImage()) { |
| 99 scaledImageSize.scale(1 / m_imageScaleFactor); | 99 FloatSize unzoomedDefaultObjectSize(defaultObjectSize); |
| 100 return scaledImageSize; | 100 unzoomedDefaultObjectSize.scale(1 / multiplier); |
| 101 LayoutSize concreteObjectSize(toSVGImage(m_bestFitImage->image())->calcu lateConcreteObjectSize(unzoomedDefaultObjectSize)); | |
| 102 | |
| 103 // Don't let images that have a width/height >= 1 shrink below 1 when zo omed. | |
| 104 LayoutSize minimumSize(concreteObjectSize.width() > LayoutUnit() ? Layou tUnit(1) : LayoutUnit(), | |
| 105 concreteObjectSize.height() > LayoutUnit() ? LayoutUnit(1) : LayoutU nit()); | |
| 106 concreteObjectSize.scale(multiplier); | |
| 107 concreteObjectSize.clampToMinimumSize(minimumSize); | |
| 108 | |
| 109 return concreteObjectSize; | |
| 110 } | |
| 111 | |
| 112 // Image orientation should only be respected for content images, | |
| 113 // not decorative ones as StyleImage (backgrounds, border-image, | |
| 114 // etc.) | |
| 115 const RespectImageOrientationEnum shouldRespectImageOrientation = DoNotRespe ctImageOrientation; | |
|
fs
2016/03/03 15:22:53
Same as above.
davve
2016/03/04 06:49:43
Done.
| |
| 116 | |
| 117 return m_bestFitImage->imageSize(shouldRespectImageOrientation, multiplier); | |
| 101 } | 118 } |
| 102 | 119 |
| 103 bool StyleFetchedImageSet::imageHasRelativeSize() const | 120 bool StyleFetchedImageSet::imageHasRelativeSize() const |
| 104 { | 121 { |
| 105 return m_bestFitImage->imageHasRelativeSize(); | 122 return m_bestFitImage->imageHasRelativeSize(); |
| 106 } | 123 } |
| 107 | 124 |
| 108 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Float Size& intrinsicSize, FloatSize& intrinsicRatio) | 125 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Float Size& intrinsicSize, FloatSize& intrinsicRatio) |
| 109 { | 126 { |
| 110 m_bestFitImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio); | 127 m_bestFitImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 140 } | 157 } |
| 141 | 158 |
| 142 DEFINE_TRACE(StyleFetchedImageSet) | 159 DEFINE_TRACE(StyleFetchedImageSet) |
| 143 { | 160 { |
| 144 visitor->trace(m_bestFitImage); | 161 visitor->trace(m_bestFitImage); |
| 145 visitor->trace(m_imageSetValue); | 162 visitor->trace(m_imageSetValue); |
| 146 StyleImage::trace(visitor); | 163 StyleImage::trace(visitor); |
| 147 } | 164 } |
| 148 | 165 |
| 149 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |