summaryrefslogtreecommitdiff
path: root/layout/style/nsRuleNode.cpp
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-09-29 11:31:46 -0500
committerathenian200 <athenian200@outlook.com>2020-10-18 10:04:12 -0500
commit8e3832bacbbef4a549f64df5c978a5672e47ff2e (patch)
tree6a3afb705aa7ae2a9f2be65cd6f5628fcc72131a /layout/style/nsRuleNode.cpp
parent5ad0a15f6a60e24fb260e4a0d0d8050e42c33114 (diff)
downloaduxp-8e3832bacbbef4a549f64df5c978a5672e47ff2e.tar.gz
Issue #1668 - Part 1: Implement support for caret-color property.
This CSS property allows input carets (that blinking input cursor you see in text fields), to be given a custom color. This was implemented in Firefox 53, and it was such a minor feature that no one ever missed it, but I don't see any harm in implementing this. https://bugzilla.mozilla.org/show_bug.cgi?id=1063162
Diffstat (limited to 'layout/style/nsRuleNode.cpp')
-rw-r--r--layout/style/nsRuleNode.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 036d97f867..66345390e5 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1152,13 +1152,16 @@ SetComplexColor(const nsCSSValue& aValue,
aResult = StyleComplexColor::CurrentColor();
} else if (unit == eCSSUnit_ComplexColor) {
aResult = aValue.GetStyleComplexColorValue();
+ } else if (unit == eCSSUnit_Auto) {
+ aResult = StyleComplexColor::Auto();
} else {
+ nscolor resultColor;
if (!SetColor(aValue, aParentColor.mColor, aPresContext,
- nullptr, aResult.mColor, aConditions)) {
+ nullptr, resultColor, aConditions)) {
MOZ_ASSERT_UNREACHABLE("Unknown color value");
return;
}
- aResult.mForegroundRatio = 0;
+ aResult = StyleComplexColor::FromColor(resultColor);
}
}
@@ -5210,6 +5213,14 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
parentUI->mPointerEvents,
NS_STYLE_POINTER_EVENTS_AUTO);
+ // caret-color: auto, color, inherit
+ const nsCSSValue* caretColorValue = aRuleData->ValueForCaretColor();
+ SetComplexColor<eUnsetInherit>(*caretColorValue,
+ parentUI->mCaretColor,
+ StyleComplexColor::Auto(),
+ mPresContext,
+ ui->mCaretColor, conditions);
+
COMPUTE_END_INHERITED(UserInterface, ui)
}