Changeset 255228 in webkit for trunk/Source/WebCore/css/CSSImageSetValue.cpp
- Timestamp:
- Jan 27, 2020, 11:54:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSImageSetValue.cpp
r254861 r255228 51 51 { 52 52 size_t length = this->length(); 53 size_t i = 0; 54 while (i < length) { 53 for (size_t i = 0; i + 1 < length; i += 2) { 55 54 CSSValue* imageValue = item(i); 55 CSSValue* scaleFactorValue = item(i + 1); 56 56 57 ASSERT(is<CSSImageValue>(imageValue) || is<CSSImageGeneratorValue>(imageValue)); 57 ++i; 58 ASSERT_WITH_SECURITY_IMPLICATION(i < length); 59 CSSValue* scaleFactorValue = item(i); 60 float scaleFactor = downcast<CSSPrimitiveValue>(*scaleFactorValue).floatValue(); 58 ASSERT(is<CSSPrimitiveValue>(scaleFactorValue)); 61 59 62 ImageWithScale image; 63 image.value = imageValue; 64 image.scaleFactor = scaleFactor; 65 m_imagesInSet.append(image); 66 ++i; 60 float scaleFactor = downcast<CSSPrimitiveValue>(scaleFactorValue)->floatValue(CSSUnitType::CSS_DPPX); 61 m_imagesInSet.append({ imageValue, scaleFactor }); 67 62 } 68 63 … … 107 102 void CSSImageSetValue::updateDeviceScaleFactor(const Document& document) 108 103 { 109 110 104 // FIXME: In the future, we want to take much more than deviceScaleFactor into acount here. 111 105 // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(), … … 137 131 138 132 size_t length = this->length(); 139 size_t i = 0; 140 while (i < length) { 133 for (size_t i = 0; i + 1 < length; i += 2) { 141 134 if (i > 0) 142 135 result.appendLiteral(", "); 143 136 144 const CSSValue* imageValue = item(i); 145 result.append(imageValue->cssText()); 146 result.append(' '); 147 148 ++i; 149 ASSERT_WITH_SECURITY_IMPLICATION(i < length); 150 const CSSValue* scaleFactorValue = item(i); 151 result.append(scaleFactorValue->cssText()); 152 // FIXME: Eventually the scale factor should contain it's own unit http://wkb.ug/100120. 153 // For now 'x' is hard-coded in the parser, so we hard-code it here too. 154 result.append('x'); 155 156 ++i; 137 result.append(item(i)->cssText(), ' ', item(i + 1)->cssText()); 157 138 } 158 139
Note:
See TracChangeset
for help on using the changeset viewer.