Bug 1538042 Part 1: Change nsIFind::Find to have access to text length. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D25005

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-03-29 15:55:57 +00:00
Родитель a7991ad77c
Коммит 3e8325f6fb
5 изменённых файлов: 5 добавлений и 23 удалений

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

@ -448,7 +448,7 @@ char16_t nsFind::PeekNextChar(State& aState) const {
// Take nodes out of the tree with NextNode, until null (NextNode will return 0
// at the end of our range).
NS_IMETHODIMP
nsFind::Find(const char16_t* aPatText, nsRange* aSearchRange,
nsFind::Find(const nsAString& aPatText, nsRange* aSearchRange,
nsRange* aStartPoint, nsRange* aEndPoint, nsRange** aRangeRet) {
DEBUG_FIND_PRINTF("============== nsFind::Find('%s'%s, %p, %p, %p)\n",
NS_LossyConvertUTF16toASCII(aPatText).get(),
@ -469,10 +469,6 @@ nsFind::Find(const char16_t* aPatText, nsRange* aSearchRange,
*aRangeRet = 0;
if (!aPatText) {
return NS_ERROR_NULL_POINTER;
}
nsAutoString patAutoStr(aPatText);
if (!mCaseSensitive) {
ToLowerCase(patAutoStr);

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

@ -30,6 +30,6 @@ interface nsIFind : nsISupports
* end (forward) or start (backward).
* @retval A range spanning the match that was found (or null).
*/
Range Find(in wstring aPatText, in Range aSearchRange,
Range Find(in AString aPatText, in Range aSearchRange,
in Range aStartPoint, in Range aEndPoint);
};

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

@ -673,7 +673,7 @@ nsresult nsWebBrowserFind::SearchInFrame(nsPIDOMWindowOuter* aWindow,
rv = GetSearchLimits(searchRange, startPt, endPt, theDoc, sel, aWrapping);
NS_ENSURE_SUCCESS(rv, rv);
rv = find->Find(mSearchString.get(), searchRange, startPt, endPt,
rv = find->Find(mSearchString, searchRange, startPt, endPt,
getter_AddRefs(foundRange));
if (NS_SUCCEEDED(rv) && foundRange) {

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

@ -434,7 +434,7 @@ nsresult nsTypeAheadFind::FindItNow(nsIPresShell* aPresShell, bool aIsLinksOnly,
while (true) { // ----- Outer while loop: go through all docs -----
while (true) { // === Inner while loop: go through a single doc ===
mFind->Find(mTypeAheadBuffer.get(), mSearchRange, mStartPointRange,
mFind->Find(mTypeAheadBuffer, mSearchRange, mStartPointRange,
mEndPointRange, getter_AddRefs(returnRange));
if (!returnRange) {
break; // Nothing found in this doc, go to outer loop (try next doc)

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

@ -33,20 +33,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=450048
var startPt = searchRange;
var endPt = searchRange;
// Check |null| detection on |aPatText| parameter.
try {
rf.Find(null, searchRange, startPt, endPt);
ok(false, "Missing NS_ERROR_NULL_POINTER exception");
} catch (e) {
let wrappedError = SpecialPowers.wrap(e);
if (wrappedError.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER) {
ok(true, null);
} else {
throw wrappedError;
}
}
// Check |null| detection on |aSearchRange| parameter.
try {
rf.Find("", null, startPt, endPt);