зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1314928 - get link text color by GTK_STATE_FLAG_LINK on Gtk3 >= 3.12, r=karlt
MozReview-Commit-ID: BPR2AgoUx5H --HG-- extra : rebase_source : c4670cd6b7df84dd00a4d04c3bfc582f917795da
This commit is contained in:
Родитель
51707805bc
Коммит
4cb65b6801
|
@ -43,6 +43,10 @@ using mozilla::LookAndFeel;
|
||||||
((nscolor) NS_RGBA((int)((c).red*255), (int)((c).green*255), \
|
((nscolor) NS_RGBA((int)((c).red*255), (int)((c).green*255), \
|
||||||
(int)((c).blue*255), (int)((c).alpha*255)))
|
(int)((c).blue*255), (int)((c).alpha*255)))
|
||||||
|
|
||||||
|
#if !GTK_CHECK_VERSION(3,12,0)
|
||||||
|
#define GTK_STATE_FLAG_LINK (static_cast<GtkStateFlags>(1 << 9))
|
||||||
|
#endif
|
||||||
|
|
||||||
nsLookAndFeel::nsLookAndFeel()
|
nsLookAndFeel::nsLookAndFeel()
|
||||||
: nsXPLookAndFeel(),
|
: nsXPLookAndFeel(),
|
||||||
#if (MOZ_WIDGET_GTK == 2)
|
#if (MOZ_WIDGET_GTK == 2)
|
||||||
|
@ -1457,14 +1461,26 @@ nsLookAndFeel::EnsureInit()
|
||||||
}
|
}
|
||||||
sMenuSupportsDrag = supports_menubar_drag;
|
sMenuSupportsDrag = supports_menubar_drag;
|
||||||
|
|
||||||
colorValuePtr = nullptr;
|
#if (MOZ_WIDGET_GTK == 3)
|
||||||
gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, nullptr);
|
if (gtk_check_version(3, 12, 0) == nullptr) {
|
||||||
if (colorValuePtr) {
|
// TODO: It returns wrong color for themes which
|
||||||
colorValue = *colorValuePtr; // we can't pass deref pointers to GDK_COLOR_TO_NS_RGB
|
// sets link color for GtkLabel only as we query
|
||||||
sNativeHyperLinkText = GDK_COLOR_TO_NS_RGB(colorValue);
|
// GtkLinkButton style here.
|
||||||
gdk_color_free(colorValuePtr);
|
style = gtk_widget_get_style_context(linkButton);
|
||||||
} else {
|
gtk_style_context_get_color(style, GTK_STATE_FLAG_LINK, &color);
|
||||||
sNativeHyperLinkText = NS_RGB(0x00,0x00,0xEE);
|
sNativeHyperLinkText = GDK_RGBA_TO_NS_RGBA(color);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
colorValuePtr = nullptr;
|
||||||
|
gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, nullptr);
|
||||||
|
if (colorValuePtr) {
|
||||||
|
colorValue = *colorValuePtr; // we can't pass deref pointers to GDK_COLOR_TO_NS_RGB
|
||||||
|
sNativeHyperLinkText = GDK_COLOR_TO_NS_RGB(colorValue);
|
||||||
|
gdk_color_free(colorValuePtr);
|
||||||
|
} else {
|
||||||
|
sNativeHyperLinkText = NS_RGB(0x00,0x00,0xEE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// invisible character styles
|
// invisible character styles
|
||||||
|
|
Загрузка…
Ссылка в новой задаче