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

Side by Side Diff: samples/swarm/swarm_ui_lib/touch/FxUtil.dart

Issue 11610006: Revert revision 16240 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of touch; 5 part of touch;
6 6
7 /** 7 /**
8 * Common effects related helpers. 8 * Common effects related helpers.
9 */ 9 */
10 class FxUtil { 10 class FxUtil {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 /** 62 /**
63 * Determine the position of an [element] relative to a [target] element. 63 * Determine the position of an [element] relative to a [target] element.
64 * Moving the [element] to be a child of [target] and setting the 64 * Moving the [element] to be a child of [target] and setting the
65 * [element]'s top and left values to the returned coordinate should result 65 * [element]'s top and left values to the returned coordinate should result
66 * in the [element]'s position remaining unchanged while its parent is 66 * in the [element]'s position remaining unchanged while its parent is
67 * changed. 67 * changed.
68 */ 68 */
69 static Coordinate computeRelativePosition(Element element, Element target) { 69 static Coordinate computeRelativePosition(Element element, Element target) {
70 final elementPoint = computePagePosition(element); 70 final testPoint = new Point(0, 0);
71 final targetPoint = computePagePosition(target); 71 final pagePoint =
72 return new Coordinate(elementPoint.x - targetPoint.x, 72 window.webkitConvertPointFromNodeToPage(element, testPoint);
73 elementPoint.y - targetPoint.y); 73 final pointRelativeToTarget =
74 } 74 window.webkitConvertPointFromPageToNode(target, pagePoint);
75 75 return new Coordinate(pointRelativeToTarget.x, pointRelativeToTarget.y);
76 /** Computes the position of an element on the page. */
77 static Coordinate computePagePosition(Element element) {
78 num left = 0;
79 num top = 0;
80 do {
81 left += element.offsetLeft;
82 top += element.offsetTop;
83 element = element.offsetParent;
84 } while (element != null);
85 return new Coordinate(left, top);
86 } 76 }
87 77
88 /** Clear a -webkit-transform from an element. */ 78 /** Clear a -webkit-transform from an element. */
89 static void clearWebkitTransform(Element el) { 79 static void clearWebkitTransform(Element el) {
90 el.style.transform = ''; 80 el.style.transform = '';
91 } 81 }
92 82
93 /** 83 /**
94 * Checks whether an element has a translate3d webkit transform applied. 84 * Checks whether an element has a translate3d webkit transform applied.
95 */ 85 */
(...skipping 10 matching lines...) Expand all
106 style.left = '${x}px'; 96 style.left = '${x}px';
107 style.top = '${y}px'; 97 style.top = '${y}px';
108 } 98 }
109 } 99 }
110 100
111 class TransitionTimingFunction { 101 class TransitionTimingFunction {
112 static const EASE_IN = 'ease-in'; 102 static const EASE_IN = 'ease-in';
113 static const EASE_OUT = 'ease-out'; 103 static const EASE_OUT = 'ease-out';
114 static const EASE_IN_OUT = 'ease-in-out'; 104 static const EASE_IN_OUT = 'ease-in-out';
115 } 105 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698