Closed Bug 1101582 Opened 10 years ago Closed 10 years ago

[ GTK3 ] - missing text area borders

Categories

(Core :: Widget: Gtk, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: stransky, Assigned: stransky)

References

()

Details

Attachments

(4 files, 2 obsolete files)

sFrameBackground is transparent now so 3D textarea inputs and frames have invisible borders.
Assignee: nobody → stransky
Those two colors has wrong color:

case eColorID_threedface:
case eColorID_buttonface:
Attached patch border-color.patch (obsolete) (deleted) — Splinter Review
Karl, I'm confused with this bug. According the CSS spec the threedface/buttonface should be used for background but they're actually used for border rendering - so the attached patch works. Do you think we should use a different color ID for the element borders?
Flags: needinfo?(karlt)
Yes, threedface and buttonface sound like an attempt to hide the border.
I'm surprised the behavior is not similar with GTK2.

I would expect buttonshadow or threedshadow for borders.
Flags: needinfo?(karlt)
The threedface is used as border as well as a background color. But that's not Gtk3 specific - the colors are wrongly used in the css element definitions which is shared by gtk2 and gtk3 code. 

The threedface color is get from button background for Gtk2 code which is gray, so it can be used as background and border. But Gtk3 has transparent borders so we fail here.
Attached patch border color v.2 (obsolete) (deleted) — Splinter Review
What about this solution? It emulates the gtk2 by choosing a basic non-transparent background color.
Attachment #8527730 - Flags: feedback?(karlt)
Attachment #8525380 - Attachment is obsolete: true
(In reply to Martin Stránský from comment #5)
> The threedface color is get from button background for Gtk2 code which is
> gray, so it can be used as background and border. But Gtk3 has transparent
> borders so we fail here.

I'm not sure I understand.  Which of these is the situation?:

* The LookAndFeel border colors are transparent, so borders using these
  colors are not visible.  That actually would happen to work out OK because
  background colors are also used in the/another border, but doesn't work out
  because the frame background color is also transparent.

* The CSS only uses background colors (threedface/buttonface) for the borders
  involved here.

Can you point me at the relevant CSS please?
I don't know exactly which inputs and frames have invisible borders.
Perhaps it would help to upload a screenshot, or describe which UI or content
elements are affected.

(In reply to Martin Stránský from comment #0)
> sFrameBackground is transparent now so 3D textarea inputs and frames have
> invisible borders.

Is this since http://hg.mozilla.org/mozilla-central/rev/6d06526b4d4a or has
something else changed?
Attached image missing-border (deleted) —
Attached image correct-border (deleted) —
http://mxr.mozilla.org/mozilla-central/search?string=+ThreeDFace&find=\.css&findi=\.css&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central

As you can see, the ThreeDFace color is widely used as border as well as a background color.

IMHO the affected element is the textarea from:
http://mxr.mozilla.org/mozilla-central/source/layout/style/forms.css

with:
border: 2px inset ThreeDFace;

>* The LookAndFeel border colors are transparent, so borders using these
>  colors are not visible.  That actually would happen to work out OK because
>  background colors are also used in the/another border, but doesn't work out
>  because the frame background color is also transparent.

Many of the Gtk3 colors are trasparent so yes, the borders using these colors are not visible.

> (In reply to Martin Stránský from comment #0)
>> sFrameBackground is transparent now so 3D textarea inputs and frames have
>> invisible borders.
>
>Is this since http://hg.mozilla.org/mozilla-central/rev/6d06526b4d4a or has
>something else changed?

No. The original (button background) is also transparent.
(In reply to Martin Stránský from comment #10)
> > (In reply to Martin Stránský from comment #0)
> >> sFrameBackground is transparent now so 3D textarea inputs and frames have
> >> invisible borders.
> >
> >Is this since http://hg.mozilla.org/mozilla-central/rev/6d06526b4d4a or has
> >something else changed?
> 
> No. The original (button background) is also transparent.

I assume you were saying that something has changed,
but I guess we don't know what that is.

.frame doesn't explicitly set a transparent background in Adwaita (3.12.0 at
least), so I don't know why we are not getting the background from its
ancestor GtkWindow.  However, GtkFrame is probably not the ideal widget to
find a background anyway.

We probably could try mButtonStyle first and fall back to window.background
when mButtonStyle has a transparent background, but the lack of distinction
between eColorID_threedface and eColorID_buttonface seems to suggest that
buttons don't usually have different colors anyway.
Comment on attachment 8527730 [details] [diff] [review]
border color v.2

I'm happy with this approach, but sFrameBackground is no longer used with
GTK3, so please rename it to sButtonBackground in the GTK2 code, because that
is there, and remove it from the GTK3 code.
Attachment #8527730 - Flags: feedback?(karlt) → feedback+
(In reply to Karl Tomlinson (:karlt) from comment #11)
> (In reply to Martin Stránský from comment #10)
> > > (In reply to Martin Stránský from comment #0)
> > >> sFrameBackground is transparent now so 3D textarea inputs and frames have
> > >> invisible borders.
> > >
> > >Is this since http://hg.mozilla.org/mozilla-central/rev/6d06526b4d4a or has
> > >something else changed?
> > 
> > No. The original (button background) is also transparent.
> 
> I assume you were saying that something has changed,
> but I guess we don't know what that is.

Yes, we know what changed. We used a frame background which was grey in 3.10.x but became transparent in 3.14.

> .frame doesn't explicitly set a transparent background in Adwaita (3.12.0 at
> least), so I don't know why we are not getting the background from its
> ancestor GtkWindow.  However, GtkFrame is probably not the ideal widget to
> find a background anyway.
> 
> We probably could try mButtonStyle first and fall back to window.background
> when mButtonStyle has a transparent background, but the lack of distinction
> between eColorID_threedface and eColorID_buttonface seems to suggest that
> buttons don't usually have different colors anyway.

Buttons are transparent too (http://hg.mozilla.org/mozilla-central/rev/6d06526b4d4a was about it). Looks like more and more elements become transparent and only base widgets (window for instance) has a solid color.
Attached patch border-color-v3.patch (deleted) — Splinter Review
New patch with sButtonBackground.
Attachment #8527730 - Attachment is obsolete: true
Attachment #8529125 - Flags: review?(karlt)
(In reply to Martin Stránský from comment #13)
> Yes, we know what changed. We used a frame background which was grey in
> 3.10.x but became transparent in 3.14.

Hmm.  I don't see any background-color: transparent for .frame in gtk+-3.14.5/gtk/resources/theme/Adwaita/gtk-contained.css either.
Comment on attachment 8529125 [details] [diff] [review]
border-color-v3.patch

but this approach still makes sense.

>Bug 1101582 - [GTK3] - fixes missing text area borders, r=?karlt

Please prioritize what is changed, rather than what the change fixes in the
commit message summary.  This makes it easier to look through checkin comments to understand what changes have happened.  There may be other, likely positive,
effects of this patch beyond textarea.  Something like

> Bug 1101582 - [GTK3] - Use window background color for ThreeDFace,ButtonFace r=karlt

> This fixes missing borders on non-natively-styled textareas.

>     case eColorID_threedlightshadow:
>         // 3-D highlighted inner edge color
>-        aColor = sFrameBackground; // always same as background in GTK code
>+#if (MOZ_WIDGET_GTK == 3)
>+        aColor = sMozWindowBackground;
>+#else
>+        aColor = sButtonBackground; // always same as background in GTK code
>+#endif

I think the "always same" comment goes with  eColorID_threedlightshadow rather
than being GTK2-specific, so please move the comment to before #if.

Alternatively merge with eColorID_threedface:

      case eColorID_threedlightshadow:
          // 3-D highlighted inner edge color
          // always same as background in GTK code; fall through
      case eColorID_threedface:
      case eColorID_buttonface:
          // 3-D face color
  #if (MOZ_WIDGET_GTK == 3)
          aColor = sMozWindowBackground;
  #else
          aColor = sButtonBackground;
  #endif
          break;
Attachment #8529125 - Flags: review?(karlt) → review+
Attached patch border color v.4 for check-in (deleted) — Splinter Review
Thanks, there's the one for check-in.
Try: https://tbpl.mozilla.org/?tree=Try&rev=0a1130fc4c15
https://hg.mozilla.org/mozilla-central/rev/0cc5fbe6f279
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: