Bug 1471114 part 3 - Drop the reference to getter functions we don't call. r=emilio
authorXidorn Quan <me@upsuper.org>
Wed, 27 Jun 2018 15:34:29 +1000
changeset 423873 787a0e28e114fe9968b3421af7c221b296411c3c
parent 423872 7b6bf8c652f36b7a356279b0db58981d6573ec7b
child 423874 f53127621009412c4fa2803c0b859d745269d49e
push id34193
push userdluca@mozilla.com
push dateWed, 27 Jun 2018 10:27:30 +0000
treeherdermozilla-central@e5fd22d48987 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1471114
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1471114 part 3 - Drop the reference to getter functions we don't call. r=emilio MozReview-Commit-ID: IbBayOwsjNX
layout/style/GenerateComputedDOMStyleGenerated.py
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
--- 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,
@@ -7146,16 +7147,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
@@ -609,16 +609,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,