Changeset 199727 in webkit
- Timestamp:
- Apr 19, 2016 8:10:36 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199722 r199727 1 2016-04-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [Cairo] GraphicsContext::drawFocusRing methods are not consistent to each other 4 https://bugs.webkit.org/show_bug.cgi?id=156742 5 6 Reviewed by Martin Robinson. 7 8 We are rendering the focus ring differently depending on whether a path is used or a vector of rectangles. This 9 is causing that some reftests fail because they assume we always render the focus ring the same way. For example 10 fast/images/image-map-outline-in-positioned-container.html, when rendering the test 11 GraphicsContext::drawFocusRing is called with a path, and when rendering the reference it's called with a vector 12 of rectangles, producing different results. 13 14 * platform/graphics/cairo/GraphicsContextCairo.cpp: 15 (WebCore::GraphicsContext::drawFocusRing): When receiving a vector of rectangles, build a Path from the given 16 rectangles and call drawFocusRing() with the built path to ensure consistency. 17 1 18 2016-04-19 Antti Koivisto <antti@apple.com> 2 19 -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r198655 r199727 600 600 cairo_t* cr = platformContext()->cr(); 601 601 cairo_save(cr); 602 cairo_push_group(cr); 602 603 appendWebCorePathToCairoContext(cr, path); 603 604 setSourceRGBAFromColor(cr, ringColor); 604 605 cairo_set_line_width(cr, width); 605 606 setPlatformStrokeStyle(focusRingStrokeStyle()); 606 cairo_stroke(cr);607 cairo_restore(cr);608 }609 610 void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float /* offset */, const Color& color)611 {612 if (paintingDisabled())613 return;614 615 cairo_t* cr = platformContext()->cr();616 cairo_save(cr);617 cairo_push_group(cr);618 cairo_new_path(cr);619 620 #if PLATFORM(GTK)621 for (const auto& rect : rects)622 cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());623 #else624 unsigned rectCount = rects.size();625 int radius = (width - 1) / 2;626 Path path;627 for (unsigned i = 0; i < rectCount; ++i) {628 if (i > 0)629 path.clear();630 path.addRoundedRect(rects[i], FloatSize(radius, radius));631 appendWebCorePathToCairoContext(cr, path);632 }633 #endif634 Color ringColor = color;635 adjustFocusRingColor(ringColor);636 adjustFocusRingLineWidth(width);637 setSourceRGBAFromColor(cr, ringColor);638 cairo_set_line_width(cr, width);639 setPlatformStrokeStyle(focusRingStrokeStyle());640 641 607 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 642 608 cairo_stroke_preserve(cr); … … 650 616 cairo_paint(cr); 651 617 cairo_restore(cr); 618 } 619 620 void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float /* offset */, const Color& color) 621 { 622 if (paintingDisabled()) 623 return; 624 625 Path path; 626 #if PLATFORM(GTK) 627 for (const auto& rect : rects) 628 path.addRect(rect); 629 #else 630 unsigned rectCount = rects.size(); 631 int radius = (width - 1) / 2; 632 Path subPath; 633 for (unsigned i = 0; i < rectCount; ++i) { 634 if (i > 0) 635 subPath.clear(); 636 subPath.addRoundedRect(rects[i], FloatSize(radius, radius)); 637 path.addPath(subPath, AffineTransform()); 638 } 639 #endif 640 drawFocusRing(path, width, 0, color); 652 641 } 653 642
Note: See TracChangeset
for help on using the changeset viewer.