Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/forced-layout-only-in-document.html

Issue 1839803007: Guard Element and getComputedStyle methods that force a layout with inActiveDocument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698