<!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>[199553] 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/199553">199553</a></dd>
<dt>Author</dt> <dd>tonikitoo@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-14 14:14:55 -0700 (Thu, 14 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow listbox content and scrollbar to intrude padding area.
https://bugs.webkit.org/show_bug.cgi?id=128489

Reviewed by Myles C. Maxfield.

Source/WebCore:

Originally when the RenderListBox::controlClipRect method was implemented (see [1]), it used
to allow its content (&lt;option&gt;'s) to intrude padding to get rendered. Overlay scrollbars were also
allowed to paint over the padding area, if necessary.

[2] changed this behavior to restrict list-box'es content within the content box rect (excluding padding and border).

This had two consequences:
1) it made WebKit disallow list-box' content to intrude the padding area, diverging from other vendors.
like Firefox and Chrome.
2) Since overlay scrollbar might get painted over the padding area, if any, [2] could result
in the scrollbar being clipped out if padding-right is set (or padding-left in case of RTL content).

Patch changed WebKit back so that it allows list-box' content and overlay scrollbars to intrude the
padding area, matching other browsers vendors

[1] https://trac.webkit.org/changeset/18819/trunk/WebCore/rendering/RenderListBox.cpp
[2] https://trac.webkit.org/changeset/19037/trunk/WebCore/rendering/RenderListBox.cpp

Tests: fast/forms/listbox-selection-3.html
       fast/forms/listbox-padding-clip-selected.html
       fast/forms/listbox-padding-clip-expected-mismatch.html (renamed from listbox-padding-clip-overlay-expected.html)
       fast/forms/listbox-padding-clip-overlay-expected-mismatch.html (renamed from listbox-padding-clip-expected.html)

* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::numVisibleItems): changed to allow list-box items to get rendered on the padding-bottom area.
This matches Firefox and Chrome.
(WebCore::RenderListBox::listIndexAtOffset): relax the check for a given list-box item at a specific offset in the vertical axis.
This means if an list-box item has its content painted into the padding-bottom area, it will be actionable by mouse clicking.
This matches Firefox and Chrome.
(WebCore::RenderListBox::controlClipRect): clips list-box content against the padding box rect rather than the content box rect,
to allow its list-box items' content intrude the padding area.
This matches Firefox and Chrome.

LayoutTests:

