Closed Bug 566178 Opened 14 years ago Closed 14 years ago

search bar suggestions have alternating background (autocomplete tree shouldn't be considered a multicol tree)

Categories

(Toolkit :: Themes, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla2.0b2
Tracking Status
blocking2.0 --- final+

People

(Reporter: dao, Assigned: steffen.wilberg)

References

Details

(Keywords: regression)

Attachments

(3 files, 5 obsolete files)

Attached image screenshot
      No description provided.
I think we want to undo odd row highlighting in all autocomplete result popups.

Tested on Linux, needs testing on Mac.
Assignee: nobody → steffen.wilberg
Status: NEW → ASSIGNED
Attachment #445587 - Flags: review?(dao)
OK, what is the way one is supposed to use to specify that this kind of highlighting is to be used or not?

What is the relationship with the alternatingbackground attribute?
(In reply to comment #1)
> Tested on Linux, needs testing on Mac.

On Mac it looks like this (latest trunk, Mac OS X 10.6):
http://img32.imageshack.us/img32/7702/bildschirmfotof.jpg
Neil, the odd-row-highlighting is specified by tree.css for all trees with more than one column:
  treechildren::-moz-tree-row(multicol, odd) {
    background-color: -moz-oddtreerow;
  }

In bug 282127, my first approach was to sprinkle 'alternatingbackground="tree"' to every tree with more than one column. Then I found the general solution above by implementing "multicol".

The alternatingbackground="true" attribute is obsolete, not unused anywhere except DOM Insepctor, and not even styled by Gnomestripe. I propose to remove it altogether in bug 565460.

So the proposed way to suppress this highlighting is by using css like in the patch above. Since odd-row-highlighting is a platform convention on Mac and Linux, the need to suppress it should be limited to special cases like this.
This is just the second case after Gnomestripe's aboutsessionrestore.css, which wants a special "alternate" highlight instead.

Nomis101, thanks for the screenshot, looks good!
Can we make it so that this tree isn't considered "multicol" in the first place?
The code to implement multicol (bug 282127) is just this, in nsTreeBodyFrame::PrefillPropertyArray:
    if (mColumns->GetColumnAt(1))
      mScratchArray->AppendElement(nsGkAtoms::multicol);

The autocomplete popup uses a tree, and an (optional) comments column, which is used to show the "Suggestions" label in this case.
I don't think we want to change any of that...

I could add something like treechildren:not([alternatingbackground="false"]) to tree.css and alternatingbackground="false" to search.xml or autocomplete.xml.

Or I could exclude autocomplete-trees from the odd-row-styling in tree.css:
-treechildren::-moz-tree-row(multicol, odd) {
+tree:not(.autocomplete-tree) treechildren::-moz-tree-row(multicol, odd) {
So here's the approach from the last sentence in comment 6.
Sadly I had to add tree:not(.autocomplete-tree) to the "selected" and "selected, focus" cases as well to make them still apply.
Tested on Linux only.
Attachment #446071 - Flags: review?(dao)
Comment on attachment 446071 [details] [diff] [review]
alternate approach: tree:not(.autocomplete-tree)

>-treechildren::-moz-tree-row(multicol, odd) {
>+tree:not(.autocomplete-tree) treechildren::-moz-tree-row(multicol, odd) {

treechildren:not(.autocomplete-treebody)?

>  background-color: -moz-oddtreerow;

Please indent 1px further.
Right, that works as well, and should be faster.
I also fixed the indent.
Attachment #446071 - Attachment is obsolete: true
Attachment #447376 - Flags: review?(dao)
Attachment #446071 - Flags: review?(dao)
Comment on attachment 447376 [details] [diff] [review]
alternate approach, v2: treechildren:not(.autocomplete-treebody)

>--- a/toolkit/themes/gnomestripe/global/tree.css
>+++ b/toolkit/themes/gnomestripe/global/tree.css

>-treechildren::-moz-tree-row(multicol, odd) {
>- background-color: -moz-oddtreerow;
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(multicol, odd) {
>+  background-color: -moz-oddtreerow;
> }
> 
>-treechildren::-moz-tree-row(selected) {
>+treechildren::-moz-tree-row(selected),
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(multicol, odd, selected) {
>   background-color: -moz-cellhighlight;
> }

Do you actually care about 'multicol' and 'odd' here? Does it affect the selector weighting?

> 
> treechildren::-moz-tree-row(selected, focus),
>-treechildren::-moz-tree-row(multicol, odd, selected, focus) {
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(multicol, odd, selected, focus) {
>   background-color: Highlight;
> }

Same question.
Yes, see comment 7.
"selected" and "selected, focus" don't apply to "multicol, odd" rows.
So I do need "multicol, odd, selected" and "multicol, odd, selected, focus".
(In reply to comment #11)
> "selected" and "selected, focus" don't apply to "multicol, odd" rows.

Do they actually not apply or are they overridden?
They're overridden. Adding !important does the trick:

treechildren:not(.autocomplete-treebody)::-moz-tree-row(multicol, odd) {
  background-color: -moz-oddtreerow;
}

treechildren::-moz-tree-row(selected) {
  background-color: -moz-cellhighlight !important;
}

treechildren::-moz-tree-row(selected, focus) {
  background-color: Highlight !important;
}
Dão: please decide which patch (or modification of the last patch by comment 13) you like...
Comment on attachment 447376 [details] [diff] [review]
alternate approach, v2: treechildren:not(.autocomplete-treebody)

I removed 'multicol' and 'odd' from said selectors and couldn't see a difference...
blocking2.0: --- → ?
Any chance this can get reviewed & landed in time for Firefox 4 beta 1?
Attachment #445587 - Attachment is obsolete: true
Attachment #445587 - Flags: review?(dao)
Attached patch alternate approach, v3 (obsolete) — Splinter Review
Sorry, couldn't work on this while on vacation.

I misunderstood you in comment 10, thought you meant removing the entire "multicol, odd, selected" line instead of just the "multicol" and "odd" selectors from that line (and the same for the "selected, focus" line). I now did that and it works fine indeed.

I also changed Pinstripe's tree.css by removing "multicol" from the "selected" and "selected, focus" lines.

Tested on Linux but not Mac.
Attachment #447376 - Attachment is obsolete: true
Attachment #454257 - Flags: review?(dao)
Attachment #447376 - Flags: review?(dao)
Comment on attachment 454257 [details] [diff] [review]
alternate approach, v3

>--- a/toolkit/themes/pinstripe/global/tree.css
>+++ b/toolkit/themes/pinstripe/global/tree.css

> treechildren::-moz-tree-row(selected),
> treechildren::-moz-tree-row(odd, selected),
>-treechildren::-moz-tree-row(multicol, odd, selected) {
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(odd, selected) {
>   background-color: -moz-mac-secondaryhighlight;
> }

'odd' seems redundant here, including the preexisting selector.

> treechildren::-moz-tree-row(selected, focus), 
> treechildren::-moz-tree-row(odd, selected, focus),
>-treechildren::-moz-tree-row(multicol, odd, selected, focus) {
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(odd, selected, focus) {
>   background-color: Highlight;
>   color: HighlightText;
> }

ditto

Gnomestripe looks good.
Here you are. I can't test on Mac though.
Attachment #454257 - Attachment is obsolete: true
Attachment #454671 - Flags: review?(dao)
Attachment #454257 - Flags: review?(dao)
Attachment #454671 - Flags: review?(dao) → review+
Comment on attachment 454671 [details] [diff] [review]
v4 (with changes from comment 19)

> treechildren::-moz-tree-row(selected),
> treechildren::-moz-tree-row(odd, selected),
>-treechildren::-moz-tree-row(multicol, odd, selected) {
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected) {
>   background-color: -moz-mac-secondaryhighlight;
> }
> 
> treechildren::-moz-tree-row(selected, focus), 
> treechildren::-moz-tree-row(odd, selected, focus),
>-treechildren::-moz-tree-row(multicol, odd, selected, focus) {
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected, focus) {
>   background-color: Highlight;
>   color: HighlightText;
> }

In comment 19 I was also trying to refer to treechildren::-moz-tree-row(odd, selected) and treechildren::-moz-tree-row(odd, selected, focus) -- they seem redundant, please drop them while you're at it.
Comment on attachment 454671 [details] [diff] [review]
v4 (with changes from comment 19)

>diff --git a/toolkit/themes/gnomestripe/global/tree.css b/toolkit/themes/gnomestripe/global/tree.css

>+treechildren::-moz-tree-row(selected),
>+treechildren:not(.autocomplete-treebody)::-moz-tree-row(selected) {

This doesn't look right... isn't this supposed to be a replacement rather than an addition?
OK, I blame the existing code for tricking me into thinking this needs to be so complicated ;-)

Tested on Linux only.
Attachment #454671 - Attachment is obsolete: true
Attachment #455259 - Flags: review?(dao)
Comment on attachment 455259 [details] [diff] [review]
v5 (comments 21 and 23 addressed)

I see, autocomplete.css provides its own styling for ::-moz-tree-row(selected), otherwise the double selectors from the previous patches would actually have made sense.
Attachment #455259 - Flags: review?(dao) → review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/b0f99f426843
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Component: XUL → Themes
Keywords: checkin-needed
Product: Core → Toolkit
QA Contact: xptoolkit.widgets → themes
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3b2
blocking2.0: ? → final+
Verified fixed with trunk builds on OS X and Linux like Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; en-US; rv:2.0b2pre) Gecko/20100712 Minefield/4.0b2pre

Can we get an automated test to make sure we don't regress it again?
Status: RESOLVED → VERIFIED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: