Changeset 86070 in webkit
- Timestamp:
- May 9, 2011 11:20:35 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86069 r86070 1 2011-05-09 Robin Dunn <robin@alldunn.com> 2 3 Reviewed by Kevin Ollivier. 4 5 [wx] Make sure other controls adjust the rect to handle transforms, and turn off the 6 adjustment in 2.9.2+ where it is handled internally by wx. 7 8 Also add a couple drawing and focus handling fixes for text fields and menulist controls. 9 10 https://bugs.webkit.org/show_bug.cgi?id=60481 11 12 * platform/wx/RenderThemeWx.cpp: 13 (WebCore::getAdjustedRect): 14 (WebCore::RenderThemeWx::supportsFocus): 15 (WebCore::RenderThemeWx::paintButton): 16 (WebCore::RenderThemeWx::adjustTextFieldStyle): 17 (WebCore::RenderThemeWx::paintTextField): 18 (WebCore::RenderThemeWx::adjustMenuListStyle): 19 (WebCore::RenderThemeWx::paintMenuList): 20 (WebCore::RenderThemeWx::paintMenuListButton): 21 1 22 2011-05-09 Tony Gentilcore <tonyg@chromium.org> 2 23 -
trunk/Source/WebCore/platform/wx/RenderThemeWx.cpp
r77392 r86070 46 46 namespace WebCore { 47 47 48 IntRect getAdjustedRect(wxDC* dc, const IntRect& r) 49 { 50 IntRect rect = r; 51 // On Mac, wxGraphicsContext and wxDC share the same native implementation, 52 // and so transformations are available. 53 // On Win and Linux, however, this is not true and transforms are lost, 54 // so we need to restore them here. 55 #if !wxCHECK_VERSION(2, 9, 2) && USE(WXGC) && !defined(__WXMAC__) 56 LOG_ERROR("Rect is (%d, %d)\n", rect.x(), rect.y()); 57 double xtrans = 0; 58 double ytrans = 0; 59 60 wxGCDC* gcdc = static_cast<wxGCDC*>(dc); 61 wxGraphicsContext* gc = gcdc->GetGraphicsContext(); 62 gc->GetTransform().TransformPoint(&xtrans, &ytrans); 63 rect.setX(r.x() + (int)xtrans); 64 rect.setY(r.y() + (int)ytrans); 65 LOG_ERROR("Transform is (%f, %f), (%d, %d)\n", xtrans, ytrans, rect.x(), rect.y()); 66 #endif 67 68 return rect; 69 } 70 48 71 class RenderThemeWx : public RenderTheme { 49 72 private: … … 250 273 case ButtonPart: 251 274 case TextFieldPart: 275 case MenulistPart: 252 276 return true; 253 277 default: // No for all others... … … 267 291 int flags = 0; 268 292 269 IntRect rect = r; 270 271 // On Mac, wxGraphicsContext and wxDC share the same native implementation, 272 // and so transformations are available. 273 // On Win and Linux, however, this is not true and transforms are lost, 274 // so we need to restore them here. 275 #if USE(WXGC) && !defined(__WXMAC__) 276 double xtrans = 0; 277 double ytrans = 0; 278 279 wxGCDC* gcdc = static_cast<wxGCDC*>(dc); 280 wxGraphicsContext* gc = gcdc->GetGraphicsContext(); 281 gc->GetTransform().TransformPoint(&xtrans, &ytrans); 282 rect.setX(r.x() + (int)xtrans); 283 rect.setY(r.y() + (int)ytrans); 284 #endif 293 IntRect rect = getAdjustedRect(dc, r); 285 294 286 295 if (!isEnabled(o)) … … 317 326 void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 318 327 { 319 328 320 329 } 321 330 … … 324 333 wxWindow* window = nativeWindowForRenderObject(o); 325 334 wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 335 int flags = 0; 336 337 IntRect rect = getAdjustedRect(dc, r); 338 339 ControlPart part = o->style()->appearance(); 340 if (supportsFocus(part) && isFocused(o)) 341 flags |= wxCONTROL_FOCUSED; 342 326 343 #if wxCHECK_VERSION(2,9,0) 327 wxRendererNative::Get().DrawTextCtrl(window, *dc, r , 0);344 wxRendererNative::Get().DrawTextCtrl(window, *dc, rect, flags); 328 345 #else 329 346 wxRenderer_DrawTextCtrl(window, *dc, r, 0); … … 340 357 void RenderThemeWx::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const 341 358 { 359 style->resetBorder(); 360 361 // Height is locked to auto. 362 style->setHeight(Length(Auto)); 363 364 style->setPaddingTop(Length(2, Fixed)); 365 style->setPaddingBottom(Length(2, Fixed)); 342 366 } 343 367 … … 346 370 wxWindow* window = nativeWindowForRenderObject(o); 347 371 wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 348 372 373 IntRect rect = getAdjustedRect(dc, r); 374 349 375 int flags = 0; 350 376 if (!isEnabled(o)) … … 358 384 359 385 #if wxCHECK_VERSION(2,9,0) 360 wxRendererNative::Get().DrawChoice(window, *dc, r , flags);361 #else 362 wxRenderer_DrawChoice(window, *dc, r , flags);386 wxRendererNative::Get().DrawChoice(window, *dc, rect, flags); 387 #else 388 wxRenderer_DrawChoice(window, *dc, rect, flags); 363 389 #endif 364 390 … … 375 401 wxWindow* window = nativeWindowForRenderObject(o); 376 402 wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); 377 403 404 IntRect rect = getAdjustedRect(dc, r); 405 378 406 int flags = 0; 379 407 if (!isEnabled(o)) … … 386 414 flags |= wxCONTROL_PRESSED; 387 415 388 wxRendererNative::Get().DrawComboBoxDropButton(window, *dc, r , flags);416 wxRendererNative::Get().DrawComboBoxDropButton(window, *dc, rect, flags); 389 417 390 418 return false;
Note: See TracChangeset
for help on using the changeset viewer.