Source/WebCore/ChangeLog

 12012-06-05 David Barr <davidbarr@chromium.org>
 2
 3 Add css3-images image-resolution (dppx only)
 4 https://bugs.webkit.org/show_bug.cgi?id=85332
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The css3-images module is at candidate recommendation.
 9 http://www.w3.org/TR/2012/CR-css3-images-20120417/#image-resolution
 10
 11 Test: fast/css/image-resolution.html
 12
 13 * css/CSSComputedStyleDeclaration.cpp:
 14 (WebCore):
 15 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
 16 * css/CSSGrammar.y:
 17 * css/CSSParser.cpp:
 18 (WebCore::CSSParser::validUnit):
 19 (WebCore::CSSParser::createPrimitiveNumericValue):
 20 (WebCore::unitFromString):
 21 (WebCore::CSSParser::parseValidPrimitive):
 22 (WebCore::CSSParser::parseValue):
 23 (WebCore):
 24 (WebCore::CSSParser::parseImageResolution):
 25 (WebCore::CSSParser::detectNumberToken):
 26 * css/CSSParser.h:
 27 * css/CSSPrimitiveValue.cpp:
 28 (WebCore::isValidCSSUnitTypeForDoubleConversion):
 29 (WebCore::unitCategory):
 30 (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
 31 (WebCore::CSSPrimitiveValue::customCssText):
 32 (WebCore::CSSPrimitiveValue::cloneForCSSOM):
 33 * css/CSSPrimitiveValue.h:
 34 * css/CSSProperty.cpp:
 35 (WebCore::CSSProperty::isInheritedProperty):
 36 * css/CSSPropertyNames.in:
 37 * css/StyleBuilder.cpp:
 38 (WebCore):
 39 (ApplyPropertyImageResolution):
 40 (WebCore::ApplyPropertyImageResolution::applyInheritValue):
 41 (WebCore::ApplyPropertyImageResolution::applyInitialValue):
 42 (WebCore::ApplyPropertyImageResolution::applyValue):
 43 (WebCore::ApplyPropertyImageResolution::createHandler):
 44 (WebCore::StyleBuilder::StyleBuilder):
 45 * css/StyleResolver.cpp:
 46 (WebCore::StyleResolver::collectMatchingRulesForList):
 47 * rendering/RenderImage.cpp:
 48 (WebCore::RenderImage::styleDidChange):
 49 (WebCore::RenderImage::imageDimensionsChanged):
 50 * rendering/style/RenderStyle.cpp:
 51 (WebCore::RenderStyle::diff):
 52 * rendering/style/RenderStyle.h:
 53 * rendering/style/StyleRareInheritedData.cpp:
 54 (WebCore::StyleRareInheritedData::StyleRareInheritedData):
 55 (WebCore::StyleRareInheritedData::operator==):
 56 * rendering/style/StyleRareInheritedData.h:
 57 (StyleRareInheritedData):
 58
1592012-06-05 Roland Takacs <takacs.roland@stud.u-szeged.hu>
260
361 [Qt] Use GraphicsContext3DOpenGLES.cpp when using OpenGL ES

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

@@static const CSSPropertyID computedProperties[] = {
125125 CSSPropertyFontWeight,
126126 CSSPropertyHeight,
127127 CSSPropertyImageRendering,
 128#if ENABLE(CSS_IMAGE_RESOLUTION)
 129 CSSPropertyImageResolution,
 130#endif
128131 CSSPropertyLeft,
129132 CSSPropertyLetterSpacing,
130133 CSSPropertyLineHeight,

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
17671770 return cssValuePool().createIdentifierValue(CSSValueLines);
17681771 case CSSPropertyImageRendering:
17691772 return CSSPrimitiveValue::create(style->imageRendering());
 1773#if ENABLE(CSS_IMAGE_RESOLUTION)
 1774 case CSSPropertyImageResolution:
 1775 return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
 1776#endif
17701777 case CSSPropertyLeft:
17711778 return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document()->renderView());
17721779 case CSSPropertyLetterSpacing:

Source/WebCore/css/CSSGrammar.y

@@static int cssyylex(YYSTYPE* yylval, void* parser)
101101
102102%}
103103
104 %expect 58
 104%expect 59
