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

Side by Side Diff: Source/core/css/CSSCrossfadeValue.cpp

Issue 1306283006: BackgroundImage incorrectly returns empty url() when created on-the-fly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ensure getComputedStyle returns absolute URLs Created 5 years, 3 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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 result.appendLiteral("-webkit-cross-fade("); 110 result.appendLiteral("-webkit-cross-fade(");
111 result.append(m_fromValue->cssText()); 111 result.append(m_fromValue->cssText());
112 result.appendLiteral(", "); 112 result.appendLiteral(", ");
113 result.append(m_toValue->cssText()); 113 result.append(m_toValue->cssText());
114 result.appendLiteral(", "); 114 result.appendLiteral(", ");
115 result.append(m_percentageValue->cssText()); 115 result.append(m_percentageValue->cssText());
116 result.append(')'); 116 result.append(')');
117 return result.toString(); 117 return result.toString();
118 } 118 }
119 119
120 PassRefPtrWillBeRawPtr<CSSCrossfadeValue> CSSCrossfadeValue::valueWithAbsoluteUR L()
121 {
122 if (m_fromValue->isImageValue() && m_toValue->isImageValue()) {
Timothy Loh 2015/09/15 12:20:47 The logic here seems weird. What if only one side
nainar 2015/09/16 07:16:48 Fixed.
123 return CSSCrossfadeValue::create(toCSSImageValue(*m_fromValue).valueWith AbsoluteURL(), toCSSImageValue(*m_toValue).valueWithAbsoluteURL(), m_percentageV alue);
124 }
125 return this;
126 }
127
120 IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject) 128 IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject)
121 { 129 {
122 Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObjec t); 130 float percentage = m_percentageValue->getFloatValue();
Timothy Loh 2015/09/15 12:20:47 ???
nainar 2015/09/16 07:16:48 Fixed.
123 Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject); 131 float inversePercentage = 1 - percentage;
132
133 Document* document = &layoutObject->document();
134 ImageResource* cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), d ocument);
135 ImageResource* cachedToImage = cachedImageForCSSValue(m_toValue.get(), docum ent);
124 136
125 if (!fromImage || !toImage) 137 if (!fromImage || !toImage)
126 return IntSize(); 138 return IntSize();
127 139
128 IntSize fromImageSize = fromImage->size(); 140 IntSize fromImageSize = fromImage->size();
129 IntSize toImageSize = toImage->size(); 141 IntSize toImageSize = toImage->size();
130 142
131 // Rounding issues can cause transitions between images of equal size to ret urn 143 // Rounding issues can cause transitions between images of equal size to ret urn
132 // a different fixed size; avoid performing the interpolation if the images are the same size. 144 // a different fixed size; avoid performing the interpolation if the images are the same size.
133 if (fromImageSize == toImageSize) 145 if (fromImageSize == toImageSize)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) 236 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue)
225 { 237 {
226 visitor->trace(m_fromValue); 238 visitor->trace(m_fromValue);
227 visitor->trace(m_toValue); 239 visitor->trace(m_toValue);
228 visitor->trace(m_percentageValue); 240 visitor->trace(m_percentageValue);
229 visitor->trace(m_crossfadeSubimageObserver); 241 visitor->trace(m_crossfadeSubimageObserver);
230 CSSImageGeneratorValue::traceAfterDispatch(visitor); 242 CSSImageGeneratorValue::traceAfterDispatch(visitor);
231 } 243 }
232 244
233 } // namespace blink 245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698