WebKit Bugzilla
Attachment 340489 Details for
Bug 126907
: [GTK] Hardcoded text color in input fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Set color in textfield
color_patch (text/plain), 4.69 KB, created by
Carlos Bentzen
on 2018-05-16 07:06:16 PDT
(
hide
)
Description:
Set color in textfield
Filename:
MIME Type:
Creator:
Carlos Bentzen
Created:
2018-05-16 07:06:16 PDT
Size:
4.69 KB
patch
obsolete
>diff --git a/Source/WebCore/rendering/RenderThemeGtk.cpp b/Source/WebCore/rendering/RenderThemeGtk.cpp >index 96584aa56a8..16424df2c87 100644 >--- a/Source/WebCore/rendering/RenderThemeGtk.cpp >+++ b/Source/WebCore/rendering/RenderThemeGtk.cpp >@@ -924,6 +924,49 @@ bool RenderThemeGtk::paintMenuListButtonDecorations(const RenderBox& object, con > return paintMenuList(object, info, rect); > } > >+enum StyleColorType { StyleColorBackground, StyleColorForeground }; >+ >+#if GTK_CHECK_VERSION(3, 20, 0) >+static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType) >+{ >+ RenderThemeGadget* gadget = nullptr; >+ switch (themePart) { >+ default: >+ ASSERT_NOT_REACHED(); >+ FALLTHROUGH; >+ case Entry: >+ gadget = &static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Entry)).entry(); >+ break; >+ case EntrySelection: >+ gadget = static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SelectedEntry)).selection(); >+ break; >+ case ListBox: >+ gadget = &static_cast<RenderThemeListView&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ListView)).treeview(); >+ break; >+ case Button: >+ gadget = &static_cast<RenderThemeButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Button)).button(); >+ break; >+ } >+ >+ ASSERT(gadget); >+ gadget->setState(state); >+ return colorType == StyleColorBackground ? gadget->backgroundColor() : gadget->color(); >+} >+#else >+static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType) >+{ >+ GRefPtr<GtkStyleContext> context = createStyleContext(themePart); >+ gtk_style_context_set_state(context.get(), state); >+ >+ GdkRGBA gdkRGBAColor; >+ if (colorType == StyleColorBackground) >+ gtk_style_context_get_background_color(context.get(), state, &gdkRGBAColor); >+ else >+ gtk_style_context_get_color(context.get(), state, &gdkRGBAColor); >+ return gdkRGBAColor; >+} >+#endif // GTK_CHECK_VERSION(3, 20, 0) >+ > #if GTK_CHECK_VERSION(3, 20, 0) > > static IntSize spinButtonSize() >@@ -942,9 +985,11 @@ static IntSize spinButtonSize() > return IntSize(upPreferredSize.width() + downPreferredSize.width(), std::max(upPreferredSize.height(), downPreferredSize.height())); > } > >- > void RenderThemeGtk::adjustTextFieldStyle(StyleResolver&, RenderStyle& style, const Element* element) const > { >+ // If the text color isn't set then it may render dark text on dark background. >+ style.setColor(styleColor(Entry, GTK_STATE_FLAG_NORMAL, StyleColorForeground)); >+ > if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element))) > return; > >@@ -1673,49 +1718,6 @@ Seconds RenderThemeGtk::caretBlinkInterval() const > return 500_us * time; > } > >-enum StyleColorType { StyleColorBackground, StyleColorForeground }; >- >-#if GTK_CHECK_VERSION(3, 20, 0) >-static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType) >-{ >- RenderThemeGadget* gadget = nullptr; >- switch (themePart) { >- default: >- ASSERT_NOT_REACHED(); >- FALLTHROUGH; >- case Entry: >- gadget = &static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Entry)).entry(); >- break; >- case EntrySelection: >- gadget = static_cast<RenderThemeEntry&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SelectedEntry)).selection(); >- break; >- case ListBox: >- gadget = &static_cast<RenderThemeListView&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::ListView)).treeview(); >- break; >- case Button: >- gadget = &static_cast<RenderThemeButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::Button)).button(); >- break; >- } >- >- ASSERT(gadget); >- gadget->setState(state); >- return colorType == StyleColorBackground ? gadget->backgroundColor() : gadget->color(); >-} >-#else >-static Color styleColor(RenderThemePart themePart, GtkStateFlags state, StyleColorType colorType) >-{ >- GRefPtr<GtkStyleContext> context = createStyleContext(themePart); >- gtk_style_context_set_state(context.get(), state); >- >- GdkRGBA gdkRGBAColor; >- if (colorType == StyleColorBackground) >- gtk_style_context_get_background_color(context.get(), state, &gdkRGBAColor); >- else >- gtk_style_context_get_color(context.get(), state, &gdkRGBAColor); >- return gdkRGBAColor; >-} >-#endif // GTK_CHECK_VERSION(3, 20, 0) >- > Color RenderThemeGtk::platformActiveSelectionBackgroundColor() const > { > return styleColor(EntrySelection, static_cast<GtkStateFlags>(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED), StyleColorBackground);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 126907
:
302499
|
340464
|
340489
|
340924
|
341088
|
341463
|
341468
|
341565
|
343018
|
343026
|
343033
|
343657
|
343659
|
343695
|
368142
|
368149
|
368150