mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1508987 - Enable ESLint for dom/svg/ (Manual Changes). r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D22294 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9dc9ed699e
commit
caa79f7f4b
@ -191,7 +191,6 @@ dom/security/test/mixedcontentblocker/**
|
||||
dom/security/test/sri/**
|
||||
dom/serviceworkers/**
|
||||
dom/smil/**
|
||||
dom/svg/**
|
||||
|
||||
dom/tests/html/**
|
||||
dom/tests/mochitest/**
|
||||
@ -213,6 +212,8 @@ dom/canvas/test/webgl-conf/**
|
||||
dom/imptests/**
|
||||
dom/media/webaudio/test/blink/**
|
||||
dom/media/webvtt/**
|
||||
dom/svg/test/test_nonAnimStrings.xhtml
|
||||
dom/svg/test/test_SVG_namespace_ids.html
|
||||
|
||||
# Third-party
|
||||
editor/libeditor/tests/browserscope/**
|
||||
|
@ -201,6 +201,7 @@ function MutationEventChecker() {
|
||||
case MutationEvent.REMOVAL:
|
||||
return "removal";
|
||||
}
|
||||
return "Unknown MutationEvent Type";
|
||||
};
|
||||
|
||||
this._argToEventId = function(arg) {
|
||||
|
@ -225,7 +225,7 @@ function make_log_msg(over, tag, attributes) {
|
||||
} else if (over == POINT_OVER_STROKE) {
|
||||
target = "stroke";
|
||||
} else {
|
||||
throw "unexpected bit combination in 'over'";
|
||||
throw new Error("unexpected bit combination in 'over'");
|
||||
}
|
||||
var msg = "Check if events are intercepted at a point over the " + target + " on <" + tag + "> for";
|
||||
for (var attr in attributes) {
|
||||
@ -258,7 +258,7 @@ function test_element(id, x, y, over /* bit flags indicating which area(s) of th
|
||||
} else if (over == POINT_OVER_STROKE) {
|
||||
inputs = hit_test_inputs.stroke;
|
||||
} else {
|
||||
throw "unexpected bit combination in 'over'";
|
||||
throw new Error("unexpected bit combination in 'over'");
|
||||
}
|
||||
|
||||
for_all_permutations(inputs, test_permutation);
|
||||
@ -286,7 +286,7 @@ function run_tests(subtest) {
|
||||
pointer_events_values.splice(0, partition);
|
||||
break;
|
||||
case 2:
|
||||
throw "unexpected subtest number";
|
||||
throw new Error("unexpected subtest number");
|
||||
}
|
||||
|
||||
test_element("rect", 30, 30, POINT_OVER_FILL);
|
||||
|
@ -40,7 +40,7 @@ function run_tests() {
|
||||
|
||||
// Test mutation events
|
||||
// --- Initialization
|
||||
eventChecker = new MutationEventChecker;
|
||||
var eventChecker = new MutationEventChecker;
|
||||
eventChecker.watchAttr(text, "x");
|
||||
eventChecker.expect("modify");
|
||||
text.textContent = "abc";
|
||||
|
@ -40,7 +40,7 @@ function main() {
|
||||
}
|
||||
|
||||
function testCreateMatrix() {
|
||||
svg = $("svg");
|
||||
var svg = $("svg");
|
||||
var m = svg.createSVGMatrix();
|
||||
|
||||
// Should be initialised to identity
|
||||
|
@ -38,7 +38,7 @@ function run_tests() {
|
||||
|
||||
// Test mutation events
|
||||
// --- Initialization
|
||||
eventChecker = new MutationEventChecker;
|
||||
var eventChecker = new MutationEventChecker;
|
||||
eventChecker.watchAttr(text, "rotate");
|
||||
// -- Actual changes
|
||||
eventChecker.expect("modify modify");
|
||||
|
@ -39,7 +39,7 @@ function run_tests() {
|
||||
|
||||
// Test mutation events
|
||||
// --- Initialization
|
||||
eventChecker = new MutationEventChecker;
|
||||
var eventChecker = new MutationEventChecker;
|
||||
eventChecker.watchAttr(polyline, "points");
|
||||
// -- Actual changes
|
||||
eventChecker.expect("modify modify");
|
||||
|
@ -328,7 +328,6 @@ function testOrphan(g) {
|
||||
}
|
||||
ok(exception === null,
|
||||
"Unexpected exception " + exception + " modifying orphaned transform");
|
||||
uexception = null;
|
||||
|
||||
// So should matrix
|
||||
exception = null;
|
||||
@ -364,7 +363,7 @@ function testMutationEvents(g) {
|
||||
g.setAttribute("transform", "translate(50 90)");
|
||||
var list = g.transform.baseVal;
|
||||
is(list.numberOfItems, 1, "Unexpected initial length of list");
|
||||
eventChecker = new MutationEventChecker;
|
||||
var eventChecker = new MutationEventChecker;
|
||||
eventChecker.watchAttr(g, "transform");
|
||||
|
||||
// consolidate
|
||||
|
@ -170,7 +170,7 @@ function createAnim(attrs) {
|
||||
anim.setAttribute("attributeName", "transform");
|
||||
anim.setAttribute("dur", "1s");
|
||||
anim.setAttribute("fill", "freeze");
|
||||
for (attr in attrs) {
|
||||
for (let attr in attrs) {
|
||||
anim.setAttribute(attr, attrs[attr]);
|
||||
}
|
||||
return anim;
|
||||
|
@ -370,7 +370,7 @@ function is_transform_attr(attr_name) {
|
||||
}
|
||||
|
||||
function get_array_of_list_items(list) {
|
||||
array = [];
|
||||
let array = [];
|
||||
for (var i = 0; i < list.numberOfItems; ++i) {
|
||||
array.push(list.getItem(i));
|
||||
}
|
||||
@ -394,7 +394,7 @@ function get_array_of_list_items(list) {
|
||||
* @param t A test from the 'tests' array.
|
||||
*/
|
||||
function run_baseVal_API_tests() {
|
||||
var res, threw, items;
|
||||
var res, threw;
|
||||
var eventChecker = new MutationEventChecker;
|
||||
|
||||
for (var t of tests) {
|
||||
@ -453,7 +453,7 @@ function run_baseVal_API_tests() {
|
||||
var expectedModEvents =
|
||||
t.item_type == "DOMString" ? "modify" : "modify modify";
|
||||
eventChecker.expect(expectedModEvents);
|
||||
var res = t.baseVal.initialize(item);
|
||||
res = t.baseVal.initialize(item);
|
||||
eventChecker.ignoreEvents();
|
||||
|
||||
|
||||
@ -815,7 +815,7 @@ function run_animVal_API_tests() {
|
||||
|
||||
// Test .getItem():
|
||||
|
||||
var item = t.animVal.getItem(2);
|
||||
item = t.animVal.getItem(2);
|
||||
ok(item != null && item === t.animVal.getItem(2),
|
||||
"The method " + t.list_type + ".getItem() should work when called on an " +
|
||||
"anim val list, and always return the exact same object.");
|
||||
@ -913,6 +913,7 @@ function run_basic_setAttribute_tests() {
|
||||
t.bv_path + " and " + t.av_path + " should be different objects.");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-self-compare
|
||||
ok(t.baseVal.getItem(0) === t.baseVal.getItem(0),
|
||||
"The exact same " + t.item_type + " DOM object should be returned each " +
|
||||
"time the item at a given index in the " + t.list_type + " for " +
|
||||
@ -920,6 +921,7 @@ function run_basic_setAttribute_tests() {
|
||||
"by a change in list length between the successive accesses.");
|
||||
|
||||
if (t.animVal) {
|
||||
// eslint-disable-next-line no-self-compare
|
||||
ok(t.animVal.getItem(0) === t.animVal.getItem(0),
|
||||
"The exact same " + t.item_type + " DOM object should be returned each " +
|
||||
"time the item at a given index in the " + t.list_type + " for " +
|
||||
@ -1299,7 +1301,7 @@ function run_animation_timeline_tests() {
|
||||
function run_tests() {
|
||||
// Initialize each test object with some useful properties, and create their
|
||||
// 'animate' elements. Note that 'prop' and 'animVal' may be null.
|
||||
for (var t of tests) {
|
||||
for (let t of tests) {
|
||||
t.element = document.getElementById(t.target_element_id);
|
||||
t.prop = t.prop_name ? t.element[t.prop_name] : null;
|
||||
t.baseVal = ( t.prop || t.element )[t.bv_name];
|
||||
@ -1340,7 +1342,7 @@ function run_tests() {
|
||||
// After all the other test manipulations, we check that the following
|
||||
// objects have still not changed, since they never should:
|
||||
|
||||
for (var t of tests) {
|
||||
for (let t of tests) {
|
||||
if (t.prop) {
|
||||
ok(t.prop === t.element[t.prop_name],
|
||||
"The same " + t.prop_type + " object should ALWAYS be returned for " +
|
||||
|
@ -17,9 +17,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=631437
|
||||
requiredFeatures="foo bar baz"/>
|
||||
</svg>
|
||||
<script type="text/javascript"><![CDATA[
|
||||
|
||||
var text = document.getElementById("text"),
|
||||
path = document.getElementById("path"),
|
||||
poly = document.getElementById("poly");
|
||||
poly = document.getElementById("poly"),
|
||||
g = document.getElementById("g");
|
||||
|
||||
function CheckList(aListObject, aExpectedListLength, aListDescription) {
|
||||
|
@ -112,7 +112,6 @@ function checkWhilstFrozen() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
var animate = document.getElementById("animate");
|
||||
if (animate && animate.targetElement) {
|
||||
window.addEventListener("load", main);
|
||||
} else {
|
||||
|
@ -116,7 +116,7 @@ function runTest() {
|
||||
is(rect1Bounds.width, 50, "rect1.getBoundingClientRect().width");
|
||||
is(rect1Bounds.height, 50, "rect1.getBoundingClientRect().height");
|
||||
|
||||
rect = new Rect(175 - 50 * sin45, 75 - 50 * sin45, 50 * sin45 * 2, 50 * sin45 * 2);
|
||||
var rect = new Rect(175 - 50 * sin45, 75 - 50 * sin45, 50 * sin45 * 2, 50 * sin45 * 2);
|
||||
isWithAbsTolerance(rect2Bounds.left, rect.left, 0.1, "rect2.getBoundingClientRect().left");
|
||||
isWithAbsTolerance(rect2Bounds.top, rect.top, 0.1, "rect2.getBoundingClientRect().top");
|
||||
isWithAbsTolerance(rect2Bounds.width, rect.width, 0.1, "rect2.getBoundingClientRect().width");
|
||||
@ -245,7 +245,7 @@ function runTest() {
|
||||
|
||||
var nonScalingStrokedLine3Bounds =
|
||||
doc.getElementById("nonScalingStrokedLine3").getBoundingClientRect();
|
||||
var capDelta = 5 / Math.SQRT2;
|
||||
capDelta = 5 / Math.SQRT2;
|
||||
rect = new Rect(280 - capDelta, 15 - capDelta, 20 / Math.SQRT2 + 2 * capDelta,
|
||||
20 / Math.SQRT2 + 2 * capDelta);
|
||||
isWithAbsTolerance(nonScalingStrokedLine3Bounds.left, rect.left, 0.1,
|
||||
|
@ -17,6 +17,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=759124
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript">
|
||||
var svg = $("svg");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function Test(svgFragmentIdentifier, valid, viewBoxString,
|
||||
@ -26,7 +28,6 @@ function Test(svgFragmentIdentifier, valid, viewBoxString,
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
var svg = $("svg");
|
||||
var doc = svg.contentWindow.document;
|
||||
var rootElement = doc.documentElement;
|
||||
|
||||
@ -107,8 +108,8 @@ function runTests() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
$(svg).addEventListener("load", runTests);
|
||||
$(svg).setAttribute("src", "fragments-helper.svg");
|
||||
svg.addEventListener("load", runTests);
|
||||
svg.setAttribute("src", "fragments-helper.svg");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -36,7 +36,6 @@ function runTest() {
|
||||
var g3 = doc.getElementById("g3");
|
||||
var g4 = doc.getElementById("g4");
|
||||
var g5 = doc.getElementById("g5");
|
||||
var sym = doc.getElementById("sym");
|
||||
var symbolRect = doc.getElementById("symbolRect");
|
||||
var fO = doc.getElementById("fO");
|
||||
/* Tests the consistency with nearestViewportElement
|
||||
|
@ -37,9 +37,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=892372
|
||||
"orientType baseVal after numeric angle is set");
|
||||
is(marker.orientType.animVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE,
|
||||
"orientType animVal after numeric angle is set");
|
||||
is(m.orientAngle.baseVal.value, angleVal,
|
||||
is(marker.orientAngle.baseVal.value, angleVal,
|
||||
"orientAngle baseVal after numeric angle is set");
|
||||
is(m.orientAngle.animVal.value, angleVal,
|
||||
is(marker.orientAngle.animVal.value, angleVal,
|
||||
"orientAngle animVal after numeric angle is set");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=829085
|
||||
function startTest() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
disableNonTestMouseEvents(true);
|
||||
var line = document.getElementById("line");
|
||||
// Send a click
|
||||
synthesizeMouseExpectEvent($("svg"), 170, 100, { },
|
||||
$("line"), "click",
|
||||
|
@ -223,9 +223,9 @@ function addTest(aPrefixLength, aPrefix, aFromType, aFromArguments,
|
||||
var animate =
|
||||
newSVGElement("animate", { attributeName: "d",
|
||||
from: fromPath,
|
||||
to: toPath,
|
||||
dur: "8s",
|
||||
additive: aAdditive ? "sum" : "replace" });
|
||||
to: toPath,
|
||||
dur: "8s",
|
||||
additive: aAdditive ? "sum" : "replace" });
|
||||
path.appendChild(animate);
|
||||
gSVG.appendChild(path);
|
||||
|
||||
@ -275,7 +275,7 @@ function run() {
|
||||
for (let prefixEntry of gPrefixes) {
|
||||
let [prefixLength, prefix] = prefixEntry;
|
||||
addTest(prefixLength, prefix, fromType, fromArguments,
|
||||
toType, toArguments, toType, expectedArguments, additive);
|
||||
toType, toArguments, toType, expectedArguments, additive);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,11 +284,11 @@ function run() {
|
||||
addTest(1, "M100,100",
|
||||
"A", [10, 20, 30, 0, 0, 40, 50],
|
||||
"a", [60, 70, 80, 0, 1, 90, 100],
|
||||
"a", [60, 70, 80, 0, 1, 90, 100], additive);
|
||||
"a", [60, 70, 80, 0, 1, 90, 100], additive);
|
||||
addTest(1, "M100,100",
|
||||
"A", [10, 20, 30, 0, 0, 40, 50],
|
||||
"a", [60, 70, 80, 1, 0, 90, 100],
|
||||
"a", [60, 70, 80, 1, 0, 90, 100], additive);
|
||||
"a", [60, 70, 80, 1, 0, 90, 100], additive);
|
||||
|
||||
// Test all pairs of segment types that cannot be interpolated between.
|
||||
for (let fromType of gTypes) {
|
||||
@ -297,7 +297,7 @@ function run() {
|
||||
if (!isValidInterpolation(fromType, toType)) {
|
||||
let toArguments = generatePathSegmentArguments(toType, 1000);
|
||||
addTest(1, "M100,100", fromType, fromArguments,
|
||||
toType, toArguments, toType, toArguments, additive);
|
||||
toType, toArguments, toType, toArguments, additive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -312,7 +312,7 @@ function run() {
|
||||
is(list.numberOfItems, test.prefixLength + 1,
|
||||
"Length of animatedPathSegList for interpolation " +
|
||||
(test.usesAddition ? "with addition " : "") +
|
||||
" from " + test.from + " to " + test.to);
|
||||
" from " + test.from + " to " + test.to);
|
||||
|
||||
let seg = list.getItem(list.numberOfItems - 1);
|
||||
let propertyNames = argumentNames(test.expectedType);
|
||||
|
@ -22,7 +22,7 @@ function run() {
|
||||
// set the pathLength to twice its actual length
|
||||
// and check that makes no difference
|
||||
p1.setAttribute("pathLength", "800");
|
||||
var point = p1.getPointAtLength(200);
|
||||
point = p1.getPointAtLength(200);
|
||||
is(point.x, 200);
|
||||
is(point.y, 50);
|
||||
|
||||
|
@ -14,13 +14,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svgDoc = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
var originY = div.offsetTop;
|
||||
var circle = document.getElementById("circle");
|
||||
var path = document.getElementById("path");
|
||||
|
||||
var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
|
||||
is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
|
||||
|
@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=762679
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svgDoc = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
@ -24,13 +23,13 @@ function run() {
|
||||
var elementFromPoint = document.elementFromPoint(originX + 150, originY + 52);
|
||||
is(elementFromPoint, circle, "Top of circle should hit");
|
||||
|
||||
var elementFromPoint = document.elementFromPoint(originX + 249, originY + 150);
|
||||
elementFromPoint = document.elementFromPoint(originX + 249, originY + 150);
|
||||
is(elementFromPoint, circle, "Right of circle should hit");
|
||||
|
||||
var elementFromPoint = document.elementFromPoint(originX + 150, originY + 249);
|
||||
elementFromPoint = document.elementFromPoint(originX + 150, originY + 249);
|
||||
is(elementFromPoint, circle, "Bottom of circle should hit");
|
||||
|
||||
var elementFromPoint = document.elementFromPoint(originX + 51, originY + 150);
|
||||
elementFromPoint = document.elementFromPoint(originX + 51, originY + 150);
|
||||
is(elementFromPoint, circle, "Left of circle should hit");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=820506
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svgDoc = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
@ -22,6 +21,7 @@ function run() {
|
||||
var r1 = document.getElementById("r1");
|
||||
var r2 = document.getElementById("r2");
|
||||
var element;
|
||||
var background = document.getElementById("background");
|
||||
|
||||
// Test r1 just outsite the clip area:
|
||||
|
||||
|
@ -14,13 +14,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svgDoc = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
var originY = div.offsetTop;
|
||||
var circle = document.getElementById("circle");
|
||||
var path = document.getElementById("path");
|
||||
|
||||
var elementFromPoint = document.elementFromPoint(originX + 55, originY + 55);
|
||||
is(elementFromPoint, circle, 'Over circle stroke with pointer-events="all"');
|
||||
|
@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1119698
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svgDoc = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
// Get the coords of the origin of the SVG canvas:
|
||||
var originX = div.offsetLeft;
|
||||
@ -22,6 +21,7 @@ function run() {
|
||||
var image4 = document.getElementById("image4");
|
||||
var image5 = document.getElementById("image5");
|
||||
var element;
|
||||
var background = document.getElementById("background");
|
||||
|
||||
element = document.elementFromPoint(originX + 20, originY + 20);
|
||||
is(element, background, "Should not hit visibility:hidden image by default");
|
||||
|
@ -19,61 +19,60 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=302971
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests() {
|
||||
var doc = $("svg").contentWindow.document;
|
||||
var rect = doc.getElementById("rect");
|
||||
var text = doc.getElementById("text");
|
||||
function runTests() {
|
||||
var doc = $("svg").contentWindow.document;
|
||||
var rect = doc.getElementById("rect");
|
||||
|
||||
// ordinary
|
||||
// ordinary
|
||||
|
||||
rect.setAttribute("stroke-width", "5");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Ordinary");
|
||||
rect.setAttribute("stroke-width", "5");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Ordinary");
|
||||
|
||||
// valid exponential notation
|
||||
// valid exponential notation
|
||||
|
||||
rect.setAttribute("stroke-width", "4E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Exponent");
|
||||
rect.setAttribute("stroke-width", "4E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "6e1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "60px", "Lower-case Exponent");
|
||||
rect.setAttribute("stroke-width", "6e1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "60px", "Lower-case Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "2E+1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "20px", "Positive Exponent");
|
||||
rect.setAttribute("stroke-width", "2E+1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "20px", "Positive Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "100E-1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "10px", "Negative Exponent");
|
||||
rect.setAttribute("stroke-width", "100E-1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "10px", "Negative Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "0.7E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "7px", "Floating Point with Exponent");
|
||||
rect.setAttribute("stroke-width", "0.7E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "7px", "Floating Point with Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "50.0E-1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Floating Point with Negative Exponent");
|
||||
rect.setAttribute("stroke-width", "50.0E-1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Floating Point with Negative Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "0.8E+1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "8px", "Floating Point with Positive Exponent");
|
||||
rect.setAttribute("stroke-width", "0.8E+1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "8px", "Floating Point with Positive Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "4E1px");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Units");
|
||||
rect.setAttribute("stroke-width", "4E1px");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Units");
|
||||
|
||||
// check units that begin with the letter e
|
||||
// check units that begin with the letter e
|
||||
|
||||
var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue("font-size");
|
||||
var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue("font-size");
|
||||
|
||||
rect.setAttribute("stroke-width", "1em");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), font_size, "em Units");
|
||||
rect.setAttribute("stroke-width", "1em");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), font_size, "em Units");
|
||||
|
||||
// invalid exponential notation
|
||||
// invalid exponential notation
|
||||
|
||||
rect.setAttribute("stroke-width", "1E1.1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Floating Point Exponent");
|
||||
rect.setAttribute("stroke-width", "1E1.1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Floating Point Exponent");
|
||||
|
||||
rect.setAttribute("stroke-width", "E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "No Mantissa");
|
||||
rect.setAttribute("stroke-width", "E1");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "No Mantissa");
|
||||
|
||||
rect.setAttribute("stroke-width", "1 e");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Spaces");
|
||||
rect.setAttribute("stroke-width", "1 e");
|
||||
is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Spaces");
|
||||
|
||||
SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", runTests);
|
||||
|
@ -14,7 +14,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589648
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
var svg = document.getElementById("svg");
|
||||
var div = document.getElementById("div");
|
||||
var x = div.offsetLeft;
|
||||
var y = div.offsetTop;
|
||||
|
@ -36,7 +36,7 @@ function runTest() {
|
||||
var startPositions = [],
|
||||
endPositions = [],
|
||||
extents = [];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
startPositions.push(text.getStartPositionOfChar(i));
|
||||
endPositions.push(text.getEndPositionOfChar(i));
|
||||
extents.push(text.getExtentOfChar(i));
|
||||
@ -54,7 +54,7 @@ function runTest() {
|
||||
};
|
||||
|
||||
var checkPositions = function(start, end, width) {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
// check their positions
|
||||
close(text.getStartPositionOfChar(i).x, start[i], "start position of glyph " + i);
|
||||
close(text.getEndPositionOfChar(i).x, end[i], "end position of glyph " + i);
|
||||
|
@ -40,11 +40,6 @@ function runTest() {
|
||||
ok(Math.abs(a - b) < epsilon, str + " - " + b + " should be close to " + a);
|
||||
}
|
||||
|
||||
function isPoint(pt1, x, y, str) {
|
||||
is(pt1.x, x, str + " x");
|
||||
is(pt1.y, y, str + " y");
|
||||
}
|
||||
|
||||
function isPointCloseX(pt1, x, y, str) {
|
||||
isClose(pt1.x, x, str + " x");
|
||||
is(pt1.y, y, str + " y");
|
||||
@ -54,10 +49,6 @@ function runTest() {
|
||||
return r.y + r.height;
|
||||
}
|
||||
|
||||
function xmost(r) {
|
||||
return r.x + r.width;
|
||||
}
|
||||
|
||||
var p = text1.getStartPositionOfChar(0);
|
||||
|
||||
// Simple horizontal string
|
||||
|
@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=655877
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var svg, doc, win, text, dragstart, dragend;
|
||||
var svg, doc, win, dragstart, dragend;
|
||||
|
||||
function drag(fromX, fromY, toX, toY, show) {
|
||||
synthesizeMouse(doc.documentElement, fromX, fromY, { type: "mousemove" }, win);
|
||||
|
@ -145,7 +145,7 @@ function run() {
|
||||
}
|
||||
|
||||
function testCreateTransform() {
|
||||
svg = $("svg");
|
||||
var svg = $("svg");
|
||||
var t = svg.createSVGTransform();
|
||||
ok(t != svg.createSVGTransform(),
|
||||
"Got identical objects when creating new transform");
|
||||
|
Loading…
x
Reference in New Issue
Block a user