Diff
Modified: trunk/LayoutTests/ChangeLog (119983 => 119984)
--- trunk/LayoutTests/ChangeLog 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/ChangeLog 2012-06-11 17:19:26 UTC (rev 119984)
@@ -1,3 +1,21 @@
+2012-06-11 David Barr <[email protected]>
+
+ Add css3-images image-resolution (dppx only)
+ https://bugs.webkit.org/show_bug.cgi?id=85332
+
+ Reviewed by Tony Chang.
+
+ The css3-images module is at candidate recommendation.
+ http://www.w3.org/TR/2012/CR-css3-images-20120417/#image-resolution
+
+ * fast/css/image-resolution/image-resolution-expected.txt: Added.
+ * fast/css/image-resolution/image-resolution.html: Added.
+ * platform/chromium/TestExpectations: Skip tests until image-resolution implementation lands.
+ * platform/efl/TestExpectations: Skip tests until image-resolution implementation lands.
+ * platform/gtk/TestExpectations: Skip tests until image-resolution implementation lands.
+ * platform/mac/TestExpectations: Skip tests until image-resolution implementation lands.
+ * platform/qt/TestExpectations: Skip tests until image-resolution implementation lands.
+
2012-06-11 Dominic Cooney <[email protected]>
[Chromium] Unreviewed: Rebaseline more SVG tests on Windows.
Added: trunk/LayoutTests/fast/css/image-resolution/image-resolution-expected.txt (0 => 119984)
--- trunk/LayoutTests/fast/css/image-resolution/image-resolution-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/image-resolution/image-resolution-expected.txt 2012-06-11 17:19:26 UTC (rev 119984)
@@ -0,0 +1,29 @@
+Apply image-resolution property to a fixed image ([email protected]).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+TEST "0dppx"
+PASS img.style.cssText is ""
+TEST "1dppx"
+PASS img.style.cssText is "image-resolution: 1dppx; "
+PASS img.offsetWidth is 16
+PASS img.offsetHeight is 16
+TEST "2dppx"
+PASS img.style.cssText is "image-resolution: 2dppx; "
+PASS img.offsetWidth is 8
+PASS img.offsetHeight is 8
+TEST "3dppx"
+PASS img.style.cssText is "image-resolution: 3dppx; "
+PASS img.offsetWidth is 5
+PASS img.offsetHeight is 5
+TEST "4dppx"
+PASS img.style.cssText is "image-resolution: 4dppx; "
+PASS img.offsetWidth is 4
+PASS img.offsetHeight is 4
+TEST ""
+PASS img.style.cssText is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/image-resolution/image-resolution.html (0 => 119984)
--- trunk/LayoutTests/fast/css/image-resolution/image-resolution.html (rev 0)
+++ trunk/LayoutTests/fast/css/image-resolution/image-resolution.html 2012-06-11 17:19:26 UTC (rev 119984)
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style src=""
+<script src=""
+</head>
+<body>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+}
+
+function testCompleted()
+{
+ var scriptElement = document.createElement("script")
+ scriptElement.src = ''
+ document.body.appendChild(scriptElement);
+}
+
+function computeResolution(resolution, imgResolutionDppx)
+{
+ if (!resolution)
+ return;
+ var fromImage = /from-image/.test(resolution);
+ var snap = /snap/.test(resolution);
+ var explicit = /(-?\d*(\.\d+)?)(dp(px|i|cm))/.exec(resolution);
+ var value = explicit && explicit[1] * 1;
+ var unit = explicit && explicit[3];
+ var dppx = 1;
+ if (unit && value <= 0)
+ return;
+ if (unit && value) {
+ var cssPxPerIn = 96;
+ var cmPerIn = 2.54;
+ if (unit == 'dppx')
+ dppx = value;
+ else if (unit === 'dpi')
+ dppx = value / cssPxPerIn;
+ else if (unit === 'dpcm')
+ dppx = value / (cssPxPerIn / cmPerIn);
+ }
+ if (fromImage)
+ dppx = imgResolutionDppx;
+ if (snap)
+ dppx = Math.floor(dppx);
+ if (dppx <= 0)
+ dppx = 1;
+ return dppx;
+}
+
+var imgUrl = '../../images/resources/green.jpg';
+var imgWidthPx = 16;
+var imgHeightPx = 16;
+var imgResolutionDppx = 72 / 96;
+var dimensions = imgWidthPx + 'x' + imgHeightPx + '@' + imgResolutionDppx + 'dppx';
+
+description('Apply image-resolution property to a fixed image (' + dimensions + ').');
+
+var img = document.createElement('img');
+img.src = ""
+
+var resolutions = ['0dppx', '1dppx', '2dppx', '3dppx', '4dppx', ''];
+
+img._onload_ = function() {
+ resolutions.forEach(function(test) {
+ var dppx = computeResolution(test, imgResolutionDppx);
+ img.style.imageResolution = '';
+ img.style.imageResolution = test;
+ debug('<span class="pass">TEST</span> "' + test + '"');
+ if (!dppx) {
+ shouldBe('img.style.cssText', '""');
+ return;
+ }
+ shouldBe('img.style.cssText', '"image-resolution: ' + test + '; "');
+ var expectedWidth = Math.floor(imgWidthPx / dppx);
+ var expectedHeight = Math.floor(imgHeightPx / dppx);
+ shouldBe('img.offsetWidth', stringify(expectedWidth));
+ shouldBe('img.offsetHeight', stringify(expectedHeight));
+ });
+ document.body.removeChild(img);
+ testCompleted();
+};
+
+document.body.appendChild(img);
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (119983 => 119984)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-06-11 17:19:26 UTC (rev 119984)
@@ -155,6 +155,9 @@
// CSS Variables are not yet enabled.
BUGWK85580 SKIP : fast/css/variables = PASS
+// CSS image-resolution is not yet enabled.
+BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
+
// Chromium needs larger media files to test buffering this way.
BUGWK88172 SKIP : http/tests/media/video-buffered.html = PASS
Modified: trunk/LayoutTests/platform/efl/TestExpectations (119983 => 119984)
--- trunk/LayoutTests/platform/efl/TestExpectations 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2012-06-11 17:19:26 UTC (rev 119984)
@@ -53,6 +53,9 @@
BUGWK85465 SKIP : css3/filters = TEXT
BUGWK85465 SKIP : fast/css/getComputedStyle/computed-style.html = TEXT
+// CSS image-resolution is not yet enabled.
+BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
+
// This test assumes we cannot play RTSP, but we can.
BUGWKEFL SKIP : media/unsupported-rtsp.html = TIMEOUT
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (119983 => 119984)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2012-06-11 17:19:26 UTC (rev 119984)
@@ -317,6 +317,9 @@
// CSS Variables are not yet enabled.
BUGWK85580 SKIP : fast/css/variables = PASS FAIL
+// CSS image-resolution is not yet enabled.
+BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
+
// No CORS support for media elements is implemented yet.
BUGWKGTK SKIP : http/tests/security/video-cross-origin-readback.html = FAIL
Modified: trunk/LayoutTests/platform/mac/TestExpectations (119983 => 119984)
--- trunk/LayoutTests/platform/mac/TestExpectations 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2012-06-11 17:19:26 UTC (rev 119984)
@@ -15,6 +15,9 @@
// UndoManager is not yet enabled.
BUGWK87908 SKIP : editing/undomanager = PASS
+// CSS image-resolution is not yet enabled.
+BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
+
// Our slow tests, in alphabetical order.
BUGWK57672 : http/tests/local/fileapi/send-sliced-dragged-file.html = TEXT PASS
Modified: trunk/LayoutTests/platform/qt/TestExpectations (119983 => 119984)
--- trunk/LayoutTests/platform/qt/TestExpectations 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2012-06-11 17:19:26 UTC (rev 119984)
@@ -78,6 +78,9 @@
// UndoManager is not yet enabled.
BUGWK87908 SKIP : editing/undomanager = PASS
+// CSS image-resolution is not yet enabled.
+BUGWK85262 SKIP : fast/css/image-resolution = PASS FAIL
+
// Needs rebaseline after bug 86441
// failing new tests
BUGWK86441 SKIP : fast/borders/border-antialiasing.html = IMAGE
Modified: trunk/Source/WebCore/ChangeLog (119983 => 119984)
--- trunk/Source/WebCore/ChangeLog 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/ChangeLog 2012-06-11 17:19:26 UTC (rev 119984)
@@ -1,3 +1,61 @@
+2012-06-11 David Barr <[email protected]>
+
+ Add css3-images image-resolution (dppx only)
+ https://bugs.webkit.org/show_bug.cgi?id=85332
+
+ Reviewed by Tony Chang.
+
+ The css3-images module is at candidate recommendation.
+ http://www.w3.org/TR/2012/CR-css3-images-20120417/#image-resolution
+
+ Test: fast/css/image-resolution.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore):
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSGrammar.y:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::validUnit):
+ (WebCore::CSSParser::createPrimitiveNumericValue):
+ (WebCore::unitFromString):
+ (WebCore::CSSParser::parseValidPrimitive):
+ (WebCore::CSSParser::parseValue):
+ (WebCore):
+ (WebCore::CSSParser::parseImageResolution):
+ (WebCore::CSSParser::detectNumberToken):
+ * css/CSSParser.h:
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::isValidCSSUnitTypeForDoubleConversion):
+ (WebCore::unitCategory):
+ (WebCore::CSSPrimitiveValue::canonicalUnitTypeForCategory):
+ (WebCore::CSSPrimitiveValue::customCssText):
+ (WebCore::CSSPrimitiveValue::cloneForCSSOM):
+ * css/CSSPrimitiveValue.h:
+ * css/CSSProperty.cpp:
+ (WebCore::CSSProperty::isInheritedProperty):
+ * css/CSSPropertyNames.in:
+ * css/StyleBuilder.cpp:
+ (WebCore):
+ (ApplyPropertyImageResolution):
+ (WebCore::ApplyPropertyImageResolution::applyInheritValue):
+ (WebCore::ApplyPropertyImageResolution::applyInitialValue):
+ (WebCore::ApplyPropertyImageResolution::applyValue):
+ (WebCore::ApplyPropertyImageResolution::createHandler):
+ (WebCore::StyleBuilder::StyleBuilder):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::styleDidChange):
+ (WebCore::RenderImage::imageDimensionsChanged):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::diff):
+ * rendering/style/RenderStyle.h:
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+ (WebCore::StyleRareInheritedData::operator==):
+ * rendering/style/StyleRareInheritedData.h:
+ (StyleRareInheritedData):
+
2012-06-05 Dana Jansens <[email protected]>
[chromium] Free texture from CCIOSurfaceLayerImpl when it is destroyed
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -125,6 +125,9 @@
CSSPropertyFontWeight,
CSSPropertyHeight,
CSSPropertyImageRendering,
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ CSSPropertyImageResolution,
+#endif
CSSPropertyLeft,
CSSPropertyLetterSpacing,
CSSPropertyLineHeight,
@@ -1767,6 +1770,10 @@
return cssValuePool().createIdentifierValue(CSSValueLines);
case CSSPropertyImageRendering:
return CSSPrimitiveValue::create(style->imageRendering());
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPropertyImageResolution:
+ return cssValuePool().createValue(style->imageResolution(), CSSPrimitiveValue::CSS_DPPX);
+#endif
case CSSPropertyLeft:
return getPositionOffsetValue(style.get(), CSSPropertyLeft, m_node->document()->renderView());
case CSSPropertyLetterSpacing:
Modified: trunk/Source/WebCore/css/CSSGrammar.y (119983 => 119984)
--- trunk/Source/WebCore/css/CSSGrammar.y 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSGrammar.y 2012-06-11 17:19:26 UTC (rev 119984)
@@ -101,7 +101,7 @@
%}
-%expect 58
+%expect 59
%nonassoc LOWEST_PREC
@@ -193,6 +193,7 @@
%token <number> VW
%token <number> VH
%token <number> VMIN
+%token <number> DPPX
%token <string> URI
%token <string> FUNCTION
@@ -1475,6 +1476,7 @@
| VW maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VW; }
| VH maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
| VMIN maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
+ | DPPX maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
;
function:
Modified: trunk/Source/WebCore/css/CSSParser.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/CSSParser.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -1335,6 +1335,11 @@
case CSSPrimitiveValue::CSS_TURN:
b = (unitflags & FAngle);
break;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPrimitiveValue::CSS_DPPX:
+ b = (unitflags & FResolution);
+ break;
+#endif
case CSSPrimitiveValue::CSS_HZ:
case CSSPrimitiveValue::CSS_KHZ:
case CSSPrimitiveValue::CSS_DIMENSION:
@@ -1353,9 +1358,16 @@
return CSSPrimitiveValue::create(m_parsedCalculation.release());
}
+#if ENABLE(CSS_IMAGE_RESOLUTION)
ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
|| (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
+ || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
+ || (value->unit == CSSPrimitiveValue::CSS_DPPX));
+#else
+ ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
+ || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
|| (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN));
+#endif
return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
}
@@ -1410,6 +1422,10 @@
return CSSPrimitiveValue::CSS_VH;
if (equal(value->string, "vmin"))
return CSSPrimitiveValue::CSS_VMIN;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ if (equal(value->string, "dppx"))
+ return CSSPrimitiveValue::CSS_DPPX;
+#endif
return 0;
}
@@ -1463,6 +1479,10 @@
return createPrimitiveNumericValue(value);
if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
return createPrimitiveNumericValue(value);
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ if (value->unit == CSSPrimitiveValue::CSS_DPPX)
+ return createPrimitiveNumericValue(value);
+#endif
if (value->unit >= CSSParserValue::Q_EMS)
return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPrimitiveValue::CSS_EMS);
if (isCalculation(value))
@@ -2495,6 +2515,14 @@
case CSSPropertyWebkitWrap:
return RuntimeEnabledFeatures::cssExclusionsEnabled() && parseShorthand(propId, webkitWrapShorthand(), important);
#endif
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPropertyImageResolution:
+ parsedValue = parseImageResolution(m_valueList.get());
+ if (!parsedValue)
+ return false;
+ m_valueList->next();
+ break;
+#endif
case CSSPropertyBorderBottomStyle:
case CSSPropertyBorderCollapse:
case CSSPropertyBorderLeftStyle:
@@ -6786,6 +6814,27 @@
return true;
}
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+PassRefPtr<CSSValue> CSSParser::parseImageResolution(CSSParserValueList* valueList)
+{
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ bool haveResolution = false;
+
+ CSSParserValue* value = valueList->current();
+ while (value) {
+ if (!haveResolution && validUnit(value, FResolution | FNonNeg) && value->fValue > 0) {
+ list->append(createPrimitiveNumericValue(value));
+ haveResolution = true;
+ } else
+ return 0;
+ value = m_valueList->next();
+ }
+ if (!list->length())
+ return 0;
+ return list;
+}
+#endif
+
#if ENABLE(CSS_IMAGE_SET)
PassRefPtr<CSSValue> CSSParser::parseImageSet(CSSParserValueList* valueList)
{
@@ -8263,6 +8312,14 @@
case 'd':
if (length == 3 && isASCIIAlphaCaselessEqual(type[1], 'e') && isASCIIAlphaCaselessEqual(type[2], 'g'))
m_token = DEGS;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ // There is a discussion about the name of this unit on www-style.
+ // Keep this compile time guard in place until that is resolved.
+ // http://lists.w3.org/Archives/Public/www-style/2012May/0915.html
+ else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'p')
+ && isASCIIAlphaCaselessEqual(type[2], 'p') && isASCIIAlphaCaselessEqual(type[3], 'x'))
+ m_token = DPPX;
+#endif
return;
case 'e':
Modified: trunk/Source/WebCore/css/CSSParser.h (119983 => 119984)
--- trunk/Source/WebCore/css/CSSParser.h 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSParser.h 2012-06-11 17:19:26 UTC (rev 119984)
@@ -195,6 +195,10 @@
bool parseCrossfade(CSSParserValueList*, RefPtr<CSSValue>&);
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ PassRefPtr<CSSValue> parseImageResolution(CSSParserValueList*);
+#endif
+
#if ENABLE(CSS_IMAGE_SET)
PassRefPtr<CSSValue> parseImageSet(CSSParserValueList*);
#endif
@@ -436,7 +440,10 @@
FTime = 0x0020,
FFrequency = 0x0040,
FRelative = 0x0100,
- FNonNeg = 0x0200
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ FResolution= 0x0200,
+#endif
+ FNonNeg = 0x0400
};
friend inline Units operator|(Units a, Units b)
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -60,6 +60,9 @@
case CSSPrimitiveValue:: CSS_CM:
case CSSPrimitiveValue:: CSS_DEG:
case CSSPrimitiveValue:: CSS_DIMENSION:
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPrimitiveValue:: CSS_DPPX:
+#endif
case CSSPrimitiveValue:: CSS_EMS:
case CSSPrimitiveValue:: CSS_EXS:
case CSSPrimitiveValue:: CSS_GRAD:
@@ -85,6 +88,9 @@
case CSSPrimitiveValue:: CSS_COUNTER:
case CSSPrimitiveValue:: CSS_COUNTER_NAME:
case CSSPrimitiveValue:: CSS_DASHBOARD_REGION:
+#if !ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPrimitiveValue:: CSS_DPPX:
+#endif
case CSSPrimitiveValue:: CSS_IDENT:
case CSSPrimitiveValue:: CSS_PAIR:
case CSSPrimitiveValue:: CSS_PARSER_HEXCOLOR:
@@ -137,6 +143,10 @@
case CSSPrimitiveValue::CSS_VH:
case CSSPrimitiveValue::CSS_VMIN:
return CSSPrimitiveValue::UViewportPercentageLength;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPrimitiveValue:: CSS_DPPX:
+ return CSSPrimitiveValue::UResolution;
+#endif
default:
return CSSPrimitiveValue::UOther;
}
@@ -627,6 +637,10 @@
return CSS_HZ;
case UViewportPercentageLength:
return CSS_UNKNOWN; // Cannot convert between numbers and relative lengths.
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case UResolution:
+ return CSS_DPPX;
+#endif
default:
return CSS_UNKNOWN;
}
@@ -828,6 +842,11 @@
case CSS_CM:
text = formatNumber(m_value.num) + "cm";
break;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSS_DPPX:
+ text = formatNumber(m_value.num) + "dppx";
+ break;
+#endif
case CSS_MM:
text = formatNumber(m_value.num) + "mm";
break;
@@ -1151,6 +1170,9 @@
case CSS_VW:
case CSS_VH:
case CSS_VMIN:
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSS_DPPX:
+#endif
result = CSSPrimitiveValue::create(m_value.num, static_cast<UnitTypes>(m_primitiveUnitType));
break;
case CSS_IDENT:
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (119983 => 119984)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.h 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h 2012-06-11 17:19:26 UTC (rev 119984)
@@ -95,6 +95,7 @@
CSS_VW = 26,
CSS_VH = 27,
CSS_VMIN = 28,
+ CSS_DPPX = 29,
CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
CSS_DASHBOARD_REGION = 101, // FIXME: Dashboard region should not be a primitive value.
CSS_UNICODE_RANGE = 102,
@@ -134,6 +135,9 @@
UTime,
UFrequency,
UViewportPercentageLength,
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ UResolution,
+#endif
UOther
};
Modified: trunk/Source/WebCore/css/CSSProperty.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/CSSProperty.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSProperty.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -268,6 +268,9 @@
case CSSPropertyFontVariant:
case CSSPropertyFontWeight:
case CSSPropertyImageRendering:
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPropertyImageResolution:
+#endif
case CSSPropertyLetterSpacing:
case CSSPropertyLineHeight:
case CSSPropertyListStyle:
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (119983 => 119984)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2012-06-11 17:19:26 UTC (rev 119984)
@@ -104,6 +104,9 @@
font-stretch
height
image-rendering
+#if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
+image-resolution
+#endif
left
letter-spacing
list-style
Modified: trunk/Source/WebCore/css/StyleBuilder.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/StyleBuilder.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/StyleBuilder.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -1767,6 +1767,40 @@
};
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+class ApplyPropertyImageResolution {
+public:
+ static void applyInheritValue(StyleResolver* styleResolver)
+ {
+ ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInheritValue(styleResolver);
+ }
+
+ static void applyInitialValue(StyleResolver* styleResolver)
+ {
+ ApplyPropertyDefaultBase<float, &RenderStyle::imageResolution, float, &RenderStyle::setImageResolution, float, &RenderStyle::initialImageResolution>::applyInitialValue(styleResolver);
+ }
+
+ static void applyValue(StyleResolver* styleResolver, CSSValue* value)
+ {
+ if (!value->isValueList())
+ return;
+ CSSValueList* valueList = static_cast<CSSValueList*>(value);
+ for (size_t i = 0; i < valueList->length(); i++) {
+ CSSValue* item = valueList->itemWithoutBoundsCheck(i);
+ if (!item->isPrimitiveValue())
+ continue;
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(item);
+ styleResolver->style()->setImageResolution(primitiveValue->getDoubleValue(CSSPrimitiveValue::CSS_DPPX));
+ }
+ }
+
+ static PropertyHandler createHandler()
+ {
+ return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue);
+ }
+};
+#endif
+
const StyleBuilder& StyleBuilder::sharedStyleBuilder()
{
DEFINE_STATIC_LOCAL(StyleBuilder, styleBuilderInstance, ());
@@ -1843,6 +1877,9 @@
setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
setPropertyHandler(CSSPropertyHeight, ApplyPropertyLength<&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize, AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
setPropertyHandler(CSSPropertyImageRendering, ApplyPropertyDefault<EImageRendering, &RenderStyle::imageRendering, EImageRendering, &RenderStyle::setImageRendering, EImageRendering, &RenderStyle::initialImageRendering>::createHandler());
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
+#endif
setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeight::createHandler());
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (119983 => 119984)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -4024,6 +4024,9 @@
case CSSPropertyFontWeight:
case CSSPropertyHeight:
case CSSPropertyImageRendering:
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ case CSSPropertyImageResolution:
+#endif
case CSSPropertyLeft:
case CSSPropertyLetterSpacing:
case CSSPropertyLineHeight:
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (119983 => 119984)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -137,6 +137,10 @@
imageDimensionsChanged(true /* imageSizeChanged */);
m_needsToSetSizeForAltText = false;
}
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ if (diff == StyleDifferenceLayout && oldStyle->imageResolution() != style()->imageResolution())
+ imageDimensionsChanged(true /* imageSizeChanged */);
+#endif
}
void RenderImage::imageChanged(WrappedImagePtr newImage, const IntRect* rect)
@@ -191,7 +195,11 @@
void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* rect)
{
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom() / style()->imageResolution()), imageSizeChanged);
+#else
bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom()), imageSizeChanged);
+#endif
// In the case of generated image content using :before/:after/content, we might not be
// in the render tree yet. In that case, we just need to update our intrinsic size.
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (119983 => 119984)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -473,6 +473,9 @@
|| rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
|| rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
|| rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ || rareInheritedData->m_imageResolution != other->rareInheritedData->m_imageResolution
+#endif
|| rareInheritedData->m_lineSnap != other->rareInheritedData->m_lineSnap
|| rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign)
return StyleDifferenceLayout;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (119983 => 119984)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-06-11 17:19:26 UTC (rev 119984)
@@ -973,6 +973,10 @@
bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; }
EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
+
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ float imageResolution() const { return rareInheritedData->m_imageResolution; }
+#endif
ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
@@ -1140,6 +1144,10 @@
bool setEffectiveZoom(float);
void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) }
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ void setImageResolution(float f) { SET_VAR(rareInheritedData, m_imageResolution, f) }
+#endif
+
void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
@@ -1647,6 +1655,7 @@
static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
+ static float initialImageResolution() { return 1; }
static StyleImage* initialBorderImageSource() { return 0; }
static StyleImage* initialMaskBoxImageSource() { return 0; }
static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (119983 => 119984)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2012-06-11 17:19:26 UTC (rev 119984)
@@ -63,6 +63,9 @@
, hyphenationLimitLines(-1)
, m_lineGrid(RenderStyle::initialLineGrid())
, m_tabSize(RenderStyle::initialTabSize())
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ , m_imageResolution(RenderStyle::initialImageResolution())
+#endif
#if ENABLE(TOUCH_EVENTS)
, tapHighlightColor(RenderStyle::initialTapHighlightColor())
#endif
@@ -115,6 +118,9 @@
, textEmphasisCustomMark(o.textEmphasisCustomMark)
, m_lineGrid(o.m_lineGrid)
, m_tabSize(o.m_tabSize)
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ , m_imageResolution(o.m_imageResolution)
+#endif
#if ENABLE(TOUCH_EVENTS)
, tapHighlightColor(o.tapHighlightColor)
#endif
@@ -182,6 +188,9 @@
&& m_tabSize == o.m_tabSize
&& m_lineGrid == o.m_lineGrid
&& m_imageRendering == o.m_imageRendering
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ && m_imageResolution == o.m_imageResolution
+#endif
&& m_lineSnap == o.m_lineSnap
&& m_lineAlign == o.m_lineAlign;
}
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (119983 => 119984)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2012-06-11 16:57:27 UTC (rev 119983)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2012-06-11 17:19:26 UTC (rev 119984)
@@ -110,6 +110,10 @@
AtomicString m_lineGrid;
unsigned m_tabSize;
+#if ENABLE(CSS_IMAGE_RESOLUTION)
+ float m_imageResolution;
+#endif
+
#if ENABLE(TOUCH_EVENTS)
Color tapHighlightColor;
#endif