105105
106106%nonassoc LOWEST_PREC
107107

@@static int cssyylex(YYSTYPE* yylval, void* parser)
193193%token <number> VW
194194%token <number> VH
195195%token <number> VMIN
 196%token <number> DPPX
196197
197198%token <string> URI
198199%token <string> FUNCTION

@@unary_term:
14751476 | VW maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VW; }
14761477 | VH maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
14771478 | VMIN maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
 1479 | DPPX maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
14781480 ;
14791481
14801482function:

Source/WebCore/css/CSSParser.cpp

@@bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, CSSParserMode
13351335 case CSSPrimitiveValue::CSS_TURN:
13361336 b = (unitflags & FAngle);
13371337 break;
 1338#if ENABLE(CSS_IMAGE_RESOLUTION)
 1339 case CSSPrimitiveValue::CSS_DPPX:
 1340 b = (unitflags & FResolution);
 1341 break;
 1342#endif
13381343 case CSSPrimitiveValue::CSS_HZ:
13391344 case CSSPrimitiveValue::CSS_KHZ:
13401345 case CSSPrimitiveValue::CSS_DIMENSION:

@@inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveNumericValue(CSSP
13531358 return CSSPrimitiveValue::create(m_parsedCalculation.release());
13541359 }
13551360
 1361#if ENABLE(CSS_IMAGE_RESOLUTION)
 1362 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
 1363 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
 1364 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
 1365 || (value->unit == CSSPrimitiveValue::CSS_DPPX));
 1366#else
13561367 ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
13571368 || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
13581369 || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN));
 1370#endif
13591371 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
13601372}
13611373

@@static int unitFromString(CSSParserValue* value)
14101422 return CSSPrimitiveValue::CSS_VH;
14111423 if (equal(value->string, "vmin"))
14121424 return CSSPrimitiveValue::CSS_VMIN;
 1425#if ENABLE(CSS_IMAGE_RESOLUTION)
 1426 if (equal(value->string, "dppx"))
 1427 return CSSPrimitiveValue::CSS_DPPX;
 1428#endif
14131429
14141430 return 0;
14151431}

@@inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int identifi
14631479 return createPrimitiveNumericValue(value);
14641480 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
14651481 return createPrimitiveNumericValue(value);
 1482#if ENABLE(CSS_IMAGE_RESOLUTION)
 1483 if (value->unit == CSSPrimitiveValue::CSS_DPPX)
 1484 return createPrimitiveNumericValue(value);
 1485#endif
14661486 if (value->unit >= CSSParserValue::Q_EMS)
14671487 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPrimitiveValue::CSS_EMS);
14681488 if (isCalculation(value))

@@bool CSSParser::parseValue(CSSPropertyID propId, bool important)
24932513 case CSSPropertyWebkitWrap:
24942514 return RuntimeEnabledFeatures::cssExclusionsEnabled() && parseShorthand(propId, webkitWrapShorthand(), important);
24952515#endif
 2516#if ENABLE(CSS_IMAGE_RESOLUTION)
 2517 case CSSPropertyImageResolution:
 2518 parsedValue = parseImageResolution(m_valueList.get());
 2519 if (!parsedValue)
 2520 return false;
 2521 m_valueList->next();
 2522 break;
 2523#endif
24962524 case CSSPropertyBorderBottomStyle:
24972525 case CSSPropertyBorderCollapse:
24982526 case CSSPropertyBorderLeftStyle:

