Closed Bug 289652 Opened 19 years ago Closed 19 years ago

[regression] -moz-selection fails to work

Categories

(Core :: DOM: Selection, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: phiw2, Assigned: masayuki)

References

Details

(Keywords: regression, testcase)

Attachments

(4 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050408 Firefox/1.0+ (PowerBook)
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050408 Firefox/1.0+ (PowerBook)

On nightly trunk builds (Firefox 1.0+), since 20050405, the browser fails to
render anything with -moz-selection. I'll attach a test case.

Safari 1.2 OS X Panther renders the test correctly.

possible result from bug 56314 ?

Reproducible: Always

Steps to Reproduce:
1.add ::-moz-selection selector to stylesheet
2.select text in a page
3.

Actual Results:  
the background for the selected text takes the default background for selection
as dictated by the OS

Expected Results:  
the background for the selected text should take the background as specified by
the selector.
Attached file test case (obsolete) —
I've added the official (css3) ::selection as well, which is supported by
Safari 1.2
(In reply to comment #0)
> possible result from bug 56314 ?
Yes.
-moz-selection has been decided not to be supported by discussing bug 56314 in Mac. 
It might be INVALID. 
(In reply to comment #2)
...
> -moz-selection has been decided not to be supported by discussing bug 56314 in
Mac. 
> It might be INVALID.


Safari (1.2), OS X 10.3 does support ::selection. 
I completely fail to see the reasons why Gecko should not support this on OS X.

The problem in bug 56314 is related to a computation to automatically change the
background-colour of selected test to improve contrast. Which is not a bad idea
by the way. I can possibly understand why this shouldn't be implemented for OS X
builds. Safari doesn't do that either, at the moment.

But from there it is a big step to completely disable ::-moz-selection, which
has additional benefits for both the stylesheet author and the user, for example
in terms of accessibility.

when I remove the first selection p[class="test"]::selection, everything works
all right. 
That part Mozilla doesn't understand, that's why the whole rule is thrown out. 
As a consequence it isn't working in Mozilla1.7 also.
So I think this bug can be resolved WFM.
Attached file test case 2
Same testcase as the first one, but deleted the ::selection selector.

This does *not* work with Firefox, OS X. (but works with Windows and Linux, as
far as I know)
Attachment #180137 - Attachment is obsolete: true
Ah, ok. Marking new, then.
So testcase2 works with a 20050404 nightly MacOSX build, but fails with a
20050405 build, right?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression, testcase
(In reply to comment #6)
>...
> So testcase2 works with a 20050404 nightly MacOSX build, but fails with a
> 20050405 build, right?

Actually, it is slightly older. It works with 20050403 OS X, but not with
20050404. I'll attach a screenshot in a moment.

Attached image screenshot
Screenshot from 20050403 Official build, OS X (10.3.8), working
::-moz-selection.
I removed ::-moz-selection support on Mac in bug 56314.
(In reply to comment #10)
> I removed ::-moz-selection support on Mac in bug 56314.

That is why I filed this bug.
See my idea about this in comment #3 above.

And I point out again that Safari 1.2 does support ::selection as per CSS3
selectors. I'll attach a screenshot from Safari.

Attached image Screenshot from Safari
Screenshot with Safari 1.2 from the same testcase, but using the ::selection
pseudo-element instead. (http://www.w3.org/TR/css3-selectors/#UIfragments).
I think that if we support ::-moz-selection on Mac, it should not support
background only, we should support both background and foreground.
If not so, Mac users cannot see the selection text with following style.

p{ color: #002200; background-color: white; }
p::-moz-selection{ color: white; background-color: black; }
Color should certainly be supported.
Ideally, Firefox should support the four properties mentioned in CSS3 selectors:
color, cursor, background, outline. Safari currently supports color and
background(-color)
So to make it clear what's going on here:

1)  Before the patch in bug 56314, ::-moz-selection could change the background
    color but not the foreground color, on Mac.
2)  That patch made the behavior consistent.
3)  We probably should allow styling both, even on Mac.
4)  ::-moz-selection is not quite the same as CSS3 ::selection (that's why it's
    named differently).   It's worth keeping that in mind.

Masayuki Nakano, do you feel ok with changing this code per item 3?
Yes.
I like that it is same behavior on all platforms.

i.e.,
http://lxr.mozilla.org/seamonkey/source/layout/generic/nsTextFrame.cpp#1238
- 1238   if (!dontChangeTextColor &&
- 1239       mSelectionPseudoStyle &&
+        if (mSelectionPseudoStyle &&
  1240       mSelectionStatus == nsISelectionController::SELECTION_ON) {
Looks good if the comment right before that is removed and the declaration of
dontChangeTextColor moved below this block.
we want to fix this for 1.8.
Assignee: selection → masayuki
Flags: blocking1.8b3?
Attached patch Patch rv1.0 (obsolete) — Splinter Review
Attachment #183719 - Flags: superreview?(bzbarsky)
Attachment #183719 - Flags: review?(bzbarsky)
Attachment #183719 - Flags: superreview?(bzbarsky)
Attachment #183719 - Flags: review?(bzbarsky)
Attached patch Patch rv1.1Splinter Review
Attachment #183719 - Attachment is obsolete: true
Attachment #183720 - Flags: superreview?(bzbarsky)
Attachment #183720 - Flags: review?(bzbarsky)
Comment on attachment 183720 [details] [diff] [review]
Patch rv1.1

Requesting 1.8b2 approval for reenabling -moz-selection support on Mac.
Attachment #183720 - Flags: superreview?(bzbarsky)
Attachment #183720 - Flags: superreview+
Attachment #183720 - Flags: review?(bzbarsky)
Attachment #183720 - Flags: review+
Attachment #183720 - Flags: approval1.8b2?
Comment on attachment 183720 [details] [diff] [review]
Patch rv1.1

a=asa
Attachment #183720 - Flags: approval1.8b2? → approval1.8b2+
checked-in.
Status: NEW → RESOLVED
Closed: 19 years ago
Flags: blocking1.8b3?
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: