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

Side by Side Diff: client/html/src/ElementWrappingImplementation.dart

Issue 8839010: New version of the bindings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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
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 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. 5 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality.
6 class _ChildrenElementList implements ElementList { 6 class _ChildrenElementList implements ElementList {
7 // Raw Element. 7 // Raw Element.
8 final _element; 8 final _element;
9 final _childElements; 9 final _childElements;
10 10
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 class ElementRectWrappingImplementation implements ElementRect { 447 class ElementRectWrappingImplementation implements ElementRect {
448 final ClientRect client; 448 final ClientRect client;
449 final ClientRect offset; 449 final ClientRect offset;
450 final ClientRect scroll; 450 final ClientRect scroll;
451 451
452 // TODO(jacobr): should we move these outside of ElementRect to avoid the 452 // TODO(jacobr): should we move these outside of ElementRect to avoid the
453 // overhead of computing them every time even though they are rarely used. 453 // overhead of computing them every time even though they are rarely used.
454 // This should be type dom.ClientRect but that fails on dartium. b/5522629 454 // This should be type dom.ClientRect but that fails on dartium. b/5522629
455 final _boundingClientRect; 455 final _boundingClientRect;
456 // an exception due to a dartium bug. 456 // an exception due to a dartium bug.
457 final dom.ClientRectList _clientRects; 457 final _clientRects; // TODO(jacobr): should be dom.ClientRectList
458 458
459 ElementRectWrappingImplementation(dom.HTMLElement element) : 459 ElementRectWrappingImplementation(dom.HTMLElement element) :
460 client = new SimpleClientRect(element.clientLeft, 460 client = new SimpleClientRect(element.clientLeft,
461 element.clientTop, 461 element.clientTop,
462 element.clientWidth, 462 element.clientWidth,
463 element.clientHeight), 463 element.clientHeight),
464 offset = new SimpleClientRect(element.offsetLeft, 464 offset = new SimpleClientRect(element.offsetLeft,
465 element.offsetTop, 465 element.offsetTop,
466 element.offsetWidth, 466 element.offsetWidth,
467 element.offsetHeight), 467 element.offsetHeight),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // 4) Detatch the created element from its dummy parent. 511 // 4) Detatch the created element from its dummy parent.
512 String parentTag = 'div'; 512 String parentTag = 'div';
513 String tag; 513 String tag;
514 final match = _START_TAG_REGEXP.firstMatch(html); 514 final match = _START_TAG_REGEXP.firstMatch(html);
515 if (match !== null) { 515 if (match !== null) {
516 tag = match.group(1).toLowerCase(); 516 tag = match.group(1).toLowerCase();
517 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) { 517 if (_CUSTOM_PARENT_TAG_MAP.containsKey(tag)) {
518 parentTag = _CUSTOM_PARENT_TAG_MAP[tag]; 518 parentTag = _CUSTOM_PARENT_TAG_MAP[tag];
519 } 519 }
520 } 520 }
521 final temp = dom.document.createElement(parentTag); 521 // TODO(jacobr): make type dom.HTMLElement when dartium allows it.
522 var temp = dom.document.createElement(parentTag);
522 temp.innerHTML = html; 523 temp.innerHTML = html;
523 524
524 if (temp.childElementCount == 1) { 525 if (temp.childElementCount == 1) {
525 return LevelDom.wrapElement(temp.firstElementChild); 526 return LevelDom.wrapElement(temp.firstElementChild);
526 } else if (parentTag == 'html' && temp.childElementCount == 2) { 527 } else if (parentTag == 'html' && temp.childElementCount == 2) {
527 // Work around for edge case in WebKit and possibly other browsers where 528 // Work around for edge case in WebKit and possibly other browsers where
528 // both body and head elements are created even though the inner html 529 // both body and head elements are created even though the inner html
529 // only contains a head or body element. 530 // only contains a head or body element.
530 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1)); 531 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1));
531 } else { 532 } else {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 new Completer<CSSStyleDeclaration>()); 742 new Completer<CSSStyleDeclaration>());
742 } 743 }
743 744
744 ElementEvents get on() { 745 ElementEvents get on() {
745 if (_on === null) { 746 if (_on === null) {
746 _on = new ElementEventsImplementation._wrap(_ptr); 747 _on = new ElementEventsImplementation._wrap(_ptr);
747 } 748 }
748 return _on; 749 return _on;
749 } 750 }
750 } 751 }
OLDNEW
« no previous file with comments | « client/html/src/DocumentWrappingImplementation.dart ('k') | client/html/src/GlobalProperties.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698