@@bool CSSParser::parseCanvas(CSSParserValueList* valueList, RefPtr<CSSValue>& can
67886816 return true;
67896817}
67906818
 6819#if ENABLE(CSS_IMAGE_RESOLUTION)
 6820PassRefPtr<CSSValue> CSSParser::parseImageResolution(CSSParserValueList* valueList)
 6821{
 6822 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
 6823 bool haveResolution = false;
 6824
 6825 CSSParserValue* value = valueList->current();
 6826 while (value) {
 6827 if (!haveResolution && validUnit(value, FResolution | FNonNeg) && value->fValue > 0) {
 6828 list->append(createPrimitiveNumericValue(value));
 6829 haveResolution = true;
 6830 } else
 6831 return 0;
 6832 value = m_valueList->next();
 6833 }
 6834 if (!list->length())
 6835 return 0;
 6836 return list;
 6837}
 6838#endif
 6839
67916840#if ENABLE(CSS_IMAGE_SET)
67926841PassRefPtr<CSSValue> CSSParser::parseImageSet(CSSParserValueList* valueList)
67936842{

@@inline void CSSParser::detectNumberToken(UChar* type, int length)
82658314 case 'd':
82668315 if (length == 3 && isASCIIAlphaCaselessEqual(type[1], 'e') && isASCIIAlphaCaselessEqual(type[2], 'g'))
82678316 m_token = DEGS;
 8317#if ENABLE(CSS_IMAGE_RESOLUTION)
 8318 // There is a discussion about the name of this unit on www-style.
 8319 // Keep this compile time guard in place until that is resolved.
 8320 // http://lists.w3.org/Archives/Public/www-style/2012May/0915.html
 8321 else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'p')
 8322 && isASCIIAlphaCaselessEqual(type[2], 'p') && isASCIIAlphaCaselessEqual(type[3], 'x'))
 8323 m_token = DPPX;
 8324#endif
82688325 return;
82698326
82708327 case 'e':

Source/WebCore/css/CSSParser.h

@@public:
195195
196196 bool parseCrossfade(CSSParserValueList*, RefPtr<CSSValue>&);
197197
 198#if ENABLE(CSS_IMAGE_RESOLUTION)
 199 PassRefPtr<CSSValue> parseImageResolution(CSSParserValueList*);
 200#endif
 201
198202#if ENABLE(CSS_IMAGE_SET)
199203 PassRefPtr<CSSValue> parseImageSet(CSSParserValueList*);
200204#endif

@@private:
436440 FTime = 0x0020,
437441 FFrequency = 0x0040,
438442 FRelative = 0x0100,
439  FNonNeg = 0x0200
 443#if ENABLE(CSS_IMAGE_RESOLUTION)
 444 FResolution= 0x0200,
 445#endif
 446 FNonNeg = 0x0400
440447 };
441448
442449 friend inline Units operator|(Units a, Units b)

Source/WebCore/css/CSSPrimitiveValue.cpp

@@static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit
6060 case CSSPrimitiveValue:: CSS_CM:
6161 case CSSPrimitiveValue:: CSS_DEG:
6262 case CSSPrimitiveValue:: CSS_DIMENSION:
 63#if ENABLE(CSS_IMAGE_RESOLUTION)
 64 case CSSPrimitiveValue:: CSS_DPPX:
 65#endif
6366 case CSSPrimitiveValue:: CSS_EMS:
6467 case CSSPrimitiveValue:: CSS_EXS:
6568 case CSSPrimitiveValue:: CSS_GRAD:

@@static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit
8588 case CSSPrimitiveValue:: CSS_COUNTER:
8689 case CSSPrimitiveValue:: CSS_COUNTER_NAME:
8790 case CSSPrimitiveValue:: CSS_DASHBOARD_REGION:
 91#if !ENABLE(CSS_IMAGE_RESOLUTION)
 92 case CSSPrimitiveValue:: CSS_DPPX:
 93#endif
8894 case CSSPrimitiveValue:: CSS_IDENT:
8995 case CSSPrimitiveValue:: CSS_PAIR:
9096 case CSSPrimitiveValue:: CSS_PARSER_HEXCOLOR:

