<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[23938] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/23938">23938</a></dd>
<dt>Author</dt> <dd>aroben</dd>
<dt>Date</dt> <dd>2007-07-02 16:54:22 -0700 (Mon, 02 Jul 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix Bug 14498: RenderContainer::positionForCoordinates contains an order of operations error

WebCore:

        Fix Bug 14498: RenderContainer::positionForCoordinates contains an order of operations error
        http://bugs.webkit.org/show_bug.cgi?id=14498

        There were two bugs:
        1) xPos/yPos were flipped
        2) + binds tighter than ?:, so the order of operations was incorrect

        Reviewed by Darin.

        Test: fast/inline-block/14498-positionForCoordinates.html

        * rendering/RenderContainer.cpp:
        (WebCore::RenderContainer::positionForCoordinates):

LayoutTests:

        Test for Bug 14498: RenderContainer::positionForCoordinates contains an order of operations error
        http://bugs.webkit.org/show_bug.cgi?id=14498

        Reviewed by Darin.

        * fast/inline-block/14498-positionForCoordinates-expected.txt: Added.
        * fast/inline-block/14498-positionForCoordinates.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorerenderingRenderContainercpp">trunk/WebCore/rendering/RenderContainer.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastinlineblock14498positionForCoordinatesexpectedtxt">trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastinlineblock14498positionForCoordinateshtml">trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (23937 => 23938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2007-07-02 23:30:13 UTC (rev 23937)
+++ trunk/LayoutTests/ChangeLog        2007-07-02 23:54:22 UTC (rev 23938)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2007-07-02  Adam Roben  &lt;aroben@apple.com&gt;
+
+        Test for Bug 14498: RenderContainer::positionForCoordinates contains an order of operations error
+        http://bugs.webkit.org/show_bug.cgi?id=14498
+
+        Reviewed by Darin.
+
+        * fast/inline-block/14498-positionForCoordinates-expected.txt: Added.
+        * fast/inline-block/14498-positionForCoordinates.html: Added.
+
</ins><span class="cx"> 2007-07-01  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fixed a no-SVG test failure by removing a node that was affecting the test results differently
</span></span></pre></div>
<a id="trunkLayoutTestsfastinlineblock14498positionForCoordinatesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates-expected.txt (0 => 23938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates-expected.txt        2007-07-02 23:54:22 UTC (rev 23938)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 93x18
+          text run at (0,0) width 93: &quot;This test is for &quot;
+        RenderInline {A} at (0,0) size 299x18 [color=#0000EE]
+          RenderText {#text} at (93,0) size 299x18
+            text run at (93,0) width 299: &quot;http://bugs.webkit.org/show_bug.cgi?id=14498&quot;
+        RenderText {#text} at (392,0) size 4x18
+          text run at (392,0) width 4: &quot;.&quot;
+      RenderBlock {P} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 402x18
+          text run at (0,0) width 402: &quot;Click inside the right border. The caret should move after \x{201C}bar\x{201D}.&quot;
+      RenderBlock (anonymous) at (0,68) size 784x18
+        RenderInline {SPAN} at (0,0) size 65x38 [border: (10px solid #0000FF)]
+          RenderText {#text} at (0,0) size 0x0
+          RenderBlock {DIV} at (10,0) size 21x18
+            RenderText {#text} at (0,0) size 21x18
+              text run at (0,0) width 21: &quot;foo&quot;
+          RenderText {#text} at (31,0) size 4x18
+            text run at (31,0) width 4: &quot; &quot;
+          RenderBlock {DIV} at (35,0) size 20x18
+            RenderText {#text} at (0,0) size 20x18
+              text run at (0,0) width 20: &quot;bar&quot;
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+caret: position 3 of child 0 {#text} of child 1 {DIV} of child 5 {SPAN} of child 1 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkLayoutTestsfastinlineblock14498positionForCoordinateshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates.html (0 => 23938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates.html                                (rev 0)
+++ trunk/LayoutTests/fast/inline-block/14498-positionForCoordinates.html        2007-07-02 23:54:22 UTC (rev 23938)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        span { border: 10px solid blue; }
+        div { display:inline-block; }
+    &lt;/style&gt;
+    &lt;script&gt;
+        function test()
+        {
+            var span = document.getElementById(&quot;span&quot;);
+            var x = span.offsetLeft + span.offsetWidth - 5;
+            var y = span.offsetTop + (span.offsetHeight / 2);
+            if (window.eventSender) {
+                eventSender.mouseMoveTo(x, y);
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+            }
+        }
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot; contenteditable=&quot;true&quot;&gt;
+    &lt;p&gt;This test is for &lt;a href=&quot;http://bugs.webkit.org/show_bug.cgi?id=14498&quot;&gt;http://bugs.webkit.org/show_bug.cgi?id=14498&lt;/a&gt;.&lt;/p&gt;
+    &lt;p&gt;Click inside the right border. The caret should move after &amp;ldquo;bar&amp;rdquo;.&lt;/p&gt;
+    &lt;span id=&quot;span&quot; style=&quot;&quot;&gt;
+        &lt;div&gt;foo&lt;/div&gt;
+        &lt;div&gt;bar&lt;/div&gt;
+    &lt;/span&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (23937 => 23938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-07-02 23:30:13 UTC (rev 23937)
+++ trunk/WebCore/ChangeLog        2007-07-02 23:54:22 UTC (rev 23938)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2007-07-02  Adam Roben  &lt;aroben@apple.com&gt;
+
+        Fix Bug 14498: RenderContainer::positionForCoordinates contains an order of operations error
+        http://bugs.webkit.org/show_bug.cgi?id=14498
+
+        There were two bugs:
+        1) xPos/yPos were flipped
+        2) + binds tighter than ?:, so the order of operations was incorrect
+
+        Reviewed by Darin.
+
+        Test: fast/inline-block/14498-positionForCoordinates.html
+
+        * rendering/RenderContainer.cpp:
+        (WebCore::RenderContainer::positionForCoordinates):
+
</ins><span class="cx"> 2007-07-02  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Kevin Decker and Tim Hatcher.
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderContainercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderContainer.cpp (23937 => 23938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderContainer.cpp        2007-07-02 23:30:13 UTC (rev 23937)
+++ trunk/WebCore/rendering/RenderContainer.cpp        2007-07-02 23:54:22 UTC (rev 23938)
</span><span class="lines">@@ -583,9 +583,9 @@
</span><span class="cx">             || renderer-&gt;style()-&gt;visibility() != VISIBLE)
</span><span class="cx">             continue;
</span><span class="cx">         
</span><del>-        int top = borderTop() + paddingTop() + isTableRow() ? 0 : renderer-&gt;xPos();
</del><ins>+        int top = borderTop() + paddingTop() + (isTableRow() ? 0 : renderer-&gt;yPos());
</ins><span class="cx">         int bottom = top + renderer-&gt;contentHeight();
</span><del>-        int left = borderLeft() + paddingLeft() + isTableRow() ? 0 : renderer-&gt;yPos();
</del><ins>+        int left = borderLeft() + paddingLeft() + (isTableRow() ? 0 : renderer-&gt;xPos());
</ins><span class="cx">         int right = left + renderer-&gt;contentWidth();
</span><span class="cx">         
</span><span class="cx">         if (x &lt;= right &amp;&amp; x &gt;= left &amp;&amp; y &lt;= top &amp;&amp; y &gt;= bottom) {
</span></span></pre>
</div>
</div>

</body>
</html>