From daf87871dda74ab1b062d0abf1c2f0cd9728ce42 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Tue, 26 Aug 2008 11:04:14 +0800 Subject: [PATCH] =?UTF-8?q?Bug=20451376=20=E2=80=93=20IAccessibleText::att?= =?UTF-8?q?ributes=20provides=20incorrect=20info=20after=20a=20mis-spelled?= =?UTF-8?q?=20word,=20r=3DOlli.Pettay,=20MarcoZ,=20sr=3Dneil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/mochitest/test_textattrs.html | 9 ++- content/base/src/nsRange.cpp | 2 +- content/base/test/Makefile.in | 1 + content/base/test/test_bug451376.html | 79 +++++++++++++++++++ 4 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 content/base/test/test_bug451376.html diff --git a/accessible/tests/mochitest/test_textattrs.html b/accessible/tests/mochitest/test_textattrs.html index 5880519a7be..05aa3997eaf 100644 --- a/accessible/tests/mochitest/test_textattrs.html +++ b/accessible/tests/mochitest/test_textattrs.html @@ -67,7 +67,7 @@ return; } - var errorMsg = " for " + aID + "at offset " + aOffset; + var errorMsg = " for " + aID + " at offset " + aOffset; is(startOffset.value, aStartOffset, "Wrong start offset" + errorMsg); is(endOffset.value, aEndOffset, @@ -98,10 +98,10 @@ if (!(prop.key in aExpectedAttrs)) ok(false, - "Unexpected attribute '" + prop.key + "'" + aErrorMsg); + "Unexpected attribute '" + prop.key + "' " + aErrorMsg); else is(prop.value, aExpectedAttrs[prop.key], - "Attribute '" + prop.key + "' has wrong value" + aErrorMsg); + "Attribute '" + prop.key + " 'has wrong value" + aErrorMsg); } for (var name in aExpectedAttrs) { @@ -113,7 +113,7 @@ if (!value) ok(false, - "There is no expected attribute '" + name + "'" + aErrorMsg); + "There is no expected attribute '" + name + "' " + aErrorMsg); } } @@ -176,6 +176,7 @@ testTextAttrs(ID, 0, attrs, 0, 11, defAttrs); testTextAttrs(ID, 11, misspelledAttrs, 11, 17, defAttrs); + testTextAttrs(ID, 17, attrs, 17, 18, defAttrs); testTextAttrs(ID, 18, misspelledAttrs, 18, 22, defAttrs); is(gA11yEventObserver.mTextAttrChangedEventCounter, 2, diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 44aaf64226c..d2d19c49530 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -398,7 +398,7 @@ nsRange::ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aResult) *aResult = cmp; } else if (nsContentUtils::ComparePoints(mEndParent, mEndOffset, - parent, aOffset) == -1) { + parent, aOffset) <= 0) { *aResult = 1; } else { diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 91121fb23d9..5b8868cbaf0 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -190,6 +190,7 @@ _TEST_FILES = test_bug5141.html \ bug435425_redirect.sjs \ test_bug438519.html \ test_bug444722.html \ + test_bug451376.html \ test_text_replaceWholeText.html \ test_text_wholeText.html \ wholeTexty-helper.xml \ diff --git a/content/base/test/test_bug451376.html b/content/base/test/test_bug451376.html new file mode 100644 index 00000000000..7fd26dfa2ee --- /dev/null +++ b/content/base/test/test_bug451376.html @@ -0,0 +1,79 @@ + + + + + Test for Bug 451376 + + + + + + + Mozilla Bug 451376 +

+ +
+
+  
text
+ + +
+ + +