mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 923376 - Spellcheck all appended nodes, not just the first; r=ehsan
This commit is contained in:
parent
0f3a097677
commit
e229b75b12
@ -3229,12 +3229,22 @@ nsHTMLEditor::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
ContentInserted(aDocument, aContainer, aFirstNewContent, aIndexInContainer);
|
||||
DoContentInserted(aDocument, aContainer, aFirstNewContent, aIndexInContainer,
|
||||
eAppended);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
nsIContent* aChild, int32_t aIndexInContainer)
|
||||
{
|
||||
DoContentInserted(aDocument, aContainer, aChild, aIndexInContainer,
|
||||
eInserted);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
|
||||
nsIContent* aChild, int32_t aIndexInContainer,
|
||||
InsertedOrAppended aInsertedOrAppended)
|
||||
{
|
||||
if (!aChild) {
|
||||
return;
|
||||
@ -3259,8 +3269,17 @@ nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
|
||||
// Update spellcheck for only the newly-inserted node (bug 743819)
|
||||
if (mInlineSpellChecker) {
|
||||
nsRefPtr<nsRange> range = new nsRange(aChild);
|
||||
int32_t endIndex = aIndexInContainer + 1;
|
||||
if (aInsertedOrAppended == eAppended) {
|
||||
// Count all the appended nodes
|
||||
nsIContent* sibling = aChild->GetNextSibling();
|
||||
while (sibling) {
|
||||
endIndex++;
|
||||
sibling = sibling->GetNextSibling();
|
||||
}
|
||||
}
|
||||
nsresult res = range->Set(aContainer, aIndexInContainer,
|
||||
aContainer, aIndexInContainer + 1);
|
||||
aContainer, endIndex);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
mInlineSpellChecker->SpellCheckRange(range);
|
||||
}
|
||||
|
@ -952,7 +952,10 @@ private:
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString* aValue);
|
||||
|
||||
typedef enum { eInserted, eAppended } InsertedOrAppended;
|
||||
void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
|
||||
nsIContent* aChild, int32_t aIndexInContainer,
|
||||
InsertedOrAppended aInsertedOrAppended);
|
||||
};
|
||||
#endif //nsHTMLEditor_h__
|
||||
|
||||
|
11
layout/base/tests/bug923376-ref.html
Normal file
11
layout/base/tests/bug923376-ref.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html class="reftest-wait"><div contenteditable>something missspelled<br>something elsed#</div>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script>
|
||||
document.body.firstChild.focus();
|
||||
SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm",
|
||||
window);
|
||||
onSpellCheck(document.body.firstChild, function() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
});
|
||||
</script>
|
15
layout/base/tests/bug923376.html
Normal file
15
layout/base/tests/bug923376.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html class="reftest-wait"><div contenteditable></div>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script>
|
||||
var div = document.body.firstChild;
|
||||
div.focus();
|
||||
SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm",
|
||||
window);
|
||||
onSpellCheck(div, function() {
|
||||
div.innerHTML = 'something missspelled<br>something elsed#';
|
||||
onSpellCheck(div, function() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
});
|
||||
});
|
||||
</script>
|
@ -148,6 +148,8 @@ support-files =
|
||||
bug682712-1-ref.html
|
||||
bug746993-1.html
|
||||
bug746993-1-ref.html
|
||||
bug923376.html
|
||||
bug923376-ref.html
|
||||
bug966992-1.html
|
||||
bug966992-1-ref.html
|
||||
bug966992-2.html
|
||||
|
@ -147,6 +147,7 @@ if (navigator.appVersion.indexOf("Android") == -1 &&
|
||||
tests.push([ 'bug966992-2.html' , 'bug966992-2-ref.html' ]);
|
||||
tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]);
|
||||
tests.push(function() {SpecialPowers.setBoolPref("layout.css.overflow-clip-box.enabled", false);});
|
||||
tests.push([ 'bug923376.html' , 'bug923376-ref.html' ]);
|
||||
} else {
|
||||
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user