Bug 998188 part.5 Fix orange and improve EventUtils.js and ChromeUtils.js r=smaug

This commit is contained in:
Masayuki Nakano 2014-04-26 08:52:13 +09:00
Родитель 97396c150e
Коммит c51b2b1842
4 изменённых файлов: 30 добавлений и 11 удалений

Просмотреть файл

@ -73,8 +73,10 @@
}
function testCaretPosition(aDomWinUtils, aOffset, aRectDims) {
let rect = aDomWinUtils.sendQueryContentEvent(aDomWinUtils.QUERY_CARET_RECT,
aOffset, 0, 0, 0);
let rect = aDomWinUtils.sendQueryContentEvent(
aDomWinUtils.QUERY_CARET_RECT,
aOffset, 0, 0, 0,
aDomWinUtils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
ok(rect, "rect returned");
ok(rect.succeeded, "call succeeded");

Просмотреть файл

@ -82,8 +82,10 @@
}
function testCaretPosition(aDomWinUtils, aOffset, aRectDims) {
let rect = aDomWinUtils.sendQueryContentEvent(aDomWinUtils.QUERY_CARET_RECT,
aOffset, 0, 0, 0);
let rect = aDomWinUtils.sendQueryContentEvent(
aDomWinUtils.QUERY_CARET_RECT,
aOffset, 0, 0, 0,
aDomWinUtils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
ok(rect, "rect returned");
ok(rect.succeeded, "call succeeded");

Просмотреть файл

@ -30,7 +30,8 @@ function synthesizeQueryTextContent(aOffset, aLength, aWindow)
return nullptr;
}
return utils.sendQueryContentEvent(utils.QUERY_TEXT_CONTENT,
aOffset, aLength, 0, 0);
aOffset, aLength, 0, 0,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**
@ -51,7 +52,8 @@ function synthesizeQueryTextRect(aOffset, aLength, aWindow)
return nullptr;
}
return utils.sendQueryContentEvent(utils.QUERY_TEXT_RECT,
aOffset, aLength, 0, 0);
aOffset, aLength, 0, 0,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**
@ -67,7 +69,8 @@ function synthesizeQueryEditorRect(aWindow)
if (!utils) {
return nullptr;
}
return utils.sendQueryContentEvent(utils.QUERY_EDITOR_RECT, 0, 0, 0, 0);
return utils.sendQueryContentEvent(utils.QUERY_EDITOR_RECT, 0, 0, 0, 0,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**
@ -85,7 +88,8 @@ function synthesizeCharAtPoint(aX, aY, aWindow)
return nullptr;
}
return utils.sendQueryContentEvent(utils.QUERY_CHARACTER_AT_POINT,
0, 0, aX, aY);
0, 0, aX, aY,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**

Просмотреть файл

@ -971,6 +971,14 @@ function synthesizeText(aEvent, aWindow)
compositionString.dispatchEvent();
}
// Must be synchronized with nsIDOMWindowUtils.
const QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK = 0x0000;
const QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK = 0x0001;
const SELECTION_SET_FLAG_USE_NATIVE_LINE_BREAK = 0x0000;
const SELECTION_SET_FLAG_USE_XP_LINE_BREAK = 0x0001;
const SELECTION_SET_FLAG_REVERSE = 0x0002;
/**
* Synthesize a query selected text event.
*
@ -985,7 +993,8 @@ function synthesizeQuerySelectedText(aWindow)
return null;
}
return utils.sendQueryContentEvent(utils.QUERY_SELECTED_TEXT, 0, 0, 0, 0);
return utils.sendQueryContentEvent(utils.QUERY_SELECTED_TEXT, 0, 0, 0, 0,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**
@ -1004,7 +1013,8 @@ function synthesizeQueryCaretRect(aOffset, aWindow)
return null;
}
return utils.sendQueryContentEvent(utils.QUERY_CARET_RECT,
aOffset, 0, 0, 0);
aOffset, 0, 0, 0,
QUERY_CONTENT_FLAG_USE_NATIVE_LINE_BREAK);
}
/**
@ -1025,5 +1035,6 @@ function synthesizeSelectionSet(aOffset, aLength, aReverse, aWindow)
if (!utils) {
return false;
}
return utils.sendSelectionSetEvent(aOffset, aLength, aReverse);
var flags = aReverse ? SELECTION_SET_FLAG_REVERSE : 0;
return utils.sendSelectionSetEvent(aOffset, aLength, flags);
}