mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 867047 - remove caret theming support and the Gtk2 implementation r=roc
This commit is contained in:
parent
371b1cc4ef
commit
1fa2792b02
@ -32,7 +32,6 @@
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Selection.h"
|
||||
@ -527,26 +526,6 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
|
||||
}
|
||||
nscolor foregroundColor = aForFrame->GetCaretColorAt(contentOffset);
|
||||
|
||||
// Only draw the native caret if the foreground color matches that of
|
||||
// -moz-fieldtext (the color of the text in a textbox). If it doesn't match
|
||||
// we are likely in contenteditable or a custom widget and we risk being hard to see
|
||||
// against the background. In that case, fall back to the CSS color.
|
||||
nsPresContext* presContext = aForFrame->PresContext();
|
||||
|
||||
if (GetHookRect().IsEmpty() && presContext) {
|
||||
nsITheme *theme = presContext->GetTheme();
|
||||
if (theme && theme->ThemeSupportsWidget(presContext, aForFrame, NS_THEME_TEXTFIELD_CARET)) {
|
||||
nscolor fieldText;
|
||||
nsresult rv = LookAndFeel::GetColor(LookAndFeel::eColorID__moz_fieldtext,
|
||||
&fieldText);
|
||||
if (NS_SUCCEEDED(rv) && fieldText == foregroundColor) {
|
||||
theme->DrawWidgetBackground(aCtx, aForFrame, NS_THEME_TEXTFIELD_CARET,
|
||||
drawCaretRect, drawCaretRect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aCtx->SetColor(foregroundColor);
|
||||
aCtx->FillRect(drawCaretRect);
|
||||
if (!GetHookRect().IsEmpty())
|
||||
|
@ -1543,23 +1543,6 @@ moz_gtk_vpaned_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_caret_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect, GtkTextDirection direction)
|
||||
{
|
||||
GdkRectangle location = *rect;
|
||||
if (direction == GTK_TEXT_DIR_RTL) {
|
||||
/* gtk_draw_insertion_cursor ignores location.width */
|
||||
location.x = rect->x + rect->width;
|
||||
}
|
||||
|
||||
ensure_entry_widget();
|
||||
gtk_draw_insertion_cursor(gEntryWidget, drawable, cliprect,
|
||||
&location, TRUE, direction, FALSE);
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect, GtkWidgetState* state,
|
||||
@ -3000,7 +2983,6 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
|
||||
case MOZ_GTK_TOOLBAR:
|
||||
case MOZ_GTK_MENUBAR:
|
||||
case MOZ_GTK_TAB_SCROLLARROW:
|
||||
case MOZ_GTK_ENTRY_CARET:
|
||||
*left = *top = *right = *bottom = 0;
|
||||
return MOZ_GTK_SUCCESS;
|
||||
default:
|
||||
@ -3283,9 +3265,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
|
||||
return moz_gtk_entry_paint(drawable, rect, cliprect, state,
|
||||
gEntryWidget, direction);
|
||||
break;
|
||||
case MOZ_GTK_ENTRY_CARET:
|
||||
return moz_gtk_caret_paint(drawable, rect, cliprect, direction);
|
||||
break;
|
||||
case MOZ_GTK_DROPDOWN:
|
||||
return moz_gtk_combo_box_paint(drawable, rect, cliprect, state,
|
||||
(gboolean) flags, direction);
|
||||
|
@ -1410,23 +1410,6 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRectangle* rect,
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_caret_paint(cairo_t *cr, GdkRectangle* rect,
|
||||
GtkTextDirection direction)
|
||||
{
|
||||
GdkRectangle location = *rect;
|
||||
|
||||
if (direction == GTK_TEXT_DIR_RTL) {
|
||||
/* gtk_draw_insertion_cursor ignores location.width */
|
||||
location.x = rect->x + rect->width;
|
||||
}
|
||||
|
||||
ensure_entry_widget();
|
||||
gtk_draw_insertion_cursor(gEntryWidget, cr,
|
||||
&location, TRUE, direction, FALSE);
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
|
||||
GtkWidgetState* state,
|
||||
@ -2819,7 +2802,6 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
|
||||
case MOZ_GTK_TOOLBAR:
|
||||
case MOZ_GTK_MENUBAR:
|
||||
case MOZ_GTK_TAB_SCROLLARROW:
|
||||
case MOZ_GTK_ENTRY_CARET:
|
||||
*left = *top = *right = *bottom = 0;
|
||||
return MOZ_GTK_SUCCESS;
|
||||
default:
|
||||
@ -3115,9 +3097,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr,
|
||||
return moz_gtk_entry_paint(cr, rect, state,
|
||||
gEntryWidget, direction);
|
||||
break;
|
||||
case MOZ_GTK_ENTRY_CARET:
|
||||
return moz_gtk_caret_paint(cr, rect, direction);
|
||||
break;
|
||||
case MOZ_GTK_DROPDOWN:
|
||||
return moz_gtk_combo_box_paint(cr, rect, state,
|
||||
(gboolean) flags, direction);
|
||||
|
@ -115,8 +115,6 @@ typedef enum {
|
||||
MOZ_GTK_GRIPPER,
|
||||
/* Paints a GtkEntry. */
|
||||
MOZ_GTK_ENTRY,
|
||||
/* Paints the native caret (or in GTK-speak: insertion cursor) */
|
||||
MOZ_GTK_ENTRY_CARET,
|
||||
/* Paints a GtkOptionMenu. */
|
||||
MOZ_GTK_DROPDOWN,
|
||||
/* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */
|
||||
|
@ -445,9 +445,6 @@ nsNativeThemeGTK::GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
aGtkWidgetType = MOZ_GTK_ENTRY;
|
||||
break;
|
||||
case NS_THEME_TEXTFIELD_CARET:
|
||||
aGtkWidgetType = MOZ_GTK_ENTRY_CARET;
|
||||
break;
|
||||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_TREEVIEW:
|
||||
aGtkWidgetType = MOZ_GTK_TREEVIEW;
|
||||
@ -1395,7 +1392,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_TEXTFIELD_CARET:
|
||||
case NS_THEME_DROPDOWN_TEXTFIELD:
|
||||
case NS_THEME_RANGE:
|
||||
case NS_THEME_RANGE_THUMB:
|
||||
|
Loading…
x
Reference in New Issue
Block a user