https://bugs.webkit.org/show_bug.cgi?id=87059
Reviewed by Darin Adler.
Revision r117771 introduced a style change in the layout tests that was not
intended. This patch amends this by using "window.internals" only when checking
for the internals object. Once we know internals is there, we use directly.
This conforms to the style used for layoutTestController in the affected tests.
* editing/deleting/delete-ligature-003.html:
* editing/deleting/paragraph-in-preserveNewline.html:
* editing/deleting/whitespace-pre-1.html:
* editing/execCommand/script-tests/query-command-state.js:
(runTests):
* editing/execCommand/script-tests/query-text-alignment.js:
(runRangeTests):
* editing/execCommand/script-tests/toggle-compound-styles.js:
* editing/selection/5195166-1.html:
* editing/selection/5354455-1.html:
* editing/selection/caret-mode-paragraph-keys-navigation.html:
* editing/selection/collapse-selection-in-bidi.html:
* editing/selection/context-menu-text-selection.html:
* editing/selection/directionality-after-undo-replace.html:
* editing/selection/extend-after-mouse-selection.html:
* editing/selection/extend-selection-after-double-click.html:
* editing/selection/move-by-word-visually-crash-test-1.html:
* editing/selection/move-by-word-visually-crash-test-2.html:
* editing/selection/move-by-word-visually-crash-test-3.html:
* editing/selection/move-by-word-visually-crash-test-4.html:
* editing/selection/move-by-word-visually-crash-test-5.html:
* editing/selection/move-by-word-visually-crash-test-css-generated-content.html:
* editing/selection/move-by-word-visually-crash-test-textarea.html:
* editing/selection/move-by-word-visually-inline-block-positioned-element.html:
* editing/selection/move-by-word-visually-mac.html:
* editing/selection/move-by-word-visually-multi-line.html:
* editing/selection/move-by-word-visually-multi-space.html:
* editing/selection/move-by-word-visually-null-box.html:
* editing/selection/move-by-word-visually-single-space-inline-element.html:
* editing/selection/move-by-word-visually-single-space-one-element.html:
* editing/selection/move-by-word-visually-textarea.html:
* editing/selection/move-by-word-visually-wrong-left-right.html:
* editing/selection/programmatic-selection-on-mac-is-directionless.html:
* editing/selection/rtl-move-selection-right-left.html:
* editing/selection/script-tests/click-in-margins-inside-editable-div.js:
* editing/selection/script-tests/click-in-padding-with-multiple-line-boxes.js:
* editing/selection/script-tests/shift-click.js:
(runShiftClickTest):
* editing/selection/selection-extend-should-not-move-across-caret-on-mac.html:
* editing/style/iframe-onload-crash-mac.html:
* editing/style/iframe-onload-crash-unix.html:
* editing/style/iframe-onload-crash-win.html:
* fast/events/backspace-navigates-back.html:
* fast/forms/selection-direction.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117912
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-05-21 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Avoid using window.internals when internals is enough after r117771
+ https://bugs.webkit.org/show_bug.cgi?id=87059
+
+ Reviewed by Darin Adler.
+
+ Revision r117771 introduced a style change in the layout tests that was not
+ intended. This patch amends this by using "window.internals" only when checking
+ for the internals object. Once we know internals is there, we use directly.
+
+ This conforms to the style used for layoutTestController in the affected tests.
+
+ * editing/deleting/delete-ligature-003.html:
+ * editing/deleting/paragraph-in-preserveNewline.html:
+ * editing/deleting/whitespace-pre-1.html:
+ * editing/execCommand/script-tests/query-command-state.js:
+ (runTests):
+ * editing/execCommand/script-tests/query-text-alignment.js:
+ (runRangeTests):
+ * editing/execCommand/script-tests/toggle-compound-styles.js:
+ * editing/selection/5195166-1.html:
+ * editing/selection/5354455-1.html:
+ * editing/selection/caret-mode-paragraph-keys-navigation.html:
+ * editing/selection/collapse-selection-in-bidi.html:
+ * editing/selection/context-menu-text-selection.html:
+ * editing/selection/directionality-after-undo-replace.html:
+ * editing/selection/extend-after-mouse-selection.html:
+ * editing/selection/extend-selection-after-double-click.html:
+ * editing/selection/move-by-word-visually-crash-test-1.html:
+ * editing/selection/move-by-word-visually-crash-test-2.html:
+ * editing/selection/move-by-word-visually-crash-test-3.html:
+ * editing/selection/move-by-word-visually-crash-test-4.html:
+ * editing/selection/move-by-word-visually-crash-test-5.html:
+ * editing/selection/move-by-word-visually-crash-test-css-generated-content.html:
+ * editing/selection/move-by-word-visually-crash-test-textarea.html:
+ * editing/selection/move-by-word-visually-inline-block-positioned-element.html:
+ * editing/selection/move-by-word-visually-mac.html:
+ * editing/selection/move-by-word-visually-multi-line.html:
+ * editing/selection/move-by-word-visually-multi-space.html:
+ * editing/selection/move-by-word-visually-null-box.html:
+ * editing/selection/move-by-word-visually-single-space-inline-element.html:
+ * editing/selection/move-by-word-visually-single-space-one-element.html:
+ * editing/selection/move-by-word-visually-textarea.html:
+ * editing/selection/move-by-word-visually-wrong-left-right.html:
+ * editing/selection/programmatic-selection-on-mac-is-directionless.html:
+ * editing/selection/rtl-move-selection-right-left.html:
+ * editing/selection/script-tests/click-in-margins-inside-editable-div.js:
+ * editing/selection/script-tests/click-in-padding-with-multiple-line-boxes.js:
+ * editing/selection/script-tests/shift-click.js:
+ (runShiftClickTest):
+ * editing/selection/selection-extend-should-not-move-across-caret-on-mac.html:
+ * editing/style/iframe-onload-crash-mac.html:
+ * editing/style/iframe-onload-crash-unix.html:
+ * editing/style/iframe-onload-crash-win.html:
+ * fast/events/backspace-navigates-back.html:
+ * fast/forms/selection-direction.html:
+
2012-05-21 Levi Weintraub <leviw@chromium.org>
Unreviewed gardening. Updating more tests post r117815.
function runTestOn(platform) {
var testarea = document.getElementById("test");
if (window.internals)
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
testarea.focus();
moveSelectionForwardByCharacterCommand();
var e = document.getElementById("test");
if (window.internals)
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
sel.setPosition(e, 0);
sel.modify("extend", "forward", "character");
var s = window.getSelection();
if (window.internals)
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
s.setPosition(e, 0);
s.modify("extend", "forward", "lineBoundary");
function runTests(editingBehavior) {
if (window.internals)
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
debug('Tests for ' + editingBehavior)
testQueryCommandState("bold", 'hello', selectAll, {'mac': false, 'win': false}[editingBehavior]);
function runRangeTests(editingBehavior)
{
if (window.internals)
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
debug('Tests for ' + editingBehavior);
queryTextAlignment(selectMiddleOfHelloWorld, '<p>hello</p><p>world</p>', '');
debug('Platform: ' + platform);
if (window.internals)
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
if (platform == 'win' || platform == 'unix')
platform = 'nonmac';
function runTest(platform, expectedText)
{
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
var target = document.getElementById('select');
var startX = target.offsetLeft + target.offsetWidth;
<script>
function test(platform, result) {
window.getSelection().removeAllRanges();
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
paragraph = document.getElementById("text");
x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.offsetWidth + 10;
if (window.layoutTestController && window.internals) {
layoutTestController.overridePreference("WebKitEnableCaretBrowsing", true);
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
var target = document.getElementById("target");
target.focus();
<script>
if (window.internals) {
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
function selectTarget(target) {
eventSender.mouseMoveTo(target.offsetLeft + target.offsetWidth * 2 / 5, target.offsetTop + 5);
// clear selection
window.getSelection().removeAllRanges();
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
var text = document.getElementById("text");
if (!window.eventSender)
document.writeln('FAIL - this test requires eventSender');
else {
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
var test = document.getElementById('target');
eventSender.mouseMoveTo(target.offsetLeft + target.offsetWidth / 2, target.offsetTop + target.offsetHeight / 2);
function editingTest(editingBehavior) {
if (window.internals)
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
var startTarget = document.getElementById('start');
var endTarget = document.getElementById('end');
function runTest(behavior, expectedText)
{
- window.internals.settings.setEditingBehavior(behavior);
+ internals.settings.setEditingBehavior(behavior);
doubleClickWord();
getSelection().modify("extend", "backward", "character");
getSelection().modify("extend", "backward", "character");
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<textarea></textarea>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<vkern></vkern><marquee><div title="0|0" class="test_move_by_word">abc def
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<video></video><meter><image class="test_move_by_word" title="0|0">
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
><div title="0|0" class="test_move_by_word" dir=ltr><keygen><base>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<div contenteditable dir=ltr>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
}
</script>
</head>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
</head>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
</head>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<div id="console"></div>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
</head>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
</head>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
</script>
<title>wrong result because VisiblePosition.left()/right() returns wrong result</title>
function runTestsFor(platform) {
debug(platform + ':');
- window.internals.settings.setEditingBehavior(platform);
+ internals.settings.setEditingBehavior(platform);
var listOfTestNodes = document.getElementById('test').childNodes;
for (var i = 0; i < listOfTestNodes.length; i++) {
testSelectionChange(setSelection, "move", "left", 3, 0, "Move selection left");
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior("mac");
+ internals.settings.setEditingBehavior("mac");
testSelectionChange(dragSelection, "extend", "right", 0, 0, "Extend dragged selection right (Mac)");
testSelectionChange(dragSelection, "extend", "left", 0, 0, "Extend dragged selection left (Mac)");
- window.internals.settings.setEditingBehavior("win");
+ internals.settings.setEditingBehavior("win");
testSelectionChange(dragSelection, "extend", "right", 0, 0, "Extend dragged selection right (Win)");
testSelectionChange(dragSelection, "extend", "left", 1, 0, "Extend dragged selection left (Win)");
- window.internals.settings.setEditingBehavior("unix");
+ internals.settings.setEditingBehavior("unix");
testSelectionChange(dragSelection, "extend", "right", 0, 0, "Extend dragged selection right (Unix)");
testSelectionChange(dragSelection, "extend", "left", 1, 0, "Extend dragged selection left (Unix)");
}
function editingTest(editingBehavior)
{
if (window.internals)
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
var expectMacStyleSelection = editingBehavior == "mac";
function editingTest(editingBehavior)
{
if (window.internals)
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
var expectMacStyleSelection = editingBehavior == "mac";
function runShiftClickTest(editingBehavior)
{
- window.internals.settings.setEditingBehavior(editingBehavior);
+ internals.settings.setEditingBehavior(editingBehavior);
// Double-click select to get around eventSender bug where it won't select
// text just using single-click.
function editingTest(behavior) {
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior(behavior);
+ internals.settings.setEditingBehavior(behavior);
}
function getSetCaretFunction(node, container, offset) {
<meta><input><h6><nobr></nobr><datagrid><ins><button><em><iframe onload="
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
}
if (document.counter)
<meta><input><h6><nobr></nobr><datagrid><ins><button><em><iframe onload="
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('unix');
+ internals.settings.setEditingBehavior('unix');
}
if (document.counter)
<meta><input><h6><nobr></nobr><datagrid><ins><button><em><iframe onload="
if (window.layoutTestController && window.internals) {
layoutTestController.dumpAsText();
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
}
if (document.counter)
if (!expect(location == 'test-mac', 'navigation to test-mac'))
return;
- window.internals.settings.setEditingBehavior('mac');
+ internals.settings.setEditingBehavior('mac');
testBackspaceNavigatesBack();
break;
if (!expect(location == 'test-win', 'navigation to test-win'))
return;
- window.internals.settings.setEditingBehavior('win');
+ internals.settings.setEditingBehavior('win');
testBackspaceNavigatesBack();
break;
return;
// Test unix behavior: that backspace does not go back.
- window.internals.settings.setEditingBehavior('unix');
+ internals.settings.setEditingBehavior('unix');
// We expect backspace to *not* navigate.
// Start a navigation to the success page; if backspace causes us to go back,
\r
function runTestFor(platform) {\r
if (window.internals)\r
- window.internals.settings.setEditingBehavior(platform.toLowerCase());\r
+ internals.settings.setEditingBehavior(platform.toLowerCase());\r
var tests = document.getElementById('tests');\r
for (var i = 0; i < tests.childNodes.length; i++) {\r
runTest(tests.childNodes[i], platform);\r