Bug 1471114 part 3 - Drop the reference to getter functions we don't call. r?emilio
MozReview-Commit-ID: IbBayOwsjNX
--- a/layout/style/GenerateComputedDOMStyleGenerated.py
+++ b/layout/style/GenerateComputedDOMStyleGenerated.py
@@ -23,30 +23,31 @@ static constexpr Entry kEntries[] = {
# Gecko put then later so we do so as well. See w3c/csswg-drafts#2827.
order = p.name.startswith("-")
return (order, p.name)
# Some special cases we may get rid of later. See bug 1471423.
def method(p):
if p.id.startswith("margin_"):
return "{}Width".format(p.method)
- if p.id == "ime_mode":
- return "IMEMode"
- if p.id == "float":
- return "Float"
if p.id.startswith("_moz_"):
method = p.method[3:]
else:
method = p.method
if p.id.startswith("_moz_outline_radius_"):
method = method.replace("left", "Left")
method = method.replace("right", "Right")
return method
properties = runpy.run_path(dataFile)["data"]
properties = filter(exposed_on_getcs, properties)
properties.sort(key=order_key)
- TEMPLATE = " {{ eCSSProperty_{}, &nsComputedDOMStyle::DoGet{} }},\n"
+ TEMPLATE = " {{ eCSSProperty_{}, &nsComputedDOMStyle::{} }},\n"
for p in properties:
- output.write(TEMPLATE.format(p.id, method(p)))
+ m = "DoGet" + method(p)
+ # Put a dummy getter here instead of nullptr because MSVC seems
+ # to have bug which ruins the table when we put nullptr for
+ # pointer-to-member-function. See bug 1471426.
+ m = "DummyGetter" if "SerializedByServo" in p.flags else m
+ output.write(TEMPLATE.format(p.id, m))
output.write("};\n")
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -471,16 +471,17 @@ nsComputedDOMStyle::GetPropertyValue(con
nsString text;
value->GetCssText(text, rv);
aReturn.Assign(text);
return rv.StealNSResult();
}
return NS_OK;
}
+ MOZ_ASSERT(entry->mGetter == &nsComputedDOMStyle::DummyGetter);
Servo_GetPropertyValue(mComputedStyle, prop, &aReturn);
return NS_OK;
}
/* static */
already_AddRefed<ComputedStyle>
nsComputedDOMStyle::GetComputedStyle(Element* aElement,
nsAtom* aPseudo,
@@ -7144,16 +7145,22 @@ nsComputedDOMStyle::DoGetAnimationPlaySt
nsCSSProps::ValueToKeywordEnum(animation->GetPlayState(),
nsCSSProps::kAnimationPlayStateKTable));
valueList->AppendCSSValue(playState.forget());
} while (++i < display->mAnimationPlayStateCount);
return valueList.forget();
}
+already_AddRefed<CSSValue>
+nsComputedDOMStyle::DummyGetter()
+{
+ MOZ_CRASH("DummyGetter is not supposed to be invoked");
+}
+
static void
MarkComputedStyleMapDirty(const char* aPref, void* aData)
{
static_cast<ComputedStyleMap*>(aData)->MarkDirty();
}
void
nsComputedDOMStyle::ParentChainChanged(nsIContent* aContent)
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -607,16 +607,20 @@ private:
already_AddRefed<CSSValue> DoGetClipPath();
already_AddRefed<CSSValue> DoGetFilter();
already_AddRefed<CSSValue> DoGetMaskType();
already_AddRefed<CSSValue> DoGetPaintOrder();
already_AddRefed<CSSValue> DoGetContextProperties();
+ // For working around a MSVC bug. See related comment in
+ // GenerateComputedDOMStyleGenerated.py.
+ already_AddRefed<CSSValue> DummyGetter();
+
/* Helper functions */
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
const mozilla::StyleComplexColor& aColor);
void SetValueForWidgetColor(nsROCSSPrimitiveValue* aValue,
const mozilla::StyleComplexColor& aColor,
uint8_t aWidgetType);
void SetValueToStyleImage(const nsStyleImage& aStyleImage,