зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1274526 - Part 1: Implement support for 'q' absolute length units in CSS; r=heycam
MozReview-Commit-ID: vTDufVkAuv
This commit is contained in:
Родитель
a499148e40
Коммит
7e21de3ed5
|
@ -473,6 +473,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
|||
else if (unit.EqualsLiteral("mm")) cssUnit = eCSSUnit_Millimeter;
|
||||
else if (unit.EqualsLiteral("pt")) cssUnit = eCSSUnit_Point;
|
||||
else if (unit.EqualsLiteral("pc")) cssUnit = eCSSUnit_Pica;
|
||||
else if (unit.EqualsLiteral("q")) cssUnit = eCSSUnit_Quarter;
|
||||
else { // unexpected unit
|
||||
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
|
||||
ReportLengthParseError(aString, aDocument);
|
||||
|
|
|
@ -7475,6 +7475,7 @@ const UnitInfo UnitData[] = {
|
|||
{ STR_WITH_LEN("vmin"), eCSSUnit_ViewportMin, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("vmax"), eCSSUnit_ViewportMax, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("pc"), eCSSUnit_Pica, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("q"), eCSSUnit_Quarter, VARIANT_LENGTH },
|
||||
{ STR_WITH_LEN("deg"), eCSSUnit_Degree, VARIANT_ANGLE },
|
||||
{ STR_WITH_LEN("grad"), eCSSUnit_Grad, VARIANT_ANGLE },
|
||||
{ STR_WITH_LEN("rad"), eCSSUnit_Radian, VARIANT_ANGLE },
|
||||
|
|
|
@ -346,6 +346,7 @@ nscoord nsCSSValue::GetPixelLength() const
|
|||
case eCSSUnit_Inch: scaleFactor = 96.0; break;
|
||||
case eCSSUnit_Millimeter: scaleFactor = 96/25.4; break;
|
||||
case eCSSUnit_Centimeter: scaleFactor = 96/2.54; break;
|
||||
case eCSSUnit_Quarter: scaleFactor = 96/101.6; break;
|
||||
default:
|
||||
NS_ERROR("should never get here");
|
||||
return 0;
|
||||
|
@ -1798,6 +1799,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
|
|||
case eCSSUnit_Centimeter: aResult.AppendLiteral("cm"); break;
|
||||
case eCSSUnit_Point: aResult.AppendLiteral("pt"); break;
|
||||
case eCSSUnit_Pica: aResult.AppendLiteral("pc"); break;
|
||||
case eCSSUnit_Quarter: aResult.AppendLiteral("q"); break;
|
||||
|
||||
case eCSSUnit_ViewportWidth: aResult.AppendLiteral("vw"); break;
|
||||
case eCSSUnit_ViewportHeight: aResult.AppendLiteral("vh"); break;
|
||||
|
@ -1982,6 +1984,7 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|||
case eCSSUnit_Centimeter:
|
||||
case eCSSUnit_Pica:
|
||||
case eCSSUnit_Pixel:
|
||||
case eCSSUnit_Quarter:
|
||||
case eCSSUnit_Degree:
|
||||
case eCSSUnit_Grad:
|
||||
case eCSSUnit_Turn:
|
||||
|
|
|
@ -396,7 +396,8 @@ enum nsCSSUnit {
|
|||
eCSSUnit_Millimeter = 902, // (float) 96/25.4 CSS pixels
|
||||
eCSSUnit_Centimeter = 903, // (float) 96/2.54 CSS pixels
|
||||
eCSSUnit_Pica = 904, // (float) 12 points == 16 CSS pixls
|
||||
eCSSUnit_Pixel = 905, // (float) CSS pixel unit
|
||||
eCSSUnit_Quarter = 905, // (float) 96/101.6 CSS pixels
|
||||
eCSSUnit_Pixel = 906, // (float) CSS pixel unit
|
||||
|
||||
// Angular units
|
||||
eCSSUnit_Degree = 1000, // (float) 360 per circle
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<div id="mm" style="width:25.4mm; height:25.4mm; background:orange;">mm</div>
|
||||
<div id="cm" style="width:2.54cm; height:2.54cm; background:purple;">cm</div>
|
||||
<div id="in" style="width:1in; height:1in; background:magenta;">in</div>
|
||||
<div id="q" style="width:101.6q; height:101.6q; background:blue;">q</div>
|
||||
|
||||
<div id="mozmm" style="width:25.4mozmm; height:25.4mozmm; background:cyan;">mozmm</div>
|
||||
|
||||
|
@ -37,6 +38,7 @@ function checkPixelRelativeUnits() {
|
|||
check("mm", 96);
|
||||
check("cm", 96);
|
||||
check("in", 96);
|
||||
check("q", 96);
|
||||
}
|
||||
|
||||
checkPixelRelativeUnits();
|
||||
|
|
Загрузка…
Ссылка в новой задаче