Diff
Modified: trunk/LayoutTests/ChangeLog (188651 => 188652)
--- trunk/LayoutTests/ChangeLog 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/LayoutTests/ChangeLog 2015-08-19 22:09:27 UTC (rev 188652)
@@ -1,3 +1,22 @@
+2015-08-19 Zalan Bujtas <za...@apple.com>
+
+ Cleanup outline-style: auto painting.
+ https://bugs.webkit.org/show_bug.cgi?id=148159
+
+ Reviewed by Simon Fraser.
+
+ Old platform style required the focus ring to be painted with an offset. (https://trac.webkit.org/r5358)
+ (and it has the side effect of growing outline-width adds further, unwanted offset)
+ Default css for :focus is adjusted to remove this offset by setting the outline-width to 5px
+ and the outline-offset to -2px. (https://trac.webkit.org/r13639)
+ This patch removes both the old logic and the workaround for getting rid of the unwanted offset.
+
+ * fast/repaint/outline-auto-with-default-width-and-offset-repaint-expected.txt: Added.
+ * fast/repaint/outline-auto-with-default-width-and-offset-repaint.html: Copied from LayoutTests/fast/repaint/outline-with2px-auto-repaint-rect.html.
+ * fast/repaint/outline-with1px-auto-repaint-rect.html:
+ * fast/repaint/outline-with2px-auto-repaint-rect.html:
+ * fast/repaint/outline-with3px-auto-repaint-rect.html:
+
2015-08-18 Dean Jackson <d...@apple.com>
Support CSS filters without webkit prefix
Added: trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint-expected.txt (0 => 188652)
--- trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint-expected.txt 2015-08-19 22:09:27 UTC (rev 188652)
@@ -0,0 +1,6 @@
+PASS window.internals.repaintRectsAsText().indexOf('4 6') is not -1
+PASS window.internals.repaintRectsAsText().indexOf('4 46') is not -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint.html (from rev 188651, trunk/LayoutTests/fast/repaint/outline-with1px-auto-repaint-rect.html) (0 => 188652)
--- trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/outline-auto-with-default-width-and-offset-repaint.html 2015-08-19 22:09:27 UTC (rev 188652)
@@ -0,0 +1,37 @@
+<html>
+<script>jsTestIsAsync = true;</script>
+<script src=""
+<head>
+<title>This tests that outline-style auto repaint rect is correct with default outline-width and outline-offset.</title>
+<style>
+div {
+ position: absolute;
+ top: 10px;
+ height: 10px;
+ width: 10px;
+ outline: auto;
+ outline-offset: 1px;
+}
+</style>
+</head>
+<body>
+<div id=foo></div>
+</body>
+<script>
+setTimeout(
+ function() {
+ if (window.internals)
+ internals.startTrackingRepaints();
+ document.getElementById("foo").style.top = "50px";
+ document.body.offsetWidth;
+
+ if (window.internals) {
+ shouldNotBe("window.internals.repaintRectsAsText().indexOf('4 6')", "-1");
+ shouldNotBe("window.internals.repaintRectsAsText().indexOf('4 46')", "-1");
+ internals.stopTrackingRepaints();
+ }
+ finishJSTest();
+ }, 0);
+</script>
+<script src=""
+</html>
Modified: trunk/LayoutTests/fast/repaint/outline-with1px-auto-repaint-rect.html (188651 => 188652)
--- trunk/LayoutTests/fast/repaint/outline-with1px-auto-repaint-rect.html 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/LayoutTests/fast/repaint/outline-with1px-auto-repaint-rect.html 2015-08-19 22:09:27 UTC (rev 188652)
@@ -7,7 +7,7 @@
div {
position: absolute;
top: 10px;
- height: 0px;
+ height: 10px;
width: 10px;
outline: auto 1px;
}
Modified: trunk/LayoutTests/fast/repaint/outline-with2px-auto-repaint-rect.html (188651 => 188652)
--- trunk/LayoutTests/fast/repaint/outline-with2px-auto-repaint-rect.html 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/LayoutTests/fast/repaint/outline-with2px-auto-repaint-rect.html 2015-08-19 22:09:27 UTC (rev 188652)
@@ -7,7 +7,7 @@
div {
position: absolute;
top: 10px;
- height: 0px;
+ height: 10px;
width: 10px;
outline: auto 2px;
}
Modified: trunk/LayoutTests/fast/repaint/outline-with3px-auto-repaint-rect.html (188651 => 188652)
--- trunk/LayoutTests/fast/repaint/outline-with3px-auto-repaint-rect.html 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/LayoutTests/fast/repaint/outline-with3px-auto-repaint-rect.html 2015-08-19 22:09:27 UTC (rev 188652)
@@ -7,7 +7,7 @@
div {
position: absolute;
top: 10px;
- height: 0px;
+ height: 10px;
width: 10px;
outline: auto 3px;
}
Modified: trunk/Source/WebCore/ChangeLog (188651 => 188652)
--- trunk/Source/WebCore/ChangeLog 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/ChangeLog 2015-08-19 22:09:27 UTC (rev 188652)
@@ -1,3 +1,34 @@
+2015-08-19 Zalan Bujtas <za...@apple.com>
+
+ Cleanup outline-style: auto painting.
+ https://bugs.webkit.org/show_bug.cgi?id=148159
+
+ Reviewed by Simon Fraser.
+
+ Old platform style required the focus ring to be painted with an offset. (https://trac.webkit.org/r5358)
+ (and it has the side effect of growing outline-width adds further, unwanted offset)
+ Default css for :focus is adjusted to remove this offset by setting the outline-width to 5px
+ and the outline-offset to -2px. (https://trac.webkit.org/r13639)
+ This patch removes both the old logic and the workaround for getting rid of the unwanted offset.
+
+ Test: fast/repaint/outline-auto-with-default-width-and-offset-repaint.html
+
+ * css/html.css:
+ (:focus):
+ (input:focus, textarea:focus, isindex:focus, keygen:focus, select:focus): Deleted.
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::computeMaxOutlineSize):
+ (WebCore::RenderElement::paintFocusRing):
+ (WebCore::RenderElement::paintOutline): Short circuit painting outline when painting is disabled. It
+ only change behaviour for non-auto outlines -which are anyway not supposed to be painted when painting is disabled.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::adjustRectForOutlineAndShadow):
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::platformFocusRingWidth):
+ (WebCore::RenderTheme::platformFocusRingMaxWidth): Deleted.
+
2015-08-18 Dean Jackson <d...@apple.com>
Support CSS filters without webkit prefix
Modified: trunk/Source/WebCore/css/html.css (188651 => 188652)
--- trunk/Source/WebCore/css/html.css 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/css/html.css 2015-08-19 22:09:27 UTC (rev 188652)
@@ -1107,7 +1107,7 @@
/* states */
:focus {
- outline: auto 5px -webkit-focus-ring-color
+ outline: auto;
}
/* Read-only text fields do not show a focus ring but do still receive focus */
@@ -1118,10 +1118,6 @@
applet:focus, embed:focus, iframe:focus, object:focus {
outline: none
}
-
-input:focus, textarea:focus, isindex:focus, keygen:focus, select:focus {
- outline-offset: -2px
-}
input:matches([type="button"], [type="checkbox"], [type="file"], [type="hidden"], [type="image"], [type="radio"], [type="reset"], [type="search"], [type="submit"]):focus,
input[type="file"]:focus::-webkit-file-upload-button {
Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm (188651 => 188652)
--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm 2015-08-19 22:09:27 UTC (rev 188652)
@@ -85,13 +85,11 @@
}
#if PLATFORM(MAC)
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, double timeOffset, bool& needsRedraw)
+void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int, int offset, double timeOffset, bool& needsRedraw)
{
if (paintingDisabled())
return;
- offset += (width - 1) / 2;
-
RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
for (auto& rect : rects)
CGPathAddRect(focusRingPath.get(), 0, CGRectInset(rect, -offset, -offset));
@@ -100,14 +98,12 @@
}
#endif
-void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color&)
+void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int, int offset, const Color&)
{
#if !PLATFORM(IOS)
if (paintingDisabled())
return;
- offset += (width - 1) / 2;
-
RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
for (auto& rect : rects)
CGPathAddRect(focusRingPath.get(), 0, CGRectInset(rect, -offset, -offset));
@@ -115,7 +111,6 @@
drawFocusRingToContext(platformContext(), focusRingPath.get());
#else
UNUSED_PARAM(rects);
- UNUSED_PARAM(width);
UNUSED_PARAM(offset);
#endif
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (188651 => 188652)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2015-08-19 22:09:27 UTC (rev 188652)
@@ -372,7 +372,7 @@
return;
int maxOutlineSize = m_style->outlineSize();
if (m_style->outlineStyleIsAuto())
- maxOutlineSize = std::max(theme().platformFocusRingMaxWidth(), maxOutlineSize);
+ maxOutlineSize = std::max(theme().platformFocusRingWidth(), maxOutlineSize);
if (maxOutlineSize < maximalOutlineSize(PaintPhaseOutline))
return;
@@ -2041,7 +2041,7 @@
addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
#if PLATFORM(MAC)
bool needsRepaint;
- paintInfo.context->drawFocusRing(focusRingRects, style.outlineWidth(), style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
+ paintInfo.context->drawFocusRing(focusRingRects, theme().platformFocusRingWidth(), style.outlineOffset(), document().page()->focusController().timeSinceFocusWasSet(), needsRepaint);
if (needsRepaint)
document().page()->focusController().setFocusedElementNeedsRepaint();
#else
@@ -2051,6 +2051,10 @@
void RenderElement::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRect)
{
+ GraphicsContext& graphicsContext = *paintInfo.context;
+ if (graphicsContext.paintingDisabled())
+ return;
+
if (!hasOutline())
return;
@@ -2082,7 +2086,6 @@
EBorderStyle outlineStyle = styleToUse.outlineStyle();
Color outlineColor = styleToUse.visitedDependentColor(CSSPropertyOutlineColor);
- GraphicsContext& graphicsContext = *paintInfo.context;
bool useTransparencyLayer = outlineColor.hasAlpha();
if (useTransparencyLayer) {
if (outlineStyle == SOLID) {
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (188651 => 188652)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2015-08-19 22:09:27 UTC (rev 188652)
@@ -1918,7 +1918,7 @@
{
int outlineSize = outlineStyleForRepaint().outlineSize();
if (outlineStyleForRepaint().outlineStyleIsAuto())
- outlineSize = std::max(theme().platformFocusRingMaxWidth(), outlineSize);
+ outlineSize = std::max(theme().platformFocusRingWidth(), outlineSize);
if (const ShadowData* boxShadow = style().boxShadow()) {
boxShadow->adjustRectForShadow(rect, outlineSize);
return;
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (188651 => 188652)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2015-08-19 21:31:30 UTC (rev 188651)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2015-08-19 22:09:27 UTC (rev 188652)
@@ -163,7 +163,7 @@
static Color focusRingColor();
virtual Color platformFocusRingColor() const { return Color(0, 0, 0); }
static void setCustomFocusRingColor(const Color&);
- virtual int platformFocusRingMaxWidth() const { return 3; }
+ virtual int platformFocusRingWidth() const { return 3; }
#if ENABLE(TOUCH_EVENTS)
static Color tapHighlightColor();
virtual Color platformTapHighlightColor() const { return RenderTheme::defaultTapHighlightColor; }