Bug 1420026 - Part 1: Add aWasCurrentColor outparam to ServoCSSParser::ComputeColor. r=TYLin
MozReview-Commit-ID: CMv0LedpEfv
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -739,17 +739,18 @@ SERVO_BINDING_FUNC(Servo_CloneArcStringD
const mozilla::ServoRawOffsetArc<RustString>* string);
// CSS parsing utility functions.
SERVO_BINDING_FUNC(Servo_IsValidCSSColor, bool, const nsAString* value);
SERVO_BINDING_FUNC(Servo_ComputeColor, bool,
RawServoStyleSetBorrowedOrNull set,
nscolor current_color,
const nsAString* value,
- nscolor* result_color);
+ nscolor* result_color,
+ bool* was_current_color);
SERVO_BINDING_FUNC(Servo_ParseIntersectionObserverRootMargin, bool,
const nsAString* value,
nsCSSRect* result);
// Returning false means the parsed transform contains relative lengths or
// percentage value, so we cannot compute the matrix. In this case, we keep
// |result| and |contains_3d_transform| as-is.
SERVO_BINDING_FUNC(Servo_ParseTransformIntoMatrix, bool,
const nsAString* value,
--- a/layout/style/ServoCSSParser.cpp
+++ b/layout/style/ServoCSSParser.cpp
@@ -15,20 +15,22 @@ ServoCSSParser::IsValidCSSColor(const ns
{
return Servo_IsValidCSSColor(&aValue);
}
/* static */ bool
ServoCSSParser::ComputeColor(ServoStyleSet* aStyleSet,
nscolor aCurrentColor,
const nsAString& aValue,
- nscolor* aResultColor)
+ nscolor* aResultColor,
+ bool* aWasCurrentColor)
{
return Servo_ComputeColor(aStyleSet ? aStyleSet->RawSet() : nullptr,
- aCurrentColor, &aValue, aResultColor);
+ aCurrentColor, &aValue, aResultColor,
+ aWasCurrentColor);
}
/* static */ bool
ServoCSSParser::ParseIntersectionObserverRootMargin(const nsAString& aValue,
nsCSSRect* aResult)
{
return Servo_ParseIntersectionObserverRootMargin(&aValue, aResult);
}
--- a/layout/style/ServoCSSParser.h
+++ b/layout/style/ServoCSSParser.h
@@ -27,22 +27,25 @@ public:
/**
* Computes an nscolor from the given CSS <color> value.
*
* @param aStyleSet The style set whose nsPresContext will be used to
* compute system colors and other special color values.
* @param aCurrentColor The color value that currentcolor should compute to.
* @param aValue The CSS <color> value.
* @param aResultColor The resulting computed color value.
+ * @param aWasCurrentColor Whether aValue was currentcolor. Can be nullptr
+ * if the caller doesn't care.
* @return Whether aValue was successfully parsed and aResultColor was set.
*/
static bool ComputeColor(ServoStyleSet* aStyleSet,
nscolor aCurrentColor,
const nsAString& aValue,
- nscolor* aResultColor);
+ nscolor* aResultColor,
+ bool* aWasCurrentColor = nullptr);
/**
* Parses a IntersectionObserver's initialization dictionary's rootMargin
* property.
*
* @param aValue The rootMargin value.
* @param aResult The nsCSSRect object to write the result into.
* @return Whether the value was successfully parsed.