Reviewed by Justin.
- tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8159
REGRESSION: Clicking outside new text field focuses the field
* fast/forms/input-text-click-inside-expected.png: Added.
* fast/forms/input-text-click-inside-expected.txt: Added.
* fast/forms/input-text-click-inside-expected.checksum: Added.
* fast/forms/input-text-click-inside.html: Added.
* fast/forms/input-text-click-outside-expected.png: Added.
* fast/forms/input-text-click-outside-expected.txt: Added.
* fast/forms/input-text-click-outside-expected.checksum: Added.
* fast/forms/input-text-click-outside.html: Added.
Test clicks both inside and outside an input element.
* editing/selection/contenteditable-click-inside-expected.png: Added.
* editing/selection/contenteditable-click-inside-expected.txt: Added.
* editing/selection/contenteditable-click-inside-expected.checksum: Added.
* editing/selection/contenteditable-click-inside.html: Added.
* editing/selection/contenteditable-click-outside-expected.png: Added.
* editing/selection/contenteditable-click-outside-expected.txt: Added.
* editing/selection/contenteditable-click-outside-expected.checksum: Added.
* editing/selection/contenteditable-click-outside.html: Added.
Added a test for the same situation, but with a div element set
to have editable content.
* editing/inserting/insert-
3851164-fix-expected.txt:
* editing/inserting/insert-
3851164-fix.html:
* editing/inserting/insert-
3907422-fix-expected.txt:
* editing/inserting/insert-
3907422-fix.html:
* editing/pasteboard/paste-text-011-expected.txt:
* editing/pasteboard/paste-text-011.html:
Update some tests that were relying on a bug that would cause a
Select All in a document that contained a single content-editable
element select the contents of that element.
* fast/lists/drag-into-marker-expected.checksum:
* fast/lists/drag-into-marker-expected.png:
* fast/lists/drag-into-marker-expected.txt:
* fast/lists/drag-into-marker.html:
Changed test so that it no longer tests what happens when you drag to a marker
that is outside the content-editable element. We may still want to make that
case behave as before, but that's a separate issue.
* editing/pasteboard/drop-text-without-selection-expected.txt:
* editing/pasteboard/merge-start-blockquote-expected.txt:
* editing/pasteboard/merge-start-list-expected.txt:
* editing/selection/select-all-iframe-expected.txt:
* fast/events/div-focus-expected.txt:
* fast/events/drag-outside-window-expected.txt:
* fast/forms/focus-control-to-page-expected.txt:
* fast/forms/input-changing-value-expected.txt:
* fast/forms/input-maxlength-2-expected.txt:
* fast/forms/input-paste-undo-expected.txt:
* fast/forms/input-text-paste-maxlength-expected.txt:
* fast/forms/input-truncate-newline-expected.txt:
* fast/forms/plaintext-mode-2-expected.txt:
* fast/text/textIteratorNilRenderer-expected.txt:
Update tests where the DOM range endpoints passed to the delegate are slightly
different, but equivalent and still OK.
* editing/pasteboard/paste-
4039777-fix-expected.txt:
Updated tests where the resulting tree is slightly different, but still OK.
* editing/unsupported-content/list-delete-002-expected.checksum:
* editing/unsupported-content/list-delete-002-expected.png:
* editing/unsupported-content/list-delete-002-expected.txt:
Update test where the new code eliminates an unwanted extra space that we
got with the old code.
* editing/deleting/delete-
4038408-fix-expected.txt:
* editing/deleting/delete-
4038408-fix.html:
* editing/input/text-input-controller-expected.txt:
* editing/input/text-input-controller.html:
* fast/forms/attributed-strings-expected.txt:
* fast/forms/attributed-strings.html:
Update tests that were relying on the behavior of Select All putting the
selection inside a content-editable element if that element was the first
in the body; the patch breaks that behavior.
* fast/events/updateLayoutForHitTest-expected.checksum:
* fast/events/updateLayoutForHitTest-expected.png:
Update a test that no longer shows a visible selection.
* editing/selection/
3690703-2-expected.checksum:
* editing/selection/
3690703-2-expected.png:
* editing/selection/
3690703-2-expected.txt:
* editing/selection/
3690703-expected.checksum:
* editing/selection/
3690703-expected.png:
* editing/selection/
3690703-expected.txt:
Updated results for these tests, which have examples of form elements
inside a content-editable area. The old results were wrong; the new results
are not much better, but are OK.
- update some other misc. pixel-test results
* fast/inspector/style-expected.checksum:
* fast/inspector/style-expected.png:
Updated since the name changed to include "-webkit-".
* fast/overflow/childFocusRingClip-expected.checksum:
* fast/overflow/childFocusRingClip-expected.png:
Updated results that now seem to show correct clipping of the focus ring.
* fast/frames/empty-cols-attribute-expected.checksum:
* fast/frames/empty-cols-attribute-expected.png: Added.
Checksum was wrong, png was missing.
* fast/parser/001-expected.checksum:
* fast/parser/001-expected.png:
Checksum and png were incorrect -- changed a while back.
* plugins/embed-attributes-style-expected.checksum: Added.
* plugins/embed-attributes-style-expected.png: Added.
Added pixel-test results for tests that don't have them.
WebCore:
Reviewed by Justin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8159
REGRESSION: Clicking outside new text field focuses the field
This bug has always been present for "content editable" HTML, but
now affects <input type=text> as well. The problem is with the editing
concept of a "deep equivalent". When computing the deep equivalent,
the code can move from outside an editable area to inside. To fix this,
I removed all use of the "deep equivalent" concept.
* rendering/RenderBlock.cpp: (WebCore::RenderBlock::positionForCoordinates):
Changed argument names from _x and _y to just x and y. When the element
is the editable root, changed things so that clicks that are not within
the element at all return positions before or after the element, rather than
always choosing the closest point within the element. This gets us off on
the right foot, by not choosing a position inside an editable root when you
click outside that editable root. This code handles shadowParentNode as well,
and also calls positionForCoordinates on children rather than calling
positionForRenderer (which I believe is now a function that can be removed).
* editing/VisiblePosition.h: Removed the deepEquivalent function.
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::previousVisiblePosition): Removed use of the
deepEquivalent function. Also, to make this function easier to understand
I separated out the case where the start point is "in rendered content"
and the case where it's not into two separate loops.
(WebCore::VisiblePosition::nextVisiblePosition): Ditto.
(WebCore::VisiblePosition::initDeepPosition): Removed use of the deepEquivalent
function. Also added code to make sure that this work never turns a position
outside an editable element into a position inside that editable element, or
vice versa. Reorganized the code a bit.
* dom/Position.cpp:
(WebCore::Position::upstream): Removed use of the deepEquivalent function.
(WebCore::Position::downstream): Ditto.
* editing/htmlediting.cpp:
(WebCore::editingIgnoresContent): Changed to use isReplaced instead of isWidget
and isImage to determine if editing should ignore content.
(WebCore::firstInSpecialElement): Rewrote isFirstVisiblePositionInSpecialElement
to have code to share with positionBeforeContainingSpecialElement. And changed
to allow both the position just before a table and the position just inside a
table to qualify. While this is slightly sloppy, the old code worked because
of the "deep equivalent" technique. This change is needed to get the desired
results even without that technique.
(WebCore::lastInSpecialElement): Ditto.
(WebCore::isFirstVisiblePositionInSpecialElement): Changed to use the new function.
(WebCore::positionBeforeContainingSpecialElement): Ditto.
(WebCore::isLastVisiblePositionInSpecialElement): Ditto.
(WebCore::positionAfterContainingSpecialElement): Ditto.
* dom/Node.cpp: (WebCore::Node::rootEditableElement): Rewrote to remove
special case for body tag.
- other changes
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setOuterHTML): Added a FIXME about the fact
that this won't merge neighboring text nodes the way setOuterText does.
(WebCore::HTMLElement::setInnerText): Added a FIXME about the fact that
this creates a text node even when setting to empty text.
(WebCore::HTMLElement::setOuterText): Ditto.
* editing/DeleteSelectionCommand.cpp: Removed some #if 1 and #if 0.
* editing/ReplaceSelectionCommand.cpp: A little reformatting.
* rendering/render_button.h: Tiny formatting tweak.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14172
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-05-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Justin.
+
+ - tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8159
+ REGRESSION: Clicking outside new text field focuses the field
+
+ * fast/forms/input-text-click-inside-expected.png: Added.
+ * fast/forms/input-text-click-inside-expected.txt: Added.
+ * fast/forms/input-text-click-inside-expected.checksum: Added.
+ * fast/forms/input-text-click-inside.html: Added.
+ * fast/forms/input-text-click-outside-expected.png: Added.
+ * fast/forms/input-text-click-outside-expected.txt: Added.
+ * fast/forms/input-text-click-outside-expected.checksum: Added.
+ * fast/forms/input-text-click-outside.html: Added.
+ Test clicks both inside and outside an input element.
+
+ * editing/selection/contenteditable-click-inside-expected.png: Added.
+ * editing/selection/contenteditable-click-inside-expected.txt: Added.
+ * editing/selection/contenteditable-click-inside-expected.checksum: Added.
+ * editing/selection/contenteditable-click-inside.html: Added.
+ * editing/selection/contenteditable-click-outside-expected.png: Added.
+ * editing/selection/contenteditable-click-outside-expected.txt: Added.
+ * editing/selection/contenteditable-click-outside-expected.checksum: Added.
+ * editing/selection/contenteditable-click-outside.html: Added.
+ Added a test for the same situation, but with a div element set
+ to have editable content.
+
+ * editing/inserting/insert-3851164-fix-expected.txt:
+ * editing/inserting/insert-3851164-fix.html:
+ * editing/inserting/insert-3907422-fix-expected.txt:
+ * editing/inserting/insert-3907422-fix.html:
+ * editing/pasteboard/paste-text-011-expected.txt:
+ * editing/pasteboard/paste-text-011.html:
+ Update some tests that were relying on a bug that would cause a
+ Select All in a document that contained a single content-editable
+ element select the contents of that element.
+
+ * fast/lists/drag-into-marker-expected.checksum:
+ * fast/lists/drag-into-marker-expected.png:
+ * fast/lists/drag-into-marker-expected.txt:
+ * fast/lists/drag-into-marker.html:
+ Changed test so that it no longer tests what happens when you drag to a marker
+ that is outside the content-editable element. We may still want to make that
+ case behave as before, but that's a separate issue.
+
+ * editing/pasteboard/drop-text-without-selection-expected.txt:
+ * editing/pasteboard/merge-start-blockquote-expected.txt:
+ * editing/pasteboard/merge-start-list-expected.txt:
+ * editing/selection/select-all-iframe-expected.txt:
+ * fast/events/div-focus-expected.txt:
+ * fast/events/drag-outside-window-expected.txt:
+ * fast/forms/focus-control-to-page-expected.txt:
+ * fast/forms/input-changing-value-expected.txt:
+ * fast/forms/input-maxlength-2-expected.txt:
+ * fast/forms/input-paste-undo-expected.txt:
+ * fast/forms/input-text-paste-maxlength-expected.txt:
+ * fast/forms/input-truncate-newline-expected.txt:
+ * fast/forms/plaintext-mode-2-expected.txt:
+ * fast/text/textIteratorNilRenderer-expected.txt:
+ Update tests where the DOM range endpoints passed to the delegate are slightly
+ different, but equivalent and still OK.
+
+ * editing/pasteboard/paste-4039777-fix-expected.txt:
+ Updated tests where the resulting tree is slightly different, but still OK.
+
+ * editing/unsupported-content/list-delete-002-expected.checksum:
+ * editing/unsupported-content/list-delete-002-expected.png:
+ * editing/unsupported-content/list-delete-002-expected.txt:
+ Update test where the new code eliminates an unwanted extra space that we
+ got with the old code.
+
+ * editing/deleting/delete-4038408-fix-expected.txt:
+ * editing/deleting/delete-4038408-fix.html:
+ * editing/input/text-input-controller-expected.txt:
+ * editing/input/text-input-controller.html:
+ * fast/forms/attributed-strings-expected.txt:
+ * fast/forms/attributed-strings.html:
+ Update tests that were relying on the behavior of Select All putting the
+ selection inside a content-editable element if that element was the first
+ in the body; the patch breaks that behavior.
+
+ * fast/events/updateLayoutForHitTest-expected.checksum:
+ * fast/events/updateLayoutForHitTest-expected.png:
+ Update a test that no longer shows a visible selection.
+
+ * editing/selection/3690703-2-expected.checksum:
+ * editing/selection/3690703-2-expected.png:
+ * editing/selection/3690703-2-expected.txt:
+ * editing/selection/3690703-expected.checksum:
+ * editing/selection/3690703-expected.png:
+ * editing/selection/3690703-expected.txt:
+ Updated results for these tests, which have examples of form elements
+ inside a content-editable area. The old results were wrong; the new results
+ are not much better, but are OK.
+
+ - update some other misc. pixel-test results
+
+ * fast/inspector/style-expected.checksum:
+ * fast/inspector/style-expected.png:
+ Updated since the name changed to include "-webkit-".
+
+ * fast/overflow/childFocusRingClip-expected.checksum:
+ * fast/overflow/childFocusRingClip-expected.png:
+ Updated results that now seem to show correct clipping of the focus ring.
+
+ * fast/frames/empty-cols-attribute-expected.checksum:
+ * fast/frames/empty-cols-attribute-expected.png: Added.
+ Checksum was wrong, png was missing.
+
+ * fast/parser/001-expected.checksum:
+ * fast/parser/001-expected.png:
+ Checksum and png were incorrect -- changed a while back.
+
+ * plugins/embed-attributes-style-expected.checksum: Added.
+ * plugins/embed-attributes-style-expected.png: Added.
+ Added pixel-test results for tests that don't have them.
+
2006-05-02 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
Reviewed by darin
<http://bugzilla.opendarwin.org/show_bug.cgi?id=7059>
- TinyMCE: Select All + delete sends you Back intsead of deleting
+ TinyMCE: Select All + delete sends you Back instead of deleting
* editing/resources/select-all-iframe-src.html: Added.
* editing/selection/select-all-iframe-expected.checksum: Added.
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 13 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
<title>Editing Test</title>
</head>
<body>
-<div contenteditable id="root" class="editing">
+<div contenteditable id="test" class="editing">
<div>Radar: <a href="rdar://problems/4038408&4154187&4125087&4125381">rdar://problems/4038408&4154187&4125087&4125381</a></div>
<div>Deletion of reply text should not produce reply text style unless the caret is inside the reply text blockquote.</div>
-<div><BR class=3D"khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
<div>This tests deletion from underneath quoted text:</div>
-<div><BR class=3D"khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
<div>
<blockquote style="color:blue;" type="cite">
<div>Here is some reply text</div>
<div>It should have the reply text style</div>
-<div><BR class=3D"khtml-block-placeholder"></div>
-<div><BR class=3D"khtml-block-placeholder"></div>
-<div><BR class=3D"khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
</blockquote>
-<div><BR class=3D"khtml-block-placeholder"></div>
+<div><BR class="khtml-block-placeholder"></div>
</div>
</div>
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldInsertText:to be deleted replacingDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 13 of #text > DIV > BODY > HTML > #document to 13 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</style>
</head>
<body>
-<div contenteditable>FAILURE</div>
+<div id="test" contenteditable>FAILURE</div>
<script type="text/javascript">
if (window.layoutTestController) {
try {
layoutTestController.dumpAsText();
+ document.getElementById("test").focus();
document.execCommand("SelectAll");
textInputController.insertText("to be deleted");
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > P > BODY > HTML > #document to 19 of #text > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 3 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document toDOMRange:range from 0 of #text > P > BODY > HTML > #document to 19 of #text > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
<title>Editing Test</title>
</head>
-<body contenteditable id="root" class="editing"><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Gill Sans">@@ -571,6 +607,7 @@</P>
+<body contenteditable id="test" class="editing"><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Gill Sans">@@ -571,6 +607,7 @@</P>
<script>
runEditingTest();
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldDeleteDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
<title>Editing Test</title>
</head>
-<body contenteditable id="root" class="editing">
+<body contenteditable id="test" class="editing">
<div>foo<blockquote>bar</blockquote>baz</div>
<!-- Buggy code before fix would insert blockquote after body element in second paste -->
EDITING DELEGATE: shouldInsertText:http://www.ibm.com/ replacingDOMRange:range from 0 of DIV to 0 of DIV givenAction:WebViewInsertActionDropped
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 0 of #text > DIV to 19 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 0 of #text > DIV to 19 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BLOCKQUOTE > DIV > BODY > HTML > #document to 0 of BLOCKQUOTE > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document to 3 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document to 3 of #text > BLOCKQUOTE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of LI > UL > DIV > BODY > HTML > #document to 0 of LI > UL > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > LI > UL > DIV > BODY > HTML > #document to 3 of #text > LI > UL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > LI > UL > DIV > BODY > HTML > #document to 3 of #text > LI > UL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
text run at (0,28) width 16: "C"
RenderBlock {DIV} at (0,364) size 784x120
RenderBlock {UL} at (0,0) size 784x28
+ RenderBlock (anonymous) at (40,0) size 744x0
+ RenderInline {FONT} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x0
RenderListItem {LI} at (40,0) size 744x28
RenderListMarker at (-17,8) size 7x18
- RenderInline {FONT} at (0,0) size 0x28
- RenderInline {SPAN} at (0,0) size 0x28
RenderInline {FONT} at (0,0) size 17x28
RenderInline {SPAN} at (0,0) size 17x28
RenderText {#text} at (727,0) size 17x28
text run at (727,0) width 17: "A"
RenderBlock {DIV} at (0,44) size 784x56
+ RenderBlock (anonymous) at (0,0) size 784x0
+ RenderInline {FONT} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x0
RenderBlock {UL} at (0,0) size 784x56
+ RenderBlock (anonymous) at (40,0) size 744x0
+ RenderInline {FONT} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 0x0
RenderListItem {LI} at (40,0) size 744x56
RenderListMarker at (-17,8) size 7x18
RenderInline {A} at (0,0) size 16x18 [color=#0000EE]
RenderInline {SPAN} at (0,0) size 16x28
RenderText {#text} at (0,0) size 16x28
text run at (0,0) width 16: "B"
- RenderInline {FONT} at (0,0) size 22x56
- RenderInline {SPAN} at (0,0) size 22x56
+ RenderInline {FONT} at (0,0) size 6x28
+ RenderInline {SPAN} at (0,0) size 6x28
RenderText {#text} at (16,0) size 6x28
text run at (16,0) width 6: " "
+ RenderInline {FONT} at (0,0) size 0x28
+ RenderInline {SPAN} at (0,0) size 0x28
RenderBR {BR} at (22,22) size 0x0
+ RenderInline {FONT} at (0,0) size 16x28
+ RenderInline {SPAN} at (0,0) size 16x28
RenderText {#text} at (0,28) size 16x28
text run at (0,28) width 16: "C"
RenderBlock {DIV} at (0,116) size 784x4 [border: (2px solid #FF0000)]
+ RenderBlock (anonymous) at (2,2) size 780x0
RenderBlock {DIV} at (2,2) size 780x0
-caret: position 1 of child 2 {#text} of child 0 {SPAN} of child 1 {FONT} of child 0 {LI} of child 0 {UL} of child 2 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 1 of child 0 {#text} of child 0 {SPAN} of child 3 {FONT} of child 2 {LI} of child 2 {UL} of child 2 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document toDOMRange:range from 0 of #text > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > B > FONT > P > BODY > HTML > #document to 5 of #text > B > FONT > P > BODY > HTML > #document toDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
<title>Editing Test</title>
</head>
-<body contenteditable id="root" id="test">
+<body contenteditable id="test">
<p><font face="Monaco"><b>hello</b></font></p>
<p><font face="Monaco"><b>there</b></font></p>
-91550c1cd1cbe65448b23240a3f5dc27
\ No newline at end of file
+1359a67c7dc24fc1858e62d60f658a4a
\ No newline at end of file
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > CENTER > BODY > HTML > #document to 6 of DIV > CENTER > BODY > HTML > #document
-EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
text run at (362,0) width 60: "\x{A9}2005 Google"
layer at (206,85) size 385x13
RenderBlock {DIV} at (3,3) size 385x13
-caret: position 0 of child 0 {DIV} of child 1 {INPUT} of child 1 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
+selection start: position 0 of child 0 {#text} of child 0 {B} of child 0 {FONT} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
+selection end: position 0 of child 2 {BR} of child 1 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
-778c7b571f58dbb073870920cb76bded
\ No newline at end of file
+348682498d72c255547545ca349de34e
\ No newline at end of file
layer at (206,85) size 385x13
RenderBlock {DIV} at (3,3) size 385x13
selection start: position 0 of child 1 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
-selection end: position 1 of child 3 {#text} of child 4 {FONT} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
+selection end: position 0 of child 2 {BR} of child 1 {TD} of child 0 {TR} of child 0 {TBODY} of child 2 {TABLE} of child 4 {DIV} of child 0 {CENTER} of child 1 {BODY} of child 0 {HTML} of document
--- /dev/null
+3d66d9ba6c812ad8c9ffe3826ccf1897
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 {DIV} at (0,0) size 425x75 [bgcolor=#FFFF00]
+ RenderBlock {DIV} at (25,25) size 100x20 [bgcolor=#FFFFFF]
+ RenderBlock {P} at (0,91) size 784x36
+ RenderText {#text} at (0,0) size 780x36
+ text run at (0,0) width 780: "This test clicks inside an editable div element, and must result in the element receiving focus. If the test succeeds the element"
+ text run at (0,18) width 158: "should have a focus ring."
--- /dev/null
+<div style="width: 400px; height: 50px; padding: 25px 0 0 25px; background: yellow;"><div contenteditable="true" style="background: white; height:20px; width:100px"></div></div>
+<p>This test clicks inside an editable div element, and must result in the element receiving focus. If the test succeeds the element should have a focus ring.</p>
+<script>
+if (window.eventSender) {
+ eventSender.moveTo(100, 45);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+</script>
--- /dev/null
+0391efc68a4087a1759e88f36572cc32
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 {DIV} at (0,0) size 425x75 [bgcolor=#FFFF00]
+ RenderBlock {DIV} at (25,25) size 100x20 [bgcolor=#FFFFFF]
+ RenderBlock {P} at (0,91) size 784x36
+ RenderText {#text} at (0,0) size 759x36
+ text run at (0,0) width 759: "This test clicks outside an editable div element, and must not result in the element receiving focus. If the test succeeds the"
+ text run at (0,18) width 235: "element should not have a focus ring."
--- /dev/null
+<div style="width: 400px; height: 50px; padding: 25px 0 0 25px; background: yellow;"><div contenteditable="true" style="background: white; height:20px; width:100px"></div></div>
+<p>This test clicks outside an editable div element, and must not result in the element receiving focus. If the test succeeds the element should not have a focus ring.</p>
+<script>
+if (window.eventSender) {
+ eventSender.moveTo(225, 45);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+</script>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 4 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 11 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-893e63162eb4b4278e6f93214f941869
\ No newline at end of file
+07c987fff436a1644bd10921e569ec07
\ No newline at end of file
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 8 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > DIV > DIV > BODY > HTML > #document to 7 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
text run at (2,2) width 113: "before after"
RenderBlock {DIV} at (0,302) size 784x32
RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
- RenderText {#text} at (2,2) size 68x28
- text run at (2,2) width 68: "before "
- RenderText {#text} at (70,2) size 45x28
- text run at (70,2) width 45: "after"
-caret: position 8 of child 0 {#text} of child 1 {DIV} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+ RenderText {#text} at (2,2) size 62x28
+ text run at (2,2) width 62: "before"
+ RenderText {#text} at (64,2) size 45x28
+ text run at (64,2) width 45: "after"
+caret: position 7 of child 0 {#text} of child 1 {DIV} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 31 of #text > P > BODY > HTML > #document to 31 of #text > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 31 of #text > P > BODY > HTML > #document to 31 of #text > P > BODY > HTML > #document toDOMRange:range from 31 of #text > P > BODY > HTML > #document to 31 of #text > P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document toDOMRange:range from 0 of P > BODY > HTML > #document to 0 of P > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
ALERT: Test result: PASS
-cdf5ee18124d98312633f363ed46e908
\ No newline at end of file
+43c66494d30dd1b36b91ea149d61cbc5
\ No newline at end of file
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldInsertText:test replacingDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
</style>
</head>
<body>
-<div contenteditable>FAILURE</div>
+<div id="test" contenteditable>FAILURE</div>
<p id="console"></p>
<script type="text/javascript">
try {
layoutTestController.dumpAsText();
+ document.getElementById("test").focus();
var substr = textInputController.attributedSubstringFromRange(0, 2);
// log(substr); -- attributedSubstringFromRange is not implemented in WebKit yet
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 4 of #text > DIV to 4 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 4 of #text > DIV to 4 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This test changes the value of the text field by simulating typing, and then gets the value.
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertText:Text to paste replacingDOMRange:range from 0 of DIV to 0 of DIV givenAction:WebViewInsertActionPasted
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 13 of #text > DIV to 13 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 13 of #text > DIV to 13 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
--- /dev/null
+55d1ea4ffc968baf25045a1afd9c9fe0
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 {DIV} at (0,0) size 425x75 [bgcolor=#FFFF00]
+ RenderTextField {INPUT} at (27,27) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+ RenderBlock {P} at (0,91) size 784x36
+ RenderText {#text} at (0,0) size 739x36
+ text run at (0,0) width 739: "This test clicks inside an input element, and must result in the element receiving focus. If the test succeeds the element"
+ text run at (0,18) width 158: "should have a focus ring."
+layer at (38,38) size 142x13
+ RenderBlock {DIV} at (3,3) size 142x13
--- /dev/null
+<div style="width: 400px; height: 50px; padding: 25px 0 0 25px; background: yellow;"><input></div>
+<p>This test clicks inside an input element, and must result in the element receiving focus. If the test succeeds the element should have a focus ring.</p>
+<script>
+if (window.eventSender) {
+ eventSender.moveTo(100, 45);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+</script>
--- /dev/null
+9b57ff27683b14b3bfdc8fb7cb162177
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas 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 {DIV} at (0,0) size 425x75 [bgcolor=#FFFF00]
+ RenderTextField {INPUT} at (27,27) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+ RenderBlock {P} at (0,91) size 784x36
+ RenderText {#text} at (0,0) size 771x36
+ text run at (0,0) width 771: "This test clicks outside an input element, and must not result in the element receiving focus. If the test succeeds the element"
+ text run at (0,18) width 182: "should not have a focus ring."
+layer at (38,38) size 142x13
+ RenderBlock {DIV} at (3,3) size 142x13
--- /dev/null
+<div style="width: 400px; height: 50px; padding: 25px 0 0 25px; background: yellow;"><input></div>
+<p>This test clicks outside an input element, and must not result in the element receiving focus. If the test succeeds the element should not have a focus ring.</p>
+<script>
+if (window.eventSender) {
+ eventSender.moveTo(225, 45);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+</script>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 5 of #text > DIV to 5 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 7 of #text > DIV to 7 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 7 of #text > DIV to 7 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 7 of #text > DIV to 7 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 7 of #text > DIV to 7 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 3 of #text > DIV to 3 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 6 of #text > DIV to 6 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 6 of #text > DIV to 6 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertText:Test
Failed replacingDOMRange:range from 0 of DIV to 0 of DIV givenAction:WebViewInsertActionPasted
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 4 of #text > DIV to 4 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 4 of #text > DIV to 4 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This tests that when newlines are pasted into text fields, the text gets truncated properly.
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertText:This styled text, and link will be pasted into the textfield. All richness should be stripped. replacingDOMRange:range from 0 of DIV to 0 of DIV givenAction:WebViewInsertActionPasted
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 0 of #text > DIV toDOMRange:range from 94 of #text > DIV to 94 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV to 0 of DIV toDOMRange:range from 94 of #text > DIV to 94 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
-4ba76443f17a0b4b19c9d0505b0323d9
-\ No newline at end of file
+4ba76443f17a0b4b19c9d0505b0323d9
\ No newline at end of file
-621f18fa2942ebb003ed1d74340dbb07
\ No newline at end of file
+a75da5679b1c42d597a716e9710c3a76
\ No newline at end of file
-720296de5356ea7c8b963a39d88d5ff2
\ No newline at end of file
+315d733f8d7589801b2213dacda2ef63
\ No newline at end of file
-EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of LI > UL > BODY > HTML > #document to 2 of LI > UL > BODY > HTML > #document
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 6 of BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 2 of #text > SPAN > LI > UL > BODY > HTML > #document to 2 of #text > SPAN > LI > UL > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
RenderText {#text} at (124,0) size 95x55
text run at (124,0) width 95: "hello"
RenderBlock {P} at (0,73) size 784x72
- RenderText {#text} at (0,0) size 764x72
+ RenderText {#text} at (0,0) size 768x72
text run at (0,0) width 562: "This is an automated test for elementAtPoint for points over position:outside list markers. "
- text run at (562,0) width 168: "The dictionary returned by"
+ text run at (562,0) width 172: "The dictionary returned by "
text run at (0,18) width 743: "elementAtPoint should contain the list item as the DOMNode, not the list, for points over position:outside list markers."
text run at (0,36) width 743: "elementAtPoint is used to determine the drag operation that will occur when something is dropped over a given point. "
- text run at (743,36) width 21: "So,"
+ text run at (743,36) width 25: "So, "
text run at (0,54) width 371: "this test drags a bit of text over the list marker and drops it. "
text run at (371,54) width 386: "It should be pasted into the list item, which is contenteditable."
selection start: position 0 of child 0 {#text} of child 0 {SPAN} of child 0 {LI} of child 1 {UL} of child 0 {BODY} of child 0 {HTML} of document
-<body>
+<body contenteditable="true">
<ul id="ul" style="margin:1em; border:1px solid black;"><li id="li" contenteditable="true" style="list-style-type: square; font-size: 3em;">hello <span id="spanToDrag">world</span></a></div></li></ul>
-be24b5f8a81be5e160a9a05d46b7c642
\ No newline at end of file
+106e200348dc751b6bb041817aec3a29
\ No newline at end of file
-5f100d8f4e73e5bba1c10129c16dfcae
\ No newline at end of file
+f60b77fa76763613d412f13226c21fa0
\ No newline at end of file
--- /dev/null
+0e5a8de4cbce88294fe528515966eb21
\ No newline at end of file
+2006-05-03 Darin Adler <darin@apple.com>
+
+ Reviewed by Justin.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8159
+ REGRESSION: Clicking outside new text field focuses the field
+
+ This bug has always been present for "content editable" HTML, but
+ now affects <input type=text> as well. The problem is with the editing
+ concept of a "deep equivalent". When computing the deep equivalent,
+ the code can move from outside an editable area to inside. To fix this,
+ I removed all use of the "deep equivalent" concept.
+
+ * rendering/RenderBlock.cpp: (WebCore::RenderBlock::positionForCoordinates):
+ Changed argument names from _x and _y to just x and y. When the element
+ is the editable root, changed things so that clicks that are not within
+ the element at all return positions before or after the element, rather than
+ always choosing the closest point within the element. This gets us off on
+ the right foot, by not choosing a position inside an editable root when you
+ click outside that editable root. This code handles shadowParentNode as well,
+ and also calls positionForCoordinates on children rather than calling
+ positionForRenderer (which I believe is now a function that can be removed).
+
+ * editing/VisiblePosition.h: Removed the deepEquivalent function.
+ * editing/VisiblePosition.cpp:
+ (WebCore::VisiblePosition::previousVisiblePosition): Removed use of the
+ deepEquivalent function. Also, to make this function easier to understand
+ I separated out the case where the start point is "in rendered content"
+ and the case where it's not into two separate loops.
+ (WebCore::VisiblePosition::nextVisiblePosition): Ditto.
+ (WebCore::VisiblePosition::initDeepPosition): Removed use of the deepEquivalent
+ function. Also added code to make sure that this work never turns a position
+ outside an editable element into a position inside that editable element, or
+ vice versa. Reorganized the code a bit.
+
+ * dom/Position.cpp:
+ (WebCore::Position::upstream): Removed use of the deepEquivalent function.
+ (WebCore::Position::downstream): Ditto.
+
+ * editing/htmlediting.cpp:
+ (WebCore::editingIgnoresContent): Changed to use isReplaced instead of isWidget
+ and isImage to determine if editing should ignore content.
+ (WebCore::firstInSpecialElement): Rewrote isFirstVisiblePositionInSpecialElement
+ to have code to share with positionBeforeContainingSpecialElement. And changed
+ to allow both the position just before a table and the position just inside a
+ table to qualify. While this is slightly sloppy, the old code worked because
+ of the "deep equivalent" technique. This change is needed to get the desired
+ results even without that technique.
+ (WebCore::lastInSpecialElement): Ditto.
+ (WebCore::isFirstVisiblePositionInSpecialElement): Changed to use the new function.
+ (WebCore::positionBeforeContainingSpecialElement): Ditto.
+ (WebCore::isLastVisiblePositionInSpecialElement): Ditto.
+ (WebCore::positionAfterContainingSpecialElement): Ditto.
+
+ * dom/Node.cpp: (WebCore::Node::rootEditableElement): Rewrote to remove
+ special case for body tag.
+
+ - other changes
+
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::setOuterHTML): Added a FIXME about the fact
+ that this won't merge neighboring text nodes the way setOuterText does.
+ (WebCore::HTMLElement::setInnerText): Added a FIXME about the fact that
+ this creates a text node even when setting to empty text.
+ (WebCore::HTMLElement::setOuterText): Ditto.
+
+ * editing/DeleteSelectionCommand.cpp: Removed some #if 1 and #if 0.
+ * editing/ReplaceSelectionCommand.cpp: A little reformatting.
+ * rendering/render_button.h: Tiny formatting tweak.
+
2006-05-02 Adele Peterson <adele@apple.com>
Reviewed by Beth.
Reviewed by eric.
- WARNING: NO TEST CASES ADDED OR CHANGED
-
* WebCore.vcproj/WebCore/WebCore.vcproj: defined NDEBUG in release build
* bridge/win/FrameWin.cpp:
(WebCore::FrameWin::FrameWin): turned on javascript.
Reviewed by darin
- WARNING: NO TEST CASES ADDED OR CHANGED
-
* loader/Cache.cpp:
* loader/CachedImage.cpp:
(WebCore::CachedImage::data):
return 0;
}
-Element *Node::rootEditableElement() const
+Element* Node::rootEditableElement() const
{
- if (!isContentEditable())
- return 0;
-
- Node *n = const_cast<Node *>(this);
- if (n->hasTagName(bodyTag))
- return static_cast<Element *>(n);
-
- Node *result = n->isEditableBlock() ? n : 0;
- while (1) {
- n = n->parentNode();
- if (!n || !n->isContentEditable())
- break;
- if (n->hasTagName(bodyTag)) {
- result = n;
- break;
- }
- if (n->isBlockFlow())
- result = n;
- }
- return static_cast<Element *>(result);
+ Element* result = 0;
+ for (Node* n = const_cast<Node*>(this); n && n->isContentEditable(); n = n->parentNode())
+ if (n->isBlockFlow() && n->isElementNode())
+ result = static_cast<Element*>(n);
+ return result;
}
bool Node::inSameRootEditableElement(Node *n)
Position Position::upstream() const
{
// start at equivalent deep position
- Position start = VisiblePosition::deepEquivalent(*this);
+ Position start = *this;
Node *startNode = start.node();
if (!startNode)
return Position();
// P.downstream() returns the end of the range of positions that map to the same VisiblePosition as P.
Position Position::downstream() const
{
- Position start = VisiblePosition::deepEquivalent(*this);
+ Position start = *this;
Node *startNode = start.node();
if (!startNode)
return Position();
return lastVisible;
}
-bool hasRenderedChildrenWithHeight(RenderObject *renderer)
+static bool hasRenderedChildrenWithHeight(RenderObject *renderer)
{
if (!renderer->firstChild())
return false;
LOG(Editing, "%s%s %p", prefix, node->nodeName().deprecatedString().latin1(), node);
}
-#if 1
static Position positionBeforePossibleContainingSpecialElement(const Position &pos, Node **containingSpecialElement)
- {
+{
if (isFirstVisiblePositionInSpecialElement(pos))
- return positionBeforeContainingSpecialElement(pos, containingSpecialElement);
-
+ return positionBeforeContainingSpecialElement(pos, containingSpecialElement);
return pos;
- }
+}
static Position positionAfterPossibleContainingSpecialElement(const Position &pos, Node **containingSpecialElement)
- {
+{
if (isLastVisiblePositionInSpecialElement(pos))
return positionAfterContainingSpecialElement(pos, containingSpecialElement);
-
- return pos;
- }
-#endif
+ return pos;
+}
DeleteSelectionCommand::DeleteSelectionCommand(Document *document, bool smartDelete, bool mergeBlocksAfterDelete)
: CompositeEditCommand(document),
void DeleteSelectionCommand::initializeStartEnd()
{
-#if 0
- Position start = m_selectionToDelete.start();
- Position end = m_selectionToDelete.end();
- m_upstreamStart = start.upstream();
- m_downstreamStart = start.downstream();
- m_upstreamEnd = end.upstream();
- m_downstreamEnd = end.downstream();
-#else
- Node *startSpecialContainer = 0;
- Node *endSpecialContainer = 0;
+ Node* startSpecialContainer = 0;
+ Node* endSpecialContainer = 0;
Position start = positionOutsideContainingSpecialElement(m_selectionToDelete.start(), &startSpecialContainer);
- Position end = positionOutsideContainingSpecialElement(m_selectionToDelete.end(), &endSpecialContainer);
+ Position end = positionOutsideContainingSpecialElement(m_selectionToDelete.end(), &endSpecialContainer);
m_upstreamStart = positionBeforePossibleContainingSpecialElement(start.upstream(), &startSpecialContainer);
m_downstreamStart = positionBeforePossibleContainingSpecialElement(start.downstream(), 0);
m_downstreamEnd = end.downstream();
}
}
-#endif
}
void DeleteSelectionCommand::initializePositionData()
VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove);
+ if (mergeDestination == endOfParagraphToMove)
+ return;
+
moveParagraph(startOfParagraphToMove, endOfParagraphToMove, mergeDestination);
}
if (fragment.firstChild()) {
RefPtr<Node> refNode = fragment.firstChild();
RefPtr<Node> node = refNode ? refNode->nextSibling() : 0;
- Node *insertionBlock = insertionPos.node()->enclosingBlockFlowElement();
+ Node* insertionBlock = insertionPos.node()->enclosingBlockFlowElement();
Node* insertionRoot = insertionPos.node()->rootEditableElement();
bool insertionBlockIsRoot = insertionBlock == insertionRoot;
VisiblePosition visibleInsertionPos(insertionPos);
}
while (node) {
- Node *next = node->nextSibling();
+ Node* next = node->nextSibling();
fragment.removeNode(node);
insertNodeAfterAndUpdateNodesInserted(node.get(), refNode.get());
refNode = node;
return result;
}
-Position VisiblePosition::previousVisiblePosition(const Position &pos)
+Position VisiblePosition::previousVisiblePosition(const Position& pos)
{
- if (pos.isNull() || pos.atStart())
+ if (!pos.inRenderedContent()) {
+ Position current = pos;
+ while (!current.atStart()) {
+ current = current.previous(UsingComposedCharacters);
+ if (current.inRenderedContent())
+ return current;
+ }
return Position();
+ }
- Position test = deepEquivalent(pos);
- Position downstreamTest = test.downstream();
- bool acceptAnyVisiblePosition = !test.inRenderedContent();
-
- Position current = test;
+ Position downstreamStart = pos.downstream();
+ Position current = pos;
while (!current.atStart()) {
current = current.previous(UsingComposedCharacters);
- if (current.inRenderedContent() && (acceptAnyVisiblePosition || (downstreamTest != current.downstream()))) {
+ if (current.inRenderedContent() && downstreamStart != current.downstream())
return current;
- }
}
-
- return Position();
+ return Position();
}
-Position VisiblePosition::nextVisiblePosition(const Position &pos)
+Position VisiblePosition::nextVisiblePosition(const Position& pos)
{
- if (pos.isNull() || pos.atEnd())
+ if (!pos.inRenderedContent()) {
+ Position current = pos;
+ while (!current.atEnd()) {
+ current = current.next(UsingComposedCharacters);
+ if (current.inRenderedContent())
+ return current;
+ }
return Position();
+ }
- Position test = deepEquivalent(pos);
- bool acceptAnyVisiblePosition = !test.inRenderedContent();
-
- Position current = test;
- Position downstreamTest = test.downstream();
+ Position downstreamStart = pos.downstream();
+ Position current = pos;
while (!current.atEnd()) {
current = current.next(UsingComposedCharacters);
- if (current.inRenderedContent() && (acceptAnyVisiblePosition || (downstreamTest != current.downstream()))) {
+ if (current.inRenderedContent() && downstreamStart != current.downstream())
return current;
- }
}
-
return Position();
}
void VisiblePosition::initDeepPosition(const Position& position, EAffinity affinity)
{
- if (position.isNull()) {
+ // FIXME: No need for affinity parameter.
+ // FIXME: Would read nicer if this was a function that returned a Position.
+
+ Node* node = position.node();
+ if (!node) {
m_deepPosition = Position();
return;
}
- position.node()->document()->updateLayoutIgnorePendingStylesheets();
- Position deepPos = deepEquivalent(position);
+ node->document()->updateLayoutIgnorePendingStylesheets();
+
// If two visually equivalent positions are both candidates for being made the m_deepPosition,
// (this can happen when two rendered positions have only collapsed whitespace between them),
// we always choose the one that occurs first in the DOM to canonicalize VisiblePositions.
- m_deepPosition = deepPos.upstream();
+ m_deepPosition = position.upstream();
if (m_deepPosition.inRenderedContent())
return;
-
- m_deepPosition = deepPos;
+ m_deepPosition = position;
if (m_deepPosition.inRenderedContent())
return;
-
- m_deepPosition = deepPos.downstream();
+ m_deepPosition = position.downstream();
if (m_deepPosition.inRenderedContent())
return;
-
- // Do something rational for an input position inside unrendered whitespace that isn't really
- // equivalent to any rendered position, such as: <div>foo</div>{unrendered whitespace}<div>bar</div>
- Position next = nextVisiblePosition(deepPos);
- Position prev = previousVisiblePosition(deepPos);
-
- if (next.isNull() && prev.isNull())
- m_deepPosition = Position();
- else if (next.isNull())
+
+ // When neither upstream or downstream gets us to a visible position,
+ // look at the next and previous visible position.
+ Position next = nextVisiblePosition(position);
+ Position prev = previousVisiblePosition(position);
+ Node* nextNode = next.node();
+ Node* prevNode = prev.node();
+
+ // The new position must be in the same editable element. Enforce that first.
+ Node* editingRoot = node->rootEditableElement();
+ bool prevIsInSameEditableElement = prevNode && prevNode->rootEditableElement() == editingRoot;
+ bool nextIsInSameEditableElement = nextNode && nextNode->rootEditableElement() == editingRoot;
+ if (prevIsInSameEditableElement && !nextIsInSameEditableElement) {
m_deepPosition = prev;
- else if (prev.isNull())
- m_deepPosition = next;
- else {
- Node *originalBlock = position.node()->enclosingBlockFlowElement();
- bool nextIsOutsideOriginalBlock = !next.node()->isAncestor(originalBlock) && next.node() != originalBlock;
- bool prevIsOutsideOriginalBlock = !prev.node()->isAncestor(originalBlock) && prev.node() != originalBlock;
-
- if (nextIsOutsideOriginalBlock && !prevIsOutsideOriginalBlock)
- m_deepPosition = prev;
- else
- m_deepPosition = next;
+ return;
}
-}
-
-Position VisiblePosition::deepEquivalent(const Position &pos)
-{
- Node *node = pos.node();
- int offset = pos.offset();
-
- if (!node)
- return Position();
-
- if (pos.inRenderedContent() || isAtomicNode(node))
- return pos;
-
- if (offset >= (int)node->childNodeCount()) {
- do {
- Node *child = node->lastChild();
- if (!child)
- break;
- node = child;
- } while (!(Position(node, maxDeepOffset(node)).inRenderedContent()) && !isAtomicNode(node));
- return Position(node, maxDeepOffset(node));
+ if (nextIsInSameEditableElement && !prevIsInSameEditableElement) {
+ m_deepPosition = next;
+ return;
}
-
- node = node->childNode(offset);
- ASSERT(node);
- while (!(Position(node, 0).inRenderedContent()) && !isAtomicNode(node)) {
- Node *child = node->firstChild();
- if (!child)
- break;
- node = child;
+ if (!nextIsInSameEditableElement && !prevIsInSameEditableElement) {
+ m_deepPosition = Position();
+ return;
}
- return Position(node, 0);
+
+ // The new position should be in the same block flow element. Favor that.
+ Node *originalBlock = node->enclosingBlockFlowElement();
+ bool nextIsOutsideOriginalBlock = !nextNode->isAncestor(originalBlock) && nextNode != originalBlock;
+ bool prevIsOutsideOriginalBlock = !prevNode->isAncestor(originalBlock) && prevNode != originalBlock;
+ if (nextIsOutsideOriginalBlock && !prevIsOutsideOriginalBlock)
+ m_deepPosition = prev;
+ else
+ m_deepPosition = next;
}
int VisiblePosition::maxOffset(const Node *node)
void debugPosition(const char* msg = "") const;
- static Position deepEquivalent(const Position&);
-
Element* rootEditableElement() const { return m_deepPosition.isNotNull() ? m_deepPosition.node()->rootEditableElement() : 0; }
#ifndef NDEBUG
return false;
if (node->renderer()) {
- if (node->renderer()->isWidget())
- return true;
- if (node->renderer()->isImage())
+ if (node->renderer()->isReplaced() && !node->renderer()->canHaveChildren())
return true;
+ ASSERT(!node->renderer()->isWidget());
+ ASSERT(!node->renderer()->isImage());
} else {
// widgets
if (static_cast<const HTMLElement *>(node)->isGenericFormElement())
return 1;
}
-#if 1
// FIXME: need to dump this
bool isSpecialElement(const Node *n)
{
return false;
}
-bool isFirstVisiblePositionInSpecialElement(const Position& pos)
+static Node* firstInSpecialElement(const Position& pos)
{
- VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
-
- for (Node *n = pos.node(); n; n = n->parentNode()) {
- VisiblePosition checkVP = VisiblePosition(n, 0, DOWNSTREAM);
- if (checkVP != vPos) {
- if (isTableElement(n) && checkVP.next() == vPos)
- return true;
- return false;
+ Node* rootEditableElement = pos.node()->rootEditableElement();
+ for (Node* n = pos.node(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode())
+ if (isSpecialElement(n)) {
+ VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
+ VisiblePosition firstInElement = VisiblePosition(n, 0, DOWNSTREAM);
+ if (isTableElement(n) && vPos == firstInElement.next())
+ return n;
+ if (vPos == firstInElement)
+ return n;
}
- if (n->rootEditableElement() == NULL)
- return false;
- if (isSpecialElement(n))
- return true;
- }
+ return 0;
+}
- return false;
+static Node* lastInSpecialElement(const Position& pos)
+{
+ Node* rootEditableElement = pos.node()->rootEditableElement();
+ for (Node* n = pos.node(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode())
+ if (isSpecialElement(n)) {
+ VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
+ VisiblePosition lastInElement = VisiblePosition(n, n->childNodeCount(), DOWNSTREAM);
+ if (isTableElement(n) && vPos == lastInElement.previous())
+ return n;
+ if (vPos == lastInElement)
+ return n;
+ }
+ return 0;
}
-Position positionBeforeContainingSpecialElement(const Position& pos, Node **containingSpecialElement)
+bool isFirstVisiblePositionInSpecialElement(const Position& pos)
{
- ASSERT(isFirstVisiblePositionInSpecialElement(pos));
+ return firstInSpecialElement(pos);
+}
- VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
-
- Node *outermostSpecialElement = NULL;
-
- for (Node *n = pos.node(); n; n = n->parentNode()) {
- VisiblePosition checkVP = VisiblePosition(n, 0, DOWNSTREAM);
- if (checkVP != vPos) {
- if (isTableElement(n) && checkVP.next() == vPos)
- outermostSpecialElement = n;
- break;
- }
- if (n->rootEditableElement() == NULL)
- break;
- if (isSpecialElement(n))
- outermostSpecialElement = n;
- }
-
- ASSERT(outermostSpecialElement);
- if (containingSpecialElement)
- *containingSpecialElement = outermostSpecialElement;
-
- Position result = positionBeforeNode(outermostSpecialElement);
- if (result.isNull() || !result.node()->rootEditableElement())
+Position positionBeforeContainingSpecialElement(const Position& pos, Node** containingSpecialElement)
+{
+ Node* n = firstInSpecialElement(pos);
+ ASSERT(n);
+ if (!n)
return pos;
-
+ Position result = positionBeforeNode(n);
+ if (result.isNull() || result.node()->rootEditableElement() != pos.node()->rootEditableElement())
+ return pos;
+ if (containingSpecialElement)
+ *containingSpecialElement = n;
return result;
}
bool isLastVisiblePositionInSpecialElement(const Position& pos)
{
- // make sure to get a range-compliant version of the position
- // FIXME: rangePos isn't being used to create DOM Ranges, so why does it need to be range compliant?
- Position rangePos = rangeCompliantEquivalent(VisiblePosition(pos, DOWNSTREAM));
-
- VisiblePosition vPos = VisiblePosition(rangePos, DOWNSTREAM);
-
- for (Node *n = rangePos.node(); n; n = n->parentNode()) {
- VisiblePosition checkVP = VisiblePosition(n, maxRangeOffset(n), DOWNSTREAM);
- if (checkVP != vPos)
- return (isTableElement(n) && checkVP.previous() == vPos);
- if (n->rootEditableElement() == NULL)
- return false;
- if (isSpecialElement(n))
- return true;
- }
-
- return false;
+ return lastInSpecialElement(pos);
}
Position positionAfterContainingSpecialElement(const Position& pos, Node **containingSpecialElement)
{
- ASSERT(isLastVisiblePositionInSpecialElement(pos));
-
- // make sure to get a range-compliant version of the position
- // FIXME: rangePos isn't being used to create DOM Ranges, so why does it need to be range compliant?
- Position rangePos = rangeCompliantEquivalent(VisiblePosition(pos, DOWNSTREAM));
- VisiblePosition vPos = VisiblePosition(rangePos, DOWNSTREAM);
-
- Node *outermostSpecialElement = NULL;
-
- for (Node *n = rangePos.node(); n; n = n->parentNode()) {
- VisiblePosition checkVP = VisiblePosition(n, maxRangeOffset(n), DOWNSTREAM);
- if (checkVP != vPos) {
- if (isTableElement(n) && checkVP.previous() == vPos)
- outermostSpecialElement = n;
- break;
- }
- if (n->rootEditableElement() == NULL)
- break;
- if (isSpecialElement(n))
- outermostSpecialElement = n;
- }
-
- ASSERT(outermostSpecialElement);
- if (containingSpecialElement)
- *containingSpecialElement = outermostSpecialElement;
-
- Position result = positionAfterNode(outermostSpecialElement);
- if (result.isNull() || !result.node()->rootEditableElement())
+ Node* n = lastInSpecialElement(pos);
+ ASSERT(n);
+ if (!n)
return pos;
-
+ Position result = positionAfterNode(n);
+ if (result.isNull() || result.node()->rootEditableElement() != pos.node()->rootEditableElement())
+ return pos;
+ if (containingSpecialElement)
+ *containingSpecialElement = n;
return result;
}
{
if (isFirstVisiblePositionInSpecialElement(pos))
return positionBeforeContainingSpecialElement(pos, containingSpecialElement);
-
if (isLastVisiblePositionInSpecialElement(pos))
return positionAfterContainingSpecialElement(pos, containingSpecialElement);
-
return pos;
}
-#endif
Position positionBeforeNode(const Node *node)
{
return;
}
+ // FIXME: Why doesn't this have code to merge neighboring text nodes the
+ // way setOuterText does?
parent->replaceChild(fragment.release(), this, ec);
}
}
removeChildren();
+ // FIXME: This creates a new text node even when the text is empty.
appendChild(new Text(document(), text), ec);
}
return;
}
+ // FIXME: This creates a new text node even when the text is empy.
RefPtr<Text> t = new Text(document(), text);
ec = 0;
parent->replaceChild(t, this, ec);
return Position(node, offset);
}
-VisiblePosition RenderBlock::positionForCoordinates(int _x, int _y)
+VisiblePosition RenderBlock::positionForCoordinates(int x, int y)
{
if (isTable())
- return RenderFlow::positionForCoordinates(_x, _y);
+ return RenderFlow::positionForCoordinates(x, y);
int absx, absy;
absolutePositionForContent(absx, absy);
int top = absy + borderTop() + paddingTop();
int bottom = top + contentHeight();
- if (_y < top)
- // y coordinate is above block
- return VisiblePosition(positionForRenderer(firstLeafChild(), true), DOWNSTREAM);
+ int left = absx + borderLeft() + paddingLeft();
+ int right = left + contentWidth();
- if (_y >= bottom)
- // y coordinate is below block
- return VisiblePosition(positionForRenderer(lastLeafChild(), false), DOWNSTREAM);
+ Node* n = element();
+
+ bool isEditableRoot = n && n->rootEditableElement() == n;
+
+ if (y < top || (isEditableRoot && (y < bottom && x < left))) {
+ if (!isEditableRoot)
+ if (RenderObject* c = firstChild()) {
+ VisiblePosition p = c->positionForCoordinates(x, y);
+ if (p.isNotNull())
+ return p;
+ }
+ if (n) {
+ if (Node* sp = n->shadowParentNode())
+ n = sp;
+ if (Node* p = n->parent())
+ return VisiblePosition(p, n->nodeIndex(), DOWNSTREAM);
+ }
+ return VisiblePosition(n, 0, DOWNSTREAM);
+ }
+
+ if (y >= bottom || (isEditableRoot && (y >= top && x >= right))) {
+ if (!isEditableRoot)
+ if (RenderObject* c = lastChild()) {
+ VisiblePosition p = c->positionForCoordinates(x, y);
+ if (p.isNotNull())
+ return p;
+ }
+ if (n) {
+ if (Node* sp = n->shadowParentNode())
+ n = sp;
+ if (Node* p = n->parent())
+ return VisiblePosition(p, n->nodeIndex() + 1, DOWNSTREAM);
+ }
+ return VisiblePosition(n, 0, DOWNSTREAM);
+ }
if (childrenInline()) {
if (!firstRootBox())
- return VisiblePosition(element(), 0, DOWNSTREAM);
+ return VisiblePosition(n, 0, DOWNSTREAM);
- if (_y >= top && _y < absy + firstRootBox()->topOverflow())
+ if (y >= top && y < absy + firstRootBox()->topOverflow())
// y coordinate is above first root line box
return VisiblePosition(positionForBox(firstRootBox()->firstLeafChild(), true), DOWNSTREAM);
// look for the closest line box in the root box which is at the passed-in y coordinate
- for (RootInlineBox *root = firstRootBox(); root; root = root->nextRootBox()) {
+ for (RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) {
top = absy + root->topOverflow();
// set the bottom based on whether there is a next root box
if (root->nextRootBox())
else
bottom = absy + root->bottomOverflow();
// check if this root line box is located at this y coordinate
- if (_y >= top && _y < bottom && root->firstChild()) {
- InlineBox *closestBox = root->closestLeafChildForXPos(_x, absx);
- if (closestBox) {
+ if (y >= top && y < bottom && root->firstChild()) {
+ InlineBox* closestBox = root->closestLeafChildForXPos(x, absx);
+ if (closestBox)
// pass the box a y position that is inside it
- return closestBox->object()->positionForCoordinates(_x, absy + closestBox->m_y);
- }
+ return closestBox->object()->positionForCoordinates(x, absy + closestBox->m_y);
}
}
if (lastRootBox())
// y coordinate is below last root line box
return VisiblePosition(positionForBox(lastRootBox()->lastLeafChild(), false), DOWNSTREAM);
-
- return VisiblePosition(element(), 0, DOWNSTREAM);
+
+ return VisiblePosition(n, 0, DOWNSTREAM);
}
// see if any child blocks exist at this y coordinate
- RenderObject *lastVisibleChild = 0;
- for (RenderObject *renderer = firstChild(); renderer; renderer = renderer->nextSibling()) {
+ RenderObject* lastVisibleChild = 0;
+ for (RenderObject* renderer = firstChild(); renderer; renderer = renderer->nextSibling()) {
if (renderer->height() == 0 || renderer->style()->visibility() != VISIBLE || renderer->isFloatingOrPositioned())
continue;
renderer->absolutePositionForContent(absx, top);
- RenderObject *next = renderer->nextSibling();
+ RenderObject* next = renderer->nextSibling();
while (next && next->isFloatingOrPositioned())
next = next->nextSibling();
if (next)
next->absolutePositionForContent(absx, bottom);
else
bottom = top + contentHeight();
- if (_y >= top && _y < bottom) {
- return renderer->positionForCoordinates(_x, _y);
- }
+ if (y >= top && y < bottom)
+ return renderer->positionForCoordinates(x, y);
lastVisibleChild = renderer;
}
// pass along to the last child we saw that had a height and is visible.
if (lastVisibleChild)
- return lastVisibleChild->positionForCoordinates(_x, _y);
+ return lastVisibleChild->positionForCoordinates(x, y);
// still no luck...return this render object's element and offset 0
- return VisiblePosition(element(), 0, DOWNSTREAM);
+ return VisiblePosition(n, 0, DOWNSTREAM);
}
void RenderBlock::calcMinMaxWidth()
virtual void paintObject(PaintInfo&, int tx, int ty);
- virtual const char *renderName() const { return "RenderButton"; }
+ virtual const char* renderName() const { return "RenderButton"; }
protected:
RenderText* m_buttonText;