<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199247] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199247">199247</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2016-04-08 14:01:50 -0700 (Fri, 08 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Focus ring drawn at incorrect location on image map with CSS transform.
https://bugs.webkit.org/show_bug.cgi?id=143527
&lt;rdar://problem/21908735&gt;

Reviewed by Simon Fraser.

Source/WebCore:

Implement pathForFocusRing for HTMLAreaElement. It follows the logic of RenderObject::addFocusRingRects().

Tests: fast/images/image-map-outline-in-positioned-container.html
       fast/images/image-map-outline-with-paint-root-offset.html
       fast/images/image-map-outline-with-scale-transform.html
       fast/images/image-map-outline.html

* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::pathForFocusRing):
* html/HTMLAreaElement.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintFocusRing): Move addFocusRingRects() out of focus ring painting.
(WebCore::RenderElement::paintOutline):
* rendering/RenderElement.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paint):
(WebCore::RenderImage::paintAreaElementFocusRing):
* rendering/RenderImage.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutline):

LayoutTests:

Implement pathForFocusRing for HTMLAreaElement.

* fast/images/image-map-outline-in-positioned-container-expected.html: Added.
* fast/images/image-map-outline-in-positioned-container.html: Added.
* fast/images/image-map-outline-with-paint-root-offset-expected.html: Added.
* fast/images/image-map-outline-with-paint-root-offset.html: Added.
* fast/images/image-map-outline-with-scale-transform-expected.html: Added.
* fast/images/image-map-outline-with-scale-transform.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementcpp">trunk/Source/WebCore/html/HTMLAreaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementh">trunk/Source/WebCore/html/HTMLAreaElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementh">trunk/Source/WebCore/rendering/RenderElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImagecpp">trunk/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImageh">trunk/Source/WebCore/rendering/RenderImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlinecpp">trunk/Source/WebCore/rendering/RenderInline.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlineinpositionedcontainerexpectedhtml">trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlineinpositionedcontainerhtml">trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlinewithpaintrootoffsetexpectedhtml">trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlinewithpaintrootoffsethtml">trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlinewithscaletransformexpectedhtml">trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapoutlinewithscaletransformhtml">trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/LayoutTests/ChangeLog        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-04-08  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Focus ring drawn at incorrect location on image map with CSS transform.
+        https://bugs.webkit.org/show_bug.cgi?id=143527
+        &lt;rdar://problem/21908735&gt;
+
+        Reviewed by Simon Fraser.
+
+        Implement pathForFocusRing for HTMLAreaElement.
+
+        * fast/images/image-map-outline-in-positioned-container-expected.html: Added.
+        * fast/images/image-map-outline-in-positioned-container.html: Added.
+        * fast/images/image-map-outline-with-paint-root-offset-expected.html: Added.
+        * fast/images/image-map-outline-with-paint-root-offset.html: Added.
+        * fast/images/image-map-outline-with-scale-transform-expected.html: Added.
+        * fast/images/image-map-outline-with-scale-transform.html: Added.
+
</ins><span class="cx"> 2016-04-08  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add IC support for arguments.length
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlineinpositionedcontainerexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container-expected.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container-expected.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the image is inside positioned containers.&lt;/title&gt;
+&lt;style&gt;
+img {
+    position: absolute;
+    top: 30px;
+    left: 30px;
+}
+
+div {
+    position: absolute;
+    top: 35px;
+    left: 35px;
+    width: 20px;
+    height: 20px;
+        outline: auto;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;img src=&quot;./resources/green.jpg&quot; width=50 height=50&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlineinpositionedcontainerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-in-positioned-container.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the image is inside positioned containers.&lt;/title&gt;
+&lt;style&gt;
+.container {
+  position: absolute;
+  left: 20px;
+  top: 20px;
+}
+
+.inner {
+  position: absolute;
+  left: 10px;
+  top: 10px;
+}
+&lt;/style&gt;
+&lt;script&gt;
+window.onload = function() {
+    document.getElementById(&quot;area&quot;).focus();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=container&gt;
+  &lt;div class=inner&gt;
+    &lt;img src=&quot;./resources/green.jpg&quot; width=50 height=50 usemap=&quot;#map&quot;/&gt;
+    &lt;map name=&quot;map&quot;&gt;&lt;area id=area shape=&quot;rectangle&quot; coords=&quot;5, 5, 25, 25&quot; href=&quot;#&quot;&gt;&lt;/map&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlinewithpaintrootoffsetexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset-expected.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset-expected.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the paintroot is shifted.&lt;/title&gt;
+&lt;style&gt;
+img {
+    position: absolute;
+    top: 5px;
+    left: 5px;
+}
+div {
+    position: absolute;
+    top: 10px;
+    left: 10px;
+    width: 20px;
+    height: 20px;
+        outline: auto;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;img src=&quot;./resources/green.jpg&quot; width=50 height=50&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlinewithpaintrootoffsethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-with-paint-root-offset.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the paintroot is shifted.&lt;/title&gt;
+&lt;style&gt;
+.paintroot {
+  transform: translateZ(0);
+  position: absolute;
+  left: 5px;
+  top: 5px;
+}
+&lt;/style&gt;
+&lt;script&gt;
+window.onload = function() {
+    document.getElementById(&quot;area&quot;).focus();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=paintroot&gt;
+  &lt;img src=&quot;./resources/green.jpg&quot; width=50 height=50 usemap=&quot;#map&quot;/&gt;
+  &lt;map name=&quot;map&quot;&gt;&lt;area id=area shape=&quot;rectangle&quot; coords=&quot;5, 5, 25, 25&quot; href=&quot;#&quot;&gt;&lt;/map&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlinewithscaletransformexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform-expected.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform-expected.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the image's container is scaled.&lt;/title&gt;
+&lt;style&gt;
+img {
+    position: absolute;
+    top: 23px;
+    left: 25px;
+}
+
+div {
+    position: absolute;
+    top: 33px;
+    left: 35px;
+    width: 40px;
+    height: 40px;
+        outline: auto;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;img src=&quot;./resources/green.jpg&quot; width=100 height=100&gt;
+&lt;div&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapoutlinewithscaletransformhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform.html (0 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-map-outline-with-scale-transform.html        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;This tests that we paint area outline properly when the image's container is scaled.&lt;/title&gt;
+&lt;style&gt;
+.container {
+  transform: scale(2);
+  position: absolute;
+  left: 50px;
+  top: 50px;
+}
+&lt;/style&gt;
+&lt;script&gt;
+window.onload = function() {
+    document.getElementById(&quot;area&quot;).focus();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=container&gt;
+  &lt;img src=&quot;./resources/green.jpg&quot; width=50 height=50 usemap=&quot;#map&quot;/&gt;
+  &lt;map name=&quot;map&quot;&gt;&lt;area id=area shape=&quot;rectangle&quot; coords=&quot;5, 5, 25, 25&quot; href=&quot;#&quot;&gt;&lt;/map&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -3022,3 +3022,9 @@
</span><span class="cx"> # iOS list box controls are not drawn in the standard way.
</span><span class="cx"> fast/forms/listbox-padding-clip.html [ ImageOnlyFailure ]
</span><span class="cx"> fast/forms/listbox-padding-clip-overlay.html [ ImageOnlyFailure ]
</span><ins>+
+# No focusring on iOS.
+fast/images/image-map-outline-in-positioned-container.html [ Pass ImageOnlyFailure ]
+fast/images/image-map-outline-with-paint-root-offset.html [ Pass ImageOnlyFailure ]
+fast/images/image-map-outline-with-scale-transform.html [ Pass ImageOnlyFailure ]

</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/ChangeLog        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-04-08  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Focus ring drawn at incorrect location on image map with CSS transform.
+        https://bugs.webkit.org/show_bug.cgi?id=143527
+        &lt;rdar://problem/21908735&gt;
+
+        Reviewed by Simon Fraser.
+
+        Implement pathForFocusRing for HTMLAreaElement. It follows the logic of RenderObject::addFocusRingRects().
+
+        Tests: fast/images/image-map-outline-in-positioned-container.html
+               fast/images/image-map-outline-with-paint-root-offset.html
+               fast/images/image-map-outline-with-scale-transform.html
+               fast/images/image-map-outline.html
+
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::pathForFocusRing):
+        * html/HTMLAreaElement.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::paintFocusRing): Move addFocusRingRects() out of focus ring painting.
+        (WebCore::RenderElement::paintOutline):
+        * rendering/RenderElement.h:
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paint):
+        (WebCore::RenderImage::paintAreaElementFocusRing):
+        * rendering/RenderImage.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutline):
+
</ins><span class="cx"> 2016-04-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK1] Wheel event callback removing the window causes crash in WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.cpp (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.cpp        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/html/HTMLAreaElement.cpp        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -116,6 +116,11 @@
</span><span class="cx">     return p;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Path HTMLAreaElement::computePathForFocusRing(const LayoutSize&amp; elementSize) const
+{
+    return getRegion(m_shape == Default ? elementSize : m_lastSize);
+}
+
</ins><span class="cx"> // FIXME: Use RenderElement* instead of RenderObject* once we upstream iOS's DOMUIKitExtensions.{h, mm}.
</span><span class="cx"> LayoutRect HTMLAreaElement::computeRect(RenderObject* obj) const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.h (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.h        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/html/HTMLAreaElement.h        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx">     // FIXME: Use RenderElement* instead of RenderObject* once we upstream iOS's DOMUIKitExtensions.{h, mm}.
</span><span class="cx">     LayoutRect computeRect(RenderObject*) const;
</span><span class="cx">     Path computePath(RenderObject*) const;
</span><ins>+    Path computePathForFocusRing(const LayoutSize&amp; elementSize) const;
</ins><span class="cx"> 
</span><span class="cx">     // The parent map's image.
</span><span class="cx">     HTMLImageElement* imageElement() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -2040,12 +2040,9 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderElement::paintFocusRing(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset, const RenderStyle&amp; style)
</del><ins>+void RenderElement::paintFocusRing(PaintInfo&amp; paintInfo, const RenderStyle&amp; style, const Vector&lt;LayoutRect&gt;&amp; focusRingRects)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(style.outlineStyleIsAuto());
</span><del>-
-    Vector&lt;LayoutRect&gt; focusRingRects;
-    addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
</del><span class="cx">     float outlineOffset = style.outlineOffset();
</span><span class="cx">     Vector&lt;FloatRect&gt; pixelSnappedFocusRingRects;
</span><span class="cx">     float deviceScaleFactor = document().deviceScaleFactor();
</span><span class="lines">@@ -2086,8 +2083,11 @@
</span><span class="cx">     float outlineOffset = floorToDevicePixel(styleToUse.outlineOffset(), document().deviceScaleFactor());
</span><span class="cx"> 
</span><span class="cx">     // Only paint the focus ring by hand if the theme isn't able to draw it.
</span><del>-    if (styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse))
-        paintFocusRing(paintInfo, paintRect.location(), styleToUse);
</del><ins>+    if (styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse)) {
+        Vector&lt;LayoutRect&gt; focusRingRects;
+        addFocusRingRects(focusRingRects, paintRect.location(), paintInfo.paintContainer);
+        paintFocusRing(paintInfo, styleToUse, focusRingRects);
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (hasOutlineAnnotation() &amp;&amp; !styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse))
</span><span class="cx">         addPDFURLRect(paintInfo, paintRect.location());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.h (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.h        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/rendering/RenderElement.h        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx">     unsigned renderBlockFlowLineLayoutPath() const { return m_renderBlockFlowLineLayoutPath; }
</span><span class="cx">     bool renderBlockFlowHasMarkupTruncation() const { return m_renderBlockFlowHasMarkupTruncation; }
</span><span class="cx"> 
</span><del>-    void paintFocusRing(PaintInfo&amp;, const LayoutPoint&amp;, const RenderStyle&amp;);
</del><ins>+    void paintFocusRing(PaintInfo&amp;, const RenderStyle&amp;, const Vector&lt;LayoutRect&gt;&amp; focusRingRects);
</ins><span class="cx">     void paintOutline(PaintInfo&amp;, const LayoutRect&amp;);
</span><span class="cx">     void updateOutlineAutoAncestor(bool hasOutlineAuto) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.cpp        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BitmapImage.h&quot;
</span><span class="cx"> #include &quot;CachedImage.h&quot;
</span><ins>+#include &quot;FocusController.h&quot;
</ins><span class="cx"> #include &quot;FontCache.h&quot;
</span><span class="cx"> #include &quot;FontCascade.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="lines">@@ -484,13 +485,14 @@
</span><span class="cx">     RenderReplaced::paint(paintInfo, paintOffset);
</span><span class="cx">     
</span><span class="cx">     if (paintInfo.phase == PaintPhaseOutline)
</span><del>-        paintAreaElementFocusRing(paintInfo);
</del><ins>+        paintAreaElementFocusRing(paintInfo, paintOffset);
</ins><span class="cx"> }
</span><span class="cx">     
</span><del>-void RenderImage::paintAreaElementFocusRing(PaintInfo&amp; paintInfo)
</del><ins>+void RenderImage::paintAreaElementFocusRing(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     UNUSED_PARAM(paintInfo);
</span><ins>+    UNUSED_PARAM(paintOffset);
</ins><span class="cx"> #else
</span><span class="cx">     if (document().printing() || !frame().selection().isFocusedAndActive())
</span><span class="cx">         return;
</span><span class="lines">@@ -498,6 +500,9 @@
</span><span class="cx">     if (paintInfo.context().paintingDisabled() &amp;&amp; !paintInfo.context().updatingControlTints())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (!document().page())
+        return;
+
</ins><span class="cx">     Element* focusedElement = document().focusedElement();
</span><span class="cx">     if (!is&lt;HTMLAreaElement&gt;(focusedElement))
</span><span class="cx">         return;
</span><span class="lines">@@ -506,24 +511,37 @@
</span><span class="cx">     if (areaElement.imageElement() != element())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    auto* areaElementStyle = areaElement.computedStyle();
+    if (!areaElementStyle)
+        return;
+
+    float outlineWidth = areaElementStyle-&gt;outlineWidth();
+    if (!outlineWidth)
+        return;
+
</ins><span class="cx">     // Even if the theme handles focus ring drawing for entire elements, it won't do it for
</span><span class="cx">     // an area within an image, so we don't call RenderTheme::supportsFocusRing here.
</span><del>-
-    Path path = areaElement.computePath(this);
</del><ins>+    auto path = areaElement.computePathForFocusRing(size());
</ins><span class="cx">     if (path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: Do we need additional code to clip the path to the image's bounding box?
</del><ins>+    AffineTransform zoomTransform;
+    zoomTransform.scale(style().effectiveZoom());
+    path.transform(zoomTransform);
</ins><span class="cx"> 
</span><del>-    RenderStyle* areaElementStyle = areaElement.computedStyle();
-    float outlineWidth = areaElementStyle-&gt;outlineWidth();
-    if (!outlineWidth)
-        return;
</del><ins>+    auto adjustedOffset = paintOffset;
+    adjustedOffset.moveBy(location());
+    path.translate(toFloatSize(adjustedOffset));
</ins><span class="cx"> 
</span><del>-    paintInfo.context().drawFocusRing(path, outlineWidth,
-        areaElementStyle-&gt;outlineOffset(),
-        areaElementStyle-&gt;visitedDependentColor(CSSPropertyOutlineColor));
</del><ins>+#if PLATFORM(MAC)
+    bool needsRepaint;
+    paintInfo.context().drawFocusRing(path, document().page()-&gt;focusController().timeSinceFocusWasSet(), needsRepaint);
+    if (needsRepaint)
+        document().page()-&gt;focusController().setFocusedElementNeedsRepaint();
+#else
+    paintInfo.context().drawFocusRing(path, outlineWidth, areaElementStyle-&gt;outlineOffset(), areaElementStyle-&gt;visitedDependentColor(CSSPropertyOutlineColor));
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderImage::areaElementFocusChanged(HTMLAreaElement* element)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.h (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.h        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/rendering/RenderImage.h        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">     // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect.
</span><span class="cx">     void updateInnerContentRect();
</span><span class="cx"> 
</span><del>-    void paintAreaElementFocusRing(PaintInfo&amp;);
</del><ins>+    void paintAreaElementFocusRing(PaintInfo&amp;, const LayoutPoint&amp; paintOffset);
</ins><span class="cx">     
</span><span class="cx">     void layoutShadowControls(const LayoutSize&amp; oldSize);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (199246 => 199247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.cpp        2016-04-08 20:59:51 UTC (rev 199246)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp        2016-04-08 21:01:50 UTC (rev 199247)
</span><span class="lines">@@ -1603,8 +1603,11 @@
</span><span class="cx"> 
</span><span class="cx">     RenderStyle&amp; styleToUse = style();
</span><span class="cx">     // Only paint the focus ring by hand if the theme isn't able to draw it.
</span><del>-    if (styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse))
-        paintFocusRing(paintInfo, paintOffset, styleToUse);
</del><ins>+    if (styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse)) {
+        Vector&lt;LayoutRect&gt; focusRingRects;
+        addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer);
+        paintFocusRing(paintInfo, styleToUse, focusRingRects);
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (hasOutlineAnnotation() &amp;&amp; !styleToUse.outlineStyleIsAuto() &amp;&amp; !theme().supportsFocusRing(styleToUse))
</span><span class="cx">         addPDFURLRect(paintInfo, paintOffset);
</span></span></pre>
</div>
</div>

</body>
</html>