Bug 1382925 - Part 1: Make Servo_StyleSet_NoteStyleSheetsChanged take a set of origins to dirty. r=emilio
MozReview-Commit-ID: KY29REU78tH
--- 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
@@ -1031,17 +1031,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;