<!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>[42732] 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/42732">42732</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2009-04-21 16:30:05 -0700 (Tue, 21 Apr 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebCore:

2009-04-21  Darin Adler  &lt;darin@apple.com&gt;

        Reviewed by Dan Bernstein.

        Bug 25162: REGRESSION (r41176-r41242): Drag-selection above/below the line does not select to beginning/end
        https://bugs.webkit.org/show_bug.cgi?id=25162
        rdar://problem/6764354

        * page/Settings.cpp:
        (WebCore::Settings::Settings): Initialize editing behavior to Mac-style for PLATFORM(MAC).
        Later we may want to change this default to encompass other versions running on Mac.

        * page/Settings.h: Added EditingBehavior, setEditingBehavior, editingBehavior, and
        m_editingBehavior. Also moved m_maximumDecodedImageSize out of the middle of all
        the bit fields.

        * platform/graphics/IntPoint.h: Added a constructor to turn an IntSize into an IntPoint.
        I'm not sure the distinction here is serving us well at the moment. When converting from
        global to local coordinates you want to do IntPoint - IntPoint and have the result be
        another IntPoint, not an IntSize. And so on.

        * rendering/RenderBlock.cpp:
        (WebCore::positionForPointRespectingEditingBoundaries): Changed to use pointers more and
        separate coordinates less.
        (WebCore::RenderBlock::positionForPointWithInlineChildren): Turned into a member function.
        Added separate cases to support the Mac and Windows behavior.
        (WebCore::RenderBlock::positionForPoint): Updated for the change above. Also moved the
        computation of pointInContents closer to the place it's used.

        * rendering/RenderBlock.h: Updated for the new private member function.

LayoutTests:

2009-04-21  Darin Adler  &lt;darin@apple.com&gt;

        Reviewed by Dan Bernstein.

        Bug 25162: REGRESSION (r41176-r41242): Drag-selection above/below the line does not select to beginning/end
        https://bugs.webkit.org/show_bug.cgi?id=25162
        rdar://problem/6764354

        * editing/selection/resources/click-in-margins-inside-editable-div.js:
        Updated to expect different results on the Mac.
        * editing/selection/resources/click-in-padding-with-multiple-line-boxes.js: Ditto.

        * fast/css-generated-content/positioned-background-hit-test-crash.html: Clear the selection at
        the end of the test so the result won't include a caret.

        * platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt:
        * platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt:
        Copied from LayoutTests/editing/selection. Then changed to expect the different Mac results.

        * platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum:
        * platform/mac/editing/selection/select-from-textfield-outwards-expected.png:
        * platform/mac/editing/selection/select-from-textfield-outwards-expected.txt:
        Changed to expect the different Mac results.

        * platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt:
        Changed to expect no caret.

        * platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt:
        * platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt:
        Copied from editing/selection.

        * platform/win/editing/selection/select-from-textfield-outwards-expected.checksum:
        * platform/win/editing/selection/select-from-textfield-outwards-expected.png:
        * platform/win/editing/selection/select-from-textfield-outwards-expected.txt:
        Copied from platform/mac/editing/selection.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingselectionresourcesclickinmarginsinsideeditabledivjs">trunk/LayoutTests/editing/selection/resources/click-in-margins-inside-editable-div.js</a></li>
