Changeset 74132 in webkit
- Timestamp:
- Dec 15, 2010 11:39:10 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r74129 r74132 1 2010-12-15 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Gustavo Noronha Silva. 4 5 [GTK] Move button rendering from gtk{2,3}drawing.cpp to RenderThemeGtk 6 https://bugs.webkit.org/show_bug.cgi?id=48486 7 8 Implement button rendering in RenderThemeGtk. The implementation 9 from gtk{2,3}drawing.cpp will be removed once menu list button rendering 10 is implemented in RenderThemeGtk as well. 11 12 No new tests, as this should not change functionality. 13 14 * platform/gtk/RenderThemeGtk.cpp: 15 (WebCore::RenderThemeGtk::paintButton): Add an implementation of button 16 rendering that uses WidgetRenderingContext. 17 1 18 2010-10-18 Martin Robinson <mrobinson@igalia.com> 2 19 -
trunk/WebCore/platform/gtk/RenderThemeGtk.cpp
r74129 r74132 351 351 } 352 352 353 bool RenderThemeGtk::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) 354 { 355 return paintRenderObject(MOZ_GTK_BUTTON, o, i.context, rect, GTK_RELIEF_NORMAL); 353 bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, const IntRect& rect) 354 { 355 if (info.context->paintingDisabled()) 356 return false; 357 358 GtkWidget* widget = gtkButton(); 359 IntRect buttonRect(IntPoint(), rect.size()); 360 IntRect focusRect(buttonRect); 361 362 GtkStateType state = getGtkStateType(object); 363 gtk_widget_set_state(widget, state); 364 gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction())); 365 366 if (isFocused(object)) { 367 if (isEnabled(object)) { 368 #if !GTK_CHECK_VERSION(2, 22, 0) 369 GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); 370 #endif 371 g_object_set(widget, "has-focus", TRUE, NULL); 372 } 373 374 gboolean interiorFocus = 0, focusWidth = 0, focusPadding = 0; 375 gtk_widget_style_get(widget, 376 "interior-focus", &interiorFocus, 377 "focus-line-width", &focusWidth, 378 "focus-padding", &focusPadding, NULL); 379 // If we are using exterior focus, we shrink the button rect down before 380 // drawing. If we are using interior focus we shrink the focus rect. This 381 // approach originates from the Mozilla theme drawing code (gtk2drawing.c). 382 if (interiorFocus) { 383 GtkStyle* style = gtk_widget_get_style(widget); 384 focusRect.inflateX(-style->xthickness - focusPadding); 385 focusRect.inflateY(-style->ythickness - focusPadding); 386 } else { 387 buttonRect.inflateX(-focusWidth - focusPadding); 388 buttonRect.inflateY(-focusPadding - focusPadding); 389 } 390 } 391 392 WidgetRenderingContext widgetContext(info.context, rect); 393 GtkShadowType shadowType = state == GTK_STATE_ACTIVE ? GTK_SHADOW_IN : GTK_SHADOW_OUT; 394 widgetContext.gtkPaintBox(buttonRect, widget, state, shadowType, "button"); 395 if (isFocused(object)) 396 widgetContext.gtkPaintFocus(focusRect, widget, state, "button"); 397 398 #if !GTK_CHECK_VERSION(2, 22, 0) 399 GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); 400 #endif 401 g_object_set(widget, "has-focus", FALSE, NULL); 402 return false; 356 403 } 357 404
Note: See TracChangeset
for help on using the changeset viewer.