import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
14
layout/generic/test/bug1174521.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div>
|
||||
<div style="float: left; padding-top: 20px">
|
||||
<a href="#" onclick="parent.postMessage({msg: 'DONE'}, '*'); return false;">test</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position: absolute">
|
||||
A
|
||||
</div>
|
||||
B
|
||||
</body>
|
||||
</html>
|
||||
8
layout/generic/test/bug344830_testembed.svg
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 200 200">
|
||||
<g id="g1" transform="translate(100, 100)">
|
||||
<circle cx="0" cy="0" r="50" fill="green" />
|
||||
<text x="0" y="10" font-size="24" text-anchor="middle" fill="yellow">Kibology</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 293 B |
55
layout/generic/test/bug421839-2-page.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body style="position: absolute;">
|
||||
<iframe id="a"></iframe>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
function tripleclick(){
|
||||
var wu = SpecialPowers.getDOMWindowUtils(window);
|
||||
wu.sendMouseEvent('mousedown', 100, 100, 0, 1, 0);
|
||||
setTimeout(tripleclick,20);
|
||||
}
|
||||
setTimeout(tripleclick,200,0, 0);
|
||||
|
||||
function doe2() {
|
||||
document.body.setAttribute('style', 'position: absolute;');
|
||||
document.body.offsetHeight;
|
||||
document.getElementById('a').setAttribute('style', 'position: absolute; direction: rtl; ');
|
||||
setTimeout(doe3,200);
|
||||
}
|
||||
|
||||
function doe3() {
|
||||
document.getElementsByTagName('*')[2].setAttribute('style', 'unicode-bidi: inherit; ime-mode: disabled; font-family: Al Bayan; ');
|
||||
}
|
||||
setTimeout(doe2,500,0);
|
||||
|
||||
setTimeout(function(){window.location.reload()}, 1000);
|
||||
|
||||
|
||||
function designmodes(i){
|
||||
if (i>=0)
|
||||
{
|
||||
try {
|
||||
window.frames[i].document.designMode='on';
|
||||
window.frames[i].document.execCommand('inserthtml', false, 'tesxt ');
|
||||
window.frames[i].document.designMode='off';
|
||||
}
|
||||
catch(e) {}
|
||||
}
|
||||
else {
|
||||
i = window.frames.length-1;
|
||||
}
|
||||
i--;
|
||||
setTimeout(designmodes,50,i);
|
||||
}
|
||||
setTimeout(designmodes,500,window.frames.length-1);
|
||||
|
||||
function doe2(i) {
|
||||
document.body.style.position == 'absolute' ? document.body.style.position = '' : document.body.style.position = 'absolute';
|
||||
setTimeout(doe2,200,i);
|
||||
}
|
||||
setTimeout(doe2,500,0);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
8
layout/generic/test/bug633762_iframe.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<body>
|
||||
<div style="background: red; height: 4000px;">hi</div>
|
||||
<div id="b" style="background: blue; height: 10000px;"></div>
|
||||
<div id="a" style="background: yellow; height: 100px;"></div>
|
||||
<div style="background: green; height: 4000px;"></div>
|
||||
</body>
|
||||
</html>
|
||||
17
layout/generic/test/chrome.ini
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[DEFAULT]
|
||||
skip-if = os == 'android'
|
||||
support-files =
|
||||
file_bug514732_window.xul
|
||||
frame_selection_underline-ref.xhtml
|
||||
frame_selection_underline.css
|
||||
frame_selection_underline.xhtml
|
||||
|
||||
[test_backspace_delete.xul]
|
||||
skip-if = true # Bug 1163311
|
||||
[test_bug469613.xul]
|
||||
[test_bug469774.xul]
|
||||
[test_bug508115.xul]
|
||||
[test_bug514732-2.xul]
|
||||
[test_bug632379.xul]
|
||||
skip-if = os == 'linux' # Bug 1207914
|
||||
[test_selection_underline.html]
|
||||
BIN
layout/generic/test/file_BrokenImageReference.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
layout/generic/test/file_Dolske.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
94
layout/generic/test/file_IconTestServer.sjs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const TIMEOUT_INTERVAL_MS = 100;
|
||||
|
||||
function handleRequest(request, response) {
|
||||
|
||||
// Allow us to asynchronously construct the response with timeouts
|
||||
// rather than forcing us to make the whole thing in one call. See
|
||||
// bug 396226.
|
||||
response.processAsync();
|
||||
|
||||
// Figure out whether the client wants to load the image, or just
|
||||
// to tell us to finish the previous load
|
||||
var query = {};
|
||||
request.queryString.split('&').forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
query[name] = unescape(value);
|
||||
});
|
||||
if (query["continue"] == "true") {
|
||||
|
||||
// Debugging information so we can figure out the hang
|
||||
dump("file_IconTestServer.js DEBUG - Got continue command\n");
|
||||
|
||||
// Get the context structure and finish the old request
|
||||
getObjectState("context", function(obj) {
|
||||
|
||||
// magic or goop, depending on how you look at it
|
||||
savedCtx = obj.wrappedJSObject;
|
||||
|
||||
// Write the rest of the data
|
||||
savedCtx.ostream.writeFrom(savedCtx.istream, savedCtx.istream.available());
|
||||
|
||||
// Close the streams
|
||||
savedCtx.ostream.close();
|
||||
savedCtx.istream.close();
|
||||
|
||||
// Finish off 'the old response'
|
||||
savedCtx.response.finish();
|
||||
});
|
||||
|
||||
// Finish off 'the current response'
|
||||
response.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// Debugging information so we can figure out the hang
|
||||
dump("file_IconTestServer.js DEBUG - Got initial request\n");
|
||||
|
||||
// Context structure - we need to set this up properly to pass to setObjectState
|
||||
var ctx = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
ctx.wrappedJSObject = ctx;
|
||||
|
||||
// Save the response
|
||||
ctx.response = response;
|
||||
|
||||
// We're serving up a png
|
||||
response.setHeader("Content-Type", "image/png", false);
|
||||
|
||||
// Get the output stream
|
||||
ctx.ostream = response.bodyOutputStream;
|
||||
|
||||
// Ugly hack, but effective - copied from dom/media/test/contentDuration1.sjs
|
||||
var pngFile = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||
getService(Components.interfaces.nsIProperties).
|
||||
get("CurWorkD", Components.interfaces.nsILocalFile);
|
||||
var paths = "tests/layout/generic/test/file_Dolske.png";
|
||||
var split = paths.split("/");
|
||||
for(var i = 0; i < split.length; ++i) {
|
||||
pngFile.append(split[i]);
|
||||
}
|
||||
|
||||
// Get an input stream for the png data
|
||||
ctx.istream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileInputStream);
|
||||
ctx.istream.init(pngFile, -1, 0, 0);
|
||||
|
||||
// Write the first 10 bytes, which is just boilerplate/magic bytes
|
||||
ctx.ostream.writeFrom(ctx.istream, 10);
|
||||
|
||||
// Save the context structure for retrieval when we get pinged
|
||||
setObjectState("context", ctx);
|
||||
|
||||
// Now we play the waiting game...
|
||||
|
||||
// Debugging information so we can figure out the hang
|
||||
dump("file_IconTestServer.js DEBUG - Playing the waiting game\n");
|
||||
}
|
||||
|
||||
BIN
layout/generic/test/file_LoadingImageReference.png
Normal file
|
After Width: | Height: | Size: 268 B |
45
layout/generic/test/file_SlowImage.sjs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const IMG_BYTES = atob(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAA" +
|
||||
"DUlEQVQImWNgY2P7DwABOgESJhRQtgAAAABJRU5ErkJggg==");
|
||||
|
||||
function handleRequest(request, response) {
|
||||
response.processAsync();
|
||||
getObjectState("context", function(obj) {
|
||||
let ctx;
|
||||
if (obj == null) {
|
||||
ctx = {
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
ctx.wrappedJSObject = ctx;
|
||||
|
||||
ctx.promise = new Promise(resolve => {
|
||||
ctx.resolve = resolve;
|
||||
});
|
||||
|
||||
setObjectState("context", ctx);
|
||||
} else {
|
||||
ctx = obj.wrappedJSObject;
|
||||
}
|
||||
Promise.resolve(ctx).then(next);
|
||||
});
|
||||
|
||||
function next(ctx) {
|
||||
if (request.queryString.indexOf("continue") >= 0) {
|
||||
ctx.resolve();
|
||||
}
|
||||
|
||||
ctx.promise.then(() => {
|
||||
response.setHeader("Content-Type", "image/png");
|
||||
response.write(IMG_BYTES);
|
||||
response.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
23
layout/generic/test/file_bug1307853.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Iframe for test for Mozilla bug 1307853</title>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
|
||||
html, body { overflow: hidden; margin: 0; padding: 0; border: none; }
|
||||
|
||||
.wrapper {
|
||||
box-sizing: border-box;
|
||||
width: 100px;
|
||||
padding-right: 20%;
|
||||
}
|
||||
|
||||
#inner {
|
||||
height: 1em;
|
||||
background: aqua;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="wrapper">
|
||||
<div id="inner"></div>
|
||||
</div>
|
||||
50
layout/generic/test/file_bug448987.html
Normal file
20
layout/generic/test/file_bug448987_notref.html
Normal file
50
layout/generic/test/file_bug448987_ref.html
Normal file
18
layout/generic/test/file_bug449653_1.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<html><head>
|
||||
<title>Bug 449653 - drawWindow on canvas fails on load, draws white instead of specified region</title>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<div style="width: 100px; height: 100px; background-color: lime;"></div>
|
||||
<br>
|
||||
<canvas id="canvas" width="100" height="100" style="background-color: red;"></canvas>
|
||||
<script>
|
||||
var canvas = document.getElementById("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
SpecialPowers.wrap(ctx).drawWindow(window, 0, 0, 100, 100, "white");
|
||||
</script>
|
||||
</body></html>
|
||||
13
layout/generic/test/file_bug449653_1_ref.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<html><head>
|
||||
<title>Bug 449653 - drawWindow on canvas fails on load, draws white instead of specified region</title>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<div style="width: 100px; height: 100px; background-color: lime;"></div>
|
||||
<br>
|
||||
<div style="width: 100px; height: 100px; background-color: lime;"></div>
|
||||
</body></html>
|
||||
9
layout/generic/test/file_bug514732_1.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>hi</h1>
|
||||
<div id="imgs" style="whitespace: nowrap; overflow: visible; height: 10px;">feh</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
300
layout/generic/test/file_bug514732_helper.html
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=514732
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 514732</title>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=514732">Mozilla Bug 514732</a>
|
||||
|
||||
<div id="imgs" style="whitespace: nowrap; overflow: visible; height: 10px;"></div>
|
||||
|
||||
<iframe id="testframe" src="./file_bug514732_1.html"></iframe>
|
||||
|
||||
<br/><br/>
|
||||
<div id="log">log:<br/></div>
|
||||
<br/><br/>
|
||||
|
||||
<script class="testbody" style="width: 300; height: 150;" type="text/javascript;version=1.8">
|
||||
// Import test API
|
||||
var is = window.opener.is;
|
||||
var ok = window.opener.ok;
|
||||
var todo = window.opener.todo;
|
||||
var finish = window.opener.SimpleTest.finish;
|
||||
|
||||
function log(msg) {
|
||||
document.getElementById("log").innerHTML += msg;
|
||||
}
|
||||
|
||||
function logln(msg) {
|
||||
if (arguments.length == 0) msg = "";
|
||||
document.getElementById("log").innerHTML += msg + "<br/>";
|
||||
}
|
||||
|
||||
function logev(ev) {
|
||||
logln([ev.x, ev.y, ev.width, ev.height].join(' '));
|
||||
}
|
||||
|
||||
/* Absolutely position a 500x500 div at x, y on doc */
|
||||
function phoom(doc, x, y) {
|
||||
var d = doc.createElement('div');
|
||||
d.id = "phoomer";
|
||||
d.style.position = "absolute";
|
||||
d.style.left = x + 'px';
|
||||
d.style.top = y + 'px';
|
||||
d.style.backgroundColor = "#00FFF0";
|
||||
d.style.width = 500 + 'px';
|
||||
d.style.height = 500 + 'px';
|
||||
doc.getElementById('imgs').appendChild(d);
|
||||
}
|
||||
|
||||
function unphoom(doc) {
|
||||
var phoomer = doc.getElementById('phoomer');
|
||||
if (phoomer)
|
||||
doc.getElementById('imgs').removeChild(phoomer);
|
||||
}
|
||||
|
||||
function getDocBodyDimensions(doc) {
|
||||
return [doc.documentElement.scrollWidth, doc.documentElement.scrollHeight];
|
||||
}
|
||||
|
||||
function makeResult() {
|
||||
return {
|
||||
success: false,
|
||||
event: null
|
||||
};
|
||||
}
|
||||
|
||||
function makeListener(result, eventGen) {
|
||||
return function(ev) {
|
||||
result.success = true;
|
||||
result.event = ev;
|
||||
setTimeout(function() { eventGen.next(); }, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function waitInterrupt(result, gen) {
|
||||
result.event = null;
|
||||
result.success = false;
|
||||
setTimeout(function() { if (!result.success) gen.next(); }, 3500);
|
||||
}
|
||||
|
||||
function testPhoom(isCapturing, x, y, expectEvent) {
|
||||
|
||||
var eventGen = (function() {
|
||||
var innerdoc = document.getElementById('testframe').contentDocument;
|
||||
|
||||
for (var doc of [document, innerdoc]) {
|
||||
var inner = (doc == innerdoc);
|
||||
var w, h, result, listener;
|
||||
|
||||
/* --- EXPANSION --- */
|
||||
|
||||
result = makeResult();
|
||||
listener = makeListener(result, eventGen);
|
||||
|
||||
doc.addEventListener("MozScrolledAreaChanged", listener, isCapturing);
|
||||
|
||||
if (!expectEvent) waitInterrupt(result, eventGen);
|
||||
phoom(doc, x, y);
|
||||
yield;
|
||||
|
||||
doc.removeEventListener("MozScrolledAreaChanged", listener, isCapturing);
|
||||
|
||||
/* If we're expecting an event, better check that we got one. If we are not expecting one,
|
||||
one can still arrive, but we don't complain if it did not. In either case, any event
|
||||
that arrives will have its data checked below. */
|
||||
if (expectEvent) {
|
||||
ok(result.success, "Received expected " + (inner ? "inner" : "") + " expansion event");
|
||||
}
|
||||
|
||||
if (result.success) {
|
||||
is(result.event.x, 0, "Expansion event x is 0");
|
||||
is(result.event.y, 0, "Expansion event y is 0");
|
||||
if (inner) {
|
||||
/* In iframe-land, the values of |myiframe.contentDocument.documentElement.scrollWidth| and
|
||||
|.scrollHeight| appear to be not as expected (they stay very small). This is fine, since
|
||||
we know exactly where we're positioning our fixed-dimensions div, and we know our iframe's
|
||||
dimensions, so we can do our own math. NB: The inner iframe is styled at 300x500. */
|
||||
is(Math.round(result.event.width),
|
||||
Math.max(x + 500, 300),
|
||||
"Inner expansion event width matches body width");
|
||||
is(Math.round(result.event.height),
|
||||
Math.max(y + 500, 150),
|
||||
"Inner expansion event height matches body height");
|
||||
} else {
|
||||
[w, h] = getDocBodyDimensions(doc);
|
||||
is(Math.round(result.event.width), w, "Expansion event width matches body width");
|
||||
is(Math.round(result.event.height), h, "Expansion event height matches body height");
|
||||
}
|
||||
}
|
||||
|
||||
/* --- CONTRACTION --- */
|
||||
|
||||
result = makeResult();
|
||||
listener = makeListener(result, eventGen);
|
||||
|
||||
doc.addEventListener("MozScrolledAreaChanged", listener, isCapturing);
|
||||
|
||||
if (!expectEvent) waitInterrupt(result, eventGen);
|
||||
unphoom(doc);
|
||||
yield;
|
||||
|
||||
doc.removeEventListener("MozScrolledAreaChanged", listener, isCapturing);
|
||||
|
||||
if (expectEvent) {
|
||||
ok(result.success, "Received expected " + (inner ? "inner" : "") + " contraction event");
|
||||
}
|
||||
|
||||
if (result.success) {
|
||||
is(result.event.x, 0, "Contraction event x is 0");
|
||||
is(result.event.y, 0, "Contraction event y is 0");
|
||||
if (inner) {
|
||||
is(Math.round(result.event.width), 300, "Inner contraction event width matches body width");
|
||||
is(Math.round(result.event.height), 150, "Inner contraction event height matches body height");
|
||||
} else {
|
||||
[w, h] = getDocBodyDimensions(doc);
|
||||
is(Math.round(result.event.width), w, "Contraction event width matches body width");
|
||||
is(Math.round(result.event.height), h, "Contraction event height matches body height");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(nextTest, 0);
|
||||
|
||||
yield;
|
||||
})();
|
||||
|
||||
setTimeout(function() { eventGen.next(); }, 0);
|
||||
}
|
||||
|
||||
function testPreliminaries() {
|
||||
/* Do any setup here */
|
||||
nextTest();
|
||||
}
|
||||
|
||||
function testEventCapturingHorz() {
|
||||
testPhoom(true, 10000, 0, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventCapturingVert() {
|
||||
testPhoom(true, 0, 10000, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventCapturingBoth() {
|
||||
testPhoom(true, 10000, 10000, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventCapturingNegv() {
|
||||
testPhoom(true, -10000, -10000, false); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventBubblingHorz() {
|
||||
testPhoom(false, 10000, 0, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventBubblingVert() {
|
||||
testPhoom(false, 0, 10000, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventBubblingBoth() {
|
||||
testPhoom(false, 10000, 10000, true); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testEventBubblingNegv() {
|
||||
testPhoom(false, -10000, -10000, false); // calls nextTest() when finished
|
||||
}
|
||||
|
||||
function testCustomCreationHelper(creatingDoc, listeningDoc, x, y, w, h, expectEvent) {
|
||||
var result = makeResult();
|
||||
|
||||
var listener = function(evt) {
|
||||
result.success = true;
|
||||
result.event = evt;
|
||||
};
|
||||
|
||||
var ev = creatingDoc.createEvent("ScrollAreaEvent");
|
||||
ev.initScrollAreaEvent("MozScrolledAreaChanged",
|
||||
true, true, window, 0,
|
||||
x, y, w, h);
|
||||
|
||||
listeningDoc.addEventListener("MozScrolledAreaChanged", listener, true);
|
||||
|
||||
result.success = false;
|
||||
creatingDoc.dispatchEvent(ev);
|
||||
|
||||
listeningDoc.removeEventListener("MozScrolledAreaChanged", listener, true);
|
||||
|
||||
is(result.success, expectEvent, "Received custom event iff expected");
|
||||
if (result.success) {
|
||||
is(result.event.x, x, "Custom event data matches for x");
|
||||
is(result.event.y, y, "Custom event data matches for y");
|
||||
is(result.event.width, w, "Custom event data matches for width");
|
||||
is(result.event.height, h, "Custom event data matches for height");
|
||||
}
|
||||
}
|
||||
|
||||
function testCustomCreation() {
|
||||
var innerdoc = document.getElementById('testframe').contentDocument;
|
||||
testCustomCreationHelper(document, document, 2, 7, 1, 8, true); // e = 2.718 ...
|
||||
testCustomCreationHelper(innerdoc, innerdoc, 2, 8, 1, 8, true); // ... 2818 ...
|
||||
testCustomCreationHelper(innerdoc, document, 2, 8, 4, 5, false); // ... 2845 ...
|
||||
nextTest();
|
||||
}
|
||||
|
||||
var TESTS = [testPreliminaries,
|
||||
testEventCapturingHorz,
|
||||
testEventCapturingVert,
|
||||
testEventCapturingBoth,
|
||||
testEventCapturingNegv,
|
||||
testEventBubblingHorz,
|
||||
testEventBubblingVert,
|
||||
testEventBubblingBoth,
|
||||
testEventBubblingNegv,
|
||||
testCustomCreation,
|
||||
__end];
|
||||
|
||||
var PC = 0;
|
||||
|
||||
function nextTest() {
|
||||
TESTS[PC++]();
|
||||
}
|
||||
|
||||
function __end() {
|
||||
log("done!");
|
||||
finish();
|
||||
window.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* We need both the parent document and all iframe documents to load
|
||||
* before starting anything
|
||||
*/
|
||||
var loaded = 0;
|
||||
|
||||
window
|
||||
.addEventListener('load', function(ev) {
|
||||
logln(++loaded);
|
||||
if (loaded >= 2) {
|
||||
logln("go...");
|
||||
nextTest();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.getElementById("testframe").contentWindow
|
||||
.addEventListener('load', function(ev) {
|
||||
logln(++loaded);
|
||||
if (loaded >= 2) {
|
||||
logln("go...");
|
||||
nextTest();
|
||||
}
|
||||
}, false);
|
||||
|
||||
// window.opener says: SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
81
layout/generic/test/file_bug514732_window.xul
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<window id="514732Test"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="600"
|
||||
height="600"
|
||||
onload="setTimeout(nextTest,0);"
|
||||
title="bug 514732 test">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js">
|
||||
</script>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
|
||||
// Define the generator-iterator for the tests.
|
||||
var tests = testIterator();
|
||||
|
||||
////
|
||||
// Execute the next test in the generator function.
|
||||
//
|
||||
function nextTest() {
|
||||
tests.next();
|
||||
}
|
||||
|
||||
////
|
||||
// Generator function for test steps for bug 514732. The MozScrolledAreaChanged
|
||||
// should be fired when a page is restored from the bfcache as though it had
|
||||
// reloaded.
|
||||
//
|
||||
function testIterator() {
|
||||
// Make sure bfcache is on.
|
||||
enableBFCache(true);
|
||||
|
||||
|
||||
// Load a wide and tall page, and then another.
|
||||
for (var i = 0; i < 2; ++i) {
|
||||
doPageNavigation( {
|
||||
uri: "data:text/html,<!DOCTYPE html><html>" +
|
||||
"<head><title>bug 514732 bfcache test page " + i + "</title></head>" +
|
||||
"<body>" +
|
||||
'<div style="position: absolute; left: 10000px; top: 10000px; width: 500px; height: 500px;">' +
|
||||
"</body></html>",
|
||||
eventsToListenFor: ["MozScrolledAreaChanged"],
|
||||
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
|
||||
onNavComplete: nextTest
|
||||
} );
|
||||
yield;
|
||||
}
|
||||
|
||||
// Navigate back to the first page. Don't test for width and height
|
||||
// yet, just make sure we get an event.
|
||||
doPageNavigation( {
|
||||
back: true,
|
||||
eventsToListenFor: ["MozScrolledAreaChanged"],
|
||||
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
|
||||
onNavComplete: nextTest
|
||||
} );
|
||||
yield;
|
||||
|
||||
// Navigate forth to our wide and tall page, this time testing for
|
||||
// width and height on the event.
|
||||
doPageNavigation( {
|
||||
forward: true,
|
||||
eventsToListenFor: ["MozScrolledAreaChanged"],
|
||||
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
|
||||
onNavComplete: nextTest
|
||||
} );
|
||||
yield;
|
||||
|
||||
// Tell the framework the test is finished. Include the final 'yield'
|
||||
// statement to prevent a StopIteration exception from being thrown.
|
||||
finish();
|
||||
yield;
|
||||
}
|
||||
|
||||
]]></script>
|
||||
|
||||
<browser type="content-primary" flex="1" id="content" src="about:blank"/>
|
||||
</window>
|
||||
10
layout/generic/test/file_bug579767_1.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<HTML style="background-color: yellow">
|
||||
<FRAMESET cols="10%,90%" border="6">
|
||||
<FRAMESET rows="90,210" border="6">
|
||||
<FRAME src="data:text/html,<body bgcolor=blue>">
|
||||
<FRAME src="data:text/html,<body bgcolor=green>">
|
||||
</FRAMESET>
|
||||
<FRAME src="data:text/html,<body bgcolor=red>">
|
||||
</FRAMESET>
|
||||
</HTML>
|
||||
10
layout/generic/test/file_bug579767_2.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<HTML style="background-color: yellow">
|
||||
<FRAMESET cols="11%,89%" border="6">
|
||||
<FRAMESET rows="100,200" border="6">
|
||||
<FRAME src="data:text/html,<body bgcolor=blue>">
|
||||
<FRAME src="data:text/html,<body bgcolor=green>">
|
||||
</FRAMESET>
|
||||
<FRAME src="data:text/html,<body bgcolor=red>">
|
||||
</FRAMESET>
|
||||
</HTML>
|
||||
111186
layout/generic/test/file_scroll_position_restore.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
|
||||
x="0" y="0" width="1" height="1">
|
||||
<feFlood flood-color="#00ff00" result="flood"/>
|
||||
<feDisplacementMap x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
|
||||
in2="SourceGraphic" in="flood" scale="1" xChannelSelector="R" yChannelSelector="G"/>
|
||||
</filter>
|
||||
<g filter="url(#f1)">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#ff0000"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 517 B |
|
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
|
||||
x="0" y="0" width="1" height="1">
|
||||
<feImage xlink:href="http://example.com/tests/layout/generic/test/file_taintedfilters_red-flood-for-feImage.svg" result="flood"/>
|
||||
<feDisplacementMap x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
|
||||
in="SourceGraphic" in2="flood" scale="1" xChannelSelector="R" yChannelSelector="G"/>
|
||||
</filter>
|
||||
<g filter="url(#f1)">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#00ff00"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 642 B |
|
|
@ -0,0 +1,17 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
|
||||
x="0" y="0" width="1" height="1">
|
||||
<feImage xlink:href="file_taintedfilters_red-flood-for-feImage.svg" result="flood"/>
|
||||
<feMerge result="map">
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
<feMergeNode in="flood"/>
|
||||
</feMerge>
|
||||
<feDisplacementMap x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
|
||||
in="SourceGraphic" in2="map" scale="1" xChannelSelector="R" yChannelSelector="G"/>
|
||||
</filter>
|
||||
<g filter="url(#f1)">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#00ff00"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 701 B |
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<rect x="10" y="10" width="80" height="80" fill="#00ff00"/>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 110 B |
|
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
|
||||
x="0" y="0" width="1" height="1">
|
||||
<feImage xlink:href="file_taintedfilters_red-flood-for-feImage.svg" result="flood"/>
|
||||
<feDisplacementMap x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
|
||||
in="SourceGraphic" in2="flood" scale="1" xChannelSelector="R" yChannelSelector="G"/>
|
||||
</filter>
|
||||
<g filter="url(#f1)">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#00ff00"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 597 B |
|
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<filter id="f1" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox"
|
||||
x="0" y="0" width="1" height="1">
|
||||
<feImage xlink:href="http://example.com/tests/layout/generic/test/file_taintedfilters_red-flood-for-feImage-cors.svg" result="flood"/>
|
||||
<feDisplacementMap x="10%" y="10%" width="80%" height="80%" style="color-interpolation-filters:sRGB"
|
||||
in="SourceGraphic" in2="flood" scale="1" xChannelSelector="R" yChannelSelector="G"/>
|
||||
</filter>
|
||||
<g filter="url(#f1)">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#00ff00"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 647 B |
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<rect x="10" y="50" width="40" height="40" fill="#00ff00"/>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 110 B |
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
||||
|
||||
<rect x="0" y="0" width="100" height="100" fill="#ff0000"/>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 135 B |
|
|
@ -0,0 +1,4 @@
|
|||
Access-Control-Allow-Origin: http://mochi.test:8888
|
||||
Access-Control-Allow-Credentials: true
|
||||
Content-Type: image/svg+xml
|
||||
Cache-Control: no-cache, must-revalidate
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
||||
|
||||
<rect x="0" y="0" width="100" height="100" fill="#ff0000"/>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 135 B |
49
layout/generic/test/frame_selection_underline-ref.xhtml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" class="willBeRemoved">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="frame_selection_underline.css"/>
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function init(aTest)
|
||||
{
|
||||
var target = document.getElementById("target");
|
||||
var decoration = document.getElementById("decoration");
|
||||
var leftSpacer = document.getElementById("leftspacer");
|
||||
var rightSpacer = document.getElementById("rightspacer");
|
||||
|
||||
var docShell =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell);
|
||||
var controller =
|
||||
docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsISelectionDisplay)
|
||||
.QueryInterface(Components.interfaces.nsISelectionController);
|
||||
|
||||
const nsISelectionController = Components.interfaces.nsISelectionController;
|
||||
if (aTest.selection.isIME) {
|
||||
leftSpacer.style.display = rightSpacer.style.display = "inline-block";
|
||||
} else {
|
||||
leftSpacer.style.display = rightSpacer.style.display = "none";
|
||||
}
|
||||
|
||||
target.style.fontFamily = aTest.font.family;
|
||||
target.style.fontSize = aTest.font.defaultSize;
|
||||
|
||||
decoration.style.textDecorationStyle = aTest.decoration.styleName;
|
||||
decoration.style.textDecorationColor = aTest.selection.decorationColor;
|
||||
|
||||
document.documentElement.removeAttribute("class");
|
||||
setTimeout(function () {
|
||||
document.documentElement.setAttribute("class", "willBeRemoved"); }, 0);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</head>
|
||||
<body class="reference">
|
||||
<div id="target"><span id="decoration"><span id="leftspacer"> </span> <span id="rightspacer"></span> </span></div>
|
||||
</body>
|
||||
</html>
|
||||
51
layout/generic/test/frame_selection_underline.css
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "AhemTest";
|
||||
src: url(../../../../tests/fonts/Ahem.ttf);
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "mplusTest";
|
||||
src: url(../../../../tests/fonts/mplus/mplus-1p-regular.ttf);
|
||||
}
|
||||
|
||||
/* For aligning the two spacers (see below) to the left most and the right most,
|
||||
the div must create a new blocking format context. */
|
||||
div#target {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
span#decoration {
|
||||
margin-left: 0.333em;
|
||||
}
|
||||
|
||||
body.reference div span#decoration {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* both ends of selection underlines for IME are clipped for making the
|
||||
boundaries of clauses in composition string clear. These spacers will
|
||||
cover the ends in the reference. */
|
||||
span#leftspacer, span#rightspacer {
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
span#leftspacer {
|
||||
left: 0.333em;
|
||||
}
|
||||
|
||||
span#rightspacer {
|
||||
right: 0;
|
||||
}
|
||||
51
layout/generic/test/frame_selection_underline.xhtml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" class="willBeRemoved">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="frame_selection_underline.css"/>
|
||||
<script type="text/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function init(aTest)
|
||||
{
|
||||
var docShell =
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell);
|
||||
var controller =
|
||||
docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsISelectionDisplay)
|
||||
.QueryInterface(Components.interfaces.nsISelectionController);
|
||||
|
||||
var selections = [
|
||||
controller.SELECTION_SPELLCHECK,
|
||||
controller.SELECTION_IME_RAWINPUT,
|
||||
controller.SELECTION_IME_SELECTEDRAWTEXT,
|
||||
controller.SELECTION_IME_CONVERTEDTEXT,
|
||||
controller.SELECTION_IME_SELECTEDCONVERTEDTEXT,
|
||||
];
|
||||
for (var i = 0; i < selections.length; i++) {
|
||||
var sel = controller.getSelection(selections[i]);
|
||||
sel.removeAllRanges();
|
||||
}
|
||||
|
||||
var target = document.getElementById("target");
|
||||
target.style.fontFamily = aTest.font.family;
|
||||
target.style.fontSize = aTest.font.defaultSize;
|
||||
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(target);
|
||||
controller.getSelection(aTest.selection.type).addRange(range);
|
||||
|
||||
document.documentElement.removeAttribute("class");
|
||||
setTimeout(function () {
|
||||
document.documentElement.setAttribute("class", "willBeRemoved"); }, 0);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</head>
|
||||
<body class="test">
|
||||
<div id="target"><span id="decoration"> </span></div>
|
||||
</body>
|
||||
</html>
|
||||
140
layout/generic/test/mochitest.ini
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
[DEFAULT]
|
||||
skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM, ONLY IN CHUNK 10
|
||||
support-files =
|
||||
../../reftests/backgrounds/blue-32x32.png
|
||||
../../reftests/backgrounds/fuchsia-32x32.png
|
||||
../../../dom/plugins/test/mochitest/plugin-utils.js
|
||||
plugin_clipping_helper.xhtml
|
||||
plugin_clipping_helper2.xhtml
|
||||
plugin_clipping_helper_transformed.xhtml
|
||||
plugin_clipping_helper_table.xhtml
|
||||
plugin_clipping_lib.js
|
||||
plugin_focus_helper.html
|
||||
file_BrokenImageReference.png
|
||||
file_Dolske.png
|
||||
file_IconTestServer.sjs
|
||||
file_LoadingImageReference.png
|
||||
file_SlowImage.sjs
|
||||
bug1174521.html
|
||||
|
||||
[test_bug240933.html]
|
||||
[test_bug263683.html]
|
||||
[test_bug288789.html]
|
||||
[test_bug290397.html]
|
||||
[test_bug323656.html]
|
||||
[test_bug344830.html]
|
||||
support-files = bug344830_testembed.svg
|
||||
[test_bug348681.html]
|
||||
[test_bug382429.html]
|
||||
[test_bug384527.html]
|
||||
[test_bug385751.html]
|
||||
[test_bug389630.html]
|
||||
[test_bug391747.html]
|
||||
[test_bug392746.html]
|
||||
[test_bug392923.html]
|
||||
[test_bug394173.html]
|
||||
[test_bug394239.html]
|
||||
[test_bug402380.html]
|
||||
[test_bug404872.html]
|
||||
[test_bug405178.html]
|
||||
[test_bug416168.html]
|
||||
[test_bug421436.html]
|
||||
[test_bug421839-1.html]
|
||||
skip-if = true # Disabled for calling finish twice
|
||||
[test_bug421839-2.html]
|
||||
support-files = bug421839-2-page.html
|
||||
[test_bug424627.html]
|
||||
[test_bug438840.html]
|
||||
[test_bug448860.html]
|
||||
[test_bug448987.html]
|
||||
skip-if = true # Bug 932296
|
||||
support-files = file_bug448987.html file_bug448987_ref.html file_bug448987_notref.html
|
||||
[test_bug449653.html]
|
||||
support-files = file_bug449653_1.html file_bug449653_1_ref.html
|
||||
[test_bug460532.html]
|
||||
[test_bug468167.html]
|
||||
[test_bug470212.html]
|
||||
[test_bug488417.html]
|
||||
skip-if = true # Bug 489560
|
||||
[test_bug496275.html]
|
||||
skip-if = toolkit == 'android' #CRASH_DUMP
|
||||
[test_bug503813.html]
|
||||
skip-if = toolkit == 'android' #CRASH_DUMP
|
||||
[test_bug507902.html]
|
||||
skip-if = true # Bug 510001
|
||||
[test_bug514732.html]
|
||||
skip-if = toolkit == 'android' #CRASH_DUMP # timeouts
|
||||
support-files = file_bug514732_1.html file_bug514732_helper.html
|
||||
[test_bug527306.html]
|
||||
[test_bug579767.html]
|
||||
support-files = file_bug579767_1.html file_bug579767_2.html
|
||||
[test_bug522632.html]
|
||||
[test_bug524925.html]
|
||||
[test_bug589621.html]
|
||||
[test_bug589623.html]
|
||||
[test_bug597333.html]
|
||||
[test_bug633762.html]
|
||||
support-files = bug633762_iframe.html
|
||||
[test_bug666225.html]
|
||||
[test_bug719503.html]
|
||||
[test_bug719515.html]
|
||||
[test_bug719518.html]
|
||||
[test_bug719523.html]
|
||||
[test_bug735641.html]
|
||||
[test_bug748961.html]
|
||||
[test_bug756984.html]
|
||||
[test_bug784410.html]
|
||||
[test_bug785324.html]
|
||||
[test_bug791616.html]
|
||||
[test_bug831780.html]
|
||||
[test_bug841361.html]
|
||||
[test_bug904810.html]
|
||||
[test_bug938772.html]
|
||||
[test_bug970363.html]
|
||||
[test_bug1062406.html]
|
||||
[test_bug1174521.html]
|
||||
[test_bug1198135.html]
|
||||
[test_bug1307853.html]
|
||||
support-files = file_bug1307853.html
|
||||
[test_contained_plugin_transplant.html]
|
||||
skip-if = os=='win'
|
||||
[test_image_selection.html]
|
||||
[test_image_selection_2.html]
|
||||
[test_invalidate_during_plugin_paint.html]
|
||||
skip-if = toolkit == 'android'
|
||||
[test_intrinsic_size_on_loading.html]
|
||||
[test_movement_by_characters.html]
|
||||
[test_movement_by_words.html]
|
||||
# Disable the caret movement by word test on Linux because the shortcut keys
|
||||
# are defined in system level. So, it depends on the environment.
|
||||
# Disable on Windows for too many intermittent failures (bug 916143).
|
||||
skip-if = (toolkit == "gtk2") || (toolkit == "gtk3") || (os == "win")
|
||||
[test_overflow_event.html]
|
||||
[test_page_scroll_with_fixed_pos.html]
|
||||
support-files = page_scroll_with_fixed_pos_window.html
|
||||
[test_plugin_clipping.xhtml]
|
||||
skip-if = e10s
|
||||
[test_plugin_clipping2.xhtml]
|
||||
skip-if = e10s
|
||||
[test_plugin_clipping_transformed.xhtml]
|
||||
skip-if = e10s
|
||||
[test_plugin_clipping_table.xhtml]
|
||||
skip-if = e10s
|
||||
[test_plugin_focus.html]
|
||||
skip-if = os == 'win' # bug 1207918
|
||||
[test_plugin_mouse_coords.html]
|
||||
skip-if = toolkit == 'android'
|
||||
[test_plugin_position.xhtml]
|
||||
skip-if = e10s
|
||||
[test_scroll_behavior.html]
|
||||
[test_selection_expanding.html]
|
||||
support-files = selection_expanding_xbl.xml
|
||||
[test_selection_preventDefault.html]
|
||||
[test_selection_splitText-normalize.html]
|
||||
[test_selection_touchevents.html]
|
||||
[test_taintedfilters.html]
|
||||
support-files = file_taintedfilters_feDisplacementMap-tainted-1.svg file_taintedfilters_feDisplacementMap-tainted-2.svg file_taintedfilters_feDisplacementMap-tainted-3.svg file_taintedfilters_feDisplacementMap-tainted-ref.svg file_taintedfilters_feDisplacementMap-untainted-ref.svg file_taintedfilters_feDisplacementMap-untainted-1.svg file_taintedfilters_feDisplacementMap-untainted-2.svg file_taintedfilters_red-flood-for-feImage-cors.svg file_taintedfilters_red-flood-for-feImage-cors.svg^headers^ file_taintedfilters_red-flood-for-feImage.svg
|
||||
[test_scroll_position_restore.html]
|
||||
support-files = file_scroll_position_restore.html
|
||||
[test_scroll_animation_restore.html]
|
||||
[test_scroll_position_iframe.html]
|
||||
117
layout/generic/test/page_scroll_with_fixed_pos_window.html
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no" />
|
||||
<title>Scrolling by pages with fixed-pos headers and footers</title>
|
||||
<style>
|
||||
.fp { position:fixed; left:0; width:100%; }
|
||||
.fp2 { position:fixed; left:0; width:100%; }
|
||||
</style>
|
||||
</head>
|
||||
<body onscroll="didScroll()" onload="test()">
|
||||
<div class="fp" id="top" style="top:0; height:10px; background:yellow;"></div>
|
||||
<div class="fp2" id="top2" style="top:10px; height:11px; background:blue;"></div>
|
||||
<div class="fp" style="top:50%; height:7px; background:cyan;"></div>
|
||||
<div class="fp2" id="bottom2" style="bottom:9px; height:12px; background:red;"></div>
|
||||
<div class="fp" id="bottom" style="bottom:0; height:13px; background:yellow;"></div>
|
||||
<p id="target">Something to click on to get focus
|
||||
<div style="height:3000px;"></div>
|
||||
<pre id="test">
|
||||
<script class="testbody">
|
||||
var SimpleTest = window.opener.SimpleTest;
|
||||
var SpecialPowers = window.opener.SpecialPowers;
|
||||
var is = window.opener.is;
|
||||
|
||||
function showElements(show, classname) {
|
||||
var elements = document.getElementsByClassName(classname);
|
||||
for (var i = 0; i < elements.length; ++i) {
|
||||
elements[i].style.display = show ? '' : 'none';
|
||||
}
|
||||
}
|
||||
function showFixedPosElements(show) {
|
||||
showElements(show, "fp");
|
||||
}
|
||||
function showFixedPosElements2(show) {
|
||||
showElements(show, "fp2");
|
||||
}
|
||||
|
||||
var nextCont;
|
||||
function didScroll() {
|
||||
var c = nextCont;
|
||||
nextCont = null;
|
||||
if (c) {
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
function scrollDownOnePageWithContinuation(cont) {
|
||||
document.documentElement.scrollTop = 0;
|
||||
nextCont = cont;
|
||||
window.scrollByPages(1);
|
||||
}
|
||||
|
||||
function test() {
|
||||
var smoothScrollPref = "general.smoothScroll";
|
||||
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, runTest);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
showFixedPosElements(false);
|
||||
showFixedPosElements2(false);
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
var fullPageScrollDown = document.documentElement.scrollTop;
|
||||
|
||||
showFixedPosElements(true);
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
var fullPageScrollDownWithHeaderAndFooter = document.documentElement.scrollTop;
|
||||
is(fullPageScrollDownWithHeaderAndFooter, fullPageScrollDown - (10 + 13),
|
||||
"Reduce scroll distance by size of small header and footer");
|
||||
|
||||
document.getElementById("bottom").style.height = (window.innerHeight - 20) + "px";
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
is(document.documentElement.scrollTop, fullPageScrollDown - 10,
|
||||
"Ignore really big elements when reducing scroll size");
|
||||
document.getElementById("bottom").style.height = "13px";
|
||||
|
||||
document.getElementById("top").style.width = "100px";
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
is(document.documentElement.scrollTop, fullPageScrollDown - 13,
|
||||
"Ignore elements that don't span the entire viewport side");
|
||||
document.getElementById("top").style.width = "100%";
|
||||
|
||||
showFixedPosElements2(true);
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
is(document.documentElement.scrollTop, fullPageScrollDown - (10 + 11 + 9 + 12),
|
||||
"Combine multiple overlapping elements");
|
||||
showFixedPosElements2(false);
|
||||
|
||||
document.getElementById("top").style.width = "400px";
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
is(document.documentElement.scrollTop, fullPageScrollDown - (10 + 13),
|
||||
"Don't ignore elements that span more than half the viewport side");
|
||||
document.getElementById("top").style.width = "100%";
|
||||
|
||||
document.getElementById("top").style.top = "-40px";
|
||||
document.getElementById("top").style.transform = "translateY(38px)";
|
||||
scrollDownOnePageWithContinuation(function() {
|
||||
is(document.documentElement.scrollTop,
|
||||
fullPageScrollDown - (10 + 13 - 40 + 38),
|
||||
"Account for offset and transform");
|
||||
document.getElementById("top").style.width = "100%";
|
||||
|
||||
// Scroll back up so test results are visible
|
||||
document.documentElement.scrollTop = 0;
|
||||
SimpleTest.finish();
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
59
layout/generic/test/plugin_clipping_helper.xhtml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping">
|
||||
<head>
|
||||
<style>
|
||||
embed { width:200px; height:200px; display:block; }
|
||||
iframe { border:none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
|
||||
<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox style="width:100px;"></hbox><hbox id="h2"/>
|
||||
</hbox>
|
||||
|
||||
<!-- Non-clipped plugin -->
|
||||
<embed id="p1" type="application/x-test" wmode="window"
|
||||
style="position:absolute; left:300px; top:0"></embed>
|
||||
<!-- Clipped to the top and left by the viewport -->
|
||||
<embed id="p2" type="application/x-test" wmode="window"
|
||||
style="position:absolute; left:-100px; top:-100px;"></embed>
|
||||
<!-- Clipped by a scrollable DIV -->
|
||||
<div style="overflow:auto; width:200px; height:200px;
|
||||
position:absolute; left:100px; top:0;">
|
||||
<div style="position:relative; left:-100px; top:-100px;">
|
||||
<embed id="p3" type="application/x-test" wmode="window"></embed>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Clipped by a scrollable DIV *and* to the viewport -->
|
||||
<div style="overflow:auto; width:200px; height:200px; position:absolute; top:100px; left:-100px;">
|
||||
<div style="position:relative; top:-100px;">
|
||||
<embed id="p4" type="application/x-test" wmode="window"></embed>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Clipped by an iframe -->
|
||||
<iframe id="f1" style="position:absolute; left:200px; top:200px; width:200px; height:200px;"
|
||||
src="data:text/html,<embed style='position:absolute; left:-100px; top:-100px; width:200px; height:200px;' id='p5' type='application/x-test' wmode='window'>"></iframe>
|
||||
|
||||
<script src="plugin_clipping_lib.js"></script>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function runTests() {
|
||||
checkClipRegion("p1", [[0, 0, 200, 200]]);
|
||||
checkClipRegion("p2", [[100, 100, 200, 200]]);
|
||||
checkClipRegion("p3", [[100, 100, 200, 200]]);
|
||||
checkClipRegion("p4", [[100, 100, 200, 200]]);
|
||||
checkClipRegionForFrame("f1", "p5", [[100, 100, 200, 200]]);
|
||||
|
||||
window.opener.SimpleTest.finish();
|
||||
window.close();
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
102
layout/generic/test/plugin_clipping_helper2.xhtml
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Dynamic Tests">
|
||||
<head>
|
||||
<style>
|
||||
embed { width:300px; height:200px; display:block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
|
||||
<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox style="width:100px;"></hbox><hbox id="h2"/>
|
||||
</hbox>
|
||||
|
||||
<div id="d1" style="width:200px; overflow:hidden; position:absolute; top:0; left:0;">
|
||||
<embed id="p1" type="application/x-test" wmode="window" style="position:relative"></embed>
|
||||
</div>
|
||||
<div id="d2" style="width:200px; height:200px; overflow:hidden; position:absolute; top:100px; left:0;">
|
||||
<embed id="p2" type="application/x-test" wmode="window"></embed>
|
||||
<div id="zbox" style="position:absolute; left:50px; top:50px; width:100px; height:100px; background:yellow;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="scroll"
|
||||
style="position:absolute; top:0; left:0; width:300px; height:400px; overflow:scroll;">
|
||||
<div id="sbox"
|
||||
style="margin-top:350px; margin-left:50px; margin-bottom:1000px; width:100px; height:100px; background:blue;"></div>
|
||||
</div>
|
||||
|
||||
<script src="plugin_clipping_lib.js"></script>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
var scroll = document.getElementById("scroll");
|
||||
var zbox = document.getElementById("zbox");
|
||||
var sbox = document.getElementById("sbox");
|
||||
var p1 = document.getElementById("p1");
|
||||
var d2 = document.getElementById("d2");
|
||||
|
||||
function runTests() {
|
||||
|
||||
checkClipRegion("p1", [[0, 0, 200, 100]]);
|
||||
checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
|
||||
|
||||
scroll.scrollTop = 150;
|
||||
|
||||
// A non-zero timeout is needed on X11 (unless an XSync could be performed)
|
||||
// to delay an OOP plugin's X requests enough so that the X server processes
|
||||
// them after the parent processes requests (for the changes above).
|
||||
setTimeout(part2, 1000);
|
||||
}
|
||||
|
||||
function part2() {
|
||||
checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 200], [150, 50, 200, 200]]);
|
||||
|
||||
zbox.style.zIndex = -1;
|
||||
|
||||
setTimeout(part3, 1000);
|
||||
}
|
||||
|
||||
function part3() {
|
||||
checkClipRegion("p2", [[0, 0, 200, 100], [0, 100, 50, 200], [150, 100, 200, 200]]);
|
||||
|
||||
sbox.style.background = "";
|
||||
|
||||
setTimeout(part4, 1000);
|
||||
}
|
||||
|
||||
function part4() {
|
||||
checkClipRegion("p2", [[0, 0, 200, 200]]);
|
||||
|
||||
p1.style.zIndex = 1;
|
||||
|
||||
setTimeout(part5, 1000);
|
||||
}
|
||||
|
||||
function part5() {
|
||||
checkClipRegion("p1", [[0, 0, 200, 200]]);
|
||||
checkClipRegion("p2", [[0, 100, 200, 200]]);
|
||||
|
||||
// Test subpixel stuff
|
||||
p1.style.zIndex = -1;
|
||||
zbox.style.zIndex = 1;
|
||||
zbox.style.top = "50.3px;"
|
||||
d2.style.top = "100.3px";
|
||||
|
||||
setTimeout(done, 1000);
|
||||
}
|
||||
|
||||
function done() {
|
||||
checkClipRegionNoBounds("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
|
||||
|
||||
window.opener.SimpleTest.finish();
|
||||
window.close();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
44
layout/generic/test/plugin_clipping_helper_table.xhtml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Plugins and Tables">
|
||||
<head>
|
||||
<style>
|
||||
embed { width:300px; height:200px; display:block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
|
||||
<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox style="width:100px;"></hbox><hbox id="h2"/>
|
||||
</hbox>
|
||||
|
||||
<embed id="p1" type="application/x-test" wmode="window"
|
||||
style="position:absolute; top:0; left:0;"></embed>
|
||||
<table style="width:300px; height:100px; position:absolute; top:100px; left:0; background:white;">
|
||||
</table>
|
||||
<embed id="p2" type="application/x-test" wmode="window"
|
||||
style="position:absolute; top:200px; left:0;"></embed>
|
||||
<table style="width:300px; height:300px; position:absolute; top:300px; left:0; background:white; border-collapse:collapse;">
|
||||
</table>
|
||||
|
||||
<script src="plugin_clipping_lib.js"></script>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function runTests() {
|
||||
// p1 is partially covered by a table with an opaque background
|
||||
checkClipRegion("p1", [[0, 0, 300, 100]]);
|
||||
// p2 is partially covered by a table with an opaque background
|
||||
checkClipRegion("p2", [[0, 0, 300, 100]]);
|
||||
|
||||
window.opener.SimpleTest.finish();
|
||||
window.close();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
42
layout/generic/test/plugin_clipping_helper_transformed.xhtml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Plugins in Transforms">
|
||||
<head>
|
||||
<style>
|
||||
embed { width:300px; height:200px; display:block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
|
||||
<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<hbox style="width:100px;"></hbox><hbox id="h2"/>
|
||||
</hbox>
|
||||
|
||||
<div style="width:200px; position:absolute; top:0; left:0; -moz-transform:rotate(90deg)">
|
||||
<embed id="p1" type="application/x-test" wmode="window"></embed>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="width:200px; position:absolute; top:200px; left:0;">
|
||||
<foreignObject width="200" height="200">
|
||||
<embed xmlns="http://www.w3.org/1999/xhtml" id="p2" type="application/x-test" wmode="window"></embed>
|
||||
</foreignObject>
|
||||
</svg>
|
||||
|
||||
<script src="plugin_clipping_lib.js"></script>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function runTests() {
|
||||
// p1 and p2 are both in a transformed context so they should be hidden.
|
||||
checkClipRegionNoBounds("p1", []);
|
||||
checkClipRegionNoBounds("p2", []);
|
||||
|
||||
window.opener.childDone();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
163
layout/generic/test/plugin_clipping_lib.js
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
var checkClipRegion, checkClipRegionForFrame, checkClipRegionNoBounds;
|
||||
|
||||
(function() {
|
||||
var windowFrameX, windowFrameY;
|
||||
|
||||
// Import test API
|
||||
var is = window.opener.is;
|
||||
var ok = window.opener.ok;
|
||||
var todo = window.opener.todo;
|
||||
var finish = window.opener.SimpleTest.finish;
|
||||
window.onerror = function (event) { window.opener.onerror(event); window.close(); };
|
||||
|
||||
function dumpRect(r) {
|
||||
return "{" + r.join(",") + "}";
|
||||
}
|
||||
|
||||
function dumpRegion(rects) {
|
||||
var s = [];
|
||||
for (var i = 0; i < rects.length; ++i) {
|
||||
var r = rects[i];
|
||||
s.push(dumpRect(r));
|
||||
}
|
||||
return s.join(", ");
|
||||
}
|
||||
|
||||
function generateSpan(coords) {
|
||||
coords.sort(function(a,b) { return a - b; });
|
||||
var result = [coords[0]];
|
||||
for (var i = 1; i < coords.length; ++i) {
|
||||
if (coords[i] != coords[i - 1]) {
|
||||
result.push(coords[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function containsRect(r1, r2) {
|
||||
return r1[0] <= r2[0] && r1[2] >= r2[2] &&
|
||||
r1[1] <= r2[1] && r1[3] >= r2[3];
|
||||
}
|
||||
|
||||
function subtractRect(r1, r2, rlist) {
|
||||
var spanX = generateSpan([r1[0], r1[2], r2[0], r2[2]]);
|
||||
var spanY = generateSpan([r1[1], r1[3], r2[1], r2[3]]);
|
||||
for (var i = 1; i < spanX.length; ++i) {
|
||||
for (var j = 1; j < spanY.length; ++j) {
|
||||
var subrect = [spanX[i - 1], spanY[j - 1], spanX[i], spanY[j]];
|
||||
if (containsRect(r1, subrect) && !containsRect(r2, subrect)) {
|
||||
rlist.push(subrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function regionContainsRect(rs, r) {
|
||||
var rectList = [r];
|
||||
for (var i = 0; i < rs.length; ++i) {
|
||||
var newList = [];
|
||||
for (var j = 0; j < rectList.length; ++j) {
|
||||
subtractRect(rectList[j], rs[i], newList);
|
||||
}
|
||||
if (newList.length == 0)
|
||||
return true;
|
||||
rectList = newList;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function regionContains(r1s, r2s) {
|
||||
for (var i = 0; i < r2s.length; ++i) {
|
||||
if (!regionContainsRect(r1s, r2s[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function equalRegions(r1s, r2s) {
|
||||
return regionContains(r1s, r2s) && regionContains(r2s, r1s);
|
||||
}
|
||||
|
||||
// Checks that a plugin's clip region equals the specified rectangle list.
|
||||
// The rectangles are given relative to the plugin's top-left. They are in
|
||||
// [left, top, right, bottom] format.
|
||||
function checkClipRegionWithDoc(doc, offsetX, offsetY, id, rects, checkBounds) {
|
||||
var p = doc.getElementById(id);
|
||||
var bounds = p.getBoundingClientRect();
|
||||
var pX = p.getEdge(0);
|
||||
var pY = p.getEdge(1);
|
||||
|
||||
if (checkBounds) {
|
||||
var pWidth = p.getEdge(2) - pX;
|
||||
var pHeight = p.getEdge(3) - pY;
|
||||
|
||||
is(pX, windowFrameX + bounds.left + offsetX, id + " plugin X");
|
||||
is(pY, windowFrameY + bounds.top + offsetY, id + " plugin Y");
|
||||
is(pWidth, bounds.width, id + " plugin width");
|
||||
is(pHeight, bounds.height, id + " plugin height");
|
||||
}
|
||||
|
||||
// Now check clip region. 'rects' is relative to the plugin's top-left.
|
||||
var clipRects = [];
|
||||
var n = p.getClipRegionRectCount();
|
||||
for (var i = 0; i < n; ++i) {
|
||||
// Convert the clip rect to be relative to the plugin's top-left.
|
||||
clipRects[i] = [
|
||||
p.getClipRegionRectEdge(i, 0) - pX,
|
||||
p.getClipRegionRectEdge(i, 1) - pY,
|
||||
p.getClipRegionRectEdge(i, 2) - pX,
|
||||
p.getClipRegionRectEdge(i, 3) - pY
|
||||
];
|
||||
}
|
||||
|
||||
ok(equalRegions(clipRects, rects), "Matching regions for '" + id +
|
||||
"': expected " + dumpRegion(rects) + ", got " + dumpRegion(clipRects));
|
||||
}
|
||||
|
||||
checkClipRegion = function checkClipRegion(id, rects) {
|
||||
checkClipRegionWithDoc(document, 0, 0, id, rects, true);
|
||||
}
|
||||
|
||||
checkClipRegionForFrame = function checkClipRegionForFrame(fid, id, rects) {
|
||||
var f = document.getElementById(fid);
|
||||
var bounds = f.getBoundingClientRect();
|
||||
checkClipRegionWithDoc(f.contentDocument, bounds.left, bounds.top, id, rects, true);
|
||||
}
|
||||
|
||||
checkClipRegionNoBounds = function checkClipRegionNoBounds(id, rects) {
|
||||
checkClipRegionWithDoc(document, 0, 0, id, rects, false);
|
||||
}
|
||||
|
||||
function loaded() {
|
||||
var h1 = document.getElementById("h1");
|
||||
var h2 = document.getElementById("h2");
|
||||
var hwidth = h2.boxObject.screenX - h1.boxObject.screenX;
|
||||
if (hwidth != 100) {
|
||||
// Maybe it's a DPI issue
|
||||
todo(false, "Unexpected DPI?");
|
||||
finish();
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!document.getElementById("p1").identifierToStringTest) {
|
||||
todo(false, "Test plugin not available");
|
||||
finish();
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var bounds = h1.getBoundingClientRect();
|
||||
windowFrameX = h1.boxObject.screenX - bounds.left - window.screenX;
|
||||
windowFrameY = h1.boxObject.screenY - bounds.top - window.screenY;
|
||||
|
||||
// Run actual test code
|
||||
runTests();
|
||||
}
|
||||
|
||||
// Need to run 'loaded' after painting is unsuppressed, or we'll set clip
|
||||
// regions to empty. The timeout must be non-zero on X11 so that
|
||||
// gtk_container_idle_sizer runs after the GtkSocket gets the plug_window.
|
||||
window.addEventListener("load",
|
||||
function () { setTimeout(loaded, 1000); }, false);
|
||||
})();
|
||||
134
layout/generic/test/plugin_focus_helper.html
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test that clicking on plugins transfers focus correctly</title>
|
||||
<style>
|
||||
embed { width:200px; height:200px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p><input type="text" id="input"></input>
|
||||
<p><embed id="p1" type="application/x-test" wmode="window" paintscript="didPaint('p1')">
|
||||
<embed id="p2" type="application/x-test" paintscript="didPaint('p2')"></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
var SimpleTest = window.opener.SimpleTest;
|
||||
var is = window.opener.is;
|
||||
var ok = window.opener.ok;
|
||||
var todo = window.opener.todo;
|
||||
var info = window.opener.info;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// We don't want to trigger native mouse events until the document is fully
|
||||
// loaded and each plugin has painted once.
|
||||
var expectPaints = 2;
|
||||
var loaded = false;
|
||||
function didPaint(id) {
|
||||
ok(--expectPaints >= 0, "Got plugin painted event from "+id);
|
||||
document.getElementById(id).setAttribute("paintscript", null);
|
||||
if (expectPaints == 0) {
|
||||
if (document.readyState == "complete") {
|
||||
theTest();
|
||||
} else {
|
||||
info("Waiting for document load to continue");
|
||||
window.addEventListener("load", function() { theTest(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Begin the test
|
||||
//
|
||||
function theTest() {
|
||||
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
var gWindowUtils = SpecialPowers.wrap(window)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
var nativeMouseDown;
|
||||
var nativeMouseUp;
|
||||
|
||||
function nativeClickElement(id) {
|
||||
return function() {
|
||||
|
||||
var element = document.getElementById(id);
|
||||
var bounds = element.getBoundingClientRect();
|
||||
var x = (bounds.left + window.mozInnerScreenX + 10);
|
||||
var y = (bounds.top + window.mozInnerScreenY + 10);
|
||||
|
||||
SimpleTest.executeSoon(function () {
|
||||
gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseDown, 0, element);
|
||||
gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseUp, 0, element);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function done() {
|
||||
// Something about this test is losing focus to the OS intermittently, remove
|
||||
// the windowed plugins and wait for this window to be focused before
|
||||
// continuing. (Bug 874843)
|
||||
for (var p of [ "p1", "p2" ]) {
|
||||
p = document.getElementById(p);
|
||||
p.parentNode.removeChild(p);
|
||||
p = null;
|
||||
}
|
||||
SimpleTest.waitForFocus(window.opener.childDone, window);
|
||||
}
|
||||
|
||||
var step = 0;
|
||||
var steps = [
|
||||
{ event:"focus", id:"input", action:nativeClickElement("p1") },
|
||||
{ event:"blur", id:"input" },
|
||||
{ event:"focus", id:"p1", action:nativeClickElement("p2") },
|
||||
{ event:"blur", id:"p1" },
|
||||
{ event:"focus", id:"p2", action:nativeClickElement("input") },
|
||||
{ event:"blur", id:"p2" },
|
||||
{ event:"focus", id:"input", action:done }
|
||||
];
|
||||
|
||||
function handleEvent(event) {
|
||||
if (step >= steps.length)
|
||||
return;
|
||||
|
||||
var s = steps[step++];
|
||||
is(event.type, s.event, "Check event type");
|
||||
is(event.target.id, s.id, "Check event target");
|
||||
|
||||
if (s.action) {
|
||||
SimpleTest.executeSoon(s.action);
|
||||
}
|
||||
}
|
||||
|
||||
var elems = ["input", "p1", "p2"];
|
||||
for (var i = 0; i < elems.length; ++i) {
|
||||
var e = document.getElementById(elems[i]);
|
||||
e.addEventListener("focus", handleEvent, false);
|
||||
e.addEventListener("blur", handleEvent, false);
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
input.focus();
|
||||
}
|
||||
|
||||
if (navigator.platform.indexOf("Mac") >= 0) {
|
||||
nativeMouseDown = 1; // NSLeftMouseDown
|
||||
nativeMouseUp = 2; // NSLeftMouseUp
|
||||
SimpleTest.waitForFocus(doTest, window);
|
||||
} else if (navigator.platform.indexOf("Win") >= 0) {
|
||||
nativeMouseDown = 2; // MOUSEEVENTF_LEFTDOWN
|
||||
nativeMouseUp = 4; // MOUSEEVENTF_LEFTUP
|
||||
SimpleTest.waitForFocus(doTest, window);
|
||||
} else {
|
||||
// XXX(johns): our gtk2 sendNativeMouseEvent doesn't support clicks
|
||||
todo(false, "Platform not supported");
|
||||
done();
|
||||
}
|
||||
|
||||
} // function theTest
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
11
layout/generic/test/selection_expanding_xbl.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<bindings xmlns="http://www.mozilla.org/xbl">
|
||||
<binding id="binding">
|
||||
<content>
|
||||
<html:div xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<p>xxxxxxx xxxxxxx xxxxxxx</p>
|
||||
<children/>
|
||||
</html:div>
|
||||
</content>
|
||||
</binding>
|
||||
</bindings>
|
||||
325
layout/generic/test/test_backspace_delete.xul
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
title="Test BackSpace/Delete Keys">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function execTests() {
|
||||
var e = document.getElementById("edit");
|
||||
var doc = e.contentDocument;
|
||||
var win = e.contentWindow;
|
||||
var root = doc.documentElement;
|
||||
var editor = doc.body;
|
||||
var sel = win.getSelection();
|
||||
win.focus();
|
||||
|
||||
function setupTest(html, firstChildOffsetForCaret, node) {
|
||||
// Work around bug 474255 --- we need to have nonempty content before we turn on
|
||||
// editing, or the tests below break because the editor doesn't notice when we
|
||||
// insert non-empty content using innerHTML.
|
||||
doc.designMode = 'off';
|
||||
editor.innerHTML = html;
|
||||
doc.designMode = 'on';
|
||||
var n = editor.firstChild;
|
||||
if (node) {
|
||||
n = node();
|
||||
}
|
||||
sel.collapse(n, firstChildOffsetForCaret);
|
||||
}
|
||||
|
||||
var eatSpace;
|
||||
var deleteImmediately;
|
||||
|
||||
function getPrefs(branch) {
|
||||
const prefSvcContractID = "@mozilla.org/preferences-service;1";
|
||||
const prefSvcIID = Components.interfaces.nsIPrefService;
|
||||
return Components.classes[prefSvcContractID].getService(prefSvcIID)
|
||||
.getBranch(branch);
|
||||
}
|
||||
|
||||
function setPref(branch, pref, newValue) {
|
||||
getPrefs(branch).setBoolPref(pref, newValue);
|
||||
return newValue;
|
||||
}
|
||||
|
||||
function restorePref(branch, pref, newValue) {
|
||||
try {
|
||||
getPrefs(branch).clearUserPref(pref);
|
||||
} catch(ex) {}
|
||||
}
|
||||
|
||||
function setEatSpace(newValue) {
|
||||
eatSpace = setPref("layout.word_select.", "eat_space_to_next_word", newValue);
|
||||
}
|
||||
|
||||
function restoreEatSpace() {
|
||||
restorePref("layout.word_select.", "eat_space_to_next_word");
|
||||
}
|
||||
|
||||
function setDeleteImmediately(newValue) {
|
||||
deleteImmediately = setPref("bidi.edit.", "delete_immediately", newValue);
|
||||
}
|
||||
|
||||
function restoreDeleteImmediately() {
|
||||
restorePref("bidi.edit.", "delete_immediately");
|
||||
}
|
||||
|
||||
function doCommand(cmd) {
|
||||
var controller = document.commandDispatcher.getControllerForCommand(cmd);
|
||||
if (controller) {
|
||||
try {
|
||||
controller.doCommand(cmd);
|
||||
ok(true, 'doCommand(' + cmd + ') succeeded');
|
||||
} catch(ex) {
|
||||
ok(false, 'exception in doCommand(' + cmd + '): ', ex.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function testRight(node, offset) {
|
||||
doCommand("cmd_charNext");
|
||||
var msg = "Right movement broken in \"" + editor.innerHTML + "\", offset " + offset;
|
||||
is(sel.anchorNode, node, msg);
|
||||
is(sel.anchorOffset, offset, msg);
|
||||
}
|
||||
|
||||
function selErrString(dir) {
|
||||
return dir + " selection broken with eatSpace=" + eatSpace + " in \"" + editor.innerHTML + "\"";
|
||||
}
|
||||
|
||||
function testWordSelRight(startNode, startOffset, endNode, endOffset) {
|
||||
doCommand("cmd_selectWordNext");
|
||||
var selRange = sel.getRangeAt(0);
|
||||
is(selRange.startContainer, startNode, selErrString("Word right"));
|
||||
is(selRange.startOffset, startOffset, selErrString("Word right"));
|
||||
is(selRange.endContainer, endNode, selErrString("Word right"));
|
||||
is(selRange.endOffset, endOffset, selErrString("Word right"));
|
||||
}
|
||||
|
||||
function testDelete(node, offset, text, richtext) {
|
||||
doCommand("cmd_deleteCharForward");
|
||||
var msg = "Delete broken in \"" + editor.innerHTML + "\", offset " + offset + " with deleteImmediately=" + deleteImmediately;
|
||||
if(typeof node == 'function'){
|
||||
node = node();
|
||||
}
|
||||
is(sel.anchorNode, node, msg);
|
||||
|
||||
is(sel.anchorOffset, offset, msg);
|
||||
let text_result = richtext ? editor.innerHTML : editor.textContent;
|
||||
is(text_result, text, msg);
|
||||
}
|
||||
|
||||
function testBackspace(node, offset, text) {
|
||||
doCommand("cmd_deleteCharBackward");
|
||||
var msg = "Backspace broken in \"" + editor.innerHTML + "\", offset " + offset + " with deleteImmediately=" + deleteImmediately;
|
||||
is(sel.anchorNode, node, msg);
|
||||
|
||||
is(sel.anchorOffset, offset, msg);
|
||||
is(editor.textContent, text, msg);
|
||||
}
|
||||
|
||||
function testDeletePrevWord(node, offset, text) {
|
||||
doCommand("cmd_deleteWordBackward");
|
||||
var msg = "Delete previous word broken in \"" + editor.innerHTML + "\", offset " + offset;
|
||||
is(sel.anchorNode, node, msg);
|
||||
is(sel.anchorOffset, offset, msg);
|
||||
is(editor.textContent, text, msg);
|
||||
}
|
||||
|
||||
function testDeleteNextWord(node, offset, text) {
|
||||
doCommand("cmd_deleteWordForward");
|
||||
var msg = "Delete next word broken in \"" + editor.innerHTML + "\", offset " + offset;
|
||||
is(sel.anchorNode, node, msg);
|
||||
is(sel.anchorOffset, offset, msg);
|
||||
todo_is(editor.textContent, text, msg);
|
||||
}
|
||||
|
||||
// Test cell-wise deletion of Delete
|
||||
setupTest("สวัสดีพ่อแม่พี่น้อง", 0);
|
||||
testRight(editor.firstChild, 1);
|
||||
testDelete(editor.firstChild, 1, "สสดีพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 2);
|
||||
testDelete(editor.firstChild, 2, "สสพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 4);
|
||||
testDelete(editor.firstChild, 4, "สสพ่แม่พี่น้อง");
|
||||
testRight(editor.firstChild, 5);
|
||||
testDelete(editor.firstChild, 5, "สสพ่แพี่น้อง", false);
|
||||
testRight(editor.firstChild, 8);
|
||||
testDelete(editor.firstChild, 8, "สสพ่แพี่อง", false);
|
||||
testRight(editor.firstChild, 9);
|
||||
testDelete(editor.firstChild, 9, "สสพ่แพี่อ", false);
|
||||
|
||||
// Test character-wise deletion of Backspace
|
||||
setupTest("สวัสดีพ่อแม่พี่น้อง", 0);
|
||||
testRight(editor.firstChild, 1);
|
||||
testBackspace(editor.firstChild, 0, "วัสดีพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 2);
|
||||
testBackspace(editor.firstChild, 1, "วสดีพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 2);
|
||||
testBackspace(editor.firstChild, 1, "วดีพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 3);
|
||||
testBackspace(editor.firstChild, 2, "วดพ่อแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 4);
|
||||
testBackspace(editor.firstChild, 3, "วดพอแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 4);
|
||||
testBackspace(editor.firstChild, 3, "วดพแม่พี่น้อง");
|
||||
testRight(editor.firstChild, 4);
|
||||
testBackspace(editor.firstChild, 3, "วดพม่พี่น้อง");
|
||||
testRight(editor.firstChild, 5);
|
||||
testBackspace(editor.firstChild, 4, "วดพมพี่น้อง");
|
||||
testRight(editor.firstChild, 7);
|
||||
testBackspace(editor.firstChild, 6, "วดพมพีน้อง");
|
||||
testRight(editor.firstChild, 8);
|
||||
testBackspace(editor.firstChild, 7, "วดพมพีนอง");
|
||||
testRight(editor.firstChild, 8);
|
||||
testBackspace(editor.firstChild, 7, "วดพมพีนง");
|
||||
testRight(editor.firstChild, 8);
|
||||
testBackspace(editor.firstChild, 7, "วดพมพีน");
|
||||
|
||||
// Tests for Bug 417745
|
||||
|
||||
setEatSpace(true);
|
||||
|
||||
setupTest("Quick yellow fox", 0);
|
||||
testWordSelRight(editor.firstChild, 0, editor.firstChild, 6);
|
||||
testDelete(editor.firstChild, 0, "yellow fox");
|
||||
testWordSelRight(editor.firstChild, 0, editor.firstChild, 7);
|
||||
testDelete(editor.firstChild, 0, "fox");
|
||||
|
||||
setEatSpace(false);
|
||||
|
||||
setupTest("Quick yellow fox", 0);
|
||||
testWordSelRight(editor.firstChild, 0, editor.firstChild, 5);
|
||||
// editor converts the leading space to an , otherwise it
|
||||
// wouldn't show up which would confuse users
|
||||
testDelete(editor.firstChild, 0, "\u00A0yellow fox");
|
||||
testWordSelRight(editor.firstChild, 0, editor.firstChild, 7);
|
||||
testDelete(editor.firstChild, 0, "\u00A0fox");
|
||||
testWordSelRight(editor.firstChild, 0, editor.firstChild, 4);
|
||||
testDelete(editor, 0, "");
|
||||
|
||||
restoreEatSpace();
|
||||
|
||||
// Tests for Bug 419217
|
||||
|
||||
setupTest("foo<div>bar</div>", 3);
|
||||
testDelete(function(){return editor.firstChild;}, 3, "foobar", true);
|
||||
|
||||
// Tests for Bug 419406
|
||||
var s = "helloשלום";
|
||||
|
||||
setDeleteImmediately(true);
|
||||
|
||||
setupTest(s, 4);
|
||||
testRight(editor.firstChild, 5);
|
||||
testDelete(editor.firstChild, 5, "helloלום");
|
||||
|
||||
setDeleteImmediately(false);
|
||||
|
||||
setupTest(s, 4);
|
||||
testRight(editor.firstChild, 5);
|
||||
testDelete(editor.firstChild, 5, "helloשלום");
|
||||
|
||||
// Tests for bug 1034337
|
||||
s = "اهلاhello";
|
||||
|
||||
setDeleteImmediately(true);
|
||||
|
||||
setupTest(s, 4);
|
||||
// first delete an ltr character to make sure that the caret is ltr
|
||||
testDelete(editor.firstChild, 4, "اهلاello");
|
||||
testBackspace(editor.firstChild, 3, "اهلello");
|
||||
|
||||
setDeleteImmediately(false);
|
||||
|
||||
setupTest(s, 4);
|
||||
// first delete an ltr character to make sure that the caret is ltr
|
||||
testDelete(editor.firstChild, 4, "اهلاello");
|
||||
testBackspace(editor.firstChild, 4, "اهلاello");
|
||||
|
||||
restoreDeleteImmediately();
|
||||
|
||||
// Tests for Bug 462188
|
||||
setupTest("You should not see this text.", 29);
|
||||
testDeletePrevWord(editor.firstChild, 24, "You should not see this ");
|
||||
testDeletePrevWord(editor.firstChild, 19, "You should not see ");
|
||||
testDeletePrevWord(editor.firstChild, 15, "You should not ");
|
||||
testDeletePrevWord(editor.firstChild, 11, "You should ");
|
||||
testDeletePrevWord(editor.firstChild, 4, "You ");
|
||||
testDeletePrevWord(editor, 0, "");
|
||||
|
||||
setupTest("You should not see this text.", 0);
|
||||
testDeleteNextWord(editor.firstChild, 0, "\u00A0should not see this text.");
|
||||
testDeleteNextWord(editor.firstChild, 0, "\u00A0not see this text.");
|
||||
testDeleteNextWord(editor.firstChild, 0, "\u00A0see this text.");
|
||||
testDeleteNextWord(editor.firstChild, 0, "\u00A0this text.");
|
||||
testDeleteNextWord(editor.firstChild, 0, "\u00A0text.");
|
||||
// testDeleteNextWord(editor, 0, "");
|
||||
|
||||
// Tests for Bug 502259
|
||||
setupTest("<p>Bug</p>\n<p>502259</p>", 1);
|
||||
testDelete(function(){return editor.firstChild.firstChild;}, 3, "<p>Bug502259</p>", true);
|
||||
|
||||
// Tests for Bug 507936
|
||||
var nodecallback = function(){return editor.firstChild.firstChild.lastChild.firstChild.lastChild;};
|
||||
setupTest("<ol><li>one<ol><li>two</li></ol></li></ol>\n<p>three</p>", 3, nodecallback);
|
||||
testDelete(nodecallback, 0, "<ol><li>one<ol><li>twothree</li></ol></li></ol>", true);
|
||||
|
||||
setupTest("<ol><li>one<ol><li>two</li></ol></li></ol>\n<hr>\n<p>three</p>", 3, nodecallback);
|
||||
testDelete(nodecallback, 3,
|
||||
"<ol><li>one<ol><li>two</li></ol></li></ol><p>three</p>", true);
|
||||
|
||||
// Tests for Bug 519751
|
||||
var nodecallback = function(){return editor.firstChild.lastChild;};
|
||||
setupTest("<p>one</p><ol><li>two</li><li>three</li></ol>", 3, nodecallback);
|
||||
testDelete(nodecallback, 0, "<p>onetwo</p><ol><li>three</li></ol>", true);
|
||||
|
||||
nodecallback = function(){return editor.firstChild.childNodes[1].firstChild;};
|
||||
setupTest("<ol><li>one</li><li>two</li></ol><ol><li>three</li><li>four</li></ol>", 3, nodecallback);
|
||||
testDelete(function(){return editor.firstChild.childNodes[2].firstChild;},
|
||||
0, "<ol><li>one</li><li>two</li><li>three</li><li>four</li></ol>", true);
|
||||
/*todo_is(false, true, 'The above testDelete should use the same nodecallback' +
|
||||
'as in the proceeding setupTest: the cursor should stay at the end of "two", while currently it is at the beginning of "three" after delete');*/
|
||||
|
||||
// More Tests for Bug 507936
|
||||
nodecallback = function(){return editor.firstChild.firstChild.firstChild;}
|
||||
setupTest("<div><div>abcdef</div><div>bar</div><div>ghi</div></div>", 5, nodecallback);
|
||||
sel.extend(editor.lastChild.lastChild.lastChild, 1);
|
||||
testDelete(editor.lastChild.lastChild.lastChild, 5, "<div><div>abcdehi</div></div>", true);
|
||||
|
||||
setupTest("<div><div>abcdef</div><div>ghi</div></div>", 5, nodecallback);
|
||||
sel.extend(editor.lastChild.lastChild.lastChild, 1);
|
||||
testDelete(editor.lastChild.lastChild.lastChild, 5, "<div><div>abcdehi</div></div>", true);
|
||||
|
||||
nodecallback = function(){return editor.firstChild.firstChild;}
|
||||
setupTest("<div>abcdef<div><div>bar</div>ghi</div></div>", 5, nodecallback);
|
||||
sel.extend(editor.lastChild.lastChild.lastChild, 1);
|
||||
expectednodecallback = function(){return editor.lastChild.lastChild;}
|
||||
testDelete(expectednodecallback, 0, "<div>abcdehi</div>", true);
|
||||
|
||||
setupTest("<div>abcdef<div>ghi</div></div>", 5, nodecallback);
|
||||
sel.extend(editor.lastChild.lastChild.lastChild, 1);
|
||||
testDelete(expectednodecallback, 0, "<div>abcdehi</div>", true);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(execTests);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462188">Mozilla Bug 462188</a>
|
||||
<p id="display"></p>
|
||||
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<iframe id="edit" width="200" height="100" src="about:blank"/>
|
||||
</body>
|
||||
</window>
|
||||
39
layout/generic/test/test_bug1062406.html
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1062406
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1062406</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1062406">Mozilla Bug 1062406</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<div style="width:10000px; height:10000px"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1062406 **/
|
||||
window.scroll(100, 100);
|
||||
window.scroll(NaN, NaN);
|
||||
is(window.scrollX, 0, "window.scroll x parameter must treat NaN as 0.");
|
||||
is(window.scrollY, 0, "window.scroll y parameter must treat NaN as 0.");
|
||||
|
||||
window.scroll(100, 100);
|
||||
window.scroll(Infinity, Infinity);
|
||||
is(window.scrollX, 0, "window.scroll x parameter must treat Infinity as 0.");
|
||||
is(window.scrollY, 0, "window.scroll y parameter must treat Infinity as 0.");
|
||||
|
||||
window.scroll(100, 100);
|
||||
window.scroll(-Infinity, -Infinity);
|
||||
is(window.scrollX, 0, "window.scroll x parameter must treat -Infinity as 0.");
|
||||
is(window.scrollY, 0, "window.scroll y parameter must treat -Infinity as 0.");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
39
layout/generic/test/test_bug1174521.html
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1174521
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1174521</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1174521">Mozilla Bug 1174521</a>
|
||||
<div id="content">
|
||||
<iframe src="bug1174521.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var iframe = document.querySelector("iframe");
|
||||
var win = iframe.contentWindow;
|
||||
var doc = iframe.contentDocument;
|
||||
var link = doc.querySelector("a");
|
||||
SimpleTest.waitForFocus(function() {
|
||||
synthesizeMouseAtCenter(link, {}, win);
|
||||
}, win);
|
||||
});
|
||||
|
||||
onmessage = function(e) {
|
||||
ok(e.data.msg, "DONE", "We should be able to click the link");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
89
layout/generic/test/test_bug1198135.html
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1198135
|
||||
-->
|
||||
<html><head>
|
||||
<title>Test for Bug 1198135</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1198135">Mozilla Bug 1198135</a>
|
||||
<style>
|
||||
.example {
|
||||
perspective: 100px;
|
||||
height: 300px;
|
||||
width: 300px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
border: 1px solid blue;
|
||||
}
|
||||
|
||||
.example__group {
|
||||
position: relative;
|
||||
transform-style: preserve-3d;
|
||||
height: 300px;
|
||||
top: 0;
|
||||
}
|
||||
.example__layer {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.layer--a {
|
||||
box-shadow: inset 0 0 0 1px red;
|
||||
}
|
||||
.layer--b {
|
||||
box-shadow: inset 0 0 0 1px blue;
|
||||
transform: translateZ(50px) scale(.45);
|
||||
}
|
||||
.layer--c {
|
||||
box-shadow: inset 0 0 0 1px green;
|
||||
}
|
||||
.layer--d {
|
||||
box-shadow: inset 00px 0 0px 1px orange;
|
||||
transform: translateZ(50px) scale(.45);
|
||||
}
|
||||
.layer--e {
|
||||
box-shadow: inset 00px 0 0px 1px orange;
|
||||
transform: translateZ(50px) scale(.45) translateY(300px);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="example" id="first">
|
||||
<div class="example__group">
|
||||
<div class="example__layer layer--a"></div>
|
||||
<div class="example__layer layer--b"></div>
|
||||
</div>
|
||||
<div class="example__group">
|
||||
<div class="example__layer layer--c"></div>
|
||||
<div class="example__layer layer--d"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="example" id="second">
|
||||
<div class="example__group">
|
||||
<div class="example__layer layer--a"></div>
|
||||
<div class="example__layer layer--b"></div>
|
||||
</div>
|
||||
<div class="example__group">
|
||||
<div class="example__layer layer--c"></div>
|
||||
<div class="example__layer layer--e"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
is(document.getElementById("first").scrollHeight, 600, "Scroll height should be computed correctly");
|
||||
document.getElementById("first").scrollTop = 150;
|
||||
is(document.getElementById("first").scrollHeight, 600, "Scroll height should be a constant when scrolling");
|
||||
|
||||
// The true height is 727.5 and we don't always snap the same direction.
|
||||
isfuzzy(document.getElementById("second").scrollHeight, 728, 1, "Scroll height should be computed correctly");
|
||||
document.getElementById("second").scrollTop = 150;
|
||||
isfuzzy(document.getElementById("second").scrollHeight, 728, 1, "Scroll height should be a constant when scrolling");
|
||||
</script>
|
||||
|
||||
</body></html>
|
||||
28
layout/generic/test/test_bug1307853.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Test for Mozilla Bug 1307853</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
iframe {
|
||||
margin: 0; padding: 0; border: none;
|
||||
}
|
||||
</style>
|
||||
<body onload="run_tests()">
|
||||
<iframe id="i" src="file_bug1307853.html" style="width: 200px; height: 100px"></iframe>
|
||||
<script>
|
||||
function run_tests() {
|
||||
test(function() {
|
||||
var iframe = document.getElementById("i");
|
||||
var idoc = iframe.contentDocument;
|
||||
var iwin = iframe.contentWindow;
|
||||
var inner = idoc.getElementById("inner");
|
||||
|
||||
assert_equals(inner.clientWidth, 60,
|
||||
"width of element before iframe resize");
|
||||
iframe.style.width = "300px";
|
||||
assert_equals(inner.clientWidth, 40,
|
||||
"width of element after iframe resize");
|
||||
},
|
||||
"resize_iframe_percent_padding_fixed_width_boxsizing_borderbox");
|
||||
}
|
||||
</script>
|
||||
69
layout/generic/test/test_bug240933.html
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=240933
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for Bug 240933</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=240933">
|
||||
Mozilla Bug 240933
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 240933 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var t = document.getElementById("t");
|
||||
synthesizeMouse(t, t.clientWidth / 2, 5, {}, window);
|
||||
is(t.selectionStart, 3, "The selection should be set before the newline");
|
||||
is(t.selectionEnd, 3, "The selection should be set before the newline");
|
||||
|
||||
t = document.getElementById("ta");
|
||||
t.focus();
|
||||
t.selectionStart = t.selectionEnd = t.value.length;
|
||||
var val = t.value;
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
is(t.value, val + "\n", "Pressing enter right after focusing the textarea should work");
|
||||
|
||||
t = document.getElementById("tb");
|
||||
t.focus();
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
is(t.value, "\n", "Pressing enter for the first time should work");
|
||||
synthesizeKey("VK_RETURN", {});
|
||||
is(t.value, "\n\n", "Pressing enter for the second time should work");
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
is(t.value, "\n", "Pressing backspace for the first time should work");
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
is(t.value, "", "Pressing backspace for the second time should work");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<textarea id="t" rows="10" cols="10">abc
|
||||
</textarea>
|
||||
<textarea id="ta" rows="10" cols="10">
|
||||
test
|
||||
|
||||
</textarea>
|
||||
<textarea id="tb" rows="10" cols="10"></textarea>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
98
layout/generic/test/test_bug263683.html
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=263683
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for Bug 263683</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body onload="onLoad();" onunload="onUnload();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=263683">
|
||||
Mozilla Bug 263683
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 263683 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var userSetBG = false;
|
||||
var userValueBG = null;
|
||||
var prefNameBG = "ui.textHighlightBackground";
|
||||
var userSetFG = false;
|
||||
var userValueFG = null;
|
||||
var prefNameFG = "ui.textHighlightForeground";
|
||||
|
||||
function onLoad() {
|
||||
SpecialPowers.pushPrefEnv({'set': [[prefNameBG, "#EF0FFF"], [prefNameFG, "#FFFFFF"]]}, startTest);
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
var textToSelect = document.getElementById("selecttext");
|
||||
|
||||
// Take a snapshot now. This will be used to check that removing the
|
||||
// ranges removes the highlighting correctly
|
||||
var noHighlight = snapshotWindow(window);
|
||||
|
||||
var controller = SpecialPowers.wrap(window).
|
||||
QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsIWebNavigation).
|
||||
QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsISelectionDisplay).
|
||||
QueryInterface(SpecialPowers.Ci.nsISelectionController);
|
||||
|
||||
// Get selection
|
||||
var findSelection = controller.getSelection(controller.SELECTION_FIND);
|
||||
|
||||
// Lastly add range
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(textToSelect);
|
||||
findSelection.addRange(range);
|
||||
|
||||
// Take a snapshot of the highlighting
|
||||
var highlighted = snapshotWindow(window);
|
||||
|
||||
// Clear the highlighting, and take another snapshot
|
||||
findSelection.removeAllRanges();
|
||||
var removedHighlight = snapshotWindow(window);
|
||||
|
||||
// Manually "highlight" the text so we can check the rendering
|
||||
textToSelect.style.backgroundColor="#EF0FFF";
|
||||
textToSelect.style.color="#FFFFFF";
|
||||
var manualHighlight = snapshotWindow(window);
|
||||
|
||||
// Test 1: Did the highlighting render correctly?
|
||||
var res = compareSnapshots(highlighted, manualHighlight, true);
|
||||
ok(res[0], "SELECTION_FIND highlighting renders correctly");
|
||||
|
||||
// Test 2: Does removing the ranges from the SELECTION_FIND selection
|
||||
// work as expected?
|
||||
res = compareSnapshots(removedHighlight, noHighlight, true);
|
||||
ok(res[0], "Removing ranges from FIND_SELECTION works correctly");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<p><span id="selecttext">Text to be selected</span></p>
|
||||
</body>
|
||||
</html>
|
||||
117
layout/generic/test/test_bug288789.html
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=288789
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 288789</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=288789">Mozilla Bug 288789</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<textarea id="ta" dir="rtl">
|
||||
|
||||
אaב
|
||||
|
||||
</textarea>
|
||||
<textarea id="tb">
|
||||
|
||||
abc
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 288789 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// This seems to be necessary because the selection is not set up properly otherwise
|
||||
setTimeout(test, 0);
|
||||
|
||||
function test() {
|
||||
var textarea = $("ta");
|
||||
|
||||
function collapse(offset) {
|
||||
textarea.selectionStart = offset;
|
||||
textarea.selectionEnd = offset;
|
||||
}
|
||||
|
||||
function testRight(offset) {
|
||||
synthesizeKey("VK_RIGHT", {});
|
||||
is(textarea.selectionStart, offset, "Right movement broken");
|
||||
}
|
||||
|
||||
function testLeft(offset) {
|
||||
synthesizeKey("VK_LEFT", {});
|
||||
is(textarea.selectionStart, offset, "Left movement broken");
|
||||
}
|
||||
|
||||
textarea.focus();
|
||||
collapse(0);
|
||||
ok(true, "Testing forward movement in RTL mode");
|
||||
for (var i = 0; i < textarea.textContent.length; ++i) {
|
||||
if (i == 0) {
|
||||
testRight(i);
|
||||
}
|
||||
if (textarea.textContent[i] == 'a') {
|
||||
testLeft(i);
|
||||
} else {
|
||||
testLeft(i + 1);
|
||||
}
|
||||
if (i == textarea.textContent.length - 1) {
|
||||
testLeft(i + 1);
|
||||
}
|
||||
}
|
||||
ok(true, "Testing backward movement in RTL mode");
|
||||
for (var i = textarea.textContent.length; i > 0; --i) {
|
||||
if (i == textarea.textContent.length) {
|
||||
testLeft(i);
|
||||
}
|
||||
if (i > 0 && textarea.textContent[i - 1] == 'a') {
|
||||
testRight(i);
|
||||
} else {
|
||||
testRight(i - 1);
|
||||
}
|
||||
if (i == 1) {
|
||||
testRight(i - 1);
|
||||
}
|
||||
}
|
||||
|
||||
textarea = $("tb");
|
||||
textarea.focus();
|
||||
collapse(0);
|
||||
ok(true, "Testing forward movement in LTR mode");
|
||||
for (var i = 0; i < textarea.textContent.length; ++i) {
|
||||
if (i == 0) {
|
||||
testLeft(i);
|
||||
}
|
||||
testRight(i + 1);
|
||||
if (i == textarea.textContent.length - 1) {
|
||||
testRight(i + 1);
|
||||
}
|
||||
}
|
||||
ok(true, "Testing backward movement in LTR mode");
|
||||
for (var i = textarea.textContent.length; i > 0; --i) {
|
||||
if (i == textarea.textContent.length) {
|
||||
testRight(i);
|
||||
}
|
||||
testLeft(i - 1);
|
||||
if (i == 1) {
|
||||
testLeft(i - 1);
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
40
layout/generic/test/test_bug290397.html
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=290397
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 290397</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=290397">Mozilla Bug 290397</a>
|
||||
<p id="display">
|
||||
<map name=a>
|
||||
<area coords=0,0,20,20 href=#pass>
|
||||
<area shape=default href=#fail>
|
||||
</map>
|
||||
<img src=file_Dolske.png usemap=#a id=image>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
/** Test for Bug 290397 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
onhashchange = function() {
|
||||
is(location.hash, "#pass", "Got the wrong area");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
function runTest() {
|
||||
var image = document.getElementById("image");
|
||||
SimpleTest.waitForFocus(() => synthesizeMouse(image, 10, 10, {}));
|
||||
}
|
||||
addLoadEvent(runTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
51
layout/generic/test/test_bug323656.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=323656
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 323656</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
/**
|
||||
* The idea is that "color" inherits by default while "border-color" does
|
||||
* not. So if the former is red and the latter is green on a parent, and
|
||||
* the child's border-color is set to "inherit", it'll be green only if
|
||||
* the child is inheriting from the parent. If not, it'll either be
|
||||
* whatever the border-color is on what it's inheriting from, which will
|
||||
* be red if what it's inheriting from has the default (currentColor)
|
||||
*border-color).
|
||||
*/
|
||||
|
||||
/* 't' for "test" */
|
||||
#display, #display *
|
||||
{ color: red; border: 0px hidden red; background: transparent }
|
||||
#display .t { border-color: green }
|
||||
#display .t > :first-child
|
||||
{ border-color: inherit; border-style: solid; border-width: 10px }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=323656">Mozilla Bug 323656</a>
|
||||
<p id="display">
|
||||
<select size="1" class="t">
|
||||
<option id="testOption"></option>
|
||||
</select>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 323656 **/
|
||||
var s = document.defaultView.getComputedStyle($("testOption"), "");
|
||||
is(s.borderRightColor, "rgb(0, 128, 0)", "Inheritance broken");
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
41
layout/generic/test/test_bug344830.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=344830
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 344830</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=344830">Mozilla Bug 344830</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: block">
|
||||
<embed name="svg1"
|
||||
width="200" height="200"
|
||||
type="image/svg+xml"
|
||||
src="bug344830_testembed.svg">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 344830 **/
|
||||
function getSVG() {
|
||||
var embed = document.embeds["svg1"];
|
||||
var svgDocument = embed.getSVGDocument();
|
||||
var element = svgDocument.getElementById("g1");
|
||||
ok(embed, "document.embeds[] works with SVG");
|
||||
ok(svgDocument, "document.embeds[] works with SVG and embed.getSVGDocument()");
|
||||
ok(element, "document.embeds[] works with SVG and svgDocument.getElementById()");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
addLoadEvent(getSVG);
|
||||
SimpleTest.waitForExplicitFinish()
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
492
layout/generic/test/test_bug348681.html
Normal file
|
|
@ -0,0 +1,492 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=348681
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for Bug 348681</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="loaded()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=348681">Mozilla Bug 348681</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 348681 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function loaded() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.testing.selection.GetRangesForInterval", true]]}, doTest);
|
||||
}
|
||||
|
||||
var rangeChecker = {
|
||||
ranges: [],
|
||||
|
||||
reset: function() {
|
||||
this.ranges = [];
|
||||
},
|
||||
|
||||
check: function(testID, selection) {
|
||||
is(selection.rangeCount, this.ranges.length,
|
||||
"Test "+testID+": correct number of ranges in selection");
|
||||
var rangesMatch = true;
|
||||
var foundMsg = "Found ";
|
||||
var expectedMsg = "Expected ";
|
||||
var maxIndex = Math.max(selection.rangeCount, this.ranges.length);
|
||||
for (var x = 0; x < maxIndex; x++) {
|
||||
var expect = null;
|
||||
if (x < this.ranges.length)
|
||||
expect = this.ranges[x];
|
||||
|
||||
var found = null;
|
||||
if (x < selection.rangeCount)
|
||||
found = selection.getRangeAt(x);
|
||||
|
||||
if (found) {
|
||||
foundMsg +="["+found.startOffset+","+found.endOffset+"] ";
|
||||
}
|
||||
if (expect) {
|
||||
expectedMsg +="["+expect.start+","+expect.end+"] ";
|
||||
}
|
||||
|
||||
if (found && expect) {
|
||||
if (found.startContainer != expect.node ||
|
||||
found.endContainer != expect.node ||
|
||||
found.startOffset != expect.start ||
|
||||
found.endOffset != expect.end)
|
||||
rangesMatch = false;
|
||||
} else {
|
||||
rangesMatch = false;
|
||||
}
|
||||
}
|
||||
var okMsg = "Test "+testID+": correct ranges in selection.";
|
||||
okMsg = okMsg + foundMsg + expectedMsg;
|
||||
ok(rangesMatch, okMsg);
|
||||
},
|
||||
|
||||
addExpected: function(node, start, end) {
|
||||
var expected = {};
|
||||
expected.node = node;
|
||||
expected.start = start;
|
||||
expected.end = end;
|
||||
this.ranges[this.ranges.length] = expected;
|
||||
this.ranges.sort(function(a,b) {return a.start - b.start;});
|
||||
}
|
||||
}
|
||||
|
||||
var intervalChecker = {
|
||||
ranges: [],
|
||||
|
||||
reset: function() {
|
||||
this.ranges = [];
|
||||
},
|
||||
|
||||
check: function(testID, testArr) {
|
||||
is(testArr.length, this.ranges.length,
|
||||
"Test "+testID+": correct number of ranges for interval");
|
||||
var rangesMatch = true;
|
||||
var foundMsg = "Found ";
|
||||
var expectedMsg = "Expected ";
|
||||
var maxIndex = Math.max(testArr.length, this.ranges.length);
|
||||
for (var x = 0; x < maxIndex; x++) {
|
||||
var expect = null;
|
||||
if (x < this.ranges.length)
|
||||
expect = this.ranges[x];
|
||||
|
||||
var found = null;
|
||||
if (x < testArr.length) {
|
||||
// testArr may contain the results coming from
|
||||
// nsISelectionPrivate.GetRangesForInterval(), which are
|
||||
// wrappers for the underlying objects, therefore we may
|
||||
// need to unwrap them before comparing them with the
|
||||
// expected objects.
|
||||
found = SpecialPowers.unwrap(testArr[x]);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
foundMsg +="["+found.startOffset+","+found.endOffset+"] ";
|
||||
}
|
||||
if (expect) {
|
||||
expectedMsg +="["+expect.start+","+expect.end+"] ";
|
||||
}
|
||||
|
||||
if (found && expect) {
|
||||
if (found.startContainer != expect.node ||
|
||||
found.endContainer != expect.node ||
|
||||
found.startOffset != expect.start ||
|
||||
found.endOffset != expect.end)
|
||||
rangesMatch = false;
|
||||
} else {
|
||||
rangesMatch = false;
|
||||
}
|
||||
}
|
||||
var okMsg = "Test "+testID+": correct ranges for interval.";
|
||||
okMsg = okMsg + foundMsg + expectedMsg;
|
||||
ok(rangesMatch, okMsg);
|
||||
},
|
||||
|
||||
addExpected: function(node, start, end) {
|
||||
var expected = {};
|
||||
expected.node = node;
|
||||
expected.start = start;
|
||||
expected.end = end;
|
||||
this.ranges[this.ranges.length] = expected;
|
||||
this.ranges.sort(function(a,b) {return a.start - b.start;});
|
||||
}
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
var testNode = document.getElementById("testparagraph").firstChild;
|
||||
|
||||
var selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
ok(selection.rangeCount == 0, "Test 0 - No selections so far");
|
||||
|
||||
// Test 1. Add a single range, to ensure we've not broken anything.
|
||||
var range1 = document.createRange();
|
||||
range1.setStart(testNode, 0);
|
||||
range1.setEnd(testNode, 5);
|
||||
selection.addRange(range1);
|
||||
rangeChecker.addExpected(testNode, 0, 5);
|
||||
rangeChecker.check(1, selection);
|
||||
|
||||
// Test 2. Add a non-overlapping range, to ensure it gets added too.
|
||||
var range2 = document.createRange();
|
||||
range2.setStart(testNode, 8);
|
||||
range2.setEnd(testNode, 10);
|
||||
selection.addRange(range2);
|
||||
rangeChecker.addExpected(testNode, 8, 10);
|
||||
rangeChecker.check(2, selection);
|
||||
|
||||
// Test 3. Add the same range again. This should silently succeed.
|
||||
selection.addRange(range2);
|
||||
rangeChecker.check(3, selection);
|
||||
|
||||
// Test 4. Add a range that is left-adjacent to an existing range.
|
||||
var range3 = document.createRange();
|
||||
range3.setStart(testNode, 6);
|
||||
range3.setEnd(testNode, 8);
|
||||
selection.addRange(range3);
|
||||
rangeChecker.addExpected(testNode, 6, 8);
|
||||
rangeChecker.check(4, selection);
|
||||
|
||||
// Test 5. Add a range that is right-adjacent to an existing range.
|
||||
selection.removeRange(range2);
|
||||
selection.addRange(range2);
|
||||
rangeChecker.check(5, selection);
|
||||
|
||||
// Test 6. Add a range, add a second range that overlaps it.
|
||||
rangeChecker.reset();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range2);
|
||||
var range4 = document.createRange();
|
||||
range4.setStart(testNode, 9);
|
||||
range4.setEnd(testNode, 11);
|
||||
selection.addRange(range4);
|
||||
rangeChecker.addExpected(testNode, 8, 9);
|
||||
rangeChecker.addExpected(testNode, 9, 11);
|
||||
rangeChecker.check(6, selection);
|
||||
|
||||
// Test 7. Add a range, and this time a left-hand overlap.
|
||||
rangeChecker.reset();
|
||||
selection.removeAllRanges();
|
||||
var range5 = document.createRange();
|
||||
range5.setStart(testNode, 5);
|
||||
range5.setEnd(testNode, 7);
|
||||
selection.addRange(range3);
|
||||
selection.addRange(range5);
|
||||
rangeChecker.addExpected(testNode, 5, 7);
|
||||
rangeChecker.addExpected(testNode, 7, 8);
|
||||
rangeChecker.check(7, selection);
|
||||
|
||||
// Test 8. Add a range, and add a second range wholly contained
|
||||
// within it.
|
||||
rangeChecker.reset();
|
||||
selection.removeAllRanges();
|
||||
var range6 = document.createRange();
|
||||
range6.setStart(testNode, 0);
|
||||
range6.setEnd(testNode, 10);
|
||||
selection.addRange(range6);
|
||||
selection.addRange(range5);
|
||||
rangeChecker.addExpected(testNode, 0, 5);
|
||||
rangeChecker.addExpected(testNode, 5, 7);
|
||||
rangeChecker.addExpected(testNode, 7, 10);
|
||||
rangeChecker.check(8, selection);
|
||||
|
||||
// Test 9. Add a range that will wholly contain some existing ranges.
|
||||
rangeChecker.reset();
|
||||
selection.addRange(range6);
|
||||
rangeChecker.addExpected(testNode, 0, 10);
|
||||
rangeChecker.check(9, selection);
|
||||
|
||||
// Test 10. This time with the last range being a partial overlap.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range1);
|
||||
selection.addRange(range3);
|
||||
selection.addRange(range4);
|
||||
selection.addRange(range6);
|
||||
rangeChecker.addExpected(testNode, 10, 11);
|
||||
rangeChecker.check(10, selection);
|
||||
|
||||
// Test 11. Check we can add a collapsed range without problem.
|
||||
selection.removeAllRanges();
|
||||
rangeChecker.reset();
|
||||
range1.collapse(true);
|
||||
selection.addRange(range1);
|
||||
rangeChecker.addExpected(testNode, 0, 0);
|
||||
rangeChecker.check(11, selection);
|
||||
|
||||
// Test 12. Check we can add a collapsed range twice without a problem.
|
||||
// Part 1 - No other ranges present.
|
||||
selection.addRange(range1);
|
||||
rangeChecker.check(12, selection);
|
||||
|
||||
// Test 13. Check we can add a collapsed range twice without problem.
|
||||
// Part 2 - Collapsed range is before all existing ranges.
|
||||
selection.removeAllRanges();
|
||||
rangeChecker.reset();
|
||||
selection.addRange(range2);
|
||||
selection.addRange(range1);
|
||||
selection.addRange(range1);
|
||||
rangeChecker.addExpected(testNode, 0, 0);
|
||||
rangeChecker.addExpected(testNode, 8, 10);
|
||||
rangeChecker.check(13, selection);
|
||||
|
||||
// Test 14. Check we can add a collapsed range twice without problem.
|
||||
// Part 3 - Collapsed range is after all existing ranges.
|
||||
selection.removeAllRanges();
|
||||
rangeChecker.reset();
|
||||
selection.addRange(range3);
|
||||
range4.collapse(false);
|
||||
selection.addRange(range3);
|
||||
selection.addRange(range4);
|
||||
rangeChecker.addExpected(testNode, 6, 8);
|
||||
rangeChecker.addExpected(testNode, 11, 11);
|
||||
rangeChecker.check(14, selection);
|
||||
|
||||
// Test 15. Check that when adding a range where after overlap
|
||||
// adjustment an exisiting range would collapse that the collapsed range
|
||||
// is removed - part 1 (LHS).
|
||||
selection.removeAllRanges();
|
||||
rangeChecker.reset();
|
||||
selection.addRange(range2);
|
||||
var range7 = document.createRange();
|
||||
range7.setStart(testNode, 6);
|
||||
range7.setEnd(testNode, 10);
|
||||
selection.addRange(range7);
|
||||
rangeChecker.addExpected(testNode, 6, 10);
|
||||
rangeChecker.check(15, selection);
|
||||
|
||||
// Test 16. Check that when adding a range where after overlap
|
||||
// adjustment an exisiting range would collapse that the collapsed range
|
||||
// is removed - part 2 (RHS).
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range3);
|
||||
selection.addRange(range7);
|
||||
rangeChecker.check(16, selection);
|
||||
|
||||
// Test 17. Check GetRangesForInterval returns correct results.
|
||||
// Part 1 - Test interval matches a range, adjacency not allowed.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range2);
|
||||
selection.addRange(range3);
|
||||
var range8 = document.createRange();
|
||||
range8.setStart(testNode, 10);
|
||||
range8.setEnd(testNode, 12);
|
||||
selection.addRange(range8);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 8, 10);
|
||||
var privSel = SpecialPowers.wrap(selection)
|
||||
.QueryInterface(SpecialPowers.Ci.nsISelectionPrivate);
|
||||
ok(privSel, "Test 17 - QIed to instance of nsISelection2 interface");
|
||||
var results = privSel.GetRangesForInterval(testNode, 8, testNode, 10,
|
||||
false);
|
||||
intervalChecker.check(17, results);
|
||||
|
||||
// Test 18. Check GetRangesForInterval returns correct results.
|
||||
// Part 2 - Test interval matches a range, adjacent ranges allowed.
|
||||
intervalChecker.addExpected(testNode, 6, 8);
|
||||
intervalChecker.addExpected(testNode, 10, 12);
|
||||
results = privSel.GetRangesForInterval(testNode, 8, testNode, 10,
|
||||
true);
|
||||
intervalChecker.check(18, results);
|
||||
|
||||
// Test 19. Check GetRangesForInterval returns correct results.
|
||||
// Part 3 - Test interval not selected.
|
||||
intervalChecker.reset();
|
||||
results = privSel.GetRangesForInterval(testNode, 14, testNode, 16,
|
||||
true);
|
||||
intervalChecker.check(19, results);
|
||||
|
||||
// Test 20. Check GetRangesForInterval returns correct results.
|
||||
// Part 4 - Test interval is not equal to, and entirely contained in
|
||||
// an existing range.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range6);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 0, 10);
|
||||
results = privSel.GetRangesForInterval(testNode, 5, testNode, 7,
|
||||
true);
|
||||
intervalChecker.check(20, results);
|
||||
|
||||
// Test 21. Check GetRangesForInterval returns correct results.
|
||||
// Part 5 - Test interval is not equal to, and entirely contains an
|
||||
// existing range.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range3);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 6, 8);
|
||||
results = privSel.GetRangesForInterval(testNode, 5, testNode, 9,
|
||||
true);
|
||||
intervalChecker.check(21, results);
|
||||
|
||||
// Test 22. Check GetRangesForInterval returns correct results.
|
||||
// Part 6 - Test interval is end-adjacent to range at position 0 in
|
||||
// the range array, and adjacencies permitted.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range2);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 8, 10);
|
||||
results = privSel.GetRangesForInterval(testNode, 6, testNode, 8,
|
||||
true);
|
||||
intervalChecker.check(22, results);
|
||||
|
||||
// Test 23. Check GetRangesForInterval returns correct results.
|
||||
// Part 7 - Test interval is end-adjacent to range at position 0 in
|
||||
// the range array, and adjacencies not permitted.
|
||||
intervalChecker.reset();
|
||||
results = privSel.GetRangesForInterval(testNode, 6, testNode, 8,
|
||||
false);
|
||||
intervalChecker.check(23, results);
|
||||
|
||||
// Test 24. Check GetRangesForInterval returns correct results.
|
||||
// Part 8 - Test interval is start-adjacent to last range in array,
|
||||
// and adjacencies permitted.
|
||||
intervalChecker.addExpected(testNode, 8, 10);
|
||||
results = privSel.GetRangesForInterval(testNode, 10, testNode, 12,
|
||||
true);
|
||||
intervalChecker.check(24, results);
|
||||
|
||||
// Test 25. Check GetRangesForInterval returns correct results.
|
||||
// Part 9 - Test interval is start-adjacent to last range in array,
|
||||
// and adjacencies not permitted.
|
||||
intervalChecker.reset();
|
||||
results = privSel.GetRangesForInterval(testNode, 10, testNode, 12,
|
||||
false);
|
||||
intervalChecker.check(25, results);
|
||||
|
||||
// Test 26. Check GetRangesForInterval returns correct results.
|
||||
// Part 10 - Test interval is equal to a collapsed range at position 0
|
||||
// in the range array, and adjacencies permitted.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range4);
|
||||
intervalChecker.addExpected(testNode, 11, 11);
|
||||
results = privSel.GetRangesForInterval(testNode, 11, testNode, 11,
|
||||
true);
|
||||
intervalChecker.check(26, results);
|
||||
|
||||
// Test 27. Check GetRangesForInterval returns correct results.
|
||||
// Part 11 - Test interval is equal to a collapsed range at position 0
|
||||
// in the range array, and adjacencies not permitted.
|
||||
results = privSel.GetRangesForInterval(testNode, 11, testNode, 11,
|
||||
false);
|
||||
intervalChecker.check(27, results);
|
||||
|
||||
// Test 28. Check GetRangesForInterval returns correct results.
|
||||
// Part 12 - Test interval is equal to a collapsed range at end of the
|
||||
// range array, and adjacencies permitted.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range2);
|
||||
selection.addRange(range4);
|
||||
results = privSel.GetRangesForInterval(testNode, 11, testNode, 11,
|
||||
true);
|
||||
intervalChecker.check(28, results);
|
||||
|
||||
// Test 29. Check GetRangesForInterval returns correct results.
|
||||
// Part 13 - Test interval is equal to a collapsed range at end of the
|
||||
// range array, and adjacencies not permitted.
|
||||
results = privSel.GetRangesForInterval(testNode, 11, testNode, 11,
|
||||
false);
|
||||
intervalChecker.check(29, results);
|
||||
|
||||
// Test 30. Check GetRangesForInterval returns correct results.
|
||||
// Part 14 - Test interval is a collapsed range contained in an
|
||||
// existing range.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range3);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 6, 8);
|
||||
results = privSel.GetRangesForInterval(testNode, 7, testNode, 7,
|
||||
true);
|
||||
intervalChecker.check(30, results);
|
||||
|
||||
// Test 31. Check GetRangesForInterval returns correct results.
|
||||
// Part 15 - Test interval equals a collapsed range which is not stored
|
||||
// at either endpoint of the selection's range array,
|
||||
// adjacencies not allowed.
|
||||
selection.removeAllRanges();
|
||||
range3.collapse(false);
|
||||
selection.addRange(range5);
|
||||
selection.addRange(range3);
|
||||
selection.addRange(range8);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 8, 8);
|
||||
results = privSel.GetRangesForInterval(testNode, 8, testNode, 8,
|
||||
false);
|
||||
intervalChecker.check(31, results);
|
||||
|
||||
// Test 32. Check GetRangesForInterval returns correct results.
|
||||
// Part 16 - Test interval equals a collapsed range which is not stored
|
||||
// at either endpoint of the selection's range array,
|
||||
// adjacencies allowed.
|
||||
results = privSel.GetRangesForInterval(testNode, 8, testNode, 8,
|
||||
true);
|
||||
intervalChecker.check(32, results);
|
||||
|
||||
// Test 33. Check GetRangesForInterval returns correct results.
|
||||
// Part 17 - Test interval contains a collapsed range which is not
|
||||
// stored at either endpoint of the selection's range array.
|
||||
results = privSel.GetRangesForInterval(testNode, 7, testNode, 9,
|
||||
false);
|
||||
intervalChecker.check(33, results);
|
||||
|
||||
// Test 34. Check GetRangesForInterval returns correct results.
|
||||
// Part 18 - Test interval left-ovelaps an existing range.
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 5, 7);
|
||||
results = privSel.GetRangesForInterval(testNode, 2, testNode, 6,
|
||||
true);
|
||||
intervalChecker.check(34, results);
|
||||
|
||||
// Test 35. Check GetRangesForInterval returns correct results.
|
||||
// Part 19 - Test interval right-ovelaps an existing range.
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range8);
|
||||
intervalChecker.reset();
|
||||
intervalChecker.addExpected(testNode, 10, 12);
|
||||
results = privSel.GetRangesForInterval(testNode, 11, testNode, 13,
|
||||
true);
|
||||
intervalChecker.check(35, results);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<p id="testparagraph">
|
||||
This will be the first child of the p node above. The intention is that it is a suitably long text node to which we can add multiple ranges in order to test the various aspects of the bug.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
36
layout/generic/test/test_bug382429.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=382429
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 382429</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=382429">Mozilla Bug 382429</a>
|
||||
<p id="display">ע 3/4</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function do_Replace()
|
||||
{
|
||||
/** Test for Bug 382429 **/
|
||||
var t = $("display").firstChild;
|
||||
|
||||
t.data = t.data.replace(/3\/4/, "3 \u05d3 4");
|
||||
ok(true, "We should get here without crash or hang");
|
||||
is(t.data, "\u05e2 3 \u05d3 4", "replace succeeded");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(do_Replace, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
34
layout/generic/test/test_bug384527.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=384527
|
||||
-->
|
||||
<head style="display: inline-table;">
|
||||
<title>Test for Bug 384527</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style style="display: block; direction: rtl;">
|
||||
style::first-letter {float: right;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=384527">Mozilla Bug 384527</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function do_Test()
|
||||
{
|
||||
/** Test for Bug 384527 **/
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(do_Test, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
32
layout/generic/test/test_bug385751.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=385751
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 385751</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>#content:first-letter {float: right; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=385751">Mozilla Bug 385751</a>
|
||||
<div id="content"><span style="direction: rtl; unicode-bidi: embed;">*::first
|
||||
m</span></div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function do_Test()
|
||||
{
|
||||
/** Test for Bug 385751 **/
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(do_Test, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
32
layout/generic/test/test_bug389630.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=389630
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 389630</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>.fl:first-letter { }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=389630">Mozilla Bug 389630</a>
|
||||
<div id="content" style="direction: rtl;"><table><tr><td width="1"><div id="div" class="fl"><font><span>x y</span></font></div></td></tr></table></div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function boom()
|
||||
{
|
||||
/** Test for Bug 389630 **/
|
||||
document.getElementById("div").className = "";
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(boom, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
48
layout/generic/test/test_bug391747.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=391747
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Test for bug 391747</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391747">Mozilla Bug 391747</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: block">
|
||||
<iframe id="iframe_391747" src="data:text/html,<table><tr><td style='width:500px;height:500px;border:1px solid blue'>x</td>"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function ctrlclick_391747(doc,x,y){
|
||||
var wu = SpecialPowers.getDOMWindowUtils(doc.defaultView);
|
||||
wu.sendMouseEvent('mousedown', x, y, 0, 1, 2);
|
||||
wu.sendMouseEvent('mouseup', x, y, 0, 1, 2);
|
||||
}
|
||||
|
||||
function select_391747(doc){
|
||||
var range = doc.createRange();
|
||||
range.setStart(doc, 0);
|
||||
range.setEnd(doc, 0);
|
||||
doc.defaultView.getSelection().addRange(range);
|
||||
}
|
||||
|
||||
function boom_391747() {
|
||||
var target = document.getElementById('iframe_391747')
|
||||
select_391747(target.contentDocument)
|
||||
ctrlclick_391747(target.contentDocument, 100, 100);
|
||||
ok(true, "pass");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
addLoadEvent(boom_391747);
|
||||
SimpleTest.waitForExplicitFinish()
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
71
layout/generic/test/test_bug392746.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=392746
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 392746</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392746">Mozilla Bug 392746</a>
|
||||
<div id="content">
|
||||
text text text text text <span id="d">ddd text text </span>text text text <br>
|
||||
text <span id="c">ccc text</span> text text <span id="e">eee text</span> text text text <span id="b">bbb text</span><br>
|
||||
text text text text text text <span id="a">aaa text</span> text text text <br>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var wu = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
function ctrlselect(aX,aY, aX2, aY2) {
|
||||
var modifyers = (navigator.platform.indexOf("Mac") >= 0) ? 8 : 2;
|
||||
wu.sendMouseEvent('mousedown', aX, aY, 0, 1, modifyers);
|
||||
wu.sendMouseEvent('mousemove', aX2, aY2, 0, 0, modifyers);
|
||||
wu.sendMouseEvent('mouseup', aX2, aY2, 0, 1, modifyers);
|
||||
}
|
||||
|
||||
function test() {
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
|
||||
var a=document.getElementById('a').getBoundingClientRect();
|
||||
ctrlselect(a.left+1, a.top+1, a.right-1, a.top+1);
|
||||
var b=document.getElementById('b').getBoundingClientRect();
|
||||
ctrlselect(b.left+1, b.top+1, b.right-1, b.top+1);
|
||||
var c=document.getElementById('c').getBoundingClientRect();
|
||||
ctrlselect(c.left+1, c.top+1, c.right-1, c.top+1);
|
||||
var d=document.getElementById('d').getBoundingClientRect();
|
||||
ctrlselect(d.left+1, d.top+1, d.right-1, d.top+1);
|
||||
var e=document.getElementById('e').getBoundingClientRect();
|
||||
ctrlselect(e.right-1, e.top+1, e.left+1, e.top+1);
|
||||
|
||||
ok(sel.getRangeAt(0).toString() == 'ddd text text ', 'First selection range should be "ddd text text "');
|
||||
ok(sel.getRangeAt(1).toString() == 'ccc text', 'First selection range should be "ccc text"');
|
||||
ok(sel.getRangeAt(2).toString() == 'eee text', 'First selection range should be "eee text"');
|
||||
ok(sel.getRangeAt(3).toString() == 'bbb text', 'First selection range should be "bbb text"');
|
||||
ok(sel.getRangeAt(4).toString() == 'aaa text', 'First selection range should be "aaa text"');
|
||||
|
||||
ok(sel.focusNode == sel.anchorNode, 'focusNode and anchorNode should be the same');
|
||||
ok(sel.focusNode.parentNode == document.getElementById('e'), 'focusNode.parentNode should be the same as the node with id=e');
|
||||
ok(sel.focusOffset == 0, 'focusOffset should be 0');
|
||||
ok(sel.anchorOffset == 8, 'anchorOffset should be 8');
|
||||
|
||||
wu.sendMouseEvent('mousedown', 0, 0, 0, 1, 0);
|
||||
wu.sendMouseEvent('mousemove', 0, 0, 0, 0, 0);
|
||||
wu.sendMouseEvent('mouseup', 0, 0, 0, 1, 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.onload=function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
setTimeout(test, 0);
|
||||
};
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
41
layout/generic/test/test_bug392923.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=392923
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 392923</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>p { -moz-column-count: 2; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392923">Mozilla Bug 392923</a>
|
||||
<div id="content">
|
||||
<p>עברית Lorem ipsum dolor sit
|
||||
amet, consectetuer adipiscing elit. Maecenas volutpat. Duis purus lectus,
|
||||
hendrerit vitae, blandit ac, tristique quis, neque. Cras a nisl. Cum sociis
|
||||
natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In
|
||||
consectetuer lorem sit amet quam facilisis mollis. Etiam dolor. Donec
|
||||
elementum leo in ligula. Duis lacus diam, sodales vitae, rutrum a,
|
||||
feugiat non, tortor. Maecenas cursus lobortis diam. Mauris in pede eu
|
||||
purus ultricies vehicula. עברית</p>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function test()
|
||||
{
|
||||
/** Test for Bug 392923 **/
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(test, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
33
layout/generic/test/test_bug394173.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=394173
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 394173</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>.fl:first-letter { }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=394173">Mozilla Bug 394173</a>
|
||||
<div id="content">
|
||||
<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%0A%3Chead%3E%0A%3Cstyle%3E%0Adiv%3A%3Afirst-letter%20%7B%20%7D%0Aspan%3A%3Aafter%20%7B%20content%3A%22before%20text%22%3B%20%7D%0A%3C/style%3E%0A%3C/head%3E%0A%3Cbody%3E%0A%3Cdiv%20style%3D%22position%3A%20fixed%3B%20direction%3A%20rtl%3B%22%3E%0A%20%20%3Cspan%20style%3D%22%20direction%3A%20ltr%3B%20unicode-bidi%3A%20bidi-override%3B%20font-size%3A%2070px%3B%20%22%3E%0A%20%20%20%20%3Cspan%20style%3D%22display%3A%20table%3B%20position%3A%20fixed%3B%22%3E%3C/span%3E%0A%20%20%3C/span%3E%0A%3C/div%3E%0A%3Cscript%3E%0Afunction%20doe%28i%29%7B%0Adocument.documentElement.setAttribute%28%27style%27%2C%20%27%27%29%3B%0A%7D%0AsetTimeout%28doe%2C100%29%3B%0A%3C/script%3E%0A%3C/body%3E%0A%3C/html%3E" style="width:200px;height: 200px;"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function boom()
|
||||
{
|
||||
/** Test for Bug 394173 **/
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(boom, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
46
layout/generic/test/test_bug394239.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=394239
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 394239</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
#a::after { content:"anonymous text"; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<object id="a" style="position: relative;">
|
||||
<div style="position: absolute;">
|
||||
<input>
|
||||
</div>ع
|
||||
<div style="position: absolute;">
|
||||
<span style="position: fixed;">t</span>
|
||||
</div>
|
||||
</object>
|
||||
</div>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=394239">Mozilla Bug 394239</a>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.expectAssertions(1);
|
||||
|
||||
/** Test for Bug 394239 **/
|
||||
function test()
|
||||
{
|
||||
$("a").style.direction="rtl";
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(test, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
36
layout/generic/test/test_bug402380.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=402380
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 402380</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style type="text/css">
|
||||
div::first-letter { color: green; }
|
||||
span:before { content: open-quote "This "; }
|
||||
span:after { content: close-quote; }
|
||||
</style>
|
||||
</head>
|
||||
<body style="font-family: monospace; width: 7ch; border: 1px solid orange;"
|
||||
onload="document.getElementById('div').style.direction = 'rtl';">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402380">Mozilla Bug 402380</a>
|
||||
<div id="div"><span>is text</span></div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function test()
|
||||
{
|
||||
/** Test for Bug 402380 **/
|
||||
ok(true, "Should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(test, 500);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
38
layout/generic/test/test_bug404872.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=404872
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 404872</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=404872">Mozilla Bug 404872</a>
|
||||
<p id="display">
|
||||
<select multiple id="a">
|
||||
<option name="value1">value1</option>
|
||||
<option name="value2">value2</option>
|
||||
<option name="value3">value3</option>
|
||||
</select>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/* Focus, press key down twice, and make sure we successfully selected the second item. */
|
||||
$('a').focus();
|
||||
synthesizeKey("VK_DOWN", {});
|
||||
synthesizeKey("VK_DOWN", {});
|
||||
is($("a").value, "value2", "value2 should be selected!");
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
51
layout/generic/test/test_bug405178.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=405178
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 405178</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=405178">Mozilla Bug 405178</a>
|
||||
<p id="display"><div id="div" style="-moz-column-width: 10px;">孑ۍ </div></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 405178 **/
|
||||
|
||||
var div, textNode;
|
||||
|
||||
function boom()
|
||||
{
|
||||
div = document.getElementById("div");
|
||||
textNode = div.firstChild;
|
||||
|
||||
div.removeChild(textNode);
|
||||
setTimeout(boom2, 200);
|
||||
}
|
||||
|
||||
function boom2()
|
||||
{
|
||||
textNode.data = "";
|
||||
div.appendChild(document.createTextNode("X"))
|
||||
var foo = document.body.offsetHeight;
|
||||
|
||||
ok(true, "Test is successful if we get here without crashing");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
addLoadEvent(boom);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
44
layout/generic/test/test_bug416168.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=416168
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 416168</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=416168">Mozilla Bug 416168</a>
|
||||
<p id="display">
|
||||
|
||||
<div id="a" style="overflow: hidden; outline: 1px solid black; height: 0px;">
|
||||
<div style="margin-top: 50px; width:20px; height:20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="b" style="overflow: hidden; outline: 1px solid black; width:0px; height: 100px;">
|
||||
</div>
|
||||
|
||||
<div id="c" style="overflow: hidden; outline: 1px solid black; width:100px; height: 0px;">
|
||||
</div>
|
||||
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var a = document.getElementById("a");
|
||||
is(a.scrollHeight, 70, "margin-top included");
|
||||
|
||||
var b = document.getElementById("b");
|
||||
is(b.scrollHeight, 100, "zero width");
|
||||
|
||||
var c = document.getElementById("c");
|
||||
is(c.scrollWidth, 100, "zero height");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
31
layout/generic/test/test_bug421436.html
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=421436
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 421436</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421436">Mozilla Bug 421436</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<span id="outer"><span id="inner">Hello</span><br></span>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 421436 **/
|
||||
var inner = document.getElementById("inner");
|
||||
var outer = document.getElementById("outer");
|
||||
|
||||
is(inner.getBoundingClientRect().left, outer.getBoundingClientRect().left, "left edges equal");
|
||||
todo_is(inner.getBoundingClientRect().right, outer.getBoundingClientRect().right, "right edges equal");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
80
layout/generic/test/test_bug421839-1.html
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=421839
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 421839</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421839">Mozilla Bug 421839</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
Moving with you mouse from above to below and back a few times across the iframe, shouldn't crash Mozilla<br/>
|
||||
|
||||
<iframe id="iframe" src="data:text/html;charset=utf-8,text%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%0A%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3Etext%3Cbr%3E"></iframe>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 421839 **/
|
||||
|
||||
var counter = 0;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var doc = document;
|
||||
if (document.getElementById('iframe'))
|
||||
doc = document.getElementById('iframe').contentDocument;
|
||||
|
||||
function toggleIframe(){
|
||||
var x=document.getElementById('iframe');
|
||||
x.style.display = x.style.display == 'none' ? x.style.display = '' : x.style.display = 'none';
|
||||
setTimeout(toggleIframe,100);
|
||||
|
||||
if (++counter == 4)
|
||||
setTimeout(finish, 200);
|
||||
|
||||
}
|
||||
setTimeout(toggleIframe,100);
|
||||
|
||||
function ctrlclick(i){
|
||||
var wu = SpecialPowers.getDOMWindowUtils(doc.defaultView);
|
||||
var wu2 = SpecialPowers.getDOMWindowUtils(top);
|
||||
|
||||
try
|
||||
{
|
||||
wu.sendMouseEvent('mousedown', 2*i, 2*i, 0, 1, 0);
|
||||
wu2.sendMouseEvent('mousemove', 500*i, 500*i, 0, 0, 0);
|
||||
//wu.sendMouseEvent('mouseup', 2*i, 2*i, 0, 1, 2);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
|
||||
i+=1;
|
||||
if (i>50)
|
||||
i =0;
|
||||
|
||||
setTimeout(ctrlclick,20,i);
|
||||
|
||||
if (++counter == 4)
|
||||
setTimeout(finish, 200);
|
||||
|
||||
}
|
||||
|
||||
setTimeout(ctrlclick,20,0);
|
||||
|
||||
function finish()
|
||||
{
|
||||
ok(true, "This is a mochikit version of a crash test. To complete is to pass.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
35
layout/generic/test/test_bug421839-2.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=421839
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 421839</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421839">Mozilla Bug 421839</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 421839 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
setTimeout(finish, 5000);
|
||||
|
||||
function finish()
|
||||
{
|
||||
ok(true, "This is a mochikit version of a crash test. To complete is to pass.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
41
layout/generic/test/test_bug424627.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=424627
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 424627</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=424627">Mozilla Bug 424627</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<table><tr><td><textarea cols="60" rows="4" style="border: 20px solid blue;">text
|
||||
more text
|
||||
even more text
|
||||
enough text</textarea></td></tr></table>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 424627 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var t = document.querySelector("textarea")
|
||||
t.focus();
|
||||
var originalValue = t.value;
|
||||
synthesizeMouse(t, 10, 30, {accelKey: true});
|
||||
synthesizeKey("x", {});
|
||||
t = document.querySelector("textarea")
|
||||
ok(t, "The text area should not be removed from the document");
|
||||
isnot(t.value, originalValue, "Its value should be modified");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
52
layout/generic/test/test_bug438840.html
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Character Movement (including nsTextFrame::PeekOffsetCharacter)</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div>content before the editor</div>
|
||||
<div contentEditable="true" id="editor" style="width:200px;height:150px;overflow-y:auto;overflow-x:hidden;"><p>paragraph1</p>
|
||||
<p>paragraph2</p>
|
||||
<p>paragraph3</p>
|
||||
<p>paragraph4</p>
|
||||
<p>paragraph5</p>
|
||||
<p>paragraph6</p>
|
||||
</div>
|
||||
<div>content after the editor</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript;version=1.7">
|
||||
|
||||
function test() {
|
||||
var sel = window.getSelection();
|
||||
var editor = document.getElementById("editor");
|
||||
|
||||
var keymodifier={};
|
||||
//in windows/linux, pageup/pagedown will trigger movement of caret
|
||||
//while in Mac, pageup/pagedown will just scroll. We need to press
|
||||
//alt-pageup/pagedown in Mac to actually move caret
|
||||
if(navigator.platform.indexOf("Mac") >= 0){
|
||||
keymodifier.altKey=true;
|
||||
}
|
||||
|
||||
sel.collapse(editor.firstChild.firstChild, 1);
|
||||
synthesizeKey("VK_PAGE_UP", keymodifier);
|
||||
is(sel.anchorNode, editor.firstChild.firstChild, 'after pageup caret should still be in the first paragraph');
|
||||
|
||||
synthesizeKey("VK_PAGE_DOWN", keymodifier);
|
||||
is(sel.anchorNode.parentNode.parentNode, editor, 'pagedown should not move caret outside the editor');
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(test);
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
64
layout/generic/test/test_bug448860.html
Normal file
72
layout/generic/test/test_bug448987.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=448987
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 448987</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
iframe {
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448987">Mozilla Bug 448987</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe id="f1"></iframe>
|
||||
<iframe id="f2"></iframe>
|
||||
<iframe id="f3"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 448987 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.setIntPref("accessibility.tabfocus", 7);
|
||||
|
||||
var f1 = document.getElementById("f1");
|
||||
var f2 = document.getElementById("f2");
|
||||
var f3 = document.getElementById("f3");
|
||||
|
||||
var snapshotf1;
|
||||
|
||||
SimpleTest.waitForFocus(function() {
|
||||
f1.src = "file_bug448987.html";
|
||||
});
|
||||
|
||||
function firstIframeLoaded() {
|
||||
snapshotf1 = snapshotWindow(f1.contentWindow);
|
||||
f2.src="file_bug448987_ref.html";
|
||||
}
|
||||
|
||||
function secondIframeLoaded() {
|
||||
ok(compareSnapshots(snapshotf1,
|
||||
snapshotWindow(f2.contentWindow), true)[0],
|
||||
"<area shape=default> should render focus outline");
|
||||
f3.src="file_bug448987_notref.html";
|
||||
}
|
||||
|
||||
function thirdIframeLoaded() {
|
||||
ok(compareSnapshots(snapshotf1,
|
||||
snapshotWindow(f3.contentWindow), false)[0],
|
||||
"file_bug448987.html should render focus outline, file_bug448987_notref.html should not");
|
||||
finish();
|
||||
}
|
||||
|
||||
function finish()
|
||||
{
|
||||
SpecialPowers.clearUserPref("accessibility.tabfocus");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
44
layout/generic/test/test_bug449653.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=449653
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 449653</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
iframe {
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="doTest()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=449653">Mozilla Bug 449653</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe src="file_bug449653_1.html" id="f1"></iframe>
|
||||
<iframe id="f2" src="file_bug449653_1_ref.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 449653 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var f1 = document.getElementById("f1");
|
||||
var f2 = document.getElementById("f2");
|
||||
|
||||
function doTest() {
|
||||
ok(compareSnapshots(snapshotWindow(f1.contentWindow),
|
||||
snapshotWindow(f2.contentWindow), true)[0],
|
||||
"No red should be shown");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
58
layout/generic/test/test_bug460532.html
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=460532
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Test for bug 460532</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=460532">Mozilla Bug 460532</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: block">
|
||||
lorem ipsum.
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function select_460532(){
|
||||
var content = document.getElementById('content');
|
||||
var node = content.firstChild;
|
||||
|
||||
var range = document.createRange();
|
||||
range.setStart(node, 0);
|
||||
range.setEnd(node, 5);
|
||||
window.getSelection().addRange(range);
|
||||
|
||||
range = document.createRange();
|
||||
range.setStart(node, 0);
|
||||
range.setEnd(node, 6);
|
||||
window.getSelection().addRange(range);
|
||||
}
|
||||
|
||||
function click_460532(){
|
||||
var wu = SpecialPowers.getDOMWindowUtils(window);
|
||||
var content = document.getElementById('content');
|
||||
var rect = content.getBoundingClientRect();
|
||||
wu.sendMouseEvent('mousedown', rect.left+5, rect.top+5, 0, 1, 0);
|
||||
wu.sendMouseEvent('mouseup', rect.left+5, rect.top+5, 0, 1, 0);
|
||||
ok(true, "pass");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function boom_460532() {
|
||||
select_460532();
|
||||
setTimeout(click_460532, 100);
|
||||
}
|
||||
|
||||
addLoadEvent(boom_460532);
|
||||
SimpleTest.waitForExplicitFinish()
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
55
layout/generic/test/test_bug468167.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=468167
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 468167</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468167">Mozilla Bug 468167</a>
|
||||
<p id="display">
|
||||
<textarea id="ta" rows="10" cols="80"></textarea>
|
||||
</p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 468167 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
|
||||
function runTests()
|
||||
{
|
||||
var ta = document.getElementById("ta");
|
||||
ta.focus();
|
||||
is(ta.scrollTop, 0, "initially scrolled to top");
|
||||
var s = "";
|
||||
for (var i = 0; i < 40; ++i) {
|
||||
// three characters per line
|
||||
if (i < 10)
|
||||
s += "0";
|
||||
s += i + "\n";
|
||||
}
|
||||
ta.value = s;
|
||||
is(ta.scrollTop, 0, "scrolled to top after adding content");
|
||||
ta.scrollTop = 9999; // scroll down as far as we can
|
||||
isnot(ta.scrollTop, 0, "scrolled down after scrolling down");
|
||||
|
||||
ta.setSelectionRange(0, 99); // 33 lines out of 40
|
||||
|
||||
// Send a backspace key event to delete the selection
|
||||
synthesizeKey("VK_BACK_SPACE", { });
|
||||
|
||||
is(ta.scrollTop, 0, "scrolled to top after deleting selection");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
85
layout/generic/test/test_bug469613.xul
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=469613
|
||||
-->
|
||||
<window title="Mozilla Bug 469613"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469613">Mozilla Bug 469613</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<vbox style="height: 100px; overflow: auto;" id="scrollbox">
|
||||
<hbox style="height: 200px;"/>
|
||||
</vbox>
|
||||
|
||||
<script class="testbody" type="application/javascript;version=1.7"><![CDATA[
|
||||
|
||||
/** Test for Bug 469613 **/
|
||||
|
||||
function doTest() {
|
||||
let scrollbox = document.getElementById("scrollbox");
|
||||
scrollbox.scrollTop = 0;
|
||||
|
||||
// Make sure that the "scroll focus" is inside the scrollbox by moving the
|
||||
// mouse in the scrollbox.
|
||||
synthesizeMouse(scrollbox, 6, 6, { type: "mousemove" });
|
||||
synthesizeMouse(scrollbox, 8, 8, { type: "mousemove" });
|
||||
|
||||
// Now scroll 10px down.
|
||||
synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
|
||||
|
||||
// Send a 0-delta scroll.
|
||||
synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
|
||||
|
||||
setTimeout(function() {
|
||||
// Check if the 10px were scrolled.
|
||||
todo(false, "Starting a 0-delta scroll shouldn't cancel a pending async scroll is disabled, see bug 752786");
|
||||
//is(scrollbox.scrollTop, 10, "Starting a 0-delta scroll shouldn't cancel a pending async scroll.");
|
||||
|
||||
// Second test
|
||||
scrollbox.scrollTop = 20;
|
||||
|
||||
// Start an async scroll to 30.
|
||||
synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
|
||||
|
||||
// Start a sync scroll to 30.
|
||||
scrollbox.scrollTop = 30;
|
||||
|
||||
is(scrollbox.scrollTop, 30, "Setting scrollTop should have immediate effect, even if there was a pending async scroll to the same position.");
|
||||
|
||||
|
||||
// Third test
|
||||
scrollbox.scrollTop = 40;
|
||||
|
||||
// Start an async scroll to 50.
|
||||
synthesizeWheel(scrollbox, 10, 10, { deltaY: 10.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
|
||||
|
||||
// Cancel the async scroll.
|
||||
scrollbox.scrollTop = 40;
|
||||
|
||||
// Send a 0-delta scroll.
|
||||
synthesizeWheel(scrollbox, 10, 10, { deltaY: 0.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL });
|
||||
|
||||
setTimeout(function() {
|
||||
is(scrollbox.scrollTop, 40, "Canceling an async scroll should reset the point of reference for relative scrolls (mDestinationX/Y).");
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(() => setTimeout(doTest, 0));
|
||||
|
||||
]]></script>
|
||||
|
||||
</window>
|
||||
72
layout/generic/test/test_bug469774.xul
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=469774
|
||||
-->
|
||||
<window title="Mozilla Bug 469774"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
|
||||
<vbox height="50"/>
|
||||
|
||||
<menupopup id="popup">
|
||||
<textbox id="textbox"/>
|
||||
</menupopup>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469774">Mozilla Bug 469774</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script class="testbody" type="application/javascript;version=1.7"><![CDATA[
|
||||
|
||||
/** Test for Bug 469774 **/
|
||||
|
||||
// Test whether menu popups are blocked from being painted in their parent window.
|
||||
|
||||
// Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET
|
||||
function snapShot() {
|
||||
var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
canvas.setAttribute("width", 200);
|
||||
canvas.setAttribute("height", 50);
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawWindow(window, 0, 0, 200, 50, "transparent", ctx.DRAWWINDOW_DRAW_CARET);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
window.removeEventListener("focus", doTest, false);
|
||||
|
||||
var before = snapShot();
|
||||
|
||||
var popup = document.getElementById("popup");
|
||||
popup.openPopup(null, "after_start", 0, 0, false, false);
|
||||
|
||||
popup.addEventListener("popupshown", function() {
|
||||
var textbox = document.getElementById("textbox");
|
||||
textbox.focus(); // show caret
|
||||
|
||||
var after = snapShot();
|
||||
|
||||
var equal, str1, str2;
|
||||
[equal, str1, str2] = compareSnapshots(after, before, true);
|
||||
ok(equal, "Showing a popup shouldn't affect drawing in its parent window",
|
||||
"got " + str1 + " but expected " + str2);
|
||||
|
||||
popup.hidePopup();
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.addEventListener("focus", doTest, false);
|
||||
|
||||
]]></script>
|
||||
|
||||
</window>
|
||||
53
layout/generic/test/test_bug470212.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=470212
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 470212 - crash [@ nsContentUtils::ComparePoints]</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=470212">Mozilla Bug 470212</a>
|
||||
<div style="width: 200px;">
|
||||
<ca>
|
||||
<canvas style="border: 1px solid black;" id="dragSource"></canvas>
|
||||
</ca>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
function doShiftDrag(){
|
||||
setTimeout(function() {
|
||||
var wu = SpecialPowers.DOMWindowUtils;
|
||||
var canvas = document.getElementById("dragSource");
|
||||
var canvasRect = canvas.getBoundingClientRect();
|
||||
|
||||
// Drag canvas element starts with a mouse down event, combine with shift
|
||||
// key, follows by two mouse move events.
|
||||
|
||||
// Press on left-top corner of the canvas element.
|
||||
wu.sendMouseEvent('mousedown', canvasRect.left, canvasRect.top, 0, 1, 4);
|
||||
// Move to the center of this cavas element.
|
||||
wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2),
|
||||
canvasRect.top + (canvasRect.height / 2), 0, 0, 4);
|
||||
// move out of cavas's region.
|
||||
wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2),
|
||||
canvasRect.bottom + 10, 0, 0, 4);
|
||||
|
||||
is(window.getSelection().rangeCount, 0, "rangeCount should be 0");
|
||||
|
||||
wu.sendMouseEvent('mouseup', canvasRect.left + (canvasRect.width / 2),
|
||||
canvasRect.bottom + 10, 0, 0, 4);
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doShiftDrag);
|
||||
</script>
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
59
layout/generic/test/test_bug488417.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=488417
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 488417</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488417">Mozilla Bug 488417</a>
|
||||
<div id="display">
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td id="a">A1</td>
|
||||
<td id="b">B1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>A2</td>
|
||||
<td>B2</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
function clickIt(node) {
|
||||
synthesizeMouse(node, node.getBoundingClientRect().width/2,
|
||||
node.getBoundingClientRect().height/2,
|
||||
{ accelKey: 1 });
|
||||
}
|
||||
|
||||
/** Test for Bug 488417 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
// Do the test async so we can unsuppress painting
|
||||
SimpleTest.executeSoon(function() {
|
||||
clickIt($("a"));
|
||||
clickIt($("b"));
|
||||
clickIt($("a"));
|
||||
ok(1, "Got here");
|
||||
// Clean up
|
||||
window.getSelection().removeAllRanges();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
289
layout/generic/test/test_bug496275.html
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=496275
|
||||
-->
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Test for Bug 496275</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body onload="run()">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=496275">
|
||||
Mozilla Bug 496275
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="c" contenteditable="true">
|
||||
<p id="p1">The first paragraph. Another sentence. Even more text.</p>
|
||||
<p id="p2">Paragraph no. 2.</p>
|
||||
<p id="p3">This paragraph<br>
|
||||
is broken up<br>
|
||||
into four<br>
|
||||
lines</p>
|
||||
</div>
|
||||
|
||||
<div id="ltr" contenteditable="true">
|
||||
<p id="l1">םלש Hello</p>
|
||||
<p id="l2">Goodbye</p>
|
||||
</div>
|
||||
|
||||
<div id="rtl" contenteditable="true" dir="rtl">
|
||||
<p id="r1">התרגום האחרון שפיתחנו הוא עבור Firefox 3.5.6.</p>
|
||||
<p id="r2">קראו את הערות ההפצה (אנגלית) להוראות ורשימת בעיות ידועות.</p>
|
||||
</div>
|
||||
|
||||
<!-- Special characters: لا is actually two characters, while تَ should be
|
||||
treated as one character. -->
|
||||
<div id="special" contenteditable="true">
|
||||
<p id="s1">a لا b تَ c</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Anchor offset: <span id="anchor-offset"></span></p>
|
||||
<p>Focus offset: <span id="focus-offset"></span></p>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
function isOrIsParent(actual, expected, msg) {
|
||||
// actual should be expected or actual's parent node should be expected.
|
||||
msg += " Expected " + actual + " or " + actual.parentNode +
|
||||
" to be " + expected + ".";
|
||||
|
||||
ok(actual == expected || actual.parentNode == expected, msg);
|
||||
}
|
||||
|
||||
function isAt(anchorNode, anchorOffset, focusNode, focusOffset, msg) {
|
||||
var sel = window.getSelection();
|
||||
|
||||
isOrIsParent(sel.anchorNode, $(anchorNode), msg + ": Wrong anchor node.");
|
||||
is(sel.anchorOffset, anchorOffset, msg + ": Wrong anchor offset.");
|
||||
isOrIsParent(sel.focusNode, $(focusNode), msg + ": Wrong focus node.");
|
||||
is(sel.focusOffset, $(focusOffset), msg + ": Wrong focus offset.");
|
||||
}
|
||||
|
||||
function run() {
|
||||
var sel = window.getSelection();
|
||||
|
||||
// If nothing is focused, selection.modify() should silently fail.
|
||||
sel.removeAllRanges();
|
||||
sel.modify("move", "forward", "character");
|
||||
|
||||
// Now focus our first div and put the cursor at the beginning of p1.
|
||||
$("c").focus();
|
||||
sel.collapse($("p1"), 0);
|
||||
|
||||
// We're intentionally inconsistent with the capitalization of "move",
|
||||
// "extend", etc. below to test the case-insensitivity of modify().
|
||||
|
||||
// If we move backward, selection.modify() shouldn't do anything, since we're
|
||||
// already at the beginning of the frame.
|
||||
isAt("p1", 0, "p1", 0, "test 0a");
|
||||
sel.modify("Move", "Backward", "Character");
|
||||
isAt("p1", 0, "p1", 0, "test 0b");
|
||||
|
||||
// After this move, the cursor should be at the second character of p1
|
||||
sel.modify("Move", "Forward", "Character");
|
||||
isAt("p1", 1, "p1", 1, "test 1");
|
||||
|
||||
// Select the first character in p1
|
||||
sel.collapse($("p1"), 0);
|
||||
sel.modify("Extend", "Forward", "Character");
|
||||
isAt("p1", 0, "p1", 1, "test 2");
|
||||
sel.modify("Move", "Forward", "Character");
|
||||
isAt("p1", 2, "p1", 2, "test 2a");
|
||||
|
||||
// Select all of p1, then move the selection forward one character a few
|
||||
// times.
|
||||
sel.collapse($("p1"), 0);
|
||||
sel.extend($("p1"), 1);
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("p2", 0, "p2", 0, "test 3a");
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("p2", 1, "p2", 1, "test 3b");
|
||||
|
||||
// Put the cursor at the beginning of p3, then extend forward one line.
|
||||
// Now go back twice and forward once. Focus should now be at the end of p3.
|
||||
sel.collapse($("p3"), 0);
|
||||
sel.modify("Extend", "Forward", "Line");
|
||||
sel.modify("extend", "backward", "character");
|
||||
sel.modify("extend", "backward", "character");
|
||||
sel.modify("extend", "forward", "character");
|
||||
isAt("p3", 0, "p3", 14, "test 4");
|
||||
|
||||
// Put the cursor at the beginning of p3, then go forward a few words
|
||||
sel.collapse($("p3"), 0);
|
||||
sel.modify("Move", "Forward", "Word");
|
||||
isAt("p3", 4, "p3", 4, "test 4a");
|
||||
sel.modify("move", "forward", "word");
|
||||
// Go back and forward so the indexes are correct.
|
||||
sel.modify("move", "backward", "character");
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("p3", 14, "p3", 14, "test 4b");
|
||||
|
||||
// Test the lineboundary granularity
|
||||
sel.collapse($("p3"), 0);
|
||||
sel.modify("Move", "Forward", "Lineboundary");
|
||||
// Go back and forward so the indexes are correct.
|
||||
sel.modify("move", "Backward", "character");
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("p3", 14, "p3", 14, "test 5");
|
||||
|
||||
//
|
||||
// Test RTL text within a dir=LTR div.
|
||||
//
|
||||
$("ltr").focus();
|
||||
sel.collapse($("l1"), 0);
|
||||
SpecialPowers.wrap(sel).caretBidiLevel = 1;
|
||||
isAt("l1", 0, "l1", 0, "test 6a");
|
||||
sel.modify("Move", "Left", "Character");
|
||||
isAt("l1", 1, "l1", 1, "test 6b");
|
||||
sel.modify("Extend", "Backward", "Character");
|
||||
isAt("l1", 1, "l1", 0, "test 6c");
|
||||
sel.modify("extend", "forward", "character");
|
||||
isAt("l1", 1, "l1", 1, "test 6d");
|
||||
sel.modify("Extend", "Right", "Character");
|
||||
isAt("l1", 1, "l1", 0, "test 6e");
|
||||
|
||||
sel.collapse($("l1"), 0);
|
||||
SpecialPowers.wrap(sel).caretBidiLevel = 1;
|
||||
sel.modify("move", "left", "character");
|
||||
sel.modify("extend", "right", "Word");
|
||||
isAt("l1", 1, "l1", 3, "test 7a");
|
||||
sel.modify("move", "left", "word");
|
||||
isAt("l1", 3, "l1", 3, "test 7b");
|
||||
sel.modify("move", "forward", "word");
|
||||
isAt("l1", 9, "l1", 9, "test 7c");
|
||||
sel.modify("extend", "backward", "word");
|
||||
isAt("l1", 9, "l1", 4, "test 7d");
|
||||
sel.modify("move", "left", "word");
|
||||
isAt("l1", 3, "l1", 3, "test 7e");
|
||||
|
||||
sel.collapse($("l1"), 0);
|
||||
SpecialPowers.wrap(sel).caretBidiLevel = 1;
|
||||
sel.modify("extend", "left", "lineboundary");
|
||||
isAt("l1", 0, "l1", 3, "test 8a");
|
||||
sel.modify("move", "forward", "lineboundary");
|
||||
isAt("l1", 9, "l1", 9, "test 8b");
|
||||
sel.modify("extend", "backward", "lineboundary");
|
||||
isAt("l1", 9, "l1", 0, "test 8c");
|
||||
sel.modify("move", "left", "lineboundary");
|
||||
isAt("l1", 3, "l1", 3, "test 8d");
|
||||
sel.modify("extend", "forward", "lineboundary");
|
||||
isAt("l1", 3, "l1", 9, "test 8e");
|
||||
|
||||
// Put the cursor at the left edge of the first line so that when we go up
|
||||
// and down, where we end up doesn't depend on how the characters line up.
|
||||
sel.collapse($("l1"), 0);
|
||||
SpecialPowers.wrap(sel).caretBidiLevel = 1;
|
||||
sel.modify("move", "left", "lineboundary");
|
||||
isAt("l1", 3, "l1", 3, "test 9a");
|
||||
sel.modify("move", "forward", "Line");
|
||||
isAt("l2", 0, "l2", 0, "test 9b");
|
||||
sel.modify("extend", "backward", "Line");
|
||||
// Apparently going up from the beginning of the line takes us to offset 3 in
|
||||
// the line above. This is a little weird, but it's consistent with how the
|
||||
// keyboard works.
|
||||
isAt("l2", 0, "l1", 3, "test 9c");
|
||||
|
||||
// Same test as above, now with absolute directions.
|
||||
sel.collapse($("l1"), 0);
|
||||
SpecialPowers.wrap(sel).caretBidiLevel = 1;
|
||||
sel.modify("move", "left", "lineboundary");
|
||||
isAt("l1", 3, "l1", 3, "test 10a");
|
||||
sel.modify("move", "right", "line");
|
||||
isAt("l2", 0, "l2", 0, "test 10b");
|
||||
sel.modify("extend", "left", "line");
|
||||
isAt("l2", 0, "l1", 3, "test 10c");
|
||||
|
||||
//
|
||||
// Test RTL text within a dir=RTL div.
|
||||
//
|
||||
$("rtl").focus();
|
||||
sel.collapse($("r1"), 0);
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("r1", 1, "r1", 1, "test 11a");
|
||||
sel.modify("extend", "backward", "character");
|
||||
isAt("r1", 1, "r1", 0, "test 11b");
|
||||
sel.modify("move", "forward", "word");
|
||||
isAt("r1", 6, "r1", 6, "test 11c");
|
||||
sel.modify("extend", "backward", "word");
|
||||
isAt("r1", 6, "r1", 0, "test 11d");
|
||||
sel.modify("extend", "forward", "lineboundary");
|
||||
isAt("r1", 6, "r1", 45, "test 11e");
|
||||
|
||||
// Same as above, but with absolute directions.
|
||||
sel.collapse($("r1"), 0);
|
||||
sel.modify("move", "left", "character");
|
||||
isAt("r1", 1, "r1", 1, "test 12a");
|
||||
sel.modify("extend", "right", "character");
|
||||
isAt("r1", 1, "r1", 0, "test 12b");
|
||||
sel.modify("move", "left", "word");
|
||||
isAt("r1", 6, "r1", 6, "test 12c");
|
||||
sel.modify("extend", "right", "word");
|
||||
isAt("r1", 6, "r1", 0, "test 12d");
|
||||
|
||||
// Test that move left/right is correct within the RTL div.
|
||||
sel.collapse($("r1"), 0);
|
||||
sel.modify("extend", "left", "lineboundary");
|
||||
isAt("r1", 0, "r1", 45, "test 13a");
|
||||
sel.modify("move", "right", "lineboundary");
|
||||
isAt("r1", 0, "r1", 0, "test 13b");
|
||||
|
||||
// Test that up/down at the first/last line correctly wraps to the
|
||||
// beginning/end of the line.
|
||||
sel.collapse($("r1"), 0);
|
||||
sel.modify("move", "forward", "word");
|
||||
isAt("r1", 6, "r1", 6, "test 14a");
|
||||
// Even in RTL text, "left" still means up.
|
||||
sel.modify("extend", "left", "Line");
|
||||
isAt("r1", 6, "r1", 0, "test 14b");
|
||||
sel.modify("move", "right", "line");
|
||||
isAt("r2", 0, "r2", 0, "test 14c");
|
||||
sel.modify("extend", "forward", "line");
|
||||
isAt("r2", 0, "r2", 57, "test 14d");
|
||||
sel.modify("move", "backward", "line");
|
||||
isAt("r1", 45, "r1", 45, "test 14e");
|
||||
|
||||
// Test some special characters.
|
||||
$("special").focus();
|
||||
sel.collapse($("s1"), 0);
|
||||
sel.modify("move", "forward", "character");
|
||||
sel.modify("move", "forward", "character");
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("s1", 3, "s1", 3, "test 15a");
|
||||
sel.modify("move", "forward", "character");
|
||||
isAt("s1", 4, "s1", 4, "test 15b");
|
||||
sel.modify("move", "backward", "word");
|
||||
isAt("s1", 2, "s1", 2, "test 15c");
|
||||
sel.modify("move", "forward", "word");
|
||||
sel.modify("move", "forward", "word");
|
||||
sel.modify("move", "forward", "word");
|
||||
isAt("s1", 9, "s1", 9, "test 15d");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function update_debug_info() {
|
||||
var sel = window.getSelection();
|
||||
document.getElementById("anchor-offset").innerHTML = sel.anchorOffset;
|
||||
document.getElementById("focus-offset").innerHTML = sel.focusOffset;
|
||||
setTimeout(update_debug_info, 100);
|
||||
}
|
||||
|
||||
setTimeout(update_debug_info, 100);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
43
layout/generic/test/test_bug503813.html
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=503813
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 503813</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style>
|
||||
#a:after { content:"anonymous text"; display:block; height:10px; }
|
||||
#a:hover:after { content:"hover content"; display:block; height:20px; }
|
||||
#b:after { content:"anonymous text"; display:block; height:10px; }
|
||||
#b:hover:after { content:url(file_Dolske.png); display:block; height:20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content" style="width:300px;">
|
||||
<div id="a" style="margin:10px;"></div>
|
||||
<div id="b" style="margin:10px;"></div>
|
||||
</div>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=503813">Mozilla Bug 503813</a>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/** Test for Bug 503813 **/
|
||||
function test()
|
||||
{
|
||||
synthesizeMouse(document.getElementById("a"), 5, 5, { type: "mousemove" });
|
||||
is(document.getElementById("a").getBoundingClientRect().height, 20,
|
||||
"Expected hover style");
|
||||
synthesizeMouse(document.getElementById("b"), 5, 5, { type: "mousemove" });
|
||||
is(document.getElementById("b").getBoundingClientRect().height, 20,
|
||||
"Expected hover style");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
// Run 'test' when we've exited paint suppression and done layout
|
||||
window.onload = function() { setTimeout(test, 0); };
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
382
layout/generic/test/test_bug507902.html
Normal file
|
|
@ -0,0 +1,382 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=507902
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 507902</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=507902">Mozilla Bug 507902</a>
|
||||
|
||||
<iframe id="testFrameElem"></iframe>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
//
|
||||
// Mochitest to test nsImageFrame icons
|
||||
//
|
||||
// The 'loading' icon should be displayed up until we have enough image
|
||||
// data to determine the frame size.
|
||||
//
|
||||
// The 'broken' icon should be displayed when the URL is invalid (either
|
||||
// a bad server or a file that fails to be sniffed to an appropriate
|
||||
// mimetype).
|
||||
//
|
||||
|
||||
// Boilerplate
|
||||
gWindowUtils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
// URL + paths
|
||||
//
|
||||
// We have a separate copy of the icons in the test directory to
|
||||
// avoid any firefox caching mechanisms that might affect the
|
||||
// behavior of the load.
|
||||
var us = window.location.href;
|
||||
var baseURL = us.substring(0, us.lastIndexOf('/') + 1);
|
||||
var loadIconFilename = "file_LoadingImageReference.png";
|
||||
var imageFilename = "file_Dolske.png";
|
||||
var brokenIconFilename = "file_BrokenImageReference.png";
|
||||
var serverFilename = "file_IconTestServer.sjs";
|
||||
var serverContinueFlag = "?continue=true";
|
||||
var bogusFilename = "oneuponatimewhendolskewasyoung.png";
|
||||
|
||||
// Our test image element, inside a div, inside an iframe
|
||||
var testFrameElem = document.getElementById("testFrameElem");
|
||||
var innerDoc = testFrameElem.contentWindow.document;
|
||||
var divContainer = innerDoc.createElement("div");
|
||||
divContainer.style.cssFloat = "left";
|
||||
innerDoc.body.appendChild(divContainer);
|
||||
var testImageElem = new Image();
|
||||
divContainer.appendChild(testImageElem);
|
||||
var pingImage = new Image();
|
||||
|
||||
// Set up the canvases
|
||||
var canvases = {};
|
||||
var canvasNames = [ "brokenIconTest", "brokenIconReference",
|
||||
"loadingIconTest", "loadingIconReference",
|
||||
"loadedTest", "loadedReference" ];
|
||||
var windowElem = document.documentElement;
|
||||
for (var i in canvasNames) {
|
||||
var can = document.createElement("canvas");
|
||||
can.setAttribute("width", windowElem.getAttribute("width"));
|
||||
can.setAttribute("height", windowElem.getAttribute("height"));
|
||||
canvases[canvasNames[i]] = can;
|
||||
|
||||
// When the image frame has no idea how to size itself, it sizes itself
|
||||
// to dimensions capable of displaying the alt feedback icons. However, if
|
||||
// the image has been loaded before, something (I don't know what) seems to
|
||||
// remember the size of the last successful image for that URL. So when we
|
||||
// create a new image frame for that URL, it uses that size until it hears
|
||||
// something different. This happens through a refresh (not sure if this is
|
||||
// desired behavior). This means that if you refresh the test, the "loading"
|
||||
// icon for the test image will appear with a border that stretches further
|
||||
// right and down, because that URL previously displayed an image with larger
|
||||
// dimensions. This causes the verify stage to fail. To allow for
|
||||
// successful test refreshes (only useful for people, not automated tests),
|
||||
// we add a clipping region so that we see the left and top borders, along
|
||||
// with the image, but not the bottom and right borders.
|
||||
|
||||
if ((i > 1) && (i < 4)) {
|
||||
var ctx = can.getContext("2d");
|
||||
ctx.beginPath();
|
||||
ctx.rect(0,0, 30, 30);
|
||||
ctx.clip();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Stage 1 - Load the reference image for the broken icon
|
||||
function loadBrokenIconReference() {
|
||||
|
||||
// Debugging - Let's see if setting onload after src is a problem
|
||||
testImageElem.onload = function(event) { dump("test_bug507902.html DEBUG - uh oh, placeholder onload 1 called\n");};
|
||||
|
||||
// Debug - Figure out if we're getting an onerror instead of onload
|
||||
testImageElem.onerror = function(event) {dump("test_bug507902.html DEBUG - Got onerror for testImageElem!\n");};
|
||||
|
||||
testImageElem.src = baseURL + brokenIconFilename;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 2 - Draw the reference image for the broken icon to a canvas
|
||||
function drawBrokenIconReference() {
|
||||
|
||||
enableBorderAndPad();
|
||||
drawWindowToCanvas("brokenIconReference");
|
||||
disableBorderAndPad();
|
||||
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 3 - Load the reference image for the loading icon
|
||||
function loadLoadingIconReference() {
|
||||
|
||||
// Debugging - Let's see if setting onload after src is a problem
|
||||
testImageElem.onload = function(event) { dump("test_bug507902.html DEBUG - uh oh, placeholder onload 3 called\n");};
|
||||
|
||||
testImageElem.src = baseURL + loadIconFilename;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 4 - Draw the reference image for the loading icon to a canvas
|
||||
function drawLoadingIconReference() {
|
||||
|
||||
enableBorderAndPad();
|
||||
drawWindowToCanvas("loadingIconReference");
|
||||
disableBorderAndPad();
|
||||
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 5 - Try to load a broken image
|
||||
function loadBrokenImage() {
|
||||
resetImage();
|
||||
testImageElem.src = baseURL + bogusFilename;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 6 - Draw the screen to a canvas. This should hopefully
|
||||
// be the broken icon.
|
||||
function drawBrokenIcon() {
|
||||
drawWindowToCanvas("brokenIconTest");
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 7 - Load the reference image for the test image
|
||||
function loadImageReference() {
|
||||
resetImage();
|
||||
|
||||
// Debugging - Let's see if setting onload after src is a problem
|
||||
testImageElem.onload = function(event) { dump("test_bug507902.html DEBUG - uh oh, placeholder onload 7 called\n");};
|
||||
|
||||
testImageElem.src = baseURL + imageFilename;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 8 - Draw the reference image for the test image to a canvas
|
||||
function drawImageReference() {
|
||||
drawWindowToCanvas("loadedReference");
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 9 - Start a load of the test image from the delay-generating server
|
||||
function startServerLoad() {
|
||||
|
||||
// Reset the image
|
||||
resetImage();
|
||||
|
||||
// Debugging info so we can figure out the hang
|
||||
dump("test_bug507902.html DEBUG - starting server load\n");
|
||||
|
||||
// Load the image
|
||||
testImageElem.src = baseURL + serverFilename;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 10 - Draw the screen to a canvas. This should hopefully be the loading
|
||||
// icon.
|
||||
function drawLoadingIcon() {
|
||||
|
||||
// Debugging info so we can figure out the hang
|
||||
dump("test_bug507902.html DEBUG - drawing loading icon\n");
|
||||
|
||||
drawWindowToCanvas("loadingIconTest");
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 11 - Tell the server to continue.
|
||||
function signalServerContinue() {
|
||||
|
||||
// Debugging info so we can figure out the hang
|
||||
dump("test_bug507902.html DEBUG - signaling server to continue\n");
|
||||
|
||||
pingImage.src = baseURL + serverFilename + serverContinueFlag;
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// Stage 12 - Draw the screen to a canvas. This should hopefully be the loaded
|
||||
// test image.
|
||||
function drawLoadedImage() {
|
||||
drawWindowToCanvas("loadedTest");
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
|
||||
// Stage 13 - Verify That the appropriate canvases match
|
||||
function verifyCanvases() {
|
||||
|
||||
// Verify the broken icon
|
||||
ok(canvasesAreEqual("brokenIconTest", "brokenIconReference"),
|
||||
"Window drawn on broken load should match broken icon reference");
|
||||
|
||||
// Verify the loading icon
|
||||
ok(canvasesAreEqual("loadingIconTest", "loadingIconReference"),
|
||||
"Window drawn mid-load should match loading icon reference");
|
||||
|
||||
// Verify the loaded image
|
||||
ok(canvasesAreEqual("loadedTest", "loadedReference"),
|
||||
"Window drawn post-load should match reference image");
|
||||
|
||||
stageTransition();
|
||||
}
|
||||
|
||||
// We have a bunch of different things that need to happen in order
|
||||
// with different transitions. We make a "stage table" here where
|
||||
// each entry contains the stage function ('fn') and a transition
|
||||
// ('trans'), which can be one of the following:
|
||||
// "instant" - Just calls the next stage directly
|
||||
// "onload" - Sets the next stage as an onload event for the image element
|
||||
// "onerror" - Sets the next stage as an onerror event for the image element
|
||||
// integer - Sets the next stage to be called after the given timeout duration
|
||||
// "finish" - Finish the test
|
||||
var testStages = [
|
||||
{ "fn" : loadBrokenIconReference, "trans" : "onload"},
|
||||
{ "fn" : drawBrokenIconReference, "trans" : "instant"},
|
||||
{ "fn" : loadLoadingIconReference, "trans" : "onload" },
|
||||
{ "fn" : drawLoadingIconReference, "trans" : "instant" },
|
||||
{ "fn" : loadBrokenImage, "trans" : "onerror" },
|
||||
{ "fn" : drawBrokenIcon, "trans" : "instant" },
|
||||
{ "fn" : loadImageReference, "trans" : "onload" },
|
||||
{ "fn" : drawImageReference, "trans" : "instant" },
|
||||
// XXXbholley - We use a timeout here because resetting the
|
||||
// image doesn't seem to be quite synchronous. If we make
|
||||
// this transition "instant", then the drawImage call draws
|
||||
// an empty (0,0,0,0) rect to the canvas and we're left with
|
||||
// whatever was there before. I don't know of any good event
|
||||
// mechanism to figure out when the image frame is bootstrapped
|
||||
// enough to display the loading image, so I did trial-and-error
|
||||
// with timeouts. 50ms seems to be enough time for things to work
|
||||
// reliably, so *= 6 for good measure.
|
||||
{ "fn" : startServerLoad, "trans" : 300 },
|
||||
{ "fn" : drawLoadingIcon, "trans" : "instant" },
|
||||
{ "fn" : signalServerContinue, "trans" : "onload" },
|
||||
{ "fn" : drawLoadedImage, "trans" : "instant" },
|
||||
{ "fn" : verifyCanvases, "trans" : "finish" } ];
|
||||
var currentStage = 0;
|
||||
|
||||
// Transition function called at the end of each stage
|
||||
function stageTransition() {
|
||||
|
||||
// Debugging info so we can figure out the hang
|
||||
dump("test_bug507902.html DEBUG - Current Stage: " + currentStage + "\n");
|
||||
|
||||
// What's our transition?
|
||||
var trans = testStages[currentStage++].trans;
|
||||
|
||||
// If the transition is finish, stop now before we access out of bounds
|
||||
if (trans == "finish") {
|
||||
makeCanvasesVisible(); // Useful for debugging
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, get the next function
|
||||
var nextfn = testStages[currentStage].fn;
|
||||
|
||||
// Switch based on transition
|
||||
switch (trans) {
|
||||
|
||||
// Continue right away
|
||||
case "instant":
|
||||
nextfn();
|
||||
break;
|
||||
|
||||
// Continue after we get an onload event on the test image
|
||||
case "onload":
|
||||
testImageElem.onload = function(event) {testImageElem.onload = undefined; nextfn();};
|
||||
break;
|
||||
|
||||
// Continue after we get an onerror event on the test image
|
||||
case "onerror":
|
||||
testImageElem.onerror = function(event) {testImageElem.onerror = undefined; nextfn();};
|
||||
break;
|
||||
|
||||
// Timeout
|
||||
default:
|
||||
setTimeout(nextfn, trans);
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Lots if asynchronous behavior here
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Catch somebody's eye
|
||||
dump("This test is failing intermittently, see bug 510001 - If you see orange here, please paste the following debugging output on the bug!\n");
|
||||
|
||||
// Kick off the test by invoking the first stage. The stages call each other
|
||||
testStages[0].fn();
|
||||
|
||||
|
||||
// We need to get rid of the old image element and make a new one. If we
|
||||
// don't, the "current/pending" machinery will display the old image until
|
||||
// the new one is loaded, so we won't see the loading icon.
|
||||
function resetImage() {
|
||||
divContainer.removeChild(testImageElem);
|
||||
testImageElem = null;
|
||||
testImageElem = new Image();
|
||||
divContainer.appendChild(testImageElem);
|
||||
}
|
||||
|
||||
//
|
||||
// Makes the canvases visible. Called before the tests finish. This is useful for
|
||||
// debugging.
|
||||
//
|
||||
function makeCanvasesVisible() {
|
||||
for (var i = 0; i < canvasNames.length - 1; i += 2) {
|
||||
var title = document.createElement("h3");
|
||||
title.innerHTML = canvasNames[i] + ", " + canvasNames[i+1] + ":";
|
||||
document.body.appendChild(title);
|
||||
var myDiv = document.createElement("div");
|
||||
myDiv.appendChild(canvases[canvasNames[i]]);
|
||||
myDiv.appendChild(canvases[canvasNames[i+1]]);
|
||||
document.body.appendChild(myDiv);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Enables and disables bordering/padding to mimic the look of alt feedback icons
|
||||
//
|
||||
function enableBorderAndPad() {
|
||||
divContainer.style.border = "1px";
|
||||
divContainer.style.borderStyle = "inset";
|
||||
testImageElem.style.padding = "3px";
|
||||
}
|
||||
|
||||
function disableBorderAndPad() {
|
||||
testImageElem.style.padding = 0;
|
||||
divContainer.style.border = "0px";
|
||||
divContainer.style.borderStyle = "";
|
||||
}
|
||||
|
||||
//
|
||||
// Helper canvas methods. This is mostly copped directly from the reftest framework
|
||||
//
|
||||
|
||||
function drawWindowToCanvas(canvasName) {
|
||||
var win = testFrameElem.contentWindow;
|
||||
var ctx = canvases[canvasName].getContext("2d");
|
||||
// drawWindow always draws one canvas pixel for each CSS pixel in the source
|
||||
// window, so scale the drawing to show the zoom (making each canvas pixel be one
|
||||
// device pixel instead)
|
||||
ctx.drawWindow(win, win.scrollX, win.scrollY,
|
||||
Math.ceil(canvases[canvasName].width),
|
||||
Math.ceil(canvases[canvasName].height),
|
||||
"rgb(255,255,255)");
|
||||
}
|
||||
|
||||
function canvasesAreEqual(canvas1Name, canvas2Name) {
|
||||
var c1 = canvases[canvas1Name];
|
||||
var c2 = canvases[canvas2Name];
|
||||
var differences = gWindowUtils.compareCanvases(c1, c2, {});
|
||||
return (differences == 0);
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
66
layout/generic/test/test_bug508115.xul
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=508115
|
||||
-->
|
||||
<window title="Mozilla Bug 508115"
|
||||
onload="setTimeout(doTest, 0)"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=508115">Mozilla Bug 508115</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
</body>
|
||||
<script class="testbody" type="application/javascript"><![CDATA[
|
||||
function doTest() {
|
||||
document.getElementById("panel").style.display = '';
|
||||
document.getElementById("deck").selectedIndex = 1;
|
||||
document.getElementById("anchor").open = true;
|
||||
document.getElementById("container").style.width = "0";
|
||||
document.getElementById("anchor2").open = true;
|
||||
}
|
||||
var count = 0;
|
||||
function shown(id) {
|
||||
ok(true, "Shown popup " + id);
|
||||
++count;
|
||||
if (count >= 2) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
]]></script>
|
||||
<deck id="deck" style="margin:50px;">
|
||||
<vbox></vbox>
|
||||
<vbox id="panel" style="display:none">
|
||||
<vbox>
|
||||
<menulist id="anchor">
|
||||
<menupopup id="popup" onpopupshown="shown('anchor')">
|
||||
<menuitem label="One"/>
|
||||
<menuitem label="Two"/>
|
||||
<menuitem label="Three"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
<description>
|
||||
<html:div id="container">
|
||||
<html:span id="span" style="-moz-transform: translate(0,0)">Hello Kitty
|
||||
<menulist id="anchor2" style="display:-moz-inline-box;">
|
||||
<menupopup id="popup" onpopupshown="shown('anchor2')">
|
||||
<menuitem label="One"/>
|
||||
<menuitem label="Two"/>
|
||||
<menuitem label="Three"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</html:span>
|
||||
</html:div>
|
||||
</description>
|
||||
</window>
|
||||
40
layout/generic/test/test_bug514732-2.xul
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=514732
|
||||
-->
|
||||
<window title="Mozilla Bug 514732"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript"
|
||||
src= "chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=514732">
|
||||
Mozilla Bug 514732</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 514732 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.open("file_bug514732_window.xul", "bug514732",
|
||||
"chrome,width=600,height=600,scrollbars");
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
||||
27
layout/generic/test/test_bug514732.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=514732
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 514732</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=514732">Mozilla Bug 514732</a>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" style="width: 300; height: 150;" type="text/javascript;version=1.8">
|
||||
window.open("./file_bug514732_helper.html", "", "width=600,height=600");
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
32
layout/generic/test/test_bug522632.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=522632
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 522632</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=522632">Mozilla Bug 522632</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td style="height: 200px; padding: 0; margin: 0; border: none">
|
||||
<span style="height: 0; min-height: 50%" id="foo"></span>
|
||||
</td>
|
||||
<tr>
|
||||
</table>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 522632 **/
|
||||
is(document.defaultView.getComputedStyle($("foo"), "").height, "100px",
|
||||
"Unexpected computed height");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
35
layout/generic/test/test_bug524925.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=524925
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for Bug 524925</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container" style="width: 100px; height: 100px; overflow: auto;">
|
||||
<div id="container2" style="width: 100px; height: 100px; overflow: visible;">
|
||||
<div id="block" style="width: 50px; height: 50px; background-color: #000; -moz-transform:translatey(0px);"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
// Move 'block' 100 pixels downwards.
|
||||
var block = document.getElementById("block");
|
||||
block.style.MozTransform = "translatey(100px)";
|
||||
|
||||
// Check the result is correct and finish the test
|
||||
var container = document.getElementById("container");
|
||||
is(container.scrollHeight, 150, "Overflow areas should update after dynamic transform changes");
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
49
layout/generic/test/test_bug527306.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=527306
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 527306</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
</head>
|
||||
<body onload="runTests()">
|
||||
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=527306">Mozilla Bug 527306</a>
|
||||
|
||||
<p><input type="text" id="t1" value="FAIL"></p>
|
||||
<p><input type="text" id="t2" value="FAIL"></p>
|
||||
<p><input type="text" id="t3" value="FAIL"></p>
|
||||
<p><textarea id="t4">FAIL</textarea></p>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
|
||||
function testElement(t) {
|
||||
t.style.display = "none";
|
||||
t.value = "PASS";
|
||||
is(t.value, "PASS", "Value should be set correctly");
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
var t = document.getElementById("t1");
|
||||
testElement(t);
|
||||
t = document.getElementById("t2");
|
||||
t.focus();
|
||||
testElement(t);
|
||||
t = document.getElementById("t3");
|
||||
t.focus();
|
||||
t.blur();
|
||||
testElement(t);
|
||||
t = document.getElementById("t4");
|
||||
testElement(t);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
78
layout/generic/test/test_bug579767.html
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=579767
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 579767</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
iframe {
|
||||
width: 1006px;
|
||||
height: 306px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=579767">Mozilla Bug 579767</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe src="file_bug579767_1.html" id="f1"></iframe>
|
||||
<iframe src="file_bug579767_2.html" id="f2"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 579767 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
var f1 = document.getElementById("f1");
|
||||
var f2 = document.getElementById("f2");
|
||||
var t1 = f1.contentDocument.documentElement;
|
||||
var t2 = f2.contentDocument.documentElement;
|
||||
|
||||
setTimeout(function() {
|
||||
// drag the vertical handle 10px to the right
|
||||
synthesizeMouse(t1, 100, 6, {type: "mousedown"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 101, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 102, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 103, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 104, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 105, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 106, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 107, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 108, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 109, 6, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 200, 6, {type: "mouseup" }, f1.contentWindow);
|
||||
|
||||
setTimeout(function() {
|
||||
// drag the horizontal handle 10px to down and 5px to right
|
||||
synthesizeMouse(t1, 2, 92, {type: "mousedown"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 3, 93, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 4, 94, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 5, 95, {type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 7, 102,{type: "mousemove"}, f1.contentWindow);
|
||||
synthesizeMouse(t1, 7, 102,{type: "mouseup" }, f1.contentWindow);
|
||||
|
||||
setTimeout(function() {
|
||||
// now compare the two windows
|
||||
ok(compareSnapshots(snapshotWindow(f1.contentWindow),
|
||||
snapshotWindow(f2.contentWindow), true)[0],
|
||||
"The borders should be painted correctly after resizing");
|
||||
is(t1.querySelectorAll("frameset")[0].getAttribute("cols"), "11%,89%",
|
||||
"The cols attribute should be correctly updated");
|
||||
is(t1.querySelectorAll("frameset")[1].getAttribute("rows"), "100,200",
|
||||
"The rows attribute should be correctly updated");
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}, 0);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
37
layout/generic/test/test_bug589621.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=589621
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 589621</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589621">Mozilla Bug 589621</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
/** Test for Bug 589621 **/
|
||||
var sel = getSelection();
|
||||
var range = document.createRange();
|
||||
sel.addRange(range);
|
||||
function t(n) {
|
||||
try {
|
||||
sel.getRangeAt(n);
|
||||
ok(false, "Should not be here");
|
||||
} catch(e) {
|
||||
ok(e instanceof DOMException, "Should be a DOMException");
|
||||
is(e.name, "IndexSizeError", "Should be an IndexSizeError");
|
||||
is(e.code, DOMException.INDEX_SIZE_ERR, "Should be an INDEX_SIZE_ERR");
|
||||
}
|
||||
}
|
||||
t(-1);
|
||||
t(1);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
36
layout/generic/test/test_bug589623.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=589623
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 589623</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589623">Mozilla Bug 589623</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
/** Test for Bug 589623 **/
|
||||
var sel = getSelection();
|
||||
sel.removeAllRanges();
|
||||
function t(m) {
|
||||
try {
|
||||
sel[m]();
|
||||
ok(false, "Should not be here");
|
||||
} catch(e) {
|
||||
is(e.name, "InvalidStateError", "Should be an InvalidStateError");
|
||||
ok(e instanceof DOMException, "Should be a DOMException");
|
||||
is(e.code, DOMException.INVALID_STATE_ERR, "Should be an INVALID_STATE_ERR");
|
||||
}
|
||||
}
|
||||
t("collapseToStart");
|
||||
t("collapseToEnd");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
38
layout/generic/test/test_bug597333.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=597333
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 597333</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=597333">Mozilla Bug 597333</a>
|
||||
|
||||
<textarea id="a">‮</textarea>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
|
||||
function runTests() {
|
||||
var t = document.getElementById("a");
|
||||
t.focus();
|
||||
setTimeout(function() {
|
||||
synthesizeKey('VK_RIGHT', {});
|
||||
ok(true, "The browser did not crash!");
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
217
layout/generic/test/test_bug632379.xul
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=632379
|
||||
-->
|
||||
<window title="Mozilla Bug 632379"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<toolbox flex="1">
|
||||
<menubar>
|
||||
<menu label="MENU" accesskey="m" id="mainMenu">
|
||||
<menupopup maxheight="100" onpopupshown="openSubmenu()">
|
||||
<menu label="menu1" accesskey="1" id="menu1">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu2" accesskey="2" id="menu2">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu3" accesskey="3" id="menu3">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu4" accesskey="4" id="menu4">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu5" accesskey="5" id="menu5">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu6" accesskey="6" id="menu6">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu7" accesskey="7" id="menu7">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu8" accesskey="8" id="menu8">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="menu9" accesskey="9" id="menu9">
|
||||
<menupopup onpopupshown="snapshot(this)">
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
<menuitem label="item"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
</toolbox>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=632379">Mozilla Bug 632379</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
<script class="testbody" type="application/javascript"><![CDATA[
|
||||
|
||||
var gFinished = false;
|
||||
|
||||
/** Test for Bug 632379 **/
|
||||
// Tests whether scrolling a menu affects the position at which popups appear
|
||||
var pos = new Array(2);
|
||||
var count=0;
|
||||
|
||||
function snapshot(elem)
|
||||
{
|
||||
todo(false, "snapshot() called");
|
||||
pos[count] = elem.getBoundingClientRect().top;
|
||||
++count;
|
||||
if (count <= 1) {
|
||||
// close the submenu and open the bottom submenu
|
||||
synthesizeKey("VK_LEFT", {});
|
||||
synthesizeKey("9", {});
|
||||
} else {
|
||||
if (navigator.platform.indexOf("Mac") == -1) {
|
||||
is(pos[1], pos[0], "Popup should open in the same place when the menu is scrolled");
|
||||
} else {
|
||||
todo(false, "This test fails on Mac since it was ported to chrome: Bug 668716.");
|
||||
}
|
||||
todo(false, "Test finished");
|
||||
gFinished = true;
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
todo(false, "doTest() called");
|
||||
// open the top-level menu
|
||||
$("mainMenu").open = true;
|
||||
}
|
||||
|
||||
function openSubmenu()
|
||||
{
|
||||
if (!gFinished) {
|
||||
todo(false, "openSubmenu() called");
|
||||
}
|
||||
// open a submenu in the middle
|
||||
synthesizeKey("5", {});
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
todo(false, "Wait for focus");
|
||||
SimpleTest.waitForFocus(doTest);
|
||||
|
||||
]]></script>
|
||||
</window>
|
||||
|
||||
57
layout/generic/test/test_bug633762.html
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633762
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 633762</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=633762">Mozilla Bug 633762</a>
|
||||
|
||||
<iframe id="i" src="bug633762_iframe.html#a"></iframe>
|
||||
|
||||
<pre id="test">
|
||||
<script>
|
||||
|
||||
var doc;
|
||||
|
||||
function runTests() {
|
||||
var i = document.getElementById("i");
|
||||
doc = i.contentDocument;
|
||||
var win = i.contentWindow;
|
||||
// set display none on b
|
||||
doc.getElementById("b").style.display = "none";
|
||||
// flush layout
|
||||
doc.documentElement.offsetLeft;
|
||||
// click in middle of iframe document to give it focus
|
||||
synthesizeMouseAtCenter(i, {}, win);
|
||||
win.focus();
|
||||
// record scrolltop
|
||||
scrollTopBefore = doc.body.scrollTop;
|
||||
// send up arrow key event
|
||||
sendKey("UP");
|
||||
|
||||
window.requestAnimationFrame(finish);
|
||||
}
|
||||
|
||||
function finish() {
|
||||
// assert that scroll top is now less than before
|
||||
ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var smoothScrollPref = "general.smoothScroll";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, runTests);
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
42
layout/generic/test/test_bug666225.html
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=666225
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 666225</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666225">Mozilla Bug 666225</a>
|
||||
<p id="display"><input id="i" onmousedown="this.type='file';"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 666225
|
||||
Causes ASSERTION: Unexpected document: 'capturingContent->GetUncomposedDoc() == GetDocument()' (bug 560764) **/
|
||||
|
||||
function click()
|
||||
{
|
||||
$("i").addEventListener("mouseup", test, false);
|
||||
synthesizeMouseAtCenter($("i"), { type: "mousedown" });
|
||||
synthesizeMouseAtCenter($("i"), { type: "mouseup" });
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
ok(true, "should not crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(click);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
20
layout/generic/test/test_bug719503.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=719503
|
||||
-->
|
||||
<title>Test for Bug 719503</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=719503">Mozilla Bug 719503</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
try {
|
||||
getSelection().collapse(document.head, 0);
|
||||
getSelection().deleteFromDocument();
|
||||
} catch(e) {
|
||||
ok(false, "Exception thrown");
|
||||
}
|
||||
ok(true, "Passed, no exception");
|
||||
</script>
|
||||