Commit Graph

120 Commits

Author SHA1 Message Date
Martin Stransky
a8eb447869 Bug 1457120 - Use mozilla:: namespace at nsLookAndFeel module, r=jhorak
MozReview-Commit-ID: BXZzDAiY0e4
2018-04-26 14:59:55 +02:00
Martin Stransky
e1ad5b8a78 Bug 1453930 - Use gtk_style_context_get_state() instead of GTK_STATE_FLAG_NORMAL to get widget border/margin/padding, r=jhorak
MozReview-Commit-ID: 6FaUpaaBt2Q
2018-04-13 13:41:27 +02:00
Jonathan Watt
bd03a860aa Bug 1436048: Use user defined types for font-stretch / font-style. r=jfkthame,jwatt
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

MozReview-Commit-ID: 7ONYtICeAqb
2018-04-23 18:22:05 +02:00
Jonathan Watt
9243470005 Bug 1436048 part 1 - Use a user defined type for font weight everywhere. r=jfkthame,emilio 2018-04-13 20:34:37 +01:00
Martin Stransky
c977f1265a Bug 1441873 - [CSD] Remove nsWindow::mIsCSDAvailable and replace with CSDSupportLevel state, r=jhorak
MozReview-Commit-ID: KOiSzNvZfjg
2018-03-22 13:22:38 +01:00
Martin Stransky
da72326115 Bug 1434646 - Titlebar rendering - Place titlebar buttons in GtkBox, r=jhorak
Some themes (Ambiance for instance) uses first-child/last-child css selectors
to style titlebar buttons. Ubuntu Ambiance theme places titlebar buttons closer
by negative margin applied to them.

We put titlebar buttons to GtkBox as well as Gtk+ does and also keep
the button order here to match first-child/last-child selectors. It also means
we must have maximize/restore as one button to keep the correct order.

MozReview-Commit-ID: 9mqljOa4Vu7
2018-02-23 21:28:37 +01:00
Martin Stransky
919aa6fedd Bug 1433092 - Add spacing around titlebar buttons, r=jhorak
GtkHeaderBar has property "spacing" which defines space between buttons at titlebar.
Get this property and apply as margin to titlebar buttons when there's more than one.
Also cache this value for furter use at titlebar metrics cache.

MozReview-Commit-ID: J7qAIWEnK4Y
2018-02-23 10:37:07 +01:00
Jan Horak
4b5774827a Bug 1439857 - Fix too big fonts when devPixelsPerPx is set; r=stransky
This fixes regression introduced by hidpi support for wayland in
case devPixelsPerPx is set (bug 1431337).

MozReview-Commit-ID: DOh0aTcxbVG
2018-02-22 10:41:30 +01:00
Jan Horak
f82532e89c Bug 1431337 - Scale content for the actual monitor, not the first one; r=stransky
We need to use scaling factor of the monitor on which application is actually positioned.
Previously we used ScreenHelperGTK::GetGTKMonitorScaleFactor() which use the first monitor.
This does not work on hidpi+normal dpi monitors setup.

The GetSystemFontInfo() cannot return scaled value of the font by default monitor
scale factor. We need to scale it in nsLookAndFeel::GetFontImpl
by aDevPixPerCSSPixel like implementation for Windows does.

We also need to check layout.css.devPixelsPerPx because we cannot
scale per monitor when this preference is set to positive number.

MozReview-Commit-ID: AwT2NvkEqvz
2018-01-18 11:52:59 +01:00
Andreea Pavel
dde1c0fec7 Backed out changeset cf44885dc2ac (bug 1431337) for failing mochitest browser chrome at browser/base/content/test/performance/browser_startup_images.js on a CLOSED TREE 2018-02-15 16:03:40 +02:00
Jan Horak
e64b2123e5 Bug 1431337 - Scale content for the actual monitor, not the first one; r=stransky
We need to use scaling factor of the monitor on which application is actually positioned.
Previously we used ScreenHelperGTK::GetGTKMonitorScaleFactor() which use the first monitor.
This does not work on hidpi+normal dpi monitors setup.

