summaryrefslogtreecommitdiffstats
path: root/layout/style/nsRuleNode.cpp
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-10-18 10:12:53 -0500
committerathenian200 <athenian200@outlook.com>2020-10-18 10:12:53 -0500
commit1fc996152b7a1b0f61287c85ddc1698013ea63c0 (patch)
tree1c5df7412fb07f6cff2bb5785c8663b38e5b8f64 /layout/style/nsRuleNode.cpp
parent8e3832bacbbef4a549f64df5c978a5672e47ff2e (diff)
downloadUXP-1fc996152b7a1b0f61287c85ddc1698013ea63c0.tar
UXP-1fc996152b7a1b0f61287c85ddc1698013ea63c0.tar.gz
UXP-1fc996152b7a1b0f61287c85ddc1698013ea63c0.tar.lz
UXP-1fc996152b7a1b0f61287c85ddc1698013ea63c0.tar.xz
UXP-1fc996152b7a1b0f61287c85ddc1698013ea63c0.zip
Issue #1668 - Part 2: Visited color and auto support for caret-color property.
Mozilla's original implementation of this failed a couple of tests, but this seems to solve all the problems. Basically, the caret-color wasn't able to be set differently based on whether a link was visited, and the auto value implementation was incomplete. The only test we fail now is the one where you have grey text on a grey background and the caret is supposed to be visible, but I think that may have been removed from the spec. Even if it wasn't, no other browser supports it anyway.
Diffstat (limited to 'layout/style/nsRuleNode.cpp')
-rw-r--r--layout/style/nsRuleNode.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 66345390e..1136edee2 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -5142,6 +5142,13 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
{
COMPUTE_START_INHERITED(UserInterface, ui, parentUI)
+ auto setComplexColor = [&](const nsCSSValue* aValue,
+ StyleComplexColor nsStyleUserInterface::* aField) {
+ SetComplexColor<eUnsetInherit>(*aValue, parentUI->*aField,
+ StyleComplexColor::Auto(),
+ mPresContext, ui->*aField, conditions);
+ };
+
// cursor: enum, url, inherit
const nsCSSValue* cursorValue = aRuleData->ValueForCursor();
nsCSSUnit cursorUnit = cursorValue->GetUnit();
@@ -5214,12 +5221,8 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
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);
+ setComplexColor(aRuleData->ValueForCaretColor(),
+ &nsStyleUserInterface::mCaretColor);
COMPUTE_END_INHERITED(UserInterface, ui)
}