Bug 414748 - "Improve focus ring painting of native themed location bar" [p=twanno@lycos.nl (Teune van Steeg) r+sr=roc r=Enn a1.9=schrep]

This commit is contained in:
reed@reedloden.com 2008-02-10 00:30:04 -08:00
Родитель 2937479937
Коммит 7e50f03e0d
5 изменённых файлов: 41 добавлений и 25 удалений

Просмотреть файл

@ -54,7 +54,7 @@
</resources>
<content sizetopopup="pref">
<xul:hbox class="autocomplete-textbox-container" flex="1">
<xul:hbox class="autocomplete-textbox-container" flex="1" xbl:inherits="focused">
<children includes="image|deck|stack|box">
<xul:image class="autocomplete-icon" allowevents="true"/>
</children>
@ -70,7 +70,7 @@
<xul:dropmarker anonid="historydropmarker" class="autocomplete-history-dropmarker"
allowevents="true"
xbl:inherits="open,enablehistory"/>
xbl:inherits="open,enablehistory,parentfocused=focused"/>
<xul:popupset anonid="popupset" class="autocomplete-result-popupset"/>
</content>
@ -513,21 +513,11 @@
<handler event="compositionend" phase="capturing"
action="if (this.mController.input == this) this.mController.handleEndComposition();"/>
<handler event="focus" phase="capturing">
<![CDATA[
this.attachController();
this.inputField.parentNode.parentNode.setAttribute('focused', 'true');
]]>
</handler>
<handler event="focus" phase="capturing"
action="this.attachController();"/>
<handler event="blur" phase="capturing">
<![CDATA[
if (!this._dontBlur) {
this.detachController();
this.inputField.parentNode.parentNode.removeAttribute('focused');
}
]]>
</handler>
<handler event="blur" phase="capturing"
action="if (!this._dontBlur) this.detachController();"/>
<handler event="contextmenu" phase="capturing"
action="this.closePopup();"/>

Просмотреть файл

@ -410,7 +410,7 @@
xbl:inherits="value=label,value,disabled,tabindex,readonly"/>
</xul:hbox>
<xul:dropmarker class="menulist-dropmarker" type="menu"
xbl:inherits="open,disabled"/>
xbl:inherits="open,disabled,parentfocused=focused"/>
<children includes="menupopup"/>
</content>

Просмотреть файл

@ -1200,7 +1200,9 @@ moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkWidgetState* state,
GtkWidget* widget, GtkTextDirection direction)
{
gint x, y, width = rect->width, height = rect->height;
GtkStateType bg_state = state->disabled ?
GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
gint x, y, bg_width, width = rect->width, height = rect->height;
GtkStyle* style;
gboolean interior_focus;
gint focus_width;
@ -1212,14 +1214,21 @@ moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect,
/* paint the background first */
x = XTHICKNESS(style);
y = YTHICKNESS(style);
bg_width = rect->width - 2*x;
if (GTK_IS_COMBO_BOX_ENTRY(widget->parent)) {
bg_width += x;
if (direction == GTK_TEXT_DIR_RTL)
x = 0;
}
/* This gets us a lovely greyish disabledish look */
gtk_widget_set_sensitive(widget, !state->disabled);
TSOffsetStyleGCs(style, rect->x + x, rect->y + y);
gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE,
gtk_paint_flat_box(style, drawable, bg_state, GTK_SHADOW_NONE,
cliprect, widget, "entry_bg", rect->x + x,
rect->y + y, rect->width - 2*x, rect->height - 2*y);
rect->y + y, bg_width, rect->height - 2*y);
gtk_widget_style_get(widget,
"interior-focus", &interior_focus,
@ -1502,9 +1511,9 @@ moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
static gint
moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkWidgetState* state,
GtkTextDirection direction)
gboolean input_focus, GtkTextDirection direction)
{
static gfloat arrow_scaling = 0.7;
const gfloat arrow_scaling = 0.7;
gint real_arrow_padding;
GdkRectangle arrow_rect, real_arrow_rect;
GtkStateType state_type = ConvertGtkState(state);
@ -1512,11 +1521,21 @@ moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
GtkStyle* style;
ensure_arrow_widget();
ensure_dropdown_entry_widget();
gtk_widget_set_direction(gDropdownButtonWidget, direction);
if (input_focus) {
/* Some themes draw a complementary focus ring for the dropdown button
* when the dropdown entry has focus */
GTK_WIDGET_SET_FLAGS(gDropdownEntryWidget, GTK_HAS_FOCUS);
}
moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
gDropdownButtonWidget, direction);
if (input_focus)
GTK_WIDGET_UNSET_FLAGS(gDropdownEntryWidget, GTK_HAS_FOCUS);
/* This mirrors gtkbutton's child positioning */
style = gDropdownButtonWidget->style;
arrow_rect.x = rect->x + 1 + XTHICKNESS(style);
@ -2690,7 +2709,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
break;
case MOZ_GTK_DROPDOWN_ARROW:
return moz_gtk_dropdown_arrow_paint(drawable, rect, cliprect, state,
direction);
flags, direction);
break;
case MOZ_GTK_DROPDOWN_ENTRY:
ensure_dropdown_entry_widget();

Просмотреть файл

@ -352,6 +352,12 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
// we must not highlight buttons with open drop down menus on hover.
aState->inHover = aState->inHover && !menuOpen;
}
// When the input field of the drop down button has focus, some themes
// should draw focus for the drop down button as well.
if (aWidgetType == NS_THEME_DROPDOWN_BUTTON && aWidgetFlags) {
*aWidgetFlags = CheckBooleanAttr(aFrame, nsWidgetAtoms::parentfocused);
}
}
}
}
@ -1174,7 +1180,8 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
aAttribute == nsWidgetAtoms::readonly ||
aAttribute == nsWidgetAtoms::_default ||
aAttribute == nsWidgetAtoms::mozmenuactive ||
aAttribute == nsWidgetAtoms::open)
aAttribute == nsWidgetAtoms::open ||
aAttribute == nsWidgetAtoms::parentfocused)
*aShouldRepaint = PR_TRUE;
}

Просмотреть файл

@ -94,12 +94,12 @@ WIDGET_ATOM(menuFrame, "MenuFrame")
WIDGET_ATOM(minpos, "minpos")
WIDGET_ATOM(mode, "mode")
WIDGET_ATOM(modifiers, "modifiers") // The modifiers attribute
WIDGET_ATOM(mozinputchecked, "_moz-input-checked")
WIDGET_ATOM(mozmenuactive, "_moz-menuactive")
WIDGET_ATOM(name, "name")
WIDGET_ATOM(onAppCommand, "onAppCommand")
WIDGET_ATOM(open, "open") // Whether or not a menu, tree, etc. is open
WIDGET_ATOM(orient, "orient")
WIDGET_ATOM(parentfocused, "parentfocused")
WIDGET_ATOM(radio, "radio")
WIDGET_ATOM(readonly, "readonly")
WIDGET_ATOM(Reload, "Reload")