@@static CSSPrimitiveValue::UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes
137143 case CSSPrimitiveValue::CSS_VH:
138144 case CSSPrimitiveValue::CSS_VMIN:
139145 return CSSPrimitiveValue::UViewportPercentageLength;
 146#if ENABLE(CSS_IMAGE_RESOLUTION)
 147 case CSSPrimitiveValue:: CSS_DPPX:
 148 return CSSPrimitiveValue::UResolution;
 149#endif
140150 default:
141151 return CSSPrimitiveValue::UOther;
142152 }

@@CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::canonicalUnitTypeForCategory(Uni
627637 return CSS_HZ;
628638 case UViewportPercentageLength:
629639 return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
 640#if ENABLE(CSS_IMAGE_RESOLUTION)
 641 case UResolution:
 642 return CSS_DPPX;
 643#endif
630644 default:
631645 return CSS_UNKNOWN;
632646 }

@@String CSSPrimitiveValue::customCssText() const
828842 case CSS_CM:
829843 text = formatNumber(m_value.num) + "cm";
830844 break;
 845#if ENABLE(CSS_IMAGE_RESOLUTION)
 846 case CSS_DPPX:
 847 text = formatNumber(m_value.num) + "dppx";
 848 break;
 849#endif
831850 case CSS_MM:
832851 text = formatNumber(m_value.num) + "mm";
833852 break;

@@PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const
11511170 case CSS_VW:
11521171 case CSS_VH:
11531172 case CSS_VMIN:
 1173#if ENABLE(CSS_IMAGE_RESOLUTION)
 1174 case CSS_DPPX:
 1175#endif
11541176 result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
11551177 break;
11561178 case CSS_IDENT:

Source/WebCore/css/CSSPrimitiveValue.h

@@public:
9595 CSS_VW = 26,
9696 CSS_VH = 27,
9797 CSS_VMIN = 28,
 98 CSS_DPPX = 29,
9899 CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
99100 CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
100101 CSS_UNICODE_RANGE = 102,

@@public:
134135 UTime,
135136 UFrequency,
136137 UViewportPercentageLength,
 138#if ENABLE(CSS_IMAGE_RESOLUTION)
 139 UResolution,
 140#endif
137141 UOther
138142 };
139143

Source/WebCore/css/CSSProperty.cpp

@@bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
268268 case CSSPropertyFontVariant:
269269 case CSSPropertyFontWeight:
270270 case CSSPropertyImageRendering:
 271#if ENABLE(CSS_IMAGE_RESOLUTION)
 272 case CSSPropertyImageResolution:
 273#endif
271274 case CSSPropertyLetterSpacing:
272275 case CSSPropertyLineHeight:
273276 case CSSPropertyListStyle:

Source/WebCore/css/CSSPropertyNames.in

@@float
104104font-stretch
105105height
106106image-rendering
 107#if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
 108image-resolution
 109#endif
107110left
108111letter-spacing
109112list-style

Source/WebCore/css/StyleBuilder.cpp

@@private:
17671767
17681768};
17691769
 1770#if ENABLE(CSS_IMAGE_RESOLUTION)
 1771class ApplyPropertyImageResolution {
 1772public:
 1773 static void applyInheritValue(StyleResolver* styleResolver)
 1774 {
 1775 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(styleResolver);
 1776 }
 1777
 1778 static void applyInitialValue(StyleResolver* styleResolver)
 1779 {
 1780 ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(styleResolver);
 1781 }
 1782
 1783 static void applyValue(StyleResolver* styleResolver, CSSValue* value)
 1784 {
 1785 if (!value->isValueList())
 1786 return;
 1787 CSSValueList* valueList = static_cast<CSSValueList*>(value);
 1788 for (size_t i = 0; i < valueList->length(); i++) {
 1789 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
 1790 if (!item->isPrimitiveValue())
 1791 continue;
 1792 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
 1793 styleResolver->style()->setImageResolution(primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX));
 1794 }
 1795 }
 1796
 1797 static PropertyHandler createHandler()
 1798 {
 1799 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
 1800 }
 1801};
 1802#endif
 1803