The GetSystemFontInfo() cannot return scaled value of the font by default monitor
scale factor. We need to scale it in nsLookAndFeel::GetFontImpl
by aDevPixPerCSSPixel like implementation for Windows does.

We also need to check layout.css.devPixelsPerPx because we cannot
scale per monitor when this preference is set to positive number.

MozReview-Commit-ID: AwT2NvkEqvz
2018-01-18 11:52:59 +01:00
Noemi Erli
1081acc7c4 Backed out 2 changesets (bug 1431337) for M15 failures in parser/htmlparser/tests/mochitest/test_img_picture_preload.html on a CLOSED TREE
Backed out changeset c70e75e993fc (bug 1431337)
Backed out changeset 016f4ce0803b (bug 1431337)
2018-01-24 18:09:50 +02:00
Jan Horak
0fd6611353 Bug 1431337 - Scale font for the actual monitor, not the first one; r=stransky
The GetSystemFontInfo() cannot return scaled value of the font by default monitor
scale factor. We need to scale it in nsLookAndFeel::GetFontImpl
by aDevPixPerCSSPixel like implementation for Windows does.

MozReview-Commit-ID: 5okD8vUu9UK
2018-01-18 11:10:18 +01:00
Martin Stransky
1e9c837122 Bug 1430725 - Use mozilla::widget namespace explicitly for ScreenHelperGTK::GetGTKMonitorScaleFactor() call, r=jhorak
MozReview-Commit-ID: 9rqYsZTdwRC
2018-01-16 10:07:03 +01:00
Martin Stransky
124d3824a7 Bug 1417933 - enable CSD titlebar rendering mode as Bug 1424974 regression is fixed, r=jhorak
MozReview-Commit-ID: 7SCjbJr9Arl
2018-01-09 11:27:34 +01:00
Sylvestre Ledru
1dc3061203 Bug 1278282 - Ride along Remove some trailing whitespaces r=lsalzman
MozReview-Commit-ID: 8W6VKIW8PQV
2017-12-19 11:38:59 +01:00
Martin Stransky
d51d288cca Bug 1423810 - Temporary disable CSD decoration as it breaks popup windows, r=jhorak
MozReview-Commit-ID: DCdbxvnfV9B
2017-12-11 22:26:55 +01:00
Martin Stransky
20dadb4cc5 Bug 1420110 - remove browser.tabs.drawInTitlebar check from nsLookAndFeel, r=jhorak
The browser.tabs.drawInTitlebar check at nsLookAndFeel is redundant, breaks Thunderbird and dynamic titlebar rendering change. Let's use browser.tabs.drawInTitlebar at browser level and when enabled configure titlebar visibility by moz_gtk* media atoms.

MozReview-Commit-ID: IhCYmXgVME7
2017-11-23 21:00:12 +01:00
Martin Stransky
7320200195 Bug 1418829 - nsLookAndFeel enables rendering to the titlebar for supported window managers only, r=jhorak
MozReview-Commit-ID: JvqQuZenkWy
2017-11-20 14:29:49 +01:00
Martin Stransky
1bf6fb8628 Bug 1414212 - Enable titlebar rendering on Gtk+ >= 3.10, r=jhorak
MozReview-Commit-ID: JFmpa8JyHEl
2017-11-16 15:18:17 +01:00
Martin Stransky
f8c7508e39 Bug 1415080 - Rename all 's' prefixed members of nsLookAndFeel as they're not static ones, r=jhorak
MozReview-Commit-ID: 9LHIewRnbAY
2017-11-07 10:14:52 +01:00
Martin Stransky
df293afe54 Bug 1414774 - Initialize sCSDCloseButton/sCSDMaximizeButton/sCSDMinimizeButton, r=jhorak
MozReview-Commit-ID: 10Yk1gFu0Vk
2017-11-06 11:41:38 +01:00
Brad Werth
efb38ca1ea Bug 1403690 Part 4: gtk rearrange header and implementation to keep init and refresh functions together. r=karlt
MozReview-Commit-ID: ERsI916e7zf
2017-10-10 14:12:47 -07:00
Sebastian Hengst
4e427cf8bf Backed out changeset 7636f668f84e (bug 1403690) 2017-10-23 22:05:05 +02:00
Brad Werth
3d9273fef2 Bug 1403690 Part 4: gtk rearrange header and implementation to keep init and refresh functions together. r=karlt
MozReview-Commit-ID: ERsI916e7zf
2017-10-10 14:12:47 -07:00
Sebastian Hengst
851ac289fa Backed out changeset 349f51081127 (bug 1403690) 2017-10-23 18:21:09 +02:00
Brad Werth
589099dc33 Bug 1403690 Part 4: gtk rearrange header and implementation to keep init and refresh functions together. r=karlt
MozReview-Commit-ID: ERsI916e7zf
2017-10-10 14:12:47 -07:00
Martin Stransky
38937c6577 Bug 1409493 - Load actual CSD config from Gtk+, r=jhorak
MozReview-Commit-ID: GVHGXEk4IN
2017-10-17 21:19:48 +02:00
Martin Stransky
a2d195c16a Bug 1409493 - Implement CSD entries for Gtk+ LookAndFeel module, r=jhorak
MozReview-Commit-ID: CXsy9dhgMB9
2017-10-17 21:17:32 +02:00
Emilio Cobos Álvarez
41b553596d Bug 1406631: Remove the color-picker-available system metric. r=xidorn
All our widgets support it with a constant true.

