From 1c8b625f5d03eb13c55ae6452f55f70ce396f134 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 1 Oct 2011 18:14:40 +0200 Subject: [PATCH] Bug 93077 - Support #top in standards mode; r=bz --- layout/base/nsPresShell.cpp | 11 ++++---- layout/base/tests/Makefile.in | 6 +++++ layout/base/tests/test_bug93077-1.html | 32 +++++++++++++++++++++++ layout/base/tests/test_bug93077-2.html | 32 +++++++++++++++++++++++ layout/base/tests/test_bug93077-3.html | 35 ++++++++++++++++++++++++++ layout/base/tests/test_bug93077-4.html | 35 ++++++++++++++++++++++++++ layout/base/tests/test_bug93077-5.html | 35 ++++++++++++++++++++++++++ layout/base/tests/test_bug93077-6.html | 35 ++++++++++++++++++++++++++ 8 files changed, 215 insertions(+), 6 deletions(-) create mode 100644 layout/base/tests/test_bug93077-1.html create mode 100644 layout/base/tests/test_bug93077-2.html create mode 100644 layout/base/tests/test_bug93077-3.html create mode 100644 layout/base/tests/test_bug93077-4.html create mode 100644 layout/base/tests/test_bug93077-5.html create mode 100644 layout/base/tests/test_bug93077-6.html diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3937372979f..36b50ddb07c 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3146,12 +3146,11 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll) } } } else { - rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called - - // Scroll to the top/left if the anchor can not be - // found and it is labelled top (quirks mode only). @see bug 80784 - if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) && - (mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) { + rv = NS_ERROR_FAILURE; + NS_NAMED_LITERAL_STRING(top, "top"); + if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) { + // Scroll to the top/left if aAnchorName is "top" and there is no element + // with such a name or id. rv = NS_OK; nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable(); // Check |aScroll| after setting |rv| so we set |rv| to the same diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 963d8b23127..e37414fa8c6 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -68,6 +68,12 @@ _TEST_FILES = \ test_after_paint_pref.html \ test_border_radius_hit_testing.html \ test_bug66619.html \ + test_bug93077-1.html \ + test_bug93077-2.html \ + test_bug93077-3.html \ + test_bug93077-4.html \ + test_bug93077-5.html \ + test_bug93077-6.html \ test_bug114649.html \ $(warning test_bug369950.html disabled due to random orange; see bug 492575) \ test_bug386575.xhtml \ diff --git a/layout/base/tests/test_bug93077-1.html b/layout/base/tests/test_bug93077-1.html new file mode 100644 index 00000000000..16fad6b2aab --- /dev/null +++ b/layout/base/tests/test_bug93077-1.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-2.html b/layout/base/tests/test_bug93077-2.html new file mode 100644 index 00000000000..24e17b73539 --- /dev/null +++ b/layout/base/tests/test_bug93077-2.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-3.html b/layout/base/tests/test_bug93077-3.html new file mode 100644 index 00000000000..0c37be986a7 --- /dev/null +++ b/layout/base/tests/test_bug93077-3.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-4.html b/layout/base/tests/test_bug93077-4.html new file mode 100644 index 00000000000..ea624086ab5 --- /dev/null +++ b/layout/base/tests/test_bug93077-4.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-5.html b/layout/base/tests/test_bug93077-5.html new file mode 100644 index 00000000000..ffe9233cf6e --- /dev/null +++ b/layout/base/tests/test_bug93077-5.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ + diff --git a/layout/base/tests/test_bug93077-6.html b/layout/base/tests/test_bug93077-6.html new file mode 100644 index 00000000000..08cdb6c7fd8 --- /dev/null +++ b/layout/base/tests/test_bug93077-6.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 93077 + + + + + + +Mozilla Bug 93077 +

+
...
+

+

Top

+
+
+
+ +