* fast/forms/listbox-selection-3-expected.txt: Added.
* fast/forms/listbox-selection-3.html: Added.
* fast/forms/listbox-padding-clip-selected.html: Added.
* fast/forms/listbox-padding-clip-selected-expected.html: Added.
* fast/forms/listbox-padding-clip-expected-mismatch.html: Renamed from listbox-padding-clip-overlay-expected.html.
* fast/forms/listbox-padding-clip-overlay-expected-mismatch.html: Renamed from listbox-padding-clip-expected.html.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipoverlayhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingcliphtml">trunk/LayoutTests/fast/forms/listbox-padding-clip.html</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="#trunkSourceWebCorerenderingRenderListBoxcpp">trunk/Source/WebCore/rendering/RenderListBox.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipexpectedmismatchhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-expected-mismatch.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipoverlayexpectedmismatchhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected-mismatch.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipselectedexpectedhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-selected-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipselectedhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-selected.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxselection3expectedtxt">trunk/LayoutTests/fast/forms/listbox-selection-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxselection3html">trunk/LayoutTests/fast/forms/listbox-selection-3.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipexpectedhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastformslistboxpaddingclipoverlayexpectedhtml">trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/ChangeLog        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-04-14  Antonio Gomes  &lt;tonikitoo@webkit.org&gt;
+
+        Allow listbox content and scrollbar to intrude padding area.
+        https://bugs.webkit.org/show_bug.cgi?id=128489
+
+        Reviewed by Myles C. Maxfield.
+
+        * fast/forms/listbox-selection-3-expected.txt: Added.
+        * fast/forms/listbox-selection-3.html: Added.
+        * fast/forms/listbox-padding-clip-selected.html: Added.
+        * fast/forms/listbox-padding-clip-selected-expected.html: Added.
+        * fast/forms/listbox-padding-clip-expected-mismatch.html: Renamed from listbox-padding-clip-overlay-expected.html.
+        * fast/forms/listbox-padding-clip-overlay-expected-mismatch.html: Renamed from listbox-padding-clip-expected.html.
+
</ins><span class="cx"> 2016-04-14  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Implement CSSGridTemplateAreasValue::equals
</span></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipexpectedmismatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-padding-clip-expected-mismatch.html (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-expected-mismatch.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-expected-mismatch.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;This test makes sure that the contents of list boxes can intrude upon their padding. The test passes if you see a tall green box below and black pixels inside it)&lt;p&gt;
+&lt;div style=&quot;display: inline-block; width: 100px; height: 400px; background: green;&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/forms/listbox-padding-clip-expected.html (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-expected.html        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-expected.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p&gt;This test makes sure that the contents of list boxes do not intrude upon their padding. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
-&lt;div style=&quot;display: inline-block; width: 100px; height: 400px; background: green;&quot;&gt;&lt;/div&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipoverlayexpectedmismatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected-mismatch.html (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected-mismatch.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected-mismatch.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div style=&quot;display: inline-block; width: 100px; height: 400px; background: green;&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipoverlayexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected.html (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected.html        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay-expected.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p&gt;This test makes sure that the contents of list boxes do not intrude upon their padding. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
-&lt;div style=&quot;display: inline-block; width: 100px; height: 400px; background: green;&quot;&gt;&lt;/div&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipoverlayhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay.html (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay.html        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-overlay.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><del>-&lt;p&gt;This test makes sure that the contents of list boxes do not intrude upon their padding. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
</del><span class="cx"> &lt;div class=&quot;item&quot;&gt;
</span><span class="cx">     &lt;select multiple=&quot;multiple&quot; class=&quot;listBox&quot;&gt;
</span><span class="cx">         &lt;option&gt;f&lt;/option&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipselectedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-padding-clip-selected-expected.html (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-selected-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-selected-expected.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;p&gt;This test makes sure that the contents of list box items do not intrude upon their padding when in 'selected' state. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
+&lt;div style=&quot;display: inline-block; width: 250px; height: 230px; background: green; position: absolute; top:50px; left:50px;&quot;&gt;&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingclipselectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-padding-clip-selected.html (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip-selected.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip-selected.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;head&gt;
+  &lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+    :focus {
+      outline: 0;
+    }
+  &lt;/style&gt;
+  &lt;script type=&quot;text/javascript&quot;&gt;
+      if (window.testRunner)
+          testRunner.waitUntilDone();
+      if (window.internals)
+        internals.setUsesOverlayScrollbars(true);
+      function runTest()
+      {
+        document.getElementById('sl').focus();
+        testRunner.notifyDone();
+      }
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;setTimeout(runTest, 0)&quot;&gt;
+  &lt;p&gt;This test makes sure that the contents of list box items do not intrude upon their padding when in 'selected' state. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
+  &lt;select id=&quot;sl&quot; multiple=&quot;multiple&quot; style=&quot;border: 0px; height: 220px; width: 250px; font: 30px Zapfino; padding-right: 50px; padding-left: 50px;&quot;&gt;
+    &lt;option selected&gt;faQ'&lt;/option&gt;
+    &lt;option&gt;a&lt;/option&gt;
+  &lt;/select&gt;
+  &lt;div style=&quot;display: inline-block; width: 250px; height: 230px; background: green; position: absolute; top:50px; left:50px;&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxpaddingcliphtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/listbox-padding-clip.html (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-padding-clip.html        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/fast/forms/listbox-padding-clip.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -21,8 +21,6 @@
</span><span class="cx"> &lt;/style&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><del>-&lt;p&gt;This test makes sure that the contents of list boxes do not intrude upon their padding. The test passes if you see a tall green box below (and not a single black pixel anywhere inside it)&lt;p&gt;
-
</del><span class="cx"> &lt;div class=&quot;item&quot;&gt;
</span><span class="cx">     &lt;select multiple=&quot;multiple&quot; class=&quot;listBox&quot;&gt;
</span><span class="cx">         &lt;option&gt;f&lt;/option&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxselection3expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-selection-3-expected.txt (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-selection-3-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-selection-3-expected.txt        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Clicking on items of &lt;select&gt; with padding set.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS selectionPattern(&quot;sl1&quot;) is &quot;00000000000000000&quot;
+PASS selectionPattern(&quot;sl1&quot;) is &quot;01000000000000000&quot;
+PASS selectionPattern(&quot;sl1&quot;) is &quot;10000000000000000&quot;
+PASS selectionPattern(&quot;sl1&quot;) is &quot;10000000000000000&quot;
+PASS selectionPattern(&quot;sl1&quot;) is &quot;10000000000000000&quot;
+PASS selectionPattern(&quot;sl1&quot;) is &quot;00000000100000000&quot;
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformslistboxselection3html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/listbox-selection-3.html (0 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/listbox-selection-3.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-selection-3.html        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description('Clicking on items of &amp;lt;select&gt; with padding set.');
+
+var parent = document.createElement('div');
+parent.innerHTML = '&lt;select id=&quot;sl1&quot; multiple size=5&gt;'
+    + '&lt;option id=&quot;opt1&quot;&gt;one&lt;/option&gt;'
+    + '&lt;option id=&quot;opt2&quot;&gt;two&lt;/option&gt;'
+    + '&lt;option id=&quot;opt3&quot;&gt;three&lt;/option&gt;'
+    + '&lt;option id=&quot;opt4&quot;&gt;four&lt;/option&gt;'
+    + '&lt;option id=&quot;opt5&quot;&gt;five&lt;/option&gt;'
+    + '&lt;option id=&quot;opt6&quot;&gt;six&lt;/option&gt;'
+    + '&lt;option id=&quot;opt7&quot;&gt;seven&lt;/option&gt;'
+    + '&lt;option id=&quot;opt8&quot;&gt;eight&lt;/option&gt;'
+    + '&lt;option id=&quot;opt9&quot;&gt;nine&lt;/option&gt;'
+    + '&lt;option id=&quot;opt10&quot;&gt;ten&lt;/option&gt;'
+    + '&lt;option id=&quot;opt11&quot;&gt;eleven&lt;/option&gt;'
+    + '&lt;option id=&quot;opt12&quot;&gt;twelve&lt;/option&gt;'
+    + '&lt;option id=&quot;opt13&quot;&gt;thirteen&lt;/option&gt;'
+    + '&lt;option id=&quot;opt14&quot;&gt;fourteen&lt;/option&gt;'
+    + '&lt;option id=&quot;opt15&quot;&gt;fifteen&lt;/option&gt;'
+    + '&lt;option id=&quot;opt16&quot;&gt;sixteen&lt;/option&gt;'
+    + '&lt;option id=&quot;opt17&quot;&gt;seventeen&lt;/option&gt;'
+    + '&lt;/select&gt;';
+document.body.appendChild(parent);
+
+// Determine the item height.
+var sl1 = document.getElementById('sl1');
+var sl2 = document.getElementById('sl2');
+var itemHeight = Math.floor(sl1.offsetHeight / sl1.size);
+sl1.removeAttribute('size');
+var height = itemHeight * 9;
+sl1.setAttribute('style', 'height: ' + height + 'px; border: 0px; padding-top: 0px; padding-left: 25px; padding-right: 25px; padding-bottom: 20px;');
+
+var kClickOnPaddingLeftArea = 1;
+var kClickOnPaddingRightArea = 2;
+var kClickOnOptionElement = 3;
+
+function mouseDownOnSelect(selId, index, fudge)
+{
+    var sl = document.getElementById(selId);
+    var opt = document.getElementById(&quot;opt&quot; + index);
+    var paddingTop = 0;
+    var paddingLeft = 25;
+    var paddingRight = 25;
+
+    // default clicking to the middle of the option element.
+    var x = ((sl.offsetLeft + sl.offsetWidth - paddingRight) - (sl.offsetLeft + paddingLeft)) / 2;
+    x += sl.offsetLeft + paddingLeft;
+
+    var y = (index - 1) * itemHeight + itemHeight / 3 - window.pageYOffset + paddingTop;
+    y += sl.offsetTop;
+
+    if (fudge == kClickOnPaddingLeftArea) {
+       x = opt.offsetLeft + (paddingLeft / 2); // middle of the padding left area.
+    } else if (fudge == kClickOnOptionElement) {
+       // do nothing, already set as default value above.
+    } else if (fudge == kClickOnPaddingRightArea) {
+       x = opt.offsetRight + (paddingRight / 2); // middle of the padding right area.
+    }
+    var event = document.createEvent(&quot;MouseEvent&quot;);
+    event.initMouseEvent(&quot;mousedown&quot;, true, true, document.defaultView, 1, x, y, x, y, false, false, false, false, 0, document);
+    sl.dispatchEvent(event);
+}
+
+function selectionPattern(selectId)
+{
+    var select = document.getElementById(selectId);
+    var result = &quot;&quot;;
+    for (var i = 0; i &lt; select.options.length; i++)
+        result += select.options[i].selected ? '1' : '0';
+    return result;
+}
+
+window.onload = function () {
+  mouseDownOnSelect(&quot;sl1&quot;, 2, kClickOnPaddingRightArea);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;00000000000000000&quot;');
+
+  mouseDownOnSelect(&quot;sl1&quot;, 2, kClickOnOptionElement);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;01000000000000000&quot;');
+
+  mouseDownOnSelect(&quot;sl1&quot;, 1, kClickOnOptionElement);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;10000000000000000&quot;');
+
+  mouseDownOnSelect(&quot;sl1&quot;, 2, kClickOnPaddingRightArea);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;10000000000000000&quot;');
+
+  mouseDownOnSelect(&quot;sl1&quot;, 2, kClickOnPaddingLeftArea);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;10000000000000000&quot;');
+
+  mouseDownOnSelect(&quot;sl1&quot;, 9, kClickOnOptionElement);
+  shouldBe('selectionPattern(&quot;sl1&quot;)', '&quot;00000000100000000&quot;');
+};
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&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 (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -1762,6 +1762,7 @@
</span><span class="cx"> fast/forms/listbox-non-contiguous-keyboard-selection.html [ Failure ]
</span><span class="cx"> fast/forms/listbox-onchange.html [ Failure ]
</span><span class="cx"> fast/forms/listbox-selection-2.html [ Failure ]
</span><ins>+fast/forms/listbox-selection-3.html [ Failure ]
</ins><span class="cx"> fast/forms/listbox-selection-after-typeahead.html [ Failure ]
</span><span class="cx"> fast/forms/listbox-selection.html [ Failure ]
</span><span class="cx"> fast/forms/listbox-typeahead-scroll.html [ Failure ]
</span><span class="lines">@@ -3029,9 +3030,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>+fast/forms/listbox-padding-clip-selected.html [ ImageOnlyFailure ]
</ins><span class="cx"> 
</span><span class="cx"> # No focusring on iOS.
</span><span class="cx"> fast/images/image-map-outline-in-positioned-container.html [ Pass ImageOnlyFailure ]
</span><span class="cx"> fast/images/image-map-outline-with-paint-root-offset.html [ Pass ImageOnlyFailure ]
</span><span class="cx"> fast/images/image-map-outline-with-scale-transform.html [ Pass ImageOnlyFailure ]
</span><del>- 
</del><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 (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/Source/WebCore/ChangeLog        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2016-04-14  Antonio Gomes  &lt;tonikitoo@webkit.org&gt;
+
+        Allow listbox content and scrollbar to intrude padding area.
+        https://bugs.webkit.org/show_bug.cgi?id=128489
+
+        Reviewed by Myles C. Maxfield.
+
+        Originally when the RenderListBox::controlClipRect method was implemented (see [1]), it used
+        to allow its content (&lt;option&gt;'s) to intrude padding to get rendered. Overlay scrollbars were also
+        allowed to paint over the padding area, if necessary.
+
+        [2] changed this behavior to restrict list-box'es content within the content box rect (excluding padding and border).
+
+        This had two consequences:
+        1) it made WebKit disallow list-box' content to intrude the padding area, diverging from other vendors.
+        like Firefox and Chrome.
+        2) Since overlay scrollbar might get painted over the padding area, if any, [2] could result
+        in the scrollbar being clipped out if padding-right is set (or padding-left in case of RTL content).
+
+        Patch changed WebKit back so that it allows list-box' content and overlay scrollbars to intrude the
+        padding area, matching other browsers vendors
+
+        [1] https://trac.webkit.org/changeset/18819/trunk/WebCore/rendering/RenderListBox.cpp
+        [2] https://trac.webkit.org/changeset/19037/trunk/WebCore/rendering/RenderListBox.cpp
+
+        Tests: fast/forms/listbox-selection-3.html
+               fast/forms/listbox-padding-clip-selected.html
+               fast/forms/listbox-padding-clip-expected-mismatch.html (renamed from listbox-padding-clip-overlay-expected.html)
+               fast/forms/listbox-padding-clip-overlay-expected-mismatch.html (renamed from listbox-padding-clip-expected.html)
+
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::numVisibleItems): changed to allow list-box items to get rendered on the padding-bottom area.
+        This matches Firefox and Chrome.
+        (WebCore::RenderListBox::listIndexAtOffset): relax the check for a given list-box item at a specific offset in the vertical axis.
+        This means if an list-box item has its content painted into the padding-bottom area, it will be actionable by mouse clicking.
+        This matches Firefox and Chrome.
+        (WebCore::RenderListBox::controlClipRect): clips list-box content against the padding box rect rather than the content box rect,
+        to allow its list-box items' content intrude the padding area.
+        This matches Firefox and Chrome.
+
</ins><span class="cx"> 2016-04-14  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Collapsed border cache invalidation can lead to O(n^2) during style resolve
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderListBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (199552 => 199553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderListBox.cpp        2016-04-14 21:09:19 UTC (rev 199552)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp        2016-04-14 21:14:55 UTC (rev 199553)
</span><span class="lines">@@ -239,7 +239,7 @@
</span><span class="cx"> int RenderListBox::numVisibleItems() const
</span><span class="cx"> {
</span><span class="cx">     // Only count fully visible rows. But don't return 0 even if only part of a row shows.
</span><del>-    return std::max&lt;int&gt;(1, (contentHeight() + rowSpacing) / itemHeight());
</del><ins>+    return std::max&lt;int&gt;(1, (contentHeight() + paddingBottom() + rowSpacing) / itemHeight());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int RenderListBox::numItems() const
</span><span class="lines">@@ -466,7 +466,7 @@
</span><span class="cx">     if (!numItems())
</span><span class="cx">         return -1;
</span><span class="cx"> 
</span><del>-    if (offset.height() &lt; borderTop() + paddingTop() || offset.height() &gt; height() - paddingBottom() - borderBottom())
</del><ins>+    if (offset.height() &lt; borderTop() || offset.height() &gt; height() - borderBottom())
</ins><span class="cx">         return -1;
</span><span class="cx"> 
</span><span class="cx">     int scrollbarWidth = m_vBar ? m_vBar-&gt;width() : 0;
</span><span class="lines">@@ -726,7 +726,9 @@
</span><span class="cx"> 
</span><span class="cx"> LayoutRect RenderListBox::controlClipRect(const LayoutPoint&amp; additionalOffset) const
</span><span class="cx"> {
</span><del>-    LayoutRect clipRect = contentBoxRect();
</del><ins>+    // Clip against the padding box, to give &lt;option&gt;s and overlay scrollbar some extra space
+    // to get painted.
+    LayoutRect clipRect = paddingBoxRect();
</ins><span class="cx">     if (verticalScrollbarIsOnLeft() &amp;&amp; (!layer() || !layer()-&gt;verticalScrollbarIsOnLeft()))
</span><span class="cx">         clipRect.move(m_vBar-&gt;occupiedWidth(), 0);
</span><span class="cx">     clipRect.moveBy(additionalOffset);
</span></span></pre>
</div>
</div>

</body>
</html>