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

Side by Side Diff: samples/ui_lib/touch/Scroller.dart

Issue 11367040: Removing Element.rect. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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 /** 5 /**
6 * Implementation of a custom scrolling behavior. 6 * Implementation of a custom scrolling behavior.
7 * This behavior overrides native scrolling for an area. This area can be a 7 * This behavior overrides native scrolling for an area. This area can be a
8 * single defined part of a page, the entire page, or several different parts 8 * single defined part of a page, the entire page, or several different parts
9 * of a page. 9 * of a page.
10 * 10 *
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 _minOffset.x = 0; 534 _minOffset.x = 0;
535 _minOffset.y = 0; 535 _minOffset.y = 0;
536 reconfigure(() => _setContentOffset(_maxPoint.x, _maxPoint.y)); 536 reconfigure(() => _setContentOffset(_maxPoint.x, _maxPoint.y));
537 } 537 }
538 538
539 /** 539 /**
540 * Recalculate dimensions of the frame and the content. Adjust the minPoint 540 * Recalculate dimensions of the frame and the content. Adjust the minPoint
541 * and maxPoint allowed for scrolling. 541 * and maxPoint allowed for scrolling.
542 */ 542 */
543 void _resize(Callback callback) { 543 void _resize(Callback callback) {
544 final frameRect = _frame.rect; 544 window.requestLayoutFrame(() {
545 Future contentSizeFuture; 545 if (_lookupContentSizeDelegate !== null) {
546 _contentSize = _lookupContentSizeDelegate();
547 } else {
548 _contentSize = new Size(_element.scrollWidth, _element.scrollHeight);
549 }
546 550
547 if (_lookupContentSizeDelegate !== null) { 551 _scrollSize = new Size(_frame.offsetWidth,
548 contentSizeFuture = _lookupContentSizeDelegate(); 552 _frame.offsetHeight);
549 contentSizeFuture.then((Size size) {
550 _contentSize = size;
551 });
552 } else {
553 contentSizeFuture = _element.rect;
554 contentSizeFuture.then((ElementRect rect) {
555 _contentSize = new Size(rect.scroll.width, rect.scroll.height);
556 });
557 }
558
559 joinFutures(<Future>[frameRect, contentSizeFuture], () {
560 _scrollSize = new Size(frameRect.value.offset.width,
561 frameRect.value.offset.height);
562 Size adjusted = _getAdjustedContentSize(); 553 Size adjusted = _getAdjustedContentSize();
563 _maxPoint = new Coordinate(-_maxOffset.x, -_maxOffset.y); 554 _maxPoint = new Coordinate(-_maxOffset.x, -_maxOffset.y);
564 _minPoint = new Coordinate( 555 _minPoint = new Coordinate(
565 Math.min( 556 Math.min(
566 _scrollSize.width - adjusted.width + _minOffset.x, _maxPoint.x), 557 _scrollSize.width - adjusted.width + _minOffset.x, _maxPoint.x),
567 Math.min( 558 Math.min(
568 _scrollSize.height - adjusted.height + _minOffset.y, _maxPoint.y)) ; 559 _scrollSize.height - adjusted.height + _minOffset.y, _maxPoint.y)) ;
569 callback(); 560 callback();
570 }); 561 });
571 } 562 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 for (EventListener listener in _listeners) { 713 for (EventListener listener in _listeners) {
723 listener(evt); 714 listener(evt);
724 } 715 }
725 } 716 }
726 } 717 }
727 718
728 class ScrollerScrollTechnique { 719 class ScrollerScrollTechnique {
729 static const TRANSFORM_3D = 1; 720 static const TRANSFORM_3D = 1;
730 static const RELATIVE_POSITIONING = 2; 721 static const RELATIVE_POSITIONING = 2;
731 } 722 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698