17701804const StyleBuilder& StyleBuilder::sharedStyleBuilder()
17711805{
17721806 DEFINE_STATIC_LOCAL(StyleBuilder, styleBuilderInstance, ());

@@StyleBuilder::StyleBuilder()
18431877 setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
18441878 setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
18451879 setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
 1880#if ENABLE(CSS_IMAGE_RESOLUTION)
 1881 setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
 1882#endif
18461883 setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
18471884 setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
18481885 setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());

Source/WebCore/css/StyleResolver.cpp

@@void StyleResolver::applyProperty(CSSPropertyID id, CSSValue *value)
40304030 case CSSPropertyFontWeight:
40314031 case CSSPropertyHeight:
40324032 case CSSPropertyImageRendering:
 4033#if ENABLE(CSS_IMAGE_RESOLUTION)
 4034 case CSSPropertyImageResolution:
 4035#endif
40334036 case CSSPropertyLeft:
40344037 case CSSPropertyLetterSpacing:
40354038 case CSSPropertyLineHeight:

Source/WebCore/rendering/RenderImage.cpp

@@void RenderImage::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
137137 imageDimensionsChanged(true /* imageSizeChanged */);
138138 m_needsToSetSizeForAltText = false;
139139 }
 140#if ENABLE(CSS_IMAGE_RESOLUTION)
 141 if (diff == StyleDifferenceLayout && oldStyle->imageResolution() != style()->imageResolution())
 142 imageDimensionsChanged(true /* imageSizeChanged */);
 143#endif
140144}
141145
142146void RenderImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect)

@@bool RenderImage::updateIntrinsicSizeIfNeeded(const IntSize& newSize, bool image
191195
192196void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* rect)
193197{
 198#if ENABLE(CSS_IMAGE_RESOLUTION)
 199 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom() / style()->imageResolution()), imageSizeChanged);
 200#else
194201 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom()), imageSizeChanged);
 202#endif
195203
196204 // In the case of generated image content using :before/:after/content, we might not be
197205 // in the render tree yet. In that case, we just need to update our intrinsic size.

Source/WebCore/rendering/style/RenderStyle.cpp

@@StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
461461 || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
462462 || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
463463 || rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid
 464#if ENABLE(CSS_IMAGE_RESOLUTION)
 465 || rareInheritedData->m_imageResolution != other->rareInheritedData->m_imageResolution
 466#endif
464467 || rareInheritedData->m_lineSnap != other->rareInheritedData->m_lineSnap
465468 || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign)
466469 return StyleDifferenceLayout;

Source/WebCore/rendering/style/RenderStyle.h

@@public:
968968 bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; }
969969
970970 EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
 971
 972#if ENABLE(CSS_IMAGE_RESOLUTION)
 973 float imageResolution() const { return rareInheritedData->m_imageResolution; }
 974#endif
971975
972976 ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
973977

@@public:
11351139 bool setEffectiveZoom(float);
11361140 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
11371141
 1142#if ENABLE(CSS_IMAGE_RESOLUTION)
 1143 void setImageResolution(float f) { SET_VAR(rareInheritedData, m_imageResolution, f) }
 1144#endif
 1145
11381146 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
11391147
11401148 void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }

@@public:
16421650 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
16431651 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
16441652 static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
 1653 static float initialImageResolution() { return 1; }
16451654 static StyleImage* initialBorderImageSource() { return 0; }
16461655 static StyleImage* initialMaskBoxImageSource() { return 0; }
16471656 static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }

Source/WebCore/rendering/style/StyleRareInheritedData.cpp

@@StyleRareInheritedData::StyleRareInheritedData()
6363 , hyphenationLimitLines(-1)
6464 , m_lineGrid(RenderStyle::initialLineGrid())
6565 , m_tabSize(RenderStyle::initialTabSize())
 66#if ENABLE(CSS_IMAGE_RESOLUTION)
 67 , m_imageResolution(RenderStyle::initialImageResolution())
 68#endif
