WebKit Bugzilla
Attachment 361633 Details for
Bug 193591
: Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193591-20190210104410.patch (text/plain), 8.66 KB, created by
Daniel Bates
on 2019-02-10 10:44:12 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-02-10 10:44:12 PST
Size:
8.66 KB
patch
obsolete
>Subversion Revision: 241231 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7601dfa104d77c307bef590f57b606caf9f63f3b..baa45b4cf96a4e1f86b8feaa10136b35ea68dbe3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2019-02-10 Daniel Bates <dabates@apple.com> >+ >+ Separate out outline-style: auto user-agent appearance from Mac animated focus ring drawing >+ https://bugs.webkit.org/show_bug.cgi?id=193591 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Untangle the Mac-specific concept of animated focus ring drawing from the concepts of using >+ the fancy shrink-wrapped focus ring appearance and using the platform focus ring color when >+ outline-style: auto. >+ >+ No functionality changed. So, no new tests. >+ >+ * platform/graphics/GraphicsContext.h: >+ * platform/graphics/cocoa/GraphicsContextCocoa.mm: >+ (WebCore::drawFocusRing): >+ (WebCore::drawFocusRingToContextAtTime): >+ Change some macro guards. >+ >+ * rendering/RenderElement.cpp: >+ (WebCore::usePlatformFocusRingColorForOutlineStyleAuto): Added. >+ (WebCore::useShrinkWrappedFocusRingForOutlineStyleAuto): Added. >+ (WebCore::drawFocusRing): Added. >+ (WebCore::RenderElement::paintFocusRing): Write in terms of drawFocusRing(). >+ > 2019-02-08 Daniel Bates <dabates@apple.com> > > [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h >index 816caea7b1b007fb03296d3cecb5d76888de9df7..1c366d51cbd74d0bcedec5790df2ed71aacc7a96 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext.h >@@ -446,9 +446,7 @@ public: > > void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&); > void drawFocusRing(const Path&, float width, float offset, const Color&); >- >- // FIXME: The following functions should only be compiled for Mac. See <https://bugs.webkit.org/show_bug.cgi?id=193591>. >-#if PLATFORM(COCOA) >+#if PLATFORM(MAC) > void drawFocusRing(const Path&, double timeOffset, bool& needsRedraw, const Color&); > void drawFocusRing(const Vector<FloatRect>&, double timeOffset, bool& needsRedraw, const Color&); > #endif >diff --git a/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm b/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm >index 702d6c53a4a8b382de5307be407d68fa57bbe845..eab564b0e24255a021c94120b861e7c691781507 100644 >--- a/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm >@@ -95,7 +95,7 @@ static bool drawFocusRingAtTime(CGContextRef context, NSTimeInterval timeOffset, > return needsRepaint; > } > >-static void drawFocusRing(CGContextRef context, const Color& color) >+inline static void drawFocusRing(CGContextRef context, const Color& color) > { > drawFocusRingAtTime(context, std::numeric_limits<double>::max(), color); > } >@@ -107,14 +107,6 @@ static void drawFocusRingToContext(CGContextRef context, CGPathRef focusRingPath > drawFocusRing(context, color); > } > >-static bool drawFocusRingToContextAtTime(CGContextRef context, CGPathRef focusRingPath, double timeOffset, const Color& color) >-{ >- UNUSED_PARAM(timeOffset); >- CGContextBeginPath(context); >- CGContextAddPath(context, focusRingPath); >- return drawFocusRingAtTime(context, std::numeric_limits<double>::max(), color); >-} >- > #endif // ENABLE(FULL_KEYBOARD_ACCESS) > > void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, const Color& color) >@@ -137,8 +129,15 @@ void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, > #endif > } > >-// FIXME: The following functions should only be compiled for Mac. See <https://bugs.webkit.org/show_bug.cgi?id=193591>. >-#if ENABLE(FULL_KEYBOARD_ACCESS) >+#if PLATFORM(MAC) >+ >+static bool drawFocusRingToContextAtTime(CGContextRef context, CGPathRef focusRingPath, double timeOffset, const Color& color) >+{ >+ UNUSED_PARAM(timeOffset); >+ CGContextBeginPath(context); >+ CGContextAddPath(context, focusRingPath); >+ return drawFocusRingAtTime(context, std::numeric_limits<double>::max(), color); >+} > > void GraphicsContext::drawFocusRing(const Path& path, double timeOffset, bool& needsRedraw, const Color& color) > { >@@ -166,7 +165,7 @@ void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, double timeO > needsRedraw = drawFocusRingToContextAtTime(platformContext(), focusRingPath.get(), timeOffset, color); > } > >-#endif >+#endif // PLATFORM(MAC) > > void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color) > { >diff --git a/Source/WebCore/rendering/RenderElement.cpp b/Source/WebCore/rendering/RenderElement.cpp >index 2f2f3c1e9c22e989acad3499c5e9725e25d8c2d2..96d4a3c2abfc1562aaf023f2d47d05fa66ef6a3c 100644 >--- a/Source/WebCore/rendering/RenderElement.cpp >+++ b/Source/WebCore/rendering/RenderElement.cpp >@@ -1809,6 +1809,51 @@ void RenderElement::drawLineForBoxSide(GraphicsContext& graphicsContext, const F > } > } > >+static bool usePlatformFocusRingColorForOutlineStyleAuto() >+{ >+#if PLATFORM(COCOA) >+ return true; >+#else >+ return false; >+#endif >+} >+ >+static bool useShrinkWrappedFocusRingForOutlineStyleAuto() >+{ >+#if PLATFORM(COCOA) >+ return true; >+#else >+ return false; >+#endif >+} >+ >+static bool drawFocusRing(GraphicsContext& context, Page& page, const Path& path, const RenderStyle& style, Color focusRingColor) >+{ >+ bool needsRepaint = false; >+#if PLATFORM(MAC) >+ context.drawFocusRing(path, page.focusController().timeSinceFocusWasSet().seconds(), needsRepaint, focusRingColor); >+ UNUSED_PARAM(style); >+#else >+ context.drawFocusRing(path, style.outlineWidth(), style.outlineOffset(), focusRingColor); >+ UNUSED_PARAM(page); >+#endif >+ return needsRepaint; >+} >+ >+static bool drawFocusRing(GraphicsContext& context, Page& page, Vector<FloatRect> rects, const RenderStyle& style, Color focusRingColor) >+{ >+ bool needsRepaint = false; >+#if PLATFORM(MAC) >+ context.drawFocusRing(rects, page.focusController().timeSinceFocusWasSet().seconds(), needsRepaint, focusRingColor); >+ UNUSED_PARAM(style); >+#else >+ context.drawFocusRing(rects, style.outlineWidth(), style.outlineOffset(), focusRingColor); >+ UNUSED_PARAM(page); >+#endif >+ return needsRepaint; >+} >+ >+ > void RenderElement::paintFocusRing(PaintInfo& paintInfo, const RenderStyle& style, const Vector<LayoutRect>& focusRingRects) > { > ASSERT(style.outlineStyleIsAuto() == OutlineIsAuto::On); >@@ -1819,24 +1864,20 @@ void RenderElement::paintFocusRing(PaintInfo& paintInfo, const RenderStyle& styl > rect.inflate(outlineOffset); > pixelSnappedFocusRingRects.append(snapRectToDevicePixels(rect, deviceScaleFactor)); > } >- // FIXME: The following code should only be compiled for Mac. See <https://bugs.webkit.org/show_bug.cgi?id=193591>. >-#if ENABLE(FULL_KEYBOARD_ACCESS) >+ Color focusRingColor = usePlatformFocusRingColorForOutlineStyleAuto() ? RenderTheme::singleton().focusRingColor(styleColorOptions()) : style.visitedDependentColorWithColorFilter(CSSPropertyOutlineColor); > bool needsRepaint; >- if (style.hasBorderRadius()) { >+ if (useShrinkWrappedFocusRingForOutlineStyleAuto() && style.hasBorderRadius()) { > Path path = PathUtilities::pathWithShrinkWrappedRectsForOutline(pixelSnappedFocusRingRects, style.border(), outlineOffset, style.direction(), style.writingMode(), > document().deviceScaleFactor()); > if (path.isEmpty()) { > for (auto rect : pixelSnappedFocusRingRects) > path.addRect(rect); > } >- paintInfo.context().drawFocusRing(path, page().focusController().timeSinceFocusWasSet().seconds(), needsRepaint, RenderTheme::singleton().focusRingColor(styleColorOptions())); >+ needsRepaint = drawFocusRing(paintInfo.context(), page(), path, style, focusRingColor); > } else >- paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, page().focusController().timeSinceFocusWasSet().seconds(), needsRepaint, RenderTheme::singleton().focusRingColor(styleColorOptions())); >+ needsRepaint = drawFocusRing(paintInfo.context(), page(), pixelSnappedFocusRingRects, style, focusRingColor); > if (needsRepaint) > page().focusController().setFocusedElementNeedsRepaint(); >-#else >- paintInfo.context().drawFocusRing(pixelSnappedFocusRingRects, style.outlineWidth(), style.outlineOffset(), style.visitedDependentColorWithColorFilter(CSSPropertyOutlineColor)); >-#endif > } > > void RenderElement::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRect)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193591
:
359536
|
359540
| 361633