From c1ef9546792e8d5881c9516d8e51de3cd6999f79 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 29 Sep 2020 11:31:46 -0500 Subject: 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 --- layout/generic/nsFrame.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'layout/generic') diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index cb70f8b1e..71f882b17 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1833,8 +1833,7 @@ nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder, nscolor nsIFrame::GetCaretColorAt(int32_t aOffset) { - // Use text color. - return StyleColor()->mColor; + return StyleColor()->CalcComplexColor(StyleUserInterface()->mCaretColor); } bool -- cgit v1.2.3 From 67a7e4eabd9b91436cc658431ea1bbd28e480f5b Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sun, 18 Oct 2020 10:12:53 -0500 Subject: 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. --- layout/generic/nsFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layout/generic') diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 71f882b17..5296126ac 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1833,7 +1833,7 @@ nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder, nscolor nsIFrame::GetCaretColorAt(int32_t aOffset) { - return StyleColor()->CalcComplexColor(StyleUserInterface()->mCaretColor); + return nsLayoutUtils::GetColor(this, eCSSProperty_caret_color); } bool -- cgit v1.2.3 From abcee4f85c5320ceab1f16712d26ea059ef67fd9 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Mon, 19 Oct 2020 19:35:03 +0000 Subject: Issue #1671 - Unprefix ::-moz-selection This actually keeps both pseudo-elements for now, since the prefixed version is still used internally, but we need the unprefixed version for web compat. Note: while unprefixing a non-spec-compliant pseudo here, it's exactly in line with what other browsers do. Nobody is following the spec here and at least we'll be doing what everyone else is with our unprefixed version. --- layout/generic/nsTextFrame.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'layout/generic') diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index a47b87e38..c7b55961c 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -3949,11 +3949,18 @@ nsTextPaintStyle::InitSelectionColorsAndShadow() if (selectionElement && selectionStatus == nsISelectionController::SELECTION_ON) { RefPtr sc = nullptr; + // Probe for both selection and -moz-selection sc = mPresContext->StyleSet()-> ProbePseudoElementStyle(selectionElement, - CSSPseudoElementType::mozSelection, + CSSPseudoElementType::selection, mFrame->StyleContext()); - // Use -moz-selection pseudo class. + if (!sc) { + sc = mPresContext->StyleSet()-> + ProbePseudoElementStyle(selectionElement, + CSSPseudoElementType::mozSelection, + mFrame->StyleContext()); + } + // Use selection pseudo class. if (sc) { mSelectionBGColor = sc->GetVisitedDependentColor(eCSSProperty_background_color); -- cgit v1.2.3