<li><a href="#trunkLayoutTestseditingselectionresourcesclickinpaddingwithmultiplelineboxesjs">trunk/LayoutTests/editing/selection/resources/click-in-padding-with-multiple-line-boxes.js</a></li>
<li><a href="#trunkLayoutTestsfastcssgeneratedcontentpositionedbackgroundhittestcrashhtml">trunk/LayoutTests/fast/css-generated-content/positioned-background-hit-test-crash.html</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedchecksum">trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedpng">trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedtxt">trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastcssgeneratedcontentpositionedbackgroundhittestcrashexpectedtxt">trunk/LayoutTests/platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorebindingsjsJSLazyEventListenercpp">trunk/WebCore/bindings/js/JSLazyEventListener.cpp</a></li>
<li><a href="#trunkWebCorepageSettingscpp">trunk/WebCore/page/Settings.cpp</a></li>
<li><a href="#trunkWebCorepageSettingsh">trunk/WebCore/page/Settings.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicsIntPointh">trunk/WebCore/platform/graphics/IntPoint.h</a></li>
<li><a href="#trunkWebCorerenderingRenderBlockcpp">trunk/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkWebCorerenderingRenderBlockh">trunk/WebCore/rendering/RenderBlock.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmaceditingselectionclickinmarginsinsideeditabledivexpectedtxt">trunk/LayoutTests/platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditingselectionclickinpaddingwithmultiplelineboxesexpectedtxt">trunk/LayoutTests/platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwineditingselectionclickinmarginsinsideeditabledivexpectedtxt">trunk/LayoutTests/platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwineditingselectionclickinpaddingwithmultiplelineboxesexpectedtxt">trunk/LayoutTests/platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedchecksum">trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.checksum</a></li>
<li><a href="#trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedpng">trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedtxt">trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/ChangeLog        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2009-04-21  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Reviewed by Dan Bernstein.
+
+        Bug 25162: REGRESSION (r41176-r41242): Drag-selection above/below the line does not select to beginning/end
+        https://bugs.webkit.org/show_bug.cgi?id=25162
+        rdar://problem/6764354
+
+        * editing/selection/resources/click-in-margins-inside-editable-div.js:
+        Updated to expect different results on the Mac.
+        * editing/selection/resources/click-in-padding-with-multiple-line-boxes.js: Ditto.
+
+        * fast/css-generated-content/positioned-background-hit-test-crash.html: Clear the selection at
+        the end of the test so the result won't include a caret.
+
+        * platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt:
+        * platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt:
+        Copied from LayoutTests/editing/selection. Then changed to expect the different Mac results.
+
+        * platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum:
+        * platform/mac/editing/selection/select-from-textfield-outwards-expected.png:
+        * platform/mac/editing/selection/select-from-textfield-outwards-expected.txt:
+        Changed to expect the different Mac results.
+
+        * platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt:
+        Changed to expect no caret.
+
+        * platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt:
+        * platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt:
+        Copied from editing/selection.
+
+        * platform/win/editing/selection/select-from-textfield-outwards-expected.checksum:
+        * platform/win/editing/selection/select-from-textfield-outwards-expected.png:
+        * platform/win/editing/selection/select-from-textfield-outwards-expected.txt:
+        Copied from platform/mac/editing/selection.
+
+2009-04-21  Darin Adler  &lt;darin@apple.com&gt;
+
</ins><span class="cx">         Reviewed by Adele Peterson.
</span><span class="cx"> 
</span><span class="cx">         Fix some tests that are depending on Mac vs. Windows selection quirks accidentally.
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectionresourcesclickinmarginsinsideeditabledivjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/selection/resources/click-in-margins-inside-editable-div.js (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/resources/click-in-margins-inside-editable-div.js        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/editing/selection/resources/click-in-margins-inside-editable-div.js        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -60,27 +60,34 @@
</span><span class="cx"> // FF3: vertical padding box + some sort of overhang decent?
</span><span class="cx"> // IE6/IE7: vertical padding box
</span><span class="cx"> // IE8 b2: margin box
</span><del>-// Safari3: margin box (but cursor goes at end of line)
</del><ins>+// Safari 3: margin box (but cursor goes at end of line)
</ins><span class="cx"> 
</span><ins>+// We're going to follow IE 7's behavior and use the padding box height
+// for determining if the click below a div (in the padding/margin region)
+
+// The rules for clicking above or below the text are different on Windows and Mac.
+// Later we could break this into two tests, one that tests each platform's rules,
+// since this is supported as a setting in the Settings object, but for now we'll
+// just use separate expected results for Mac and other platforms.
+var expectMacStyleSelection = navigator.userAgent.search(/\bMac OS X\b/) != -1;
+
</ins><span class="cx"> clickShouldResultInRange(10, 10, firstText, 0);
</span><del>-clickShouldResultInRange(40, 10, firstText, 1);
-clickShouldResultInRange(70, 10, firstText, 2);
</del><ins>+clickShouldResultInRange(40, 10, firstText, expectMacStyleSelection ? 0 : 1);
+clickShouldResultInRange(70, 10, firstText, expectMacStyleSelection ? 0 : 2);
</ins><span class="cx"> 
</span><span class="cx"> clickShouldResultInRange(10, 30, firstText, 0);
</span><span class="cx"> clickShouldResultInRange(70, 30, firstText, 2);
</span><span class="cx"> 
</span><del>-clickShouldResultInRange(10, 50, firstText, 0);
-clickShouldResultInRange(40, 50, firstText, 1);
</del><ins>+clickShouldResultInRange(10, 50, firstText, expectMacStyleSelection ? 2 : 0);
+clickShouldResultInRange(40, 50, firstText, expectMacStyleSelection ? 2 : 1);
</ins><span class="cx"> clickShouldResultInRange(70, 50, firstText, 2);
</span><span class="cx"> 
</span><del>-// We're going to follow IE 7's behavior and use the padding box height
-// for determining if the click below a div (in the padding/margin region)
</del><span class="cx"> clickShouldResultInRange(10, 70, secondText, 0);
</span><del>-clickShouldResultInRange(40, 70, secondText, 1);
-clickShouldResultInRange(70, 70, secondText, 2);
</del><ins>+clickShouldResultInRange(40, 70, secondText, expectMacStyleSelection ? 0 : 1);
+clickShouldResultInRange(70, 70, secondText, expectMacStyleSelection ? 0 : 2);
</ins><span class="cx"> 
</span><del>-clickShouldResultInRange(10, 110, secondText, 0);
-clickShouldResultInRange(40, 110, secondText, 1);
</del><ins>+clickShouldResultInRange(10, 110, secondText, expectMacStyleSelection ? 2 : 0);
+clickShouldResultInRange(40, 110, secondText, expectMacStyleSelection ? 2 : 1);
</ins><span class="cx"> clickShouldResultInRange(70, 110, secondText, 2);
</span><span class="cx"> 
</span><span class="cx"> // Clean up after ourselves if we're not being run in the browser
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectionresourcesclickinpaddingwithmultiplelineboxesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/selection/resources/click-in-padding-with-multiple-line-boxes.js (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/resources/click-in-padding-with-multiple-line-boxes.js        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/editing/selection/resources/click-in-padding-with-multiple-line-boxes.js        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -46,11 +46,23 @@
</span><span class="cx">     }, false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// The rules for clicking below the text are different on Windows and Mac.
+// Later we could break this into two tests, one that tests each platform's rules,
+// since this is supported as a setting in the Settings object, but for now, we'll
+// just use separate expected results for Mac and other platforms.
+var expectMacStyleSelection = navigator.userAgent.search(/\bMac OS X\b/) != -1;
+
</ins><span class="cx"> var foo = document.getElementById('foo');
</span><span class="cx"> var x = foo.offsetLeft - div.scrollLeft + 10;
</span><ins>+
</ins><span class="cx"> // Click 10px after the start of the span should put the cursor right after the letter F.
</span><del>-clickShouldResultInRange(x, foo.offsetTop - 20, foo.firstChild, 1);
-clickShouldResultInRange(x, foo.offsetTop + 20, foo.firstChild, 1);
</del><ins>+if (expectMacStyleSelection) {
+    clickShouldResultInRange(x, foo.offsetTop - 20, div.firstChild, 0);
+    clickShouldResultInRange(x, foo.offsetTop + 20, div.lastChild.firstChild, 3);
+} else {
+    clickShouldResultInRange(x, foo.offsetTop - 20, foo.firstChild, 1);
+    clickShouldResultInRange(x, foo.offsetTop + 20, foo.firstChild, 1);
+}
</ins><span class="cx"> 
</span><span class="cx"> // Clean up after ourselves if we're not being run in the browser
</span><span class="cx"> if (window.eventSender) {
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgeneratedcontentpositionedbackgroundhittestcrashhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-generated-content/positioned-background-hit-test-crash.html (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-generated-content/positioned-background-hit-test-crash.html        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/fast/css-generated-content/positioned-background-hit-test-crash.html        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">             function finishTest()
</span><span class="cx">             {
</span><span class="cx">                 eventSender.mouseUp();
</span><ins>+                getSelection().removeAllRanges();
</ins><span class="cx">                 layoutTestController.notifyDone();
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingselectionclickinmarginsinsideeditabledivexpectedtxtfromrev42722trunkLayoutTestseditingselectionclickinmarginsinsideeditabledivexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt (from rev 42722, trunk/LayoutTests/editing/selection/click-in-margins-inside-editable-div-expected.txt) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/editing/selection/click-in-margins-inside-editable-div-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Ensure cursor placement matches IE6/IE7/FF3 when clicking above/below lines in padding.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingselectionclickinpaddingwithmultiplelineboxesexpectedtxtfromrev42722trunkLayoutTestseditingselectionclickinpaddingwithmultiplelineboxesexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt (from rev 42722, trunk/LayoutTests/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Click above/beneath the word FOO. Notice how the cursor goes in the right place (after the letter F).
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedchecksum"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -1 +1 @@
</span><del>-a9dff453693ec12631b35838d42ae03c
</del><span class="cx">\ No newline at end of file
</span><ins>+0f2bd61cb8bece5be1a37ca2270afb67
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedpng"></a>
<div class="binary"><h4>Modified: trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -8,10 +8,10 @@
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><ins>+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV toDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</ins><span class="cx"> EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</span><span class="cx"> EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</span><span class="cx"> EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</span><del>-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
</del><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderView at (0,0) size 800x600
</span><span class="cx"> layer at (0,0) size 800x600
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastcssgeneratedcontentpositionedbackgroundhittestcrashexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/LayoutTests/platform/mac/fast/css-generated-content/positioned-background-hit-test-crash-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -10,4 +10,3 @@
</span><span class="cx"> layer at (8,21) size 202x202
</span><span class="cx">   RenderBlock (positioned) at (0,0) size 202x202 [border: (1px solid #FF0000)]
</span><span class="cx">     RenderText at (0,0) size 0x0
</span><del>-caret: position 0 of child 0 {#text} of child 1 {H1} of child 1 {BODY} of child 1 {HTML} of document
</del></span></pre></div>
<a id="trunkLayoutTestsplatformwineditingselectionclickinmarginsinsideeditabledivexpectedtxtfromrev42722trunkLayoutTestseditingselectionclickinmarginsinsideeditabledivexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt (from rev 42722, trunk/LayoutTests/editing/selection/click-in-margins-inside-editable-div-expected.txt) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/win/editing/selection/click-in-margins-inside-editable-div-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Ensure cursor placement matches IE6/IE7/FF3 when clicking above/below lines in padding.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 1
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 1
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 1
+PASS Selection is at node: [object Text] offset: 2
+PASS Selection is at node: [object Text] offset: 0
+PASS Selection is at node: [object Text] offset: 1
+PASS Selection is at node: [object Text] offset: 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwineditingselectionclickinpaddingwithmultiplelineboxesexpectedtxtfromrev42722trunkLayoutTestseditingselectionclickinpaddingwithmultiplelineboxesexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt (from rev 42722, trunk/LayoutTests/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/win/editing/selection/click-in-padding-with-multiple-line-boxes-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Click above/beneath the word FOO. Notice how the cursor goes in the right place (after the letter F).
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS Selection is at node: [object Text] offset: 1
+PASS Selection is at node: [object Text] offset: 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedchecksumfromrev42722trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedchecksum"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.checksum (from rev 42722, trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.checksum) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.checksum                                (rev 0)
+++ trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.checksum        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+a9dff453693ec12631b35838d42ae03c
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedpngfromrev42722trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedpng"></a>
<div class="binary"><h4>Copied: trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.png (from rev 42722, trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.png)</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwineditingselectionselectfromtextfieldoutwardsexpectedtxtfromrev42722trunkLayoutTestsplatformmaceditingselectionselectfromtextfieldoutwardsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.txt (from rev 42722, trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt) (0 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/win/editing/selection/select-from-textfield-outwards-expected.txt        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 11 of #text &gt; DIV to 11 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 11 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 12 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 12 of #text &gt; DIV toDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text &gt; DIV to 12 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV toDOMRange:range from 11 of #text &gt; DIV to 17 of #text &gt; DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+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 784x576
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 104x18
+          text run at (0,0) width 104: &quot;This is a test for &quot;
+        RenderInline {I} at (0,0) size 755x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (104,0) size 348x18
+              text run at (104,0) width 348: &quot;http://bugzilla.opendarwin.org/show_bug.cgi?id=9312&quot;
+          RenderText {#text} at (452,0) size 755x36
+            text run at (452,0) width 4: &quot; &quot;
+            text run at (456,0) width 299: &quot;REGRESSION: Selection bug in new text fields&quot;
+            text run at (0,18) width 210: &quot;when selecting past the first letter&quot;
+        RenderText {#text} at (210,18) size 4x18
+          text run at (210,18) width 4: &quot;.&quot;
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+      RenderBlock {P} at (0,70) size 784x54
+        RenderText {#text} at (0,0) size 778x54
+          text run at (0,0) width 778: &quot;Curabitur pretium, quam quis semper malesuada, est libero feugiat libero, vel fringilla orci nibh sed neque. Quisque eu nulla&quot;
+          text run at (0,18) width 732: &quot;non nisi molestie accumsan. Etiam tellus urna, laoreet ac, laoreet non, suscipit sed, sapien. Phasellus vehicula, sem at&quot;
+          text run at (0,36) width 541: &quot;posuere vehicula, augue nibh molestie nisl, nec ullamcorper lacus ante vulputate pede.&quot;
+      RenderBlock (anonymous) at (0,140) size 784x92
+        RenderTextControl {INPUT} at (20,20) size 330x52 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {P} at (0,248) size 784x54
+        RenderText {#text} at (0,0) size 769x54
+          text run at (0,0) width 754: &quot;Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris viverra augue vitae purus.&quot;
+          text run at (0,18) width 769: &quot;Morbi sed sem. Donec dui nisi, ultrices non, pretium quis, hendrerit non, est. Donec tellus. Donec eget dui id eros pharetra&quot;
+          text run at (0,36) width 733: &quot;rutrum. Suspendisse sodales lectus sit amet nulla. Morbi tortor arcu, convallis blandit, elementum eu, aliquet a, tellus.&quot;
+layer at (40,180) size 306x28
+  RenderBlock {DIV} at (12,12) size 306x28
+    RenderText {#text} at (1,0) size 224x28
+      text run at (1,0) width 224: &quot;Lorem ipsum dolor&quot;
+selection start: position 11 of child 0 {#text} of child 0 {DIV} of child 7 {INPUT} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 17 of child 0 {#text} of child 0 {DIV} of child 7 {INPUT} of child 1 {BODY} of child 0 {HTML} of document
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/ChangeLog        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2009-04-21  Darin Adler  &lt;darin@apple.com&gt;
+
+        Reviewed by Dan Bernstein.
+
+        Bug 25162: REGRESSION (r41176-r41242): Drag-selection above/below the line does not select to beginning/end
+        https://bugs.webkit.org/show_bug.cgi?id=25162
+        rdar://problem/6764354
+
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings): Initialize editing behavior to Mac-style for PLATFORM(MAC).
+        Later we may want to change this default to encompass other versions running on Mac.
+
+        * page/Settings.h: Added EditingBehavior, setEditingBehavior, editingBehavior, and
+        m_editingBehavior. Also moved m_maximumDecodedImageSize out of the middle of all
+        the bit fields.
+
+        * platform/graphics/IntPoint.h: Added a constructor to turn an IntSize into an IntPoint.
+        I'm not sure the distinction here is serving us well at the moment. When converting from
+        global to local coordinates you want to do IntPoint - IntPoint and have the result be
+        another IntPoint, not an IntSize. And so on.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::positionForPointRespectingEditingBoundaries): Changed to use pointers more and
+        separate coordinates less.
+        (WebCore::RenderBlock::positionForPointWithInlineChildren): Turned into a member function.
+        Added separate cases to support the Mac and Windows behavior.
+        (WebCore::RenderBlock::positionForPoint): Updated for the change above. Also moved the
+        computation of pointInContents closer to the place it's used.
+
+        * rendering/RenderBlock.h: Updated for the new private member function.
+
</ins><span class="cx"> 2009-04-17  Timothy Hatcher  &lt;timothy@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change pending unload and beforeunload counts to store the listeners
</span></span></pre></div>
<a id="trunkWebCorebindingsjsJSLazyEventListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/bindings/js/JSLazyEventListener.cpp (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/bindings/js/JSLazyEventListener.cpp        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/bindings/js/JSLazyEventListener.cpp        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -37,12 +37,8 @@
</span><span class="cx"> static const String&amp; eventParameterName(bool isSVGEvent)
</span><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(const String, eventString, (&quot;event&quot;));
</span><del>-#if ENABLE(SVG)
</del><span class="cx">     DEFINE_STATIC_LOCAL(const String, evtString, (&quot;evt&quot;));
</span><span class="cx">     return isSVGEvent ? evtString : eventString;
</span><del>-#else
-    return eventString;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSLazyEventListener::JSLazyEventListener(const String&amp; functionName, const String&amp; eventParameterName, const String&amp; code, JSDOMGlobalObject* globalObject, Node* node, int lineNumber)
</span></span></pre></div>
<a id="trunkWebCorepageSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/Settings.cpp (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/Settings.cpp        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/page/Settings.cpp        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx"> #include &quot;PageCache.h&quot;
</span><span class="cx"> #include &lt;limits&gt;
</span><span class="cx"> 
</span><ins>+using namespace std;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static void setNeedsReapplyStylesInAllFrames(Page* page)
</span><span class="lines">@@ -53,6 +55,7 @@
</span><span class="cx">     , m_minimumLogicalFontSize(0)
</span><span class="cx">     , m_defaultFontSize(0)
</span><span class="cx">     , m_defaultFixedFontSize(0)
</span><ins>+    , m_maximumDecodedImageSize(numeric_limits&lt;size_t&gt;::max())
</ins><span class="cx">     , m_isJavaEnabled(false)
</span><span class="cx">     , m_loadsImagesAutomatically(false)
</span><span class="cx">     , m_privateBrowsingEnabled(false)
</span><span class="lines">@@ -88,8 +91,14 @@
</span><span class="cx">     , m_zoomsTextOnly(false)
</span><span class="cx">     , m_enforceCSSMIMETypeInStrictMode(true)
</span><span class="cx">     , m_usesEncodingDetector(false)
</span><del>-    , m_maximumDecodedImageSize(std::numeric_limits&lt;size_t&gt;::max())
</del><span class="cx">     , m_allowScriptsToCloseWindows(false)
</span><ins>+    , m_editingBehavior(
+#if PLATFORM(MAC)
+        EditingMacBehavior
+#else
+        EditingWindowsBehavior
+#endif
+        )
</ins><span class="cx"> {
</span><span class="cx">     // A Frame may not have been created yet, so we initialize the AtomicString 
</span><span class="cx">     // hash before trying to use it.
</span></span></pre></div>
<a id="trunkWebCorepageSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/Settings.h (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/Settings.h        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/page/Settings.h        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> #define Settings_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AtomicString.h&quot;
</span><del>-#include &quot;FontDescription.h&quot;
</del><ins>+#include &quot;FontRenderingMode.h&quot;
</ins><span class="cx"> #include &quot;KURL.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx">     class Page;
</span><span class="cx"> 
</span><span class="cx">     enum EditableLinkBehavior {
</span><del>-        EditableLinkDefaultBehavior = 0,
</del><ins>+        EditableLinkDefaultBehavior,
</ins><span class="cx">         EditableLinkAlwaysLive,
</span><span class="cx">         EditableLinkOnlyLiveWithShiftKey,
</span><span class="cx">         EditableLinkLiveWhenNotFocused,
</span><span class="lines">@@ -49,6 +49,21 @@
</span><span class="cx">         TextDirectionSubmenuAlwaysIncluded
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    // There are multiple editing details that are different on Windows than Macintosh.
+    // We use a single switch for all of them. Some examples:
+    //
+    //    1) Clicking below the last line of an editable area puts the caret at the end
+    //       of the last line on Mac, but in the middle of the last line on Windows.
+    //    2) Pushing the down arrow key on the last line puts the caret at the end of the
+    //       last line on Mac, but does nothing on Windows. A similar case exists on the
+    //       top line.
+    //
+    // This setting is intended to control these sorts of behaviors. There are some other
+    // behaviors with individual function calls on EditorClient (smart copy and paste and
+    // selecting the space after a double click) that could be combined with this if
+    // if possible in the future.
+    enum EditingBehavior { EditingMacBehavior, EditingWindowsBehavior };
+
</ins><span class="cx">     class Settings {
</span><span class="cx">     public:
</span><span class="cx">         Settings(Page*);
</span><span class="lines">@@ -214,6 +229,9 @@
</span><span class="cx">         void setAllowScriptsToCloseWindows(bool);
</span><span class="cx">         bool allowScriptsToCloseWindows() const { return m_allowScriptsToCloseWindows; }
</span><span class="cx"> 
</span><ins>+        void setEditingBehavior(EditingBehavior behavior) { m_editingBehavior = behavior; }
+        EditingBehavior editingBehavior() const { return static_cast&lt;EditingBehavior&gt;(m_editingBehavior); }
+
</ins><span class="cx">     private:
</span><span class="cx">         Page* m_page;
</span><span class="cx">         
</span><span class="lines">@@ -233,6 +251,7 @@
</span><span class="cx">         int m_minimumLogicalFontSize;
</span><span class="cx">         int m_defaultFontSize;
</span><span class="cx">         int m_defaultFixedFontSize;
</span><ins>+        size_t m_maximumDecodedImageSize;
</ins><span class="cx">         bool m_isJavaEnabled : 1;
</span><span class="cx">         bool m_loadsImagesAutomatically : 1;
</span><span class="cx">         bool m_privateBrowsingEnabled : 1;
</span><span class="lines">@@ -268,8 +287,8 @@
</span><span class="cx">         bool m_zoomsTextOnly : 1;
</span><span class="cx">         bool m_enforceCSSMIMETypeInStrictMode : 1;
</span><span class="cx">         bool m_usesEncodingDetector : 1;
</span><del>-        size_t m_maximumDecodedImageSize;
</del><span class="cx">         bool m_allowScriptsToCloseWindows : 1;
</span><ins>+        unsigned m_editingBehavior : 1;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(SAFARI_THEME)
</span><span class="cx">         static bool gShouldPaintNativeControls;
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsIntPointh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/IntPoint.h (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/IntPoint.h        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/platform/graphics/IntPoint.h        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> public:
</span><span class="cx">     IntPoint() : m_x(0), m_y(0) { }
</span><span class="cx">     IntPoint(int x, int y) : m_x(x), m_y(y) { }
</span><ins>+    explicit IntPoint(const IntSize&amp; size) : m_x(size.width()), m_y(size.height()) { }
</ins><span class="cx"> 
</span><span class="cx">     int x() const { return m_x; }
</span><span class="cx">     int y() const { return m_y; }
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderBlock.cpp (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderBlock.cpp        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/rendering/RenderBlock.cpp        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;RenderTheme.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;SelectionController.h&quot;
</span><ins>+#include &quot;Settings.h&quot;
</ins><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using namespace std;
</span><span class="lines">@@ -52,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> // Number of pixels to allow as a fudge factor when clicking above or below a line.
</span><span class="cx"> // clicking up to verticalLineClickFudgeFactor pixels above a line will correspond to the closest point on the line.   
</span><del>-const int verticalLineClickFudgeFactor= 3;
</del><ins>+static const int verticalLineClickFudgeFactor = 3;
</ins><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><span class="lines">@@ -3427,17 +3428,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: This function should go on RenderObject as an instance method. Then
</span><del>-// all cases in which positionForCoordinates recurs could call this instead to
</del><ins>+// all cases in which positionForPoint recurs could call this instead to
</ins><span class="cx"> // prevent crossing editable boundaries. This would require many tests.
</span><del>-static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBox* parent, RenderBox* child, const IntPoint&amp; parentCoords)
</del><ins>+static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBox* parent, RenderBox* child, const IntPoint&amp; pointInParentCoordinates)
</ins><span class="cx"> {
</span><del>-    int xInChildCoords = parentCoords.x() - child-&gt;x();
-    int yInChildCoords = parentCoords.y() - child-&gt;y();
</del><ins>+    IntPoint pointInChildCoordinates(pointInParentCoordinates - child-&gt;location());
</ins><span class="cx"> 
</span><span class="cx">     // If this is an anonymous renderer, we just recur normally
</span><span class="cx">     Node* childNode = child-&gt;node();
</span><span class="cx">     if (!childNode)
</span><del>-        return child-&gt;positionForCoordinates(xInChildCoords, yInChildCoords);
</del><ins>+        return child-&gt;positionForPoint(pointInChildCoordinates);
</ins><span class="cx"> 
</span><span class="cx">     // Otherwise, first make sure that the editability of the parent and child agree.
</span><span class="cx">     // If they don't agree, then we return a visible position just before or after the child
</span><span class="lines">@@ -3447,54 +3447,79 @@
</span><span class="cx"> 
</span><span class="cx">     // If we can't find an ancestor to check editability on, or editability is unchanged, we recur like normal
</span><span class="cx">     if (!ancestor || ancestor-&gt;node()-&gt;isContentEditable() == childNode-&gt;isContentEditable())
</span><del>-        return child-&gt;positionForCoordinates(xInChildCoords, yInChildCoords);
</del><ins>+        return child-&gt;positionForPoint(pointInChildCoordinates);
</ins><span class="cx"> 
</span><span class="cx">     // Otherwise return before or after the child, depending on if the click was left or right of the child
</span><span class="cx">     int childMidX = child-&gt;width() / 2;
</span><del>-    if (xInChildCoords &lt; childMidX)
</del><ins>+    if (pointInChildCoordinates.x() &lt; childMidX)
</ins><span class="cx">         return ancestor-&gt;createVisiblePosition(childNode-&gt;nodeIndex(), DOWNSTREAM);
</span><span class="cx">     return ancestor-&gt;createVisiblePosition(childNode-&gt;nodeIndex() + 1, UPSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static VisiblePosition positionForPointWithInlineChildren(RenderBlock* block, const IntPoint&amp; pointInContents)
</del><ins>+VisiblePosition RenderBlock::positionForPointWithInlineChildren(const IntPoint&amp; pointInContents)
</ins><span class="cx"> {
</span><del>-    ASSERT(block-&gt;childrenInline());
</del><ins>+    ASSERT(childrenInline());
</ins><span class="cx"> 
</span><del>-    if (!block-&gt;firstRootBox())
-        return block-&gt;createVisiblePosition(0, DOWNSTREAM);
</del><ins>+    if (!firstRootBox())
+        return createVisiblePosition(0, DOWNSTREAM);
</ins><span class="cx"> 
</span><ins>+    // look for the closest line box in the root box which is at the passed-in y coordinate
</ins><span class="cx">     InlineBox* closestBox = 0;
</span><del>-    // look for the closest line box in the root box which is at the passed-in y coordinate
-    for (RootInlineBox* root = block-&gt;firstRootBox(); root; root = root-&gt;nextRootBox()) {
</del><ins>+    RootInlineBox* firstRootBoxWithChildren = 0;
+    RootInlineBox* lastRootBoxWithChildren = 0;
+    for (RootInlineBox* root = firstRootBox(); root; root = root-&gt;nextRootBox()) {
+        if (!root-&gt;firstChild())
+            continue;
+        if (!firstRootBoxWithChildren)
+            firstRootBoxWithChildren = root;
+        lastRootBoxWithChildren = root;
+
+        // set the bottom based on whether there is a next root box
+        // FIXME: This will consider nextRootBox even if it has no children, and maybe it shouldn't.
</ins><span class="cx">         int bottom;
</span><del>-        // set the bottom based on whether there is a next root box
-        if (root-&gt;nextRootBox())
-            // FIXME: make the break point halfway between the bottom of the previous root box and the top of the next root box
</del><ins>+        if (root-&gt;nextRootBox()) {
+            // FIXME: We would prefer to make the break point halfway between the bottom
+            // of the previous root box and the top of the next root box.
</ins><span class="cx">             bottom = root-&gt;nextRootBox()-&gt;topOverflow();
</span><del>-        else
</del><ins>+        } else
</ins><span class="cx">             bottom = root-&gt;bottomOverflow() + verticalLineClickFudgeFactor;
</span><ins>+
</ins><span class="cx">         // check if this root line box is located at this y coordinate
</span><del>-        if (pointInContents.y() &lt; bottom &amp;&amp; root-&gt;firstChild()) {
</del><ins>+        if (pointInContents.y() &lt; bottom) {
</ins><span class="cx">             closestBox = root-&gt;closestLeafChildForXPos(pointInContents.x());
</span><span class="cx">             if (closestBox)
</span><del>-                // pass the box a y position that is inside it
</del><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // y coordinate is below last root line box, pretend we hit it
-    if (!closestBox)
-        closestBox = block-&gt;lastRootBox()-&gt;closestLeafChildForXPos(pointInContents.x());
</del><ins>+    Settings* settings = document()-&gt;settings();
+    bool useWindowsBehavior = settings &amp;&amp; settings-&gt;editingBehavior() == EditingWindowsBehavior;
</ins><span class="cx"> 
</span><ins>+    if (useWindowsBehavior &amp;&amp; !closestBox &amp;&amp; lastRootBoxWithChildren) {
+        // y coordinate is below last root line box, pretend we hit it
+        closestBox = lastRootBoxWithChildren-&gt;closestLeafChildForXPos(pointInContents.x());
+    }
+
</ins><span class="cx">     if (closestBox) {
</span><ins>+        if (!useWindowsBehavior &amp;&amp; pointInContents.y() &lt; firstRootBoxWithChildren-&gt;topOverflow() - verticalLineClickFudgeFactor) {
+            // y coordinate is above first root line box, so return the start of the first
+            return VisiblePosition(positionForBox(firstRootBoxWithChildren-&gt;firstLeafChild(), true), DOWNSTREAM);
+        }
+
</ins><span class="cx">         // pass the box a y position that is inside it
</span><del>-        return closestBox-&gt;renderer()-&gt;positionForCoordinates(pointInContents.x(), closestBox-&gt;m_y);
</del><ins>+        return closestBox-&gt;renderer()-&gt;positionForPoint(IntPoint(pointInContents.x(), closestBox-&gt;m_y));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Can't reach this.  We have a root line box, but it has no kids.
</del><ins>+    if (lastRootBoxWithChildren) {
+        // We hit this case for Mac behavior when the Y coordinate is below the last box.
+        ASSERT(!useWindowsBehavior);
+        return VisiblePosition(positionForBox(lastRootBoxWithChildren-&gt;lastLeafChild(), false), DOWNSTREAM);
+    }
+
+    // Can't reach this. We have a root line box, but it has no kids.
</ins><span class="cx">     // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text
</span><del>-    // seems to hit this codepath.
-    return block-&gt;createVisiblePosition(0, DOWNSTREAM);
</del><ins>+    // seems to hit this code path.
+    return createVisiblePosition(0, DOWNSTREAM);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline bool isChildHitTestCandidate(RenderBox* box)
</span><span class="lines">@@ -3507,11 +3532,6 @@
</span><span class="cx">     if (isTable())
</span><span class="cx">         return RenderBox::positionForPoint(point);
</span><span class="cx"> 
</span><del>-    int contentsX = point.x();
-    int contentsY = point.y();
-    offsetForContents(contentsX, contentsY);
-    IntPoint pointInContents(contentsX, contentsY);
-
</del><span class="cx">     if (isReplaced()) {
</span><span class="cx">         if (point.y() &lt; 0 || (point.y() &lt; height() &amp;&amp; point.x() &lt; 0))
</span><span class="cx">             return createVisiblePosition(caretMinOffset(), DOWNSTREAM);
</span><span class="lines">@@ -3519,10 +3539,14 @@
</span><span class="cx">             return createVisiblePosition(caretMaxOffset(), DOWNSTREAM);
</span><span class="cx">     } 
</span><span class="cx"> 
</span><del>-    if (childrenInline()) {
-        return positionForPointWithInlineChildren(this, pointInContents);
-    }
</del><ins>+    int contentsX = point.x();
+    int contentsY = point.y();
+    offsetForContents(contentsX, contentsY);
+    IntPoint pointInContents(contentsX, contentsY);
</ins><span class="cx"> 
</span><ins>+    if (childrenInline())
+        return positionForPointWithInlineChildren(pointInContents);
+
</ins><span class="cx">     if (lastChildBox() &amp;&amp; contentsY &gt; lastChildBox()-&gt;y()) {
</span><span class="cx">         for (RenderBox* childBox = lastChildBox(); childBox; childBox = childBox-&gt;previousSiblingBox()) {
</span><span class="cx">             if (isChildHitTestCandidate(childBox))
</span><span class="lines">@@ -3536,8 +3560,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // We only get here if there are no, or only floated/positioned, or only
-    // non-visible block children below the click.
</del><ins>+    // We only get here if there are no hit test candidate children below the click.
</ins><span class="cx">     return RenderBox::positionForPoint(point);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderBlock.h (42731 => 42732)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderBlock.h        2009-04-21 21:58:42 UTC (rev 42731)
+++ trunk/WebCore/rendering/RenderBlock.h        2009-04-21 23:30:05 UTC (rev 42732)
</span><span class="lines">@@ -343,6 +343,7 @@
</span><span class="cx"> private:
</span><span class="cx">     Position positionForBox(InlineBox*, bool start = true) const;
</span><span class="cx">     Position positionForRenderer(RenderObject*, bool start = true) const;
</span><ins>+    VisiblePosition positionForPointWithInlineChildren(const IntPoint&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // Adjust tx and ty from painting offsets to the local coords of this renderer
</span><span class="cx">     void offsetForContents(int&amp; tx, int&amp; ty) const;
</span></span></pre>
</div>
</div>

</body>
</html>