Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp

Issue 1756763004: Merge image sizing algorithms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop calculate prefix from concreteObjectSize member function Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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*, float 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 return imageSizeForSVGImage(toSVGImage(m_bestFitImage->image()), multipl ier, defaultObjectSize);
100 return scaledImageSize; 100
101 // Image orientation should only be respected for content images,
102 // not decorative ones such as StyleImage (backgrounds,
103 // border-image, etc.)
Yoav Weiss 2016/03/07 11:16:07 Here too, pointing to a spec and testing functiona
davve 2016/03/07 13:07:38 You mean add the spec link as a comment? I'll do t
davve 2016/03/07 14:26:10 I looked into what happens here. The background im
104 return m_bestFitImage->imageSize(DoNotRespectImageOrientation, multiplier);
101 } 105 }
102 106
103 bool StyleFetchedImageSet::imageHasRelativeSize() const 107 bool StyleFetchedImageSet::imageHasRelativeSize() const
104 { 108 {
105 return m_bestFitImage->imageHasRelativeSize(); 109 return m_bestFitImage->imageHasRelativeSize();
106 } 110 }
107 111
108 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Float Size& intrinsicSize, FloatSize& intrinsicRatio) 112 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Float Size& intrinsicSize, FloatSize& intrinsicRatio)
109 { 113 {
110 m_bestFitImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio); 114 m_bestFitImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio);
(...skipping 29 matching lines...) Expand all
140 } 144 }
141 145
142 DEFINE_TRACE(StyleFetchedImageSet) 146 DEFINE_TRACE(StyleFetchedImageSet)
143 { 147 {
144 visitor->trace(m_bestFitImage); 148 visitor->trace(m_bestFitImage);
145 visitor->trace(m_imageSetValue); 149 visitor->trace(m_imageSetValue);
146 StyleImage::trace(visitor); 150 StyleImage::trace(visitor);
147 } 151 }
148 152
149 } // namespace blink 153 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698