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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 .positionStatic { position: static; }
4 .positionRelative { position: relative; }
5 .positionAbsolute { position: absolute; }
6 .positionFixed { position: fixed; }
7
8 #outer {
9 border: 10px solid red;
10 margin: 20px;
11 padding: 30px;
12 }
13
14 #outer-relative-height {
15 border: 10px solid red;
16 margin: 20px;
17 padding: 30px;
18 height: 50%;
19 }
20
21 #inner {
22 width: 20px;
23 height: 20px;
24 top: 50%;
25 background: blue;
26 }
27
28 </style>
29 <div id='outer'>
30 <div id='inner'></div>
31 </div>
32 <script src="../../../resources/js-test.js"></script>
33 <script>
34 var outer = document.querySelector("#outer");
35 var inner = document.querySelector("#inner");
36 var computedStyle = window.getComputedStyle(inner, null);
37
38 outer.className = 'positionStatic';
39 inner.className = 'positionStatic';
40 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
41 inner.className = 'positionRelative';
42 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
43 inner.className = 'positionAbsolute';
44 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
45 inner.className = 'positionFixed';
46 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
47
48 outer.className = 'positionRelative';
49 inner.className = 'positionStatic';
50 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
51 inner.className = 'positionRelative';
52 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
53 inner.className = 'positionAbsolute';
54 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
55 inner.className = 'positionFixed';
56 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
57
58 outer.className = 'positionAbsolute';
59 inner.className = 'positionStatic';
60 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
61 inner.className = 'positionRelative';
62 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
63 inner.className = 'positionAbsolute';
64 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
65 inner.className = 'positionFixed';
66 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
67
68 outer.className = 'positionFixed';
69 inner.className = 'positionStatic';
70 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
71 inner.className = 'positionRelative';
72 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
73 inner.className = 'positionAbsolute';
74 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
75 inner.className = 'positionFixed';
76 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
77
78
79 outer.id = "outer-relative-height";
80
81 outer.className = 'positionStatic';
82 inner.className = 'positionStatic';
83 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
84 inner.className = 'positionRelative';
85 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
86 inner.className = 'positionAbsolute';
87 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
88 inner.className = 'positionFixed';
89 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
90
91 outer.className = 'positionRelative';
92 inner.className = 'positionStatic';
93 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
94 inner.className = 'positionRelative';
95 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "10px");
96 inner.className = 'positionAbsolute';
97 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "30px");
98 inner.className = 'positionFixed';
99 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
100
101 outer.className = 'positionAbsolute';
102 inner.className = 'positionStatic';
103 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
104 inner.className = 'positionRelative';
105 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "150px");
106 inner.className = 'positionAbsolute';
107 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "180px");
108 inner.className = 'positionFixed';
109 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
110
111 outer.className = 'positionFixed';
112 inner.className = 'positionStatic';
113 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "50%");
114 inner.className = 'positionRelative';
115 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "150px");
116 inner.className = 'positionAbsolute';
117 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "180px");
118 inner.className = 'positionFixed';
119 shouldBeEqualToString("computedStyle.getPropertyValue('top')", "300px");
120 </script>
OLDNEW
« 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