Changeset 120641 in webkit
- Timestamp:
- Jun 18, 2012 4:30:29 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120639 r120641 1 2012-06-18 David Barr <davidbarr@chromium.org> 2 3 Add from-image to css3-images image-resolution 4 https://bugs.webkit.org/show_bug.cgi?id=85451 5 6 Reviewed by Tony Chang. 7 8 * fast/css/image-resolution/image-resolution-expected.txt: 9 * fast/css/image-resolution/image-resolution.html: 10 1 11 2012-06-18 Igor Oliveira <igor.o@sisa.samsung.com> 2 12 -
trunk/LayoutTests/fast/css/image-resolution/image-resolution-expected.txt
r120308 r120641 1 Apply image-resolution property to a fixed image (16x16 @0.75dppx).1 Apply image-resolution property to a fixed image (16x16). 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". … … 76 76 TEST "" 77 77 PASS img.style.cssText is "" 78 TEST "0dppx from-image" 79 PASS img.style.cssText is "" 80 TEST "from-image 0dppx" 81 PASS img.style.cssText is "" 82 TEST "1dppx from-image" 83 PASS img.style.cssText is "image-resolution: 1dppx from-image; " 84 PASS img.offsetWidth is 16 85 PASS img.offsetHeight is 16 86 TEST "from-image 1dppx" 87 PASS img.style.cssText is "image-resolution: from-image 1dppx; " 88 PASS img.offsetWidth is 16 89 PASS img.offsetHeight is 16 90 TEST "2dppx from-image" 91 PASS img.style.cssText is "image-resolution: 2dppx from-image; " 92 PASS img.offsetWidth is 8 93 PASS img.offsetHeight is 8 94 TEST "from-image 2dppx" 95 PASS img.style.cssText is "image-resolution: from-image 2dppx; " 96 PASS img.offsetWidth is 8 97 PASS img.offsetHeight is 8 98 TEST "3dppx from-image" 99 PASS img.style.cssText is "image-resolution: 3dppx from-image; " 100 PASS img.offsetWidth is 5 101 PASS img.offsetHeight is 5 102 TEST "from-image 3dppx" 103 PASS img.style.cssText is "image-resolution: from-image 3dppx; " 104 PASS img.offsetWidth is 5 105 PASS img.offsetHeight is 5 106 TEST "4dppx from-image" 107 PASS img.style.cssText is "image-resolution: 4dppx from-image; " 108 PASS img.offsetWidth is 4 109 PASS img.offsetHeight is 4 110 TEST "from-image 4dppx" 111 PASS img.style.cssText is "image-resolution: from-image 4dppx; " 112 PASS img.offsetWidth is 4 113 PASS img.offsetHeight is 4 114 TEST "0dpi from-image" 115 PASS img.style.cssText is "" 116 TEST "from-image 0dpi" 117 PASS img.style.cssText is "" 118 TEST "96dpi from-image" 119 PASS img.style.cssText is "image-resolution: 96dpi from-image; " 120 PASS img.offsetWidth is 16 121 PASS img.offsetHeight is 16 122 TEST "from-image 96dpi" 123 PASS img.style.cssText is "image-resolution: from-image 96dpi; " 124 PASS img.offsetWidth is 16 125 PASS img.offsetHeight is 16 126 TEST "192dpi from-image" 127 PASS img.style.cssText is "image-resolution: 192dpi from-image; " 128 PASS img.offsetWidth is 8 129 PASS img.offsetHeight is 8 130 TEST "from-image 192dpi" 131 PASS img.style.cssText is "image-resolution: from-image 192dpi; " 132 PASS img.offsetWidth is 8 133 PASS img.offsetHeight is 8 134 TEST "288dpi from-image" 135 PASS img.style.cssText is "image-resolution: 288dpi from-image; " 136 PASS img.offsetWidth is 5 137 PASS img.offsetHeight is 5 138 TEST "from-image 288dpi" 139 PASS img.style.cssText is "image-resolution: from-image 288dpi; " 140 PASS img.offsetWidth is 5 141 PASS img.offsetHeight is 5 142 TEST "384dpi from-image" 143 PASS img.style.cssText is "image-resolution: 384dpi from-image; " 144 PASS img.offsetWidth is 4 145 PASS img.offsetHeight is 4 146 TEST "from-image 384dpi" 147 PASS img.style.cssText is "image-resolution: from-image 384dpi; " 148 PASS img.offsetWidth is 4 149 PASS img.offsetHeight is 4 150 TEST "150dpi from-image" 151 PASS img.style.cssText is "image-resolution: 150dpi from-image; " 152 PASS img.offsetWidth is 10 153 PASS img.offsetHeight is 10 154 TEST "from-image 150dpi" 155 PASS img.style.cssText is "image-resolution: from-image 150dpi; " 156 PASS img.offsetWidth is 10 157 PASS img.offsetHeight is 10 158 TEST "300dpi from-image" 159 PASS img.style.cssText is "image-resolution: 300dpi from-image; " 160 PASS img.offsetWidth is 5 161 PASS img.offsetHeight is 5 162 TEST "from-image 300dpi" 163 PASS img.style.cssText is "image-resolution: from-image 300dpi; " 164 PASS img.offsetWidth is 5 165 PASS img.offsetHeight is 5 166 TEST "450dpi from-image" 167 PASS img.style.cssText is "image-resolution: 450dpi from-image; " 168 PASS img.offsetWidth is 3 169 PASS img.offsetHeight is 3 170 TEST "from-image 450dpi" 171 PASS img.style.cssText is "image-resolution: from-image 450dpi; " 172 PASS img.offsetWidth is 3 173 PASS img.offsetHeight is 3 174 TEST "600dpi from-image" 175 PASS img.style.cssText is "image-resolution: 600dpi from-image; " 176 PASS img.offsetWidth is 2 177 PASS img.offsetHeight is 2 178 TEST "from-image 600dpi" 179 PASS img.style.cssText is "image-resolution: from-image 600dpi; " 180 PASS img.offsetWidth is 2 181 PASS img.offsetHeight is 2 182 TEST "0dpcm from-image" 183 PASS img.style.cssText is "" 184 TEST "from-image 0dpcm" 185 PASS img.style.cssText is "" 186 TEST "37.7dpcm from-image" 187 PASS img.style.cssText is "image-resolution: 37.7dpcm from-image; " 188 PASS img.offsetWidth is 16 189 PASS img.offsetHeight is 16 190 TEST "from-image 37.7dpcm" 191 PASS img.style.cssText is "image-resolution: from-image 37.7dpcm; " 192 PASS img.offsetWidth is 16 193 PASS img.offsetHeight is 16 194 TEST "75.5dpcm from-image" 195 PASS img.style.cssText is "image-resolution: 75.5dpcm from-image; " 196 PASS img.offsetWidth is 8 197 PASS img.offsetHeight is 8 198 TEST "from-image 75.5dpcm" 199 PASS img.style.cssText is "image-resolution: from-image 75.5dpcm; " 200 PASS img.offsetWidth is 8 201 PASS img.offsetHeight is 8 202 TEST "113.3dpcm from-image" 203 PASS img.style.cssText is "image-resolution: 113.3dpcm from-image; " 204 PASS img.offsetWidth is 5 205 PASS img.offsetHeight is 5 206 TEST "from-image 113.3dpcm" 207 PASS img.style.cssText is "image-resolution: from-image 113.3dpcm; " 208 PASS img.offsetWidth is 5 209 PASS img.offsetHeight is 5 210 TEST "151.1dpcm from-image" 211 PASS img.style.cssText is "image-resolution: 151.1dpcm from-image; " 212 PASS img.offsetWidth is 4 213 PASS img.offsetHeight is 4 214 TEST "from-image 151.1dpcm" 215 PASS img.style.cssText is "image-resolution: from-image 151.1dpcm; " 216 PASS img.offsetWidth is 4 217 PASS img.offsetHeight is 4 218 TEST "from-image" 219 PASS img.style.cssText is "image-resolution: from-image; " 220 PASS img.offsetWidth is 16 221 PASS img.offsetHeight is 16 78 222 PASS successfullyParsed is true 79 223 -
trunk/LayoutTests/fast/css/image-resolution/image-resolution.html
r120308 r120641 40 40 dppx = value / (cssPxPerIn / cmPerIn); 41 41 } 42 if (fromImage )42 if (fromImage && imgResolutionDppx) 43 43 dppx = imgResolutionDppx; 44 44 if (snap) … … 49 49 } 50 50 51 function permute2(rule) { 52 var s = rule.trim().split(' '); 53 if (s.length == 1) 54 return s; 55 return [s.join(' '), [s[1], s[0]].join(' ')]; 56 } 57 58 function generateTests(resolutions) { 59 var tests = resolutions.slice(); 60 resolutions.forEach(function(resolution) { 61 tests.push.apply(tests, permute2(resolution + ' from-image')); 62 }); 63 return tests; 64 } 65 51 66 var imgUrl = '../../images/resources/green.jpg'; 52 67 var imgWidthPx = 16; 53 68 var imgHeightPx = 16; 54 var imgResolutionDppx = 72 / 96;55 var dimensions = imgWidthPx + 'x' + imgHeightPx + '@' + imgResolutionDppx + 'dppx';69 var imgResolutionDppx = 0; /* Embedded image resolution data not plumbed yet. */ 70 var dimensions = imgWidthPx + 'x' + imgHeightPx; 56 71 57 72 description('Apply image-resolution property to a fixed image (' + dimensions + ').'); … … 66 81 67 82 img.onload = function() { 68 resolutions.forEach(function(test) {83 generateTests(resolutions).forEach(function(test) { 69 84 var dppx = computeResolution(test, imgResolutionDppx); 70 85 img.style.imageResolution = ''; -
trunk/Source/WebCore/ChangeLog
r120640 r120641 1 2012-06-18 David Barr <davidbarr@chromium.org> 2 3 Add from-image to css3-images image-resolution 4 https://bugs.webkit.org/show_bug.cgi?id=85451 5 6 Reviewed by Tony Chang. 7 8 The css3-images module is at candidate recommendation. 9 http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-resolution 10 11 No new tests; extended fast/css/image-resolution/image-resolution.html 12 13 * css/CSSParser.cpp: Accept from-image identifier in image-resolution property. 14 (WebCore::CSSParser::parseImageResolution): Map CSSValueFromImage to identifier value from cssValuePool. 15 * css/CSSValueKeywords.in: Add from-image. 16 * css/StyleBuilder.cpp: Extend ApplyPropertyImageResolution to apply RenderStyle::imageResolutionSource. 17 (WebCore::ApplyPropertyImageResolution::applyInheritValue): Apply RenderStyle::imageResolutionSource. 18 (WebCore::ApplyPropertyImageResolution::applyInitialValue): Apply RenderStyle::imageResolutionSource. 19 (WebCore::ApplyPropertyImageResolution::applyValue): Map CSSValueFromImage to ImageResolutionFromImage. 20 * rendering/RenderImage.cpp: Extend conditions for recalculation of intrinsic size. 21 (WebCore::RenderImage::styleDidChange): Update intrinsic size if RenderStyle::imageResolutionSource() has changed. 22 * rendering/style/RenderStyle.cpp: Include StyleRareInheritedData::m_imageResolutionSource in style diff. 23 (WebCore::RenderStyle::diff): Map change in StyleRareInheritedData::m_imageResolutionSource to StyleDifferenceLayout. 24 * rendering/style/RenderStyle.h: Add RenderStyle::imageResolutionSource, RenderStyle::setImageResolutionSource, RenderStyle::initialImageResolutionSource. 25 * rendering/style/RenderStyleConstants.h: Add enum ImageResolutionSource. 26 * rendering/style/StyleRareInheritedData.cpp: Add StyleRareInheritedData::m_imageResolutionSource. 27 (WebCore::StyleRareInheritedData::StyleRareInheritedData): Add m_imageResolutionSource to default and copy constructor. 28 (WebCore::StyleRareInheritedData::operator==): Include m_imageResolutionSource in comparison. 29 * rendering/style/StyleRareInheritedData.h: Add StyleRareInheritedData::m_imageResolutionSource. 30 (StyleRareInheritedData): Add 1-bit field StyleRareInheritedData::m_imageResolutionSource. 31 1 32 2012-06-18 James Robinson <jamesr@chromium.org> 2 33 -
trunk/Source/WebCore/css/CSSParser.cpp
r120609 r120641 6894 6894 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); 6895 6895 bool haveResolution = false; 6896 bool haveFromImage = false; 6896 6897 6897 6898 CSSParserValue* value = valueList->current(); 6898 6899 while (value) { 6899 if (!haveResolution && validUnit(value, FResolution | FNonNeg) && value->fValue > 0) { 6900 if (!haveFromImage && value->id == CSSValueFromImage) { 6901 list->append(cssValuePool().createIdentifierValue(value->id)); 6902 haveFromImage = true; 6903 } else if (!haveResolution && validUnit(value, FResolution | FNonNeg) && value->fValue > 0) { 6900 6904 list->append(createPrimitiveNumericValue(value)); 6901 6905 haveResolution = true; -
trunk/Source/WebCore/css/CSSValueKeywords.in
r120029 r120641 925 925 #endif // CSS_SHADERS 926 926 #endif // CSS_FILTERS 927 928 #if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION 929 from-image 930 #endif -
trunk/Source/WebCore/css/StyleBuilder.cpp
r120609 r120641 1773 1773 static void applyInheritValue(StyleResolver* styleResolver) 1774 1774 { 1775 ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInheritValue(styleResolver); 1775 1776 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(styleResolver); 1776 1777 } … … 1778 1779 static void applyInitialValue(StyleResolver* styleResolver) 1779 1780 { 1781 ApplyPropertyDefaultBase<ImageResolutionSource, &RenderStyle::imageResolutionSource, ImageResolutionSource, &RenderStyle::setImageResolutionSource, ImageResolutionSource, &RenderStyle::initialImageResolutionSource>::applyInitialValue(styleResolver); 1780 1782 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(styleResolver); 1781 1783 } … … 1786 1788 return; 1787 1789 CSSValueList* valueList = static_cast<CSSValueList*>(value); 1790 ImageResolutionSource source = RenderStyle::initialImageResolutionSource(); 1791 double resolution = RenderStyle::initialImageResolution(); 1788 1792 for (size_t i = 0; i < valueList->length(); i++) { 1789 1793 CSSValue* item = valueList->itemWithoutBoundsCheck(i); … … 1791 1795 continue; 1792 1796 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item); 1793 styleResolver->style()->setImageResolution(primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX)); 1794 } 1797 if (primitiveValue->getIdent() == CSSValueFromImage) 1798 source = ImageResolutionFromImage; 1799 else 1800 resolution = primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX); 1801 } 1802 styleResolver->style()->setImageResolutionSource(source); 1803 styleResolver->style()->setImageResolution(resolution); 1795 1804 } 1796 1805 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r119984 r120641 139 139 } 140 140 #if ENABLE(CSS_IMAGE_RESOLUTION) 141 if (diff == StyleDifferenceLayout && oldStyle->imageResolution() != style()->imageResolution()) 141 if (diff == StyleDifferenceLayout 142 && (oldStyle->imageResolution() != style()->imageResolution() 143 || oldStyle->imageResolutionSource() != style()->imageResolutionSource())) 142 144 imageDimensionsChanged(true /* imageSizeChanged */); 143 145 #endif -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r120154 r120641 474 474 || rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid 475 475 #if ENABLE(CSS_IMAGE_RESOLUTION) 476 || rareInheritedData->m_imageResolutionSource != other->rareInheritedData->m_imageResolutionSource 476 477 || rareInheritedData->m_imageResolution != other->rareInheritedData->m_imageResolution 477 478 #endif -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r120609 r120641 984 984 985 985 #if ENABLE(CSS_IMAGE_RESOLUTION) 986 ImageResolutionSource imageResolutionSource() const { return static_cast<ImageResolutionSource>(rareInheritedData->m_imageResolutionSource); } 986 987 float imageResolution() const { return rareInheritedData->m_imageResolution; } 987 988 #endif … … 1154 1155 1155 1156 #if ENABLE(CSS_IMAGE_RESOLUTION) 1157 void setImageResolutionSource(ImageResolutionSource v) { SET_VAR(rareInheritedData, m_imageResolutionSource, v) } 1156 1158 void setImageResolution(float f) { SET_VAR(rareInheritedData, m_imageResolution, f) } 1157 1159 #endif … … 1668 1670 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; } 1669 1671 static EImageRendering initialImageRendering() { return ImageRenderingAuto; } 1672 static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; } 1670 1673 static float initialImageResolution() { return 1; } 1671 1674 static StyleImage* initialBorderImageSource() { return 0; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r120609 r120641 455 455 enum EImageRendering { ImageRenderingAuto, ImageRenderingOptimizeSpeed, ImageRenderingOptimizeQuality, ImageRenderingOptimizeContrast }; 456 456 457 enum ImageResolutionSource { ImageResolutionSpecified = 0, ImageResolutionFromImage }; 458 457 459 enum Order { LogicalOrder = 0, VisualOrder }; 458 460 -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r120366 r120641 87 87 #if ENABLE(OVERFLOW_SCROLLING) 88 88 , useTouchOverflowScrolling(RenderStyle::initialUseTouchOverflowScrolling()) 89 #endif 90 #if ENABLE(CSS_IMAGE_RESOLUTION) 91 , m_imageResolutionSource(RenderStyle::initialImageResolutionSource()) 89 92 #endif 90 93 , hyphenationLimitBefore(-1) … … 143 146 , useTouchOverflowScrolling(o.useTouchOverflowScrolling) 144 147 #endif 148 #if ENABLE(CSS_IMAGE_RESOLUTION) 149 , m_imageResolutionSource(o.m_imageResolutionSource) 150 #endif 145 151 , hyphenationString(o.hyphenationString) 146 152 , hyphenationLimitBefore(o.hyphenationLimitBefore) … … 225 231 && m_imageRendering == o.m_imageRendering 226 232 #if ENABLE(CSS_IMAGE_RESOLUTION) 233 && m_imageResolutionSource == o.m_imageResolutionSource 227 234 && m_imageResolution == o.m_imageResolution 228 235 #endif -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r120366 r120641 102 102 unsigned useTouchOverflowScrolling: 1; 103 103 #endif 104 #if ENABLE(CSS_IMAGE_RESOLUTION) 105 unsigned m_imageResolutionSource : 1; // ImageResolutionSource 106 #endif 104 107 105 108 AtomicString hyphenationString;
Note: See TracChangeset
for help on using the changeset viewer.