Changeset 199247 in webkit
- Timestamp:
- Apr 8, 2016 2:01:50 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r199240 r199247 1 2016-04-08 Zalan Bujtas <zalan@apple.com> 2 3 Focus ring drawn at incorrect location on image map with CSS transform. 4 https://bugs.webkit.org/show_bug.cgi?id=143527 5 <rdar://problem/21908735> 6 7 Reviewed by Simon Fraser. 8 9 Implement pathForFocusRing for HTMLAreaElement. 10 11 * fast/images/image-map-outline-in-positioned-container-expected.html: Added. 12 * fast/images/image-map-outline-in-positioned-container.html: Added. 13 * fast/images/image-map-outline-with-paint-root-offset-expected.html: Added. 14 * fast/images/image-map-outline-with-paint-root-offset.html: Added. 15 * fast/images/image-map-outline-with-scale-transform-expected.html: Added. 16 * fast/images/image-map-outline-with-scale-transform.html: Added. 17 1 18 2016-04-08 Filip Pizlo <fpizlo@apple.com> 2 19 -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r199183 r199247 3023 3023 fast/forms/listbox-padding-clip.html [ ImageOnlyFailure ] 3024 3024 fast/forms/listbox-padding-clip-overlay.html [ ImageOnlyFailure ] 3025 3026 # No focusring on iOS. 3027 fast/images/image-map-outline-in-positioned-container.html [ Pass ImageOnlyFailure ] 3028 fast/images/image-map-outline-with-paint-root-offset.html [ Pass ImageOnlyFailure ] 3029 fast/images/image-map-outline-with-scale-transform.html [ Pass ImageOnlyFailure ] 3030 -
trunk/Source/WebCore/ChangeLog
r199245 r199247 1 2016-04-08 Zalan Bujtas <zalan@apple.com> 2 3 Focus ring drawn at incorrect location on image map with CSS transform. 4 https://bugs.webkit.org/show_bug.cgi?id=143527 5 <rdar://problem/21908735> 6 7 Reviewed by Simon Fraser. 8 9 Implement pathForFocusRing for HTMLAreaElement. It follows the logic of RenderObject::addFocusRingRects(). 10 11 Tests: fast/images/image-map-outline-in-positioned-container.html 12 fast/images/image-map-outline-with-paint-root-offset.html 13 fast/images/image-map-outline-with-scale-transform.html 14 fast/images/image-map-outline.html 15 16 * html/HTMLAreaElement.cpp: 17 (WebCore::HTMLAreaElement::pathForFocusRing): 18 * html/HTMLAreaElement.h: 19 * rendering/RenderElement.cpp: 20 (WebCore::RenderElement::paintFocusRing): Move addFocusRingRects() out of focus ring painting. 21 (WebCore::RenderElement::paintOutline): 22 * rendering/RenderElement.h: 23 * rendering/RenderImage.cpp: 24 (WebCore::RenderImage::paint): 25 (WebCore::RenderImage::paintAreaElementFocusRing): 26 * rendering/RenderImage.h: 27 * rendering/RenderInline.cpp: 28 (WebCore::RenderInline::paintOutline): 29 1 30 2016-04-08 Brent Fulgham <bfulgham@apple.com> 2 31 -
trunk/Source/WebCore/html/HTMLAreaElement.cpp
r195452 r199247 117 117 } 118 118 119 Path HTMLAreaElement::computePathForFocusRing(const LayoutSize& elementSize) const 120 { 121 return getRegion(m_shape == Default ? elementSize : m_lastSize); 122 } 123 119 124 // FIXME: Use RenderElement* instead of RenderObject* once we upstream iOS's DOMUIKitExtensions.{h, mm}. 120 125 LayoutRect HTMLAreaElement::computeRect(RenderObject* obj) const -
trunk/Source/WebCore/html/HTMLAreaElement.h
r197563 r199247 45 45 LayoutRect computeRect(RenderObject*) const; 46 46 Path computePath(RenderObject*) const; 47 Path computePathForFocusRing(const LayoutSize& elementSize) const; 47 48 48 49 // The parent map's image. -
trunk/Source/WebCore/rendering/RenderElement.cpp
r199154 r199247 2041 2041 } 2042 2042 2043 void RenderElement::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const RenderStyle& style)2043 void RenderElement::paintFocusRing(PaintInfo& paintInfo, const RenderStyle& style, const Vector<LayoutRect>& focusRingRects) 2044 2044 { 2045 2045 ASSERT(style.outlineStyleIsAuto()); 2046 2047 Vector<LayoutRect> focusRingRects;2048 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);2049 2046 float outlineOffset = style.outlineOffset(); 2050 2047 Vector<FloatRect> pixelSnappedFocusRingRects; … … 2087 2084 2088 2085 // Only paint the focus ring by hand if the theme isn't able to draw it. 2089 if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse)) 2090 paintFocusRing(paintInfo, paintRect.location(), styleToUse); 2086 if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse)) { 2087 Vector<LayoutRect> focusRingRects; 2088 addFocusRingRects(focusRingRects, paintRect.location(), paintInfo.paintContainer); 2089 paintFocusRing(paintInfo, styleToUse, focusRingRects); 2090 } 2091 2091 2092 2092 if (hasOutlineAnnotation() && !styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse)) -
trunk/Source/WebCore/rendering/RenderElement.h
r198943 r199247 268 268 bool renderBlockFlowHasMarkupTruncation() const { return m_renderBlockFlowHasMarkupTruncation; } 269 269 270 void paintFocusRing(PaintInfo&, const LayoutPoint&, const RenderStyle&);270 void paintFocusRing(PaintInfo&, const RenderStyle&, const Vector<LayoutRect>& focusRingRects); 271 271 void paintOutline(PaintInfo&, const LayoutRect&); 272 272 void updateOutlineAutoAncestor(bool hasOutlineAuto) const; -
trunk/Source/WebCore/rendering/RenderImage.cpp
r198074 r199247 31 31 #include "BitmapImage.h" 32 32 #include "CachedImage.h" 33 #include "FocusController.h" 33 34 #include "FontCache.h" 34 35 #include "FontCascade.h" … … 485 486 486 487 if (paintInfo.phase == PaintPhaseOutline) 487 paintAreaElementFocusRing(paintInfo );488 paintAreaElementFocusRing(paintInfo, paintOffset); 488 489 } 489 490 490 void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo )491 void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 491 492 { 492 493 #if PLATFORM(IOS) 493 494 UNUSED_PARAM(paintInfo); 495 UNUSED_PARAM(paintOffset); 494 496 #else 495 497 if (document().printing() || !frame().selection().isFocusedAndActive()) … … 499 501 return; 500 502 503 if (!document().page()) 504 return; 505 501 506 Element* focusedElement = document().focusedElement(); 502 507 if (!is<HTMLAreaElement>(focusedElement)) … … 507 512 return; 508 513 514 auto* areaElementStyle = areaElement.computedStyle(); 515 if (!areaElementStyle) 516 return; 517 518 float outlineWidth = areaElementStyle->outlineWidth(); 519 if (!outlineWidth) 520 return; 521 509 522 // Even if the theme handles focus ring drawing for entire elements, it won't do it for 510 523 // an area within an image, so we don't call RenderTheme::supportsFocusRing here. 511 512 Path path = areaElement.computePath(this); 524 auto path = areaElement.computePathForFocusRing(size()); 513 525 if (path.isEmpty()) 514 526 return; 515 527 516 // FIXME: Do we need additional code to clip the path to the image's bounding box? 517 518 RenderStyle* areaElementStyle = areaElement.computedStyle(); 519 float outlineWidth = areaElementStyle->outlineWidth(); 520 if (!outlineWidth) 521 return; 522 523 paintInfo.context().drawFocusRing(path, outlineWidth, 524 areaElementStyle->outlineOffset(), 525 areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor)); 528 AffineTransform zoomTransform; 529 zoomTransform.scale(style().effectiveZoom()); 530 path.transform(zoomTransform); 531 532 auto adjustedOffset = paintOffset; 533 adjustedOffset.moveBy(location()); 534 path.translate(toFloatSize(adjustedOffset)); 535 536 #if PLATFORM(MAC) 537 bool needsRepaint; 538 paintInfo.context().drawFocusRing(path, document().page()->focusController().timeSinceFocusWasSet(), needsRepaint); 539 if (needsRepaint) 540 document().page()->focusController().setFocusedElementNeedsRepaint(); 541 #else 542 paintInfo.context().drawFocusRing(path, outlineWidth, areaElementStyle->outlineOffset(), areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor)); 543 #endif 526 544 #endif 527 545 } -
trunk/Source/WebCore/rendering/RenderImage.h
r197566 r199247 118 118 void updateInnerContentRect(); 119 119 120 void paintAreaElementFocusRing(PaintInfo& );120 void paintAreaElementFocusRing(PaintInfo&, const LayoutPoint& paintOffset); 121 121 122 122 void layoutShadowControls(const LayoutSize& oldSize); -
trunk/Source/WebCore/rendering/RenderInline.cpp
r198753 r199247 1604 1604 RenderStyle& styleToUse = style(); 1605 1605 // Only paint the focus ring by hand if the theme isn't able to draw it. 1606 if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse)) 1607 paintFocusRing(paintInfo, paintOffset, styleToUse); 1606 if (styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse)) { 1607 Vector<LayoutRect> focusRingRects; 1608 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer); 1609 paintFocusRing(paintInfo, styleToUse, focusRingRects); 1610 } 1608 1611 1609 1612 if (hasOutlineAnnotation() && !styleToUse.outlineStyleIsAuto() && !theme().supportsFocusRing(styleToUse))
Note: See TracChangeset
for help on using the changeset viewer.