| Index: third_party/WebKit/LayoutTests/fast/dom/forced-layout-only-in-document.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/forced-layout-only-in-document.html b/third_party/WebKit/LayoutTests/fast/dom/forced-layout-only-in-document.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aa3a1e04c1358d6de6f58e595e5091661fb38a05
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/forced-layout-only-in-document.html
|
| @@ -0,0 +1,59 @@
|
| +<!DOCTYPE html>
|
| +
|
| +<script src="../../resources/js-test.js"></script>
|
| +
|
| +<div id="mutator"></div>
|
| +
|
| +<script>
|
| +description("Element APIs should not force layout for nodes not in the active document.");
|
| +
|
| +var testStatements = [
|
| + 'element.scrollIntoView()',
|
| + 'element.scrollIntoViewIfNeeded()',
|
| + 'element.offsetLeft',
|
| + 'element.offsetTop',
|
| + 'element.offsetWidth',
|
| + 'element.offsetHeight',
|
| + 'element.offsetParent',
|
| + 'element.clientLeft',
|
| + 'element.clientTop',
|
| + 'element.clientWidth',
|
| + 'element.clientHeight',
|
| + 'element.scrollLeft',
|
| + 'element.scrollTop',
|
| + 'element.scrollLeft = 10',
|
| + 'element.scrollTop = 10',
|
| + 'element.scrollBy({left: 10, top: 10})',
|
| + 'element.scrollBy(10, 10)',
|
| + 'element.scrollTo({left: 10, top: 10})',
|
| + 'element.scrollTo(10, 10)',
|
| + 'element.getClientRects()',
|
| + 'element.getBoundingClientRect()',
|
| + 'element.computedRole',
|
| + 'element.computedName',
|
| + 'element.focus()',
|
| + 'element.innerText',
|
| + 'element.innerText = "innerText value"',
|
| + 'getComputedStyle(element).color',
|
| + 'getComputedStyle(element).width',
|
| + 'getComputedStyle(element).fontSize',
|
| +];
|
| +
|
| +var mutator = document.getElementById("mutator");
|
| +var element = document.createElement("div");
|
| +var causedRecalc = false;
|
| +for (var i = 0; i < testStatements.length; ++i) {
|
| + var statement = testStatements[i];
|
| + mutator.offsetTop;
|
| + // Make the mutator's style dirty.
|
| + mutator.style.flexGrow = i;
|
| + eval(statement);
|
| + // The mutator element should still be dirty.
|
| + if (internals.updateStyleAndReturnAffectedElementCount() != 1) {
|
| + causedRecalc = true;
|
| + testFailed(statement + " caused a style or layout update.");
|
| + }
|
| +}
|
| +if (!causedRecalc)
|
| + testPassed("No style or layout updates.");
|
| +</script>
|
|
|