Back out changeset 699fc684188c from bug 483634 due to unit test failures

This commit is contained in:
Gavin Sharp 2009-03-19 00:56:19 -04:00
Родитель e7c41cb7ab
Коммит 84543ac2c6
4 изменённых файлов: 1 добавлений и 108 удалений

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

@ -47,8 +47,6 @@
#include "nsIFocusController.h"
#include "nsIEventStateManager.h"
#include "nsIScrollableView.h"
#include "nsContentUtils.h"
#include "nsIFrame.h"
@ -571,7 +569,7 @@ nsDOMWindowUtils::ElementFromPoint(PRInt32 aX, PRInt32 aY,
{
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mWindow->GetExtantDocument()));
NS_ENSURE_STATE(doc);
return doc->ElementFromPointHelper(aX, aY, aIgnoreRootScrollFrame, aFlushLayout,
aReturn);
}
@ -736,32 +734,3 @@ nsDOMWindowUtils::SuppressEventHandling(PRBool aSuppress)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetScrollXY(PRBool aFlushLayout, PRInt32* aScrollX, PRInt32* aScrollY)
{
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mWindow->GetExtantDocument()));
NS_ENSURE_STATE(doc);
if (aFlushLayout) {
doc->FlushPendingNotifications(Flush_Layout);
}
nsIPresShell *presShell = doc->GetPrimaryShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED);
nsIViewManager *viewManager = presShell->GetViewManager();
NS_ENSURE_TRUE(viewManager, NS_ERROR_UNEXPECTED);
nsIScrollableView *view = nsnull;
viewManager->GetRootScrollableView(&view);
NS_ENSURE_TRUE(view, NS_ERROR_UNEXPECTED);
nscoord xPos, yPos;
nsresult rv = view->GetScrollPosition(xPos, yPos);
NS_ENSURE_SUCCESS(rv, rv);
*aScrollX = nsPresContext::AppUnitsToIntCSSPixels(xPos);
*aScrollY = nsPresContext::AppUnitsToIntCSSPixels(yPos);
return NS_OK;
}

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

@ -320,12 +320,4 @@ interface nsIDOMWindowUtils : nsISupports {
* on all windows. Otherwise, enable them.
*/
void disableNonTestMouseEvents(in boolean aDisable);
/**
* Returns the scroll position of the window's currently loaded document.
*
* @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
* @see nsIDOMWindow::scrollX/Y
*/
void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
};

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

@ -48,7 +48,6 @@ _TEST_FILES = test_offsets.html \
test_offsets.xul \
test_offsets.js \
test_domWindowUtils.html \
test_domWindowUtils_scrollXY.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -1,67 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>nsIDOMWindowUtils::elementFromPoint test</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<style>
body {
/* Make room for scrolling */
width: 100000px;
height: 100000px;
}
</style>
</head>
<body id="body">
<p>Top</p>
<script type="application/javascript;version=1.8">
// Enable privileges so we can use nsIDOMWindowUtils interface
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var domWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
/*
void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
*/
function testScrollXY() {
function checkGetScrollXYState(flush, vals, testName) {
let scrollX = {}, scrollY = {};
domWindowUtils.getScrollXY(flush, scrollX, scrollY);
is(scrollX.value, vals[0], "getScrollXY x for test: " + testName);
is(scrollY.value, vals[1], "getScrollXY y for test: " + testName);
}
function checkWindowScrollState(vals, testName) {
is(window.scrollX, vals[0], "scrollX for test: " + testName);
is(window.scrollY, vals[1], "scrollY for test: " + testName);
}
// Check initial state (0, 0)
checkGetScrollXYState(false, [0, 0], "initial getScrollXY state");
checkGetScrollXYState(true, [0, 0], "initial getScrollXY state+flush");
checkWindowScrollState([0, 0], "initial window.scroll* state");
// scroll
window.scrollTo(900, 1000);
checkGetScrollXYState(false, [900, 1000], "after scroll getScrollXY state");
checkGetScrollXYState(true, [900, 1000], "after scroll getScrollXY state+flush");
checkWindowScrollState([900, 1000], "after scroll window.scroll* state");
// ensure flush=false works
document.body.style.width = 'auto';
document.body.style.height = 'auto';
checkGetScrollXYState(false, [900, 1000], "didn't flush layout for getScrollXY");
checkGetScrollXYState(true, [0, 0], "flushed layout for getScrollXY");
}
testScrollXY();
</script>
<p id="display"></p>
</body>
</html>