6669#if ENABLE(TOUCH_EVENTS)
6770 , tapHighlightColor(RenderStyle::initialTapHighlightColor())
6871#endif

@@StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
115118 , textEmphasisCustomMark(o.textEmphasisCustomMark)
116119 , m_lineGrid(o.m_lineGrid)
117120 , m_tabSize(o.m_tabSize)
 121#if ENABLE(CSS_IMAGE_RESOLUTION)
 122 , m_imageResolution(o.m_imageResolution)
 123#endif
118124#if ENABLE(TOUCH_EVENTS)
119125 , tapHighlightColor(o.tapHighlightColor)
120126#endif

@@bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
182188 && m_tabSize == o.m_tabSize
183189 && m_lineGrid == o.m_lineGrid
184190 && m_imageRendering == o.m_imageRendering
 191#if ENABLE(CSS_IMAGE_RESOLUTION)
 192 && m_imageResolution == o.m_imageResolution
 193#endif
185194 && m_lineSnap == o.m_lineSnap
186195 && m_lineAlign == o.m_lineAlign;
187196}

Source/WebCore/rendering/style/StyleRareInheritedData.h

@@public:
110110 AtomicString m_lineGrid;
111111 unsigned m_tabSize;
112112
 113#if ENABLE(CSS_IMAGE_RESOLUTION)
 114 float m_imageResolution;
 115#endif
 116
113117#if ENABLE(TOUCH_EVENTS)
114118 Color tapHighlightColor;
115119#endif

LayoutTests/ChangeLog

 12012-06-05 David Barr <davidbarr@chromium.org>
 2
 3 Add css3-images image-resolution (dppx only)
 4 https://bugs.webkit.org/show_bug.cgi?id=85332
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The css3-images module is at candidate recommendation.
 9 http://www.w3.org/TR/2012/CR-css3-images-20120417/#image-resolution
 10
 11 * fast/css/image-resolution/image-resolution-expected.html: Added.
 12 * fast/css/image-resolution/image-resolution.html: Added.
 13 * fast/css/image-resolution/resources/image-resolution.js: Added.
 14 (computeResolution): Compute effective resolution for a given rule.
 15 * platform/chromium/TestExpectations: Skip tests until image-resolution implementation lands.
 16 * platform/efl/TestExpectations: Skip tests until image-resolution implementation lands.
 17 * platform/gtk/TestExpectations: Skip tests until image-resolution implementation lands.
 18 * platform/mac/TestExpectations: Skip tests until image-resolution implementation lands.
 19 * platform/qt/TestExpectations: Skip tests until image-resolution implementation lands.
 20
1212012-06-05 Ryosuke Niwa <rniwa@webkit.org>
222
323 Chromium rebaselines after r115091.