MozReview-Commit-ID: JMEItUsxYWq
2017-10-07 14:06:44 +02:00
Sebastian Hengst
31ab915b94 Backed out changeset f70d6fcdb760 (bug 1406631) for failing color related reftests like layout/reftests/writing-mode/ua-style-sheet-input-color-1.html on Android. r=backout 2017-10-07 20:08:12 +02:00
Emilio Cobos Álvarez
ac4350b60d Bug 1406631: Remove the color-picker-available system metric. r=xidorn
All our widgets support it with a constant true.

MozReview-Commit-ID: JMEItUsxYWq
2017-10-07 14:06:44 +02:00
Brad Werth
1a3ca2a62b Bug 1401063: Cache remaining gtk window and button colors to eliminate on-demand gtk calls in ::NativeGetColor. r=karlt
MozReview-Commit-ID: HbZqBUG0w7y
2017-09-19 13:00:28 -07:00
Karl Tomlinson
e376ffbf74 bug 1396722 remove no-op ReleaseStyleContext() r=stransky+263117
MozReview-Commit-ID: DgKM0wrStrk
2017-09-05 09:16:01 +12:00
Karl Tomlinson
9d2f00dbbd bug 1384701 get system fonts in EnsureInit() which is on main thread even with servo r=manishearth
GTK should be used only from the main thread, but the specific symptom before
this change was that creating a GtkEntry causes
pango_cairo_font_map_get_default() to be called.  This function returns a
different font map on each thread.  The font map is leaked when StyleThreads
are leaked at exit.

Font caches are usually expensive and so using the existing font map on the
main thread is preferable.

A GtkEntry already exists on the main thread, as well as style contexts for
most other system fonts, and so it is more efficient to create these on the
main thread while the style contexts exist.

Doing this also avoids the need for Gecko_nsFont_InitSystem() to hold a global
lock to avoid concurrently calling into GTK through LookAndFeel::GetColor().

MozReview-Commit-ID: DSOwEUeYmtV
2017-09-04 18:29:04 +12:00
Karl Tomlinson
e7d47b77ad bug 1384701 get system font name and size from widget style context instead of GtkSettings r=manishearth
gtk_widget_get_settings() returns the same settings for all widgets [1] but
GTK actually uses specific fonts for each widget [2].

[1] https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=3.22.19#n11637
[2] https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=3.22.19#n10334

Changing to GtkStyleContext* will also make this easier to use from code where
the GtkStyleContext exists but not the GtkWidget, such as EnsureInit() in a
future patch.

MozReview-Commit-ID: 3NuTL5wRzm5
2017-09-04 21:33:21 +12:00
Karl Tomlinson
1e53f5773b bug 1384701 remove MOZ_WIDGET_GTK == 2 code from nsLookAndFeel r=manishearth
This old code no longer builds and is superseded by the GTK3 port.
See also bug 1278282.

