Changeset 37521 in webkit
- Timestamp:
- Oct 11, 2008 11:50:21 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r37519 r37521 1 2008-10-11 Alp Toker <alp@nuanti.com> 2 3 Reviewed by Darin Adler. 4 5 https://bugs.webkit.org/show_bug.cgi?id=20592 6 The focus ring is not shown while navigating on some pages 7 8 Fix drawFocusRing() so it doesn't depend on the current graphics 9 state, thus matching other platforms which already work this way. 10 11 This patch provides two code paths: one using straight Cairo and 12 one specialised for the GTK+ port with a more conventional appearance. 13 14 Also change focusRingColor() to return a null color, allowing the 15 focus ring to pick up the style's current color if it isn't overridden 16 with CSS. 17 18 * platform/graphics/cairo/GraphicsContextCairo.cpp: 19 (WebCore::GraphicsContext::drawFocusRing): 20 * platform/gtk/TemporaryLinkStubs.cpp: 21 (WebCore::focusRingColor): 22 1 23 2008-10-11 Dan Bernstein <mitz@apple.com> 2 24 -
trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r37456 r37521 3 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 4 * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> 5 * Copyright (C) 2008 Nuanti Ltd. 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 530 531 return; 531 532 532 int radius = (focusRingWidth() - 1) / 2;533 int offset = radius + focusRingOffset();534 535 533 const Vector<IntRect>& rects = focusRingRects(); 536 534 unsigned rectCount = rects.size(); 537 IntRect finalFocusRect; 535 536 cairo_t* cr = m_data->cr; 537 cairo_save(cr); 538 cairo_push_group(cr); 539 cairo_new_path(cr); 540 541 #if PLATFORM(GTK) 542 GdkRegion* reg = gdk_region_new(); 538 543 for (unsigned i = 0; i < rectCount; i++) { 539 IntRect focusRect = rects[i]; 540 focusRect.inflate(offset); 541 finalFocusRect.unite(focusRect); 542 } 543 544 cairo_t* cr = m_data->cr; 545 cairo_save(cr); 546 // FIXME: These rects should be rounded 547 cairo_rectangle(cr, finalFocusRect.x(), finalFocusRect.y(), finalFocusRect.width(), finalFocusRect.height()); 544 GdkRectangle rect = rects[i]; 545 gdk_region_union_with_rect(reg, &rect); 546 } 547 gdk_cairo_region(cr, reg); 548 gdk_region_destroy(reg); 549 550 setColor(cr, color); 551 cairo_set_line_width(cr, 2.0f); 552 setPlatformStrokeStyle(DottedStroke); 553 #else 554 int radius = (focusRingWidth() - 1) / 2; 555 for (unsigned i = 0; i < rectCount; i++) 556 addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); 548 557 549 558 // Force the alpha to 50%. This matches what the Mac does with outline rings. 550 559 Color ringColor(color.red(), color.green(), color.blue(), 127); 551 560 setColor(cr, ringColor); 552 cairo_stroke(cr); 561 cairo_set_line_width(cr, focusRingWidth()); 562 setPlatformStrokeStyle(SolidStroke); 563 #endif 564 565 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 566 cairo_stroke_preserve(cr); 567 568 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); 569 cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING); 570 cairo_fill(cr); 571 572 cairo_pop_group_to_source(cr); 573 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 574 cairo_paint(cr); 553 575 cairo_restore(cr); 554 576 } -
trunk/WebCore/platform/gtk/TemporaryLinkStubs.cpp
r37301 r37521 59 59 void PluginView::invalidateRegion(NPRegion) { notImplemented(); } 60 60 61 Color WebCore::focusRingColor() { return 0xFF0000FF; }61 Color WebCore::focusRingColor() { return Color(); } 62 62 void WebCore::setFocusRingColorChangeFunction(void (*)()) { } 63 63
Note: See TracChangeset
for help on using the changeset viewer.