Bug 1338936 - Part 2: stylo: Add necessary stubbed-out bindings for ServoSpecifiedValues; r=bz,emilio

MozReview-Commit-ID: 6wg32flypt7
This commit is contained in:
Manish Goregaokar 2017-02-12 16:02:29 -08:00
Родитель cb177956fe
Коммит d328a13fbb
5 изменённых файлов: 159 добавлений и 38 удалений

Просмотреть файл

@ -1522,6 +1522,12 @@ nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
if (!aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Background)))
return;
if (aData->IsServo()) {
// FIXME(bug 1339711)
NS_WARNING("stylo: cannot handle background presentation attribute");
return;
}
nsPresContext* presContext = aData->PresContext();
if (!aData->PropertyIsSet(eCSSProperty_background_image) &&
@ -1545,9 +1551,6 @@ nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
nsCSSValueList* list = backImage->SetListValue();
list->mValue.SetImageValue(value->GetImageValue());
}
} else {
// FIXME(bug 1330041)
MOZ_ASSERT_UNREACHABLE("stylo: cannot handle background");
}
}
}

Просмотреть файл

@ -490,6 +490,12 @@ void
nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
GenericSpecifiedValues* aGenericData)
{
if (aGenericData->IsServo()) {
// FIXME (bug 1339711) handle MathML properties in Stylo
NS_WARNING("stylo: cannot handle MathML presentation attributes");
return;
}
nsRuleData* aData = aGenericData->AsGecko();
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
// scriptsizemultiplier

Просмотреть файл

@ -175,10 +175,46 @@ SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemovePropertyById, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddPresValue, void,
// presentation attributes
SERVO_BINDING_FUNC(Servo_DeclarationBlock_PropertyIsSet, bool,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetIdentStringValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
nsCSSValueBorrowedMut css_value)
const nsAString& value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetKeywordValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
int32_t value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetIntValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
int32_t value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetPixelValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
float value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetPercentValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
float value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetAutoValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetCurrentColor, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetColorValue, void,
RawServoDeclarationBlockBorrowed declarations,
nsCSSPropertyID property,
nscolor value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetFontFamily, void,
RawServoDeclarationBlockBorrowed declarations,
const nsAString& value)
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetTextDecorationColorOverride, void,
RawServoDeclarationBlockBorrowed declarations)
// CSS supports()
SERVO_BINDING_FUNC(Servo_CSSSupports2, bool,

Просмотреть файл

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoSpecifiedValues.h"
namespace {
@ -25,3 +26,79 @@ ServoSpecifiedValues::ServoSpecifiedValues(nsPresContext* aContext,
{
}
bool
ServoSpecifiedValues::PropertyIsSet(nsCSSPropertyID aId)
{
// We always create fresh ServoSpecifiedValues for each property
// mapping, so unlike Gecko there aren't existing properties from
// the cascade that we wish to avoid overwriting.
//
// If a property is being overwritten, that's a bug. Check for it
// in debug mode (this is O(n^2) behavior since Servo will traverse
// the array each time you add a new property)
MOZ_ASSERT(!Servo_DeclarationBlock_PropertyIsSet(mDecl, aId),
"Presentation attribute mappers should never attempt to set the same property twice");
return false;
}
void
ServoSpecifiedValues::SetIdentStringValue(nsCSSPropertyID aId,
const nsString& aValue)
{
Servo_DeclarationBlock_SetIdentStringValue(mDecl, aId, aValue);
}
void
ServoSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
{
Servo_DeclarationBlock_SetKeywordValue(mDecl, aId, aValue);
}
void
ServoSpecifiedValues::SetIntValue(nsCSSPropertyID aId, int32_t aValue)
{
Servo_DeclarationBlock_SetIntValue(mDecl, aId, aValue);
}
void
ServoSpecifiedValues::SetPixelValue(nsCSSPropertyID aId, float aValue)
{
Servo_DeclarationBlock_SetPixelValue(mDecl, aId, aValue);
}
void
ServoSpecifiedValues::SetPercentValue(nsCSSPropertyID aId, float aValue)
{
Servo_DeclarationBlock_SetPercentValue(mDecl, aId, aValue);
}
void
ServoSpecifiedValues::SetAutoValue(nsCSSPropertyID aId)
{
Servo_DeclarationBlock_SetAutoValue(mDecl, aId);
}
void
ServoSpecifiedValues::SetCurrentColor(nsCSSPropertyID aId)
{
Servo_DeclarationBlock_SetCurrentColor(mDecl, aId);
}
void
ServoSpecifiedValues::SetColorValue(nsCSSPropertyID aId, nscolor aColor)
{
Servo_DeclarationBlock_SetColorValue(mDecl, aId, aColor);
}
void
ServoSpecifiedValues::SetFontFamily(const nsString& aValue)
{
Servo_DeclarationBlock_SetFontFamily(mDecl, aValue);
}
void
ServoSpecifiedValues::SetTextDecorationColorOverride()
{
Servo_DeclarationBlock_SetTextDecorationColorOverride(mDecl);
}

Просмотреть файл

@ -24,81 +24,80 @@ public:
ServoSpecifiedValues(nsPresContext* aContext, RawServoDeclarationBlock* aDecl);
// GenericSpecifiedValues overrides
bool PropertyIsSet(nsCSSPropertyID aId) {
return false;
}
bool PropertyIsSet(nsCSSPropertyID aId);
void SetIdentStringValue(nsCSSPropertyID aId,
const nsString& aValue) {
}
const nsString& aValue);
void SetIdentStringValueIfUnset(nsCSSPropertyID aId,
const nsString& aValue) {
if (!PropertyIsSet(aId)) {
SetIdentStringValue(aId, aValue);
}
}
void SetKeywordValue(nsCSSPropertyID aId,
int32_t aValue) {
}
int32_t aValue);
void SetKeywordValueIfUnset(nsCSSPropertyID aId,
int32_t aValue) {
if (!PropertyIsSet(aId)) {
SetKeywordValue(aId, aValue);
}
}
void SetIntValue(nsCSSPropertyID aId,
int32_t aValue) {
}
int32_t aValue);
void SetPixelValue(nsCSSPropertyID aId,
float aValue) {
}
float aValue);
void SetPixelValueIfUnset(nsCSSPropertyID aId,
float aValue) {
if (!PropertyIsSet(aId)) {
SetPixelValue(aId, aValue);
}
}
void SetPercentValue(nsCSSPropertyID aId,
float aValue) {
}
float aValue);
void SetAutoValue(nsCSSPropertyID aId) {
}
void SetAutoValue(nsCSSPropertyID aId);
void SetAutoValueIfUnset(nsCSSPropertyID aId) {
if (!PropertyIsSet(aId)) {
SetAutoValue(aId);
}
}
void SetPercentValueIfUnset(nsCSSPropertyID aId,
float aValue) {
if (!PropertyIsSet(aId)) {
SetPercentValue(aId, aValue);
}
}
void SetCurrentColor(nsCSSPropertyID aId) {
}
void SetCurrentColor(nsCSSPropertyID aId);
void SetCurrentColorIfUnset(nsCSSPropertyID aId) {
if (!PropertyIsSet(aId)) {
SetCurrentColor(aId);
}
}
void SetColorValue(nsCSSPropertyID aId,
nscolor aValue) {
}
nscolor aValue);
void SetColorValueIfUnset(nsCSSPropertyID aId,
nscolor aValue) {
if (!PropertyIsSet(aId)) {
SetColorValue(aId, aValue);
}
}
void SetFontFamily(const nsString& aValue) {
}
void SetTextDecorationColorOverride() {
}
void SetFontFamily(const nsString& aValue);
void SetTextDecorationColorOverride();
private:
RefPtr<RawServoDeclarationBlock> mDecl;