MozReview-Commit-ID: 9KyrPuNAluv
2017-09-04 17:36:17 +12:00
Martin Stransky
2278e26885 Bug 1314928 - get link text color by GTK_STATE_FLAG_LINK on Gtk3 >= 3.12, r=karlt
MozReview-Commit-ID: BPR2AgoUx5H
2017-08-25 10:30:28 +02:00
Sebastian Hengst
2d44a20a04 Backed out changeset 1f349caf1814 (bug 1314928) for bustage at widget/gtk/nsLookAndFeel.cpp:47: invalid conversion from 'int' to 'GtkStateFlags'. r=backout on a CLOSED TREE 2017-08-25 10:51:20 +02:00
Martin Stransky
22d0d52a6c Bug 1314928 - get link text color by GTK_STATE_FLAG_LINK on Gtk3 >= 3.12, r=karlt
MozReview-Commit-ID: BPR2AgoUx5H
2017-08-25 10:30:28 +02:00
Manish Goregaokar
91f4d493c1 Bug 1386915 - Add nsLookAndFeel::NativeInit() virtual call for initializing native-side state; r=jfkthame
MozReview-Commit-ID: 8XKSC1AOI0N
2017-08-06 15:41:08 -07:00
Manish Goregaokar
4e04e1a156 Bug 1386915 - Assert when nsLookAndFeel calls GTK off main thread; r=bholley
MozReview-Commit-ID: 9H9dE02bZel
2017-08-06 15:41:05 -07:00
Nicholas Nethercote
09493fcbcf Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj. 2017-07-31 14:28:48 +10:00
Samael Wang
093c09ab69 Bug 1350643 - Part 1: Rename gfxPlatformGtk::GetDPI/GetDPIScale to GetFontScaleDPI/GetFontScaleFactor to better distinguish from nsIWidget::GetDPI. r=karlt
MozReview-Commit-ID: 4fxMG1FBlM8
2017-06-14 16:54:21 +08:00
Martin Stransky
a1e8b3742b Bug 1353147 - Allow Gtk+ theme override, r=karlt
Allow to override Gtk+ theme for content process when e10s is enabled.

MozReview-Commit-ID: 1Kd2jLpBavA
2017-04-04 22:30:12 +02:00
Martin Stransky
e90e261991 Bug 1158076 - postpone nsLookAndFeel module initialization, r=karlt
MozReview-Commit-ID: JY83xiXT1xf
2017-03-30 15:03:50 +02:00
Martin Stransky
526504cd3c Bug 1158076 - add prefs to enable GTK dark themes in each process, r=karlt
Add two new prefs (widget.chrome.allow-gtk-dark-theme and widget.content.allow-gtk-dark-theme) to enable dark
themes in chrome and content when e10s is enabled.

When e10s is disabled then widget.chrome.allow-gtk-dark-theme controls both chrome and web content settings.

That may be a bit confusing but it's going to be here for two releases only (Firefox 57 is going to have e10s enabled by default) and actually matches recent state when only one ENV pref is used for both chrome and web content.

The existing MOZ_ALLOW_GTK_DARK_THEME environment variable is still considered, but, now is like widget.chrome.allow-gtk-dark-theme, no longer affecting separate content processes.

MozReview-Commit-ID: CCwriA66CNj
2017-03-31 10:40:07 +02:00
Karl Tomlinson
19a2b54f9a bug 1343802 update notebook_has_tab_gap and scrollbar metrics after theme changes r=jhorak+328198
MozReview-Commit-ID: IRPXNwLe5Ey
2017-03-27 20:32:38 +02:00
Karl Tomlinson
f6a03a5d0f bug 1343802 remove moz_gtk_get_scrollbar_widget() r=jhorak+328198
This was used with GTK2, but is now unnecessary as discussed in bug 1278282.

moz_gtk_init() is now called from only one place and so will be called only
once.

MozReview-Commit-ID: 2KwJop6qsV9
2017-03-27 20:32:29 +02:00
Sebastian Hengst
61c3d88381 Backed out changeset af279778b154 (bug 1343802) 2017-03-27 18:00:14 +02:00