LayoutTests/fast/css/image-resolution/image-resolution-expected.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<style>
 5div { position: absolute; background-color: #00ff3f; outline: solid 1px darkgreen; }
 6img { display: none; }
 7</style>
 8</head>
 9<body>
 10<script src="resources/image-resolution.js"></script>
 11</body>
 12</html>

LayoutTests/fast/css/image-resolution/image-resolution.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<style>
 5div { position: absolute; background-color: red; outline: solid 1px darkgreen; }
 6img { display: block; }
 7</style>
 8</head>
 9<body>
 10<script src="resources/image-resolution.js"></script>
 11</body>
 12</html>

LayoutTests/fast/css/image-resolution/resources/image-resolution.js

 1function computeResolution(resolution, imgResolutionDppx)
 2{
 3 var fromImage = /from-image/.test(resolution);
 4 var snap = /snap/.test(resolution);
 5 var explicit = /(\d+(\.\d+)?)(dp(px|i|cm))/.exec(resolution);
 6 var value = explicit && explicit[1] * 1;
 7 var unit = explicit && explicit[3];
 8 var dppx = 1;
 9 if (unit && value) {
 10 if (unit == 'dppx')
 11 dppx = value;
 12 var cssPxPerIn = 96;
 13 if (unit === 'dpi')
 14 dppx = value / cssPxPerIn;
 15 var cmPerIn = 2.54;
 16 if (unit === 'dpcm')
 17 dppx = value / (cssPxPerIn / cmPerIn);
 18 }
 19 if (fromImage)
 20 dppx = imgResolutionDppx;
 21 if (snap)
 22 dppx = Math.floor(dppx);
 23 if (dppx <= 0)
 24 dppx = 1;
 25 return dppx;
 26}
 27
 28var resolutions = ['0dppx', '1dppx', '2dppx', '3dppx', '4dppx', ''];
 29
 30var imgUrl = '../../images/resources/green.jpg';
 31var imgWidthPx = 16;
 32var imgHeightPx = 16;
 33var imgResolutionDppx = 72 / 96;
 34
 35var x = 8;
 36var y = 8;
 37
 38Array.prototype.forEach.call(resolutions, function(test) {
 39 var dppx = computeResolution(test, imgResolutionDppx);
 40 var div = document.createElement('div');
 41 var style = div.style;
 42 style.left = x + 'px';
 43 style.top = y + 'px';
 44 style.width = Math.floor(imgWidthPx / dppx) + 'px';
 45 style.height = Math.floor(imgHeightPx / dppx) + 'px';
 46 div.innerHTML = '<img src="' + imgUrl + '" style="image-resolution: ' + test + '">';
 47 document.body.appendChild(div);
 48 x += 40;
 49});

LayoutTests/platform/chromium/TestExpectations

@@BUGGBILLOCK SKIP : webintents/intent-tag.html = FAIL
153153// CSS Variables are not yet enabled.
154154BUGWK85580 SKIP : fast/css/variables = PASS FAIL
155155
 156// CSS image-resolution is not yet enabled.
 157BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
 158
156159// Chromium needs larger media files to test buffering this way.
157160BUGWK88172 SKIP : http/tests/media/video-buffered.html = FAIL
158161

LayoutTests/platform/efl/TestExpectations

@@BUGWK83898 : fast/css/getComputedStyle/computed-style-without-renderer.html = TE
5353BUGWK85465 SKIP : css3/filters = TEXT
5454BUGWK85465 SKIP : fast/css/getComputedStyle/computed-style.html = TEXT
5555
 56// CSS image-resolution is not yet enabled.
 57BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
 58
5659// This test assumes we cannot play RTSP, but we can.
5760BUGWKEFL SKIP : media/unsupported-rtsp.html = TIMEOUT
5861

LayoutTests/platform/gtk/TestExpectations

@@BUGWK79203 SKIP : fast/mediastream = FAIL
308308// CSS Variables are not yet enabled.
309309BUGWK85580 SKIP : fast/css/variables = PASS FAIL
310310
 311// CSS image-resolution is not yet enabled.
 312BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
 313
311314//////////////////////////////////////////////////////////////////////////////////////////
312315// End of Expected failures
313316//////////////////////////////////////////////////////////////////////////////////////////

LayoutTests/platform/mac/TestExpectations

@@BUGWK76439 DEBUG : fast/dom/shadow/content-element-outside-shadow.html = TEXT
1212// CSS Variables are not yet enabled.
1313BUGWK85580 SKIP : fast/css/variables = PASS FAIL
1414
 15// CSS image-resolution is not yet enabled.
 16BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
 17
1518// Our slow tests, in alphabetical order.
1619BUGWK57672 : http/tests/local/fileapi/send-sliced-dragged-file.html = TEXT PASS
1720

LayoutTests/platform/qt/TestExpectations

@@BUGWK88198 : svg/stroke/non-scaling-stroke-pattern.svg = PASS IMAGE
7676// CSS Variables are not yet enabled.
7777BUGWK85580 SKIP : fast/css/variables = PASS FAIL
7878
 79// CSS image-resolution is not yet enabled.
 80BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
 81
7982// Needs rebaseline after bug 86441
8083// failing new tests
8184BUGWK86441 SKIP : fast/borders/border-antialiasing.html = IMAGE