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

Unified Diff: LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position.html

Issue 1007623003: Fix incorrect percentage top for positioned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update an expected value of web-animations-api/animations-responsive-to-style-change.html Created 5 years, 8 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
« no previous file with comments | « no previous file | LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position.html
diff --git a/LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position.html b/LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position.html
new file mode 100644
index 0000000000000000000000000000000000000000..ff70a025bcc6cf8046be4166d44fb215fb661933
--- /dev/null
+++ b/LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position.html
@@ -0,0 +1,120 @@
+<!DOCTYPE html>
+<style>
+.positionStatic { position: static; }
+.positionRelative { position: relative; }
+.positionAbsolute { position: absolute; }
+.positionFixed { position: fixed; }
+
+#outer {
+ border: 10px solid red;
+ margin: 20px;
+ padding: 30px;
+}
+
+#outer-relative-height {
+ border: 10px solid red;
+ margin: 20px;
+ padding: 30px;
+ height: 50%;
+}
+
+#inner {
+ width: 20px;
+ height: 20px;
+ top: 50%;
+ background: blue;
+}
+
+</style>
+<div id='outer'>
+ <div id='inner'></div>
+</div>
+<script src="../../../resources/js-test.js"></script>
+<script>
+ var outer = document.querySelector("#outer");
+ var inner = document.querySelector("#inner");
+ var computedStyle = window.getComputedStyle(inner, null);
+
+ outer.className = 'positionStatic';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionRelative';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionAbsolute';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionFixed';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+
+ outer.id = "outer-relative-height";
+
+ outer.className = 'positionStatic';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionRelative';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionAbsolute';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "150px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "180px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+
+ outer.className = 'positionFixed';
+ inner.className = 'positionStatic';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
+ inner.className = 'positionRelative';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "150px");
+ inner.className = 'positionAbsolute';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "180px");
+ inner.className = 'positionFixed';
+ shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/getComputedStyle/computed-style-percentage-top-with-position-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698