mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
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.
This commit is contained in:
parent
33e50615d9
commit
1f68b25468
4 changed files with 27 additions and 8 deletions
|
|
@ -194,6 +194,7 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSPropertyID aPropID)
|
||||||
// writing-mode
|
// writing-mode
|
||||||
|
|
||||||
switch (aPropID) {
|
switch (aPropID) {
|
||||||
|
case eCSSProperty_caret_color:
|
||||||
case eCSSProperty_clip:
|
case eCSSProperty_clip:
|
||||||
case eCSSProperty_clip_rule:
|
case eCSSProperty_clip_rule:
|
||||||
case eCSSProperty_clip_path:
|
case eCSSProperty_clip_path:
|
||||||
|
|
|
||||||
|
|
@ -1831,7 +1831,7 @@ nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder,
|
||||||
nscolor
|
nscolor
|
||||||
nsIFrame::GetCaretColorAt(int32_t aOffset)
|
nsIFrame::GetCaretColorAt(int32_t aOffset)
|
||||||
{
|
{
|
||||||
return StyleColor()->CalcComplexColor(StyleUserInterface()->mCaretColor);
|
return nsLayoutUtils::GetColor(this, eCSSProperty_caret_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -5141,6 +5141,13 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
|
||||||
{
|
{
|
||||||
COMPUTE_START_INHERITED(UserInterface, ui, parentUI)
|
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
|
// cursor: enum, url, inherit
|
||||||
const nsCSSValue* cursorValue = aRuleData->ValueForCursor();
|
const nsCSSValue* cursorValue = aRuleData->ValueForCursor();
|
||||||
nsCSSUnit cursorUnit = cursorValue->GetUnit();
|
nsCSSUnit cursorUnit = cursorValue->GetUnit();
|
||||||
|
|
@ -5213,12 +5220,8 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
|
||||||
NS_STYLE_POINTER_EVENTS_AUTO);
|
NS_STYLE_POINTER_EVENTS_AUTO);
|
||||||
|
|
||||||
// caret-color: auto, color, inherit
|
// caret-color: auto, color, inherit
|
||||||
const nsCSSValue* caretColorValue = aRuleData->ValueForCaretColor();
|
setComplexColor(aRuleData->ValueForCaretColor(),
|
||||||
SetComplexColor<eUnsetInherit>(*caretColorValue,
|
&nsStyleUserInterface::mCaretColor);
|
||||||
parentUI->mCaretColor,
|
|
||||||
StyleComplexColor::Auto(),
|
|
||||||
mPresContext,
|
|
||||||
ui->mCaretColor, conditions);
|
|
||||||
|
|
||||||
COMPUTE_END_INHERITED(UserInterface, ui)
|
COMPUTE_END_INHERITED(UserInterface, ui)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1255,6 +1255,17 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NB: Calling Peek on |this|, not |thisVis| (see above).
|
||||||
|
if (!change && PeekStyleUserInterface()) {
|
||||||
|
const nsStyleUserInterface *thisVisUserInterface = thisVis->StyleUserInterface();
|
||||||
|
const nsStyleUserInterface *otherVisUserInterface = otherVis->StyleUserInterface();
|
||||||
|
if (thisVisUserInterface->mCaretColor !=
|
||||||
|
otherVisUserInterface->mCaretColor) {
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (change) {
|
if (change) {
|
||||||
hint |= nsChangeHint_RepaintFrame;
|
hint |= nsChangeHint_RepaintFrame;
|
||||||
}
|
}
|
||||||
|
|
@ -1487,6 +1498,9 @@ ExtractColor(nsCSSPropertyID aProperty,
|
||||||
case StyleAnimationValue::eUnit_ComplexColor:
|
case StyleAnimationValue::eUnit_ComplexColor:
|
||||||
return Some(aStyleContext->StyleColor()->
|
return Some(aStyleContext->StyleColor()->
|
||||||
CalcComplexColor(val.GetStyleComplexColorValue()));
|
CalcComplexColor(val.GetStyleComplexColorValue()));
|
||||||
|
case StyleAnimationValue::eUnit_Auto:
|
||||||
|
return Some(aStyleContext->StyleColor()->
|
||||||
|
CalcComplexColor(StyleComplexColor::Auto()));
|
||||||
default:
|
default:
|
||||||
return Nothing();
|
return Nothing();
|
||||||
}
|
}
|
||||||
|
|
@ -1508,7 +1522,8 @@ static const ColorIndexSet gVisitedIndices[2] = { { 0, 0 }, { 1, 0 } };
|
||||||
nscolor
|
nscolor
|
||||||
nsStyleContext::GetVisitedDependentColor(nsCSSPropertyID aProperty)
|
nsStyleContext::GetVisitedDependentColor(nsCSSPropertyID aProperty)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aProperty == eCSSProperty_color ||
|
NS_ASSERTION(aProperty == eCSSProperty_caret_color ||
|
||||||
|
aProperty == eCSSProperty_color ||
|
||||||
aProperty == eCSSProperty_background_color ||
|
aProperty == eCSSProperty_background_color ||
|
||||||
aProperty == eCSSProperty_border_top_color ||
|
aProperty == eCSSProperty_border_top_color ||
|
||||||
aProperty == eCSSProperty_border_right_color ||
|
aProperty == eCSSProperty_border_right_color ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue