Bug 1382925 - Part 1: Make Servo_StyleSet_NoteStyleSheetsChanged take a set of origins to dirty. r=emilio
authorCameron McCormack <cam@mcc.id.au>
Sat, 12 Aug 2017 18:19:22 +0800
changeset 374450 217e04bd718834334b3d9066f76105824df324e7
parent 374449 cc98be8b55c7e27170feb5b83cf7d883712d9925
child 374451 cbbd01a745775de59ae362cf453afb686eee07c7
push id32326
push userarchaeopteryx@coole-files.de
push dateSun, 13 Aug 2017 23:28:40 +0000
treeherdermozilla-central@e594b178728b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1382925
milestone57.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 1382925 - Part 1: Make Servo_StyleSet_NoteStyleSheetsChanged take a set of origins to dirty. r=emilio MozReview-Commit-ID: KY29REU78tH
layout/style/ServoBindingList.h
layout/style/ServoBindingTypes.h
layout/style/ServoBindings.toml
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -65,17 +65,19 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Remove
                    const mozilla::ServoStyleSheet* gecko_sheet)
 SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
                    RawServoStyleSetBorrowed set,
                    const mozilla::ServoStyleSheet* gecko_sheet,
                    const mozilla::ServoStyleSheet* before)
 SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set,
                    RawGeckoElementBorrowedOrNull doc_elem)
 SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
-                   RawServoStyleSetBorrowed set, bool author_style_disabled)
+                   RawServoStyleSetBorrowed set,
+                   bool author_style_disabled,
+                   mozilla::OriginFlags changed_origins)
 SERVO_BINDING_FUNC(Servo_StyleSet_GetKeyframesForName, bool,
                    RawServoStyleSetBorrowed set,
                    const nsACString* property,
                    nsTimingFunctionBorrowed timing_function,
                    RawGeckoKeyframeListBorrowedMut keyframe_list)
 SERVO_BINDING_FUNC(Servo_StyleSet_GetFontFaceRules, void,
                    RawServoStyleSetBorrowed set,
                    RawGeckoFontFaceRuleListBorrowedMut list)
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -31,16 +31,17 @@ namespace dom {
 class Element;
 class StyleChildrenIterator;
 } // namespace dom
 struct AnimationPropertySegment;
 struct ComputedTiming;
 struct Keyframe;
 struct PropertyValuePair;
 struct PropertyStyleAnimationValuePair;
+enum class OriginFlags : uint8_t;
 using ComputedKeyframeValues = nsTArray<PropertyStyleAnimationValuePair>;
 } // namespace mozilla
 namespace nsStyleTransformMatrix {
 enum class MatrixTransformOperator: uint8_t;
 }
 
 class nsCSSPropertyIDSet;
 class nsCSSValue;
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -85,16 +85,17 @@ raw-lines = [
 hide-types = [
     "nsString",
     ".*char_traits",
     ".*incompatible_char_type",
 ]
 bitfield-enums = [
     "nsChangeHint",
     "nsRestyleHint",
+    "OriginFlags",
 ]
 constified-enums = [
     "UpdateAnimationsTasks",
     "ParsingMode",
     "ThemeWidgetType",
     "ServoTraversalFlags",
 ]
 constified-enum-variants = [
@@ -132,16 +133,17 @@ whitelist-types = [
     "mozilla::css::ErrorReporter",
     "mozilla::css::LoaderReusableStyleSheets",
     "mozilla::css::SheetParsingMode",
     "mozilla::css::URLMatchingFunction",
     "mozilla::dom::IterationCompositeOperation",
     "mozilla::dom::StyleChildrenIterator",
     "mozilla::HalfCorner",
     "mozilla::MallocSizeOf",
+    "mozilla::OriginFlags",
     "mozilla::PropertyStyleAnimationValuePair",
     "mozilla::ServoTraversalFlags",
     "mozilla::StylePrefs",
     "mozilla::StyleShapeRadius",
     "mozilla::StyleGrid.*",
     "mozilla::UpdateAnimationsTasks",
     "mozilla::LookAndFeel",
     "mozilla::gfx::Float",
@@ -362,16 +364,17 @@ raw-lines = [
 whitelist-functions = ["Servo_.*", "Gecko_.*"]
 structs-types = [
     "mozilla::css::GridTemplateAreasValue",
     "mozilla::css::ErrorReporter",
     "mozilla::css::ImageValue",
     "mozilla::css::URLValue",
     "mozilla::css::URLValueData",
     "mozilla::MallocSizeOf",
+    "mozilla::OriginFlags",
     "mozilla::Side",
     "mozilla::UniquePtr",
     "nsIContent",
     "nsIDocument",
     "nsIDocument_DocumentTheme",
     "RawGeckoAnimationPropertySegment",
     "RawGeckoComputedTiming",
     "RawGeckoCSSPropertyIDList",
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -1035,17 +1035,19 @@ ServoStyleSet::StyleSubtreeForReconstruc
     MOZ_ASSERT(!postTraversalRequired);
   }
 }
 
 void
 ServoStyleSet::ForceAllStyleDirty()
 {
   SetStylistStyleSheetsDirty();
-  Servo_StyleSet_NoteStyleSheetsChanged(mRawSet.get(), mAuthorStyleDisabled);
+  Servo_StyleSet_NoteStyleSheetsChanged(mRawSet.get(),
+                                        mAuthorStyleDisabled,
+                                        OriginFlags::All);
 }
 
 void
 ServoStyleSet::RecordStyleSheetChange(
     ServoStyleSheet* aSheet,
     StyleSheet::ChangeType aChangeType)
 {
   SetStylistStyleSheetsDirty();
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -53,16 +53,26 @@ namespace mozilla {
 enum class StylistState : uint8_t {
   /** The stylist is not dirty, we should do nothing */
   NotDirty = 0,
 
   /** The style sheets have changed, so we need to update the style data. */
   StyleSheetsDirty,
 };
 
+// Bitfield type to represent Servo stylesheet origins.
+enum class OriginFlags : uint8_t {
+  UserAgent = 0x01,
+  User      = 0x02,
+  Author    = 0x04,
+  All       = 0x07,
+};
+
+MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OriginFlags)
+
 /**
  * The set of style sheets that apply to a document, backed by a Servo
  * Stylist.  A ServoStyleSet contains ServoStyleSheets.
  */
 class ServoStyleSet
 {
   friend class ServoRestyleManager;
   typedef ServoElementSnapshotTable SnapshotTable;