Bug 1392161 - Part 1: Update Servo binding functions for CSSPixelLength. r=emilio

MozReview-Commit-ID: 2x4Y9py4Pfv

--HG--
extra : rebase_source : 347e46b6a92794e8d12273ed963e54dbb2da1c8e
This commit is contained in:
Boris Chiou 2017-09-13 14:27:25 +08:00
parent d2de2af5d8
commit 07f634028f
3 changed files with 10 additions and 25 deletions

View File

@ -426,7 +426,7 @@ function ignoreContents(entry)
/EffectCompositor::GetServoAnimationRule/,
/LookAndFeel::GetColor/,
"Gecko_CopyStyleContentsFrom",
"Gecko_CSSValue_SetAbsoluteLength",
"Gecko_CSSValue_SetPixelValue",
"Gecko_UnsetDirtyStyleAttr",
/nsCSSPropertyIDSet::AddProperty/,
];

View File

@ -2145,28 +2145,6 @@ Gecko_NewNoneTransform()
return list.forget().take();
}
void
Gecko_CSSValue_SetAbsoluteLength(nsCSSValueBorrowedMut aCSSValue, nscoord aLen)
{
MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null || aCSSValue->IsLengthUnit());
// The call below could trigger refcounting if aCSSValue were a
// FontFamilyList, but we just asserted that it's not. So we can
// whitelist this for static analysis.
aCSSValue->SetIntegerCoordValue(aLen);
}
nscoord
Gecko_CSSValue_GetAbsoluteLength(nsCSSValueBorrowed aCSSValue)
{
// SetIntegerCoordValue() which is used in Gecko_CSSValue_SetAbsoluteLength()
// converts values by nsPresContext::AppUnitsToFloatCSSPixels() and stores
// values in eCSSUnit_Pixel unit. We need to convert the values back to app
// units by GetPixelLength().
MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Pixel,
"The unit should be eCSSUnit_Pixel");
return aCSSValue->GetPixelLength();
}
void
Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut aCSSValue, float aNumber)
{
@ -2203,6 +2181,14 @@ Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed aCSSValue)
return aCSSValue->GetPercentValue();
}
void
Gecko_CSSValue_SetPixelLength(nsCSSValueBorrowedMut aCSSValue, float aLen)
{
MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null ||
aCSSValue->GetUnit() == eCSSUnit_Pixel);
aCSSValue->SetFloatValue(aLen, eCSSUnit_Pixel);
}
void
Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut aCSSValue, nsStyleCoord::CalcValue aCalc)
{

View File

@ -546,16 +546,15 @@ nsCSSValueSharedList* Gecko_NewNoneTransform();
nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut css_value, int32_t index);
// const version of the above function.
nsCSSValueBorrowed Gecko_CSSValue_GetArrayItemConst(nsCSSValueBorrowed css_value, int32_t index);
nscoord Gecko_CSSValue_GetAbsoluteLength(nsCSSValueBorrowed css_value);
nsCSSKeyword Gecko_CSSValue_GetKeyword(nsCSSValueBorrowed aCSSValue);
float Gecko_CSSValue_GetNumber(nsCSSValueBorrowed css_value);
float Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed css_value);
nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(nsCSSValueBorrowed aCSSValue);
void Gecko_CSSValue_SetAbsoluteLength(nsCSSValueBorrowedMut css_value, nscoord len);
void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut css_value, float number);
void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut css_value, nsCSSKeyword keyword);
void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut css_value, float percent);
void Gecko_CSSValue_SetPixelLength(nsCSSValueBorrowedMut aCSSValue, float aLen);
void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value, nsStyleCoord::CalcValue calc);
void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len);
void Gecko_CSSValue_SetString(nsCSSValueBorrowedMut css_value,