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

Side by Side Diff: third_party/WebKit/ManualTests/compositor-worker/sticky/js/dom-util.js

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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
OLDNEW
(Empty)
1 function getViewportRect(target) {
2 // Q: What's the correct way to get the scroller bounds (if the scroller is th e document)?
3 if (target == document.scrollingElement) {
4 return {
5 left: 0,
6 top: 0,
7 width: window.innerWidth,
8 height: window.innerHeight,
9 right: window.innerWidth,
10 bottom: window.innerHeight
11 };
12 }
13 return target.getBoundingClientRect();
14 }
15
16 function getContainingBlockElement(node) {
17 if (node.style.position == 'absolute') {
18 do {
19 node = node.parentNode;
20 } while (['absolute', 'fixed', 'relative', 'sticky'].indexOf(getComputedStyl e(node).position) == -1);
21 return node || document;
22 }
23 do {
24 node = node.parentNode;
25 } while (['block', 'inline-block', 'list-item', 'run-in', 'table', 'table-ce ll'].indexOf(getComputedStyle(node).display) == -1);
26 return node || document;
27 }
28
29 function isScrollable(element) {
30 // Q: Why is scrollHeight > clientHeight on body when document is scrollable n ode?
31 return element.scrollHeight > element.clientHeight || element == document.scro llingElement;
32 }
33
34 function getContainingScrollingElement(element) {
35 do {
36 element = getContainingBlockElement(element);
37 } while (element && !isScrollable(element));
38 return element;
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698