Chromium Code Reviews| Index: tools/dom/templates/html/impl/impl_Element.darttemplate |
| diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate |
| index 4b8173bf316152f50f073b3ac7e11fc43c32569f..d768d8b31097eb5585777235189298c47a5740f8 100644 |
| --- a/tools/dom/templates/html/impl/impl_Element.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate |
| @@ -1484,24 +1484,9 @@ $else |
| static var _nodeList = js.context["NodeList"]; |
| static bool _hasCorruptedAttributes(Element element) { |
| - var attributes = unwrap_jso(element)["attributes"]; |
| - if (!attributes.instanceof(_namedNodeMap)) { |
| - return true; |
| - } |
| - var childNodes = unwrap_jso(element.childNodes); |
| - var length = childNodes["length"]; |
| - var lastChild = unwrap_jso(element.lastChild); |
| - if (null != lastChild && |
| - lastChild != childNodes[length - 1]) { |
| - return true; |
| - } |
| - var children = unwrap_jso(element._children); |
| - if (null != children) { // On Safari, children can apparently be null. |
| - if (!children.instanceof(_htmlCollection) || |
| - children.instanceof(_nodeList)) { |
| - return true; |
| - } |
| - } |
| + // We could support this method on Dartium but it does not seem worthwhile |
|
Alan Knight
2016/03/25 21:39:09
They can be corrupted in a way that doesn't show u
Jacob
2016/03/30 00:19:00
I switched to a version of the cleaned up version
|
| + // given Dartium is a development platform and the checked method are |
| + // implemented with C++ natives that cannot be corrupted. |
| return false; |
| } |
| @@ -1509,6 +1494,7 @@ $else |
| static bool _hasCorruptedAttributesAdditionalCheck(Element element) => false; |
| $endif |
| +$if DART2JS |
| static String _safeTagName(element) { |
| String result = 'element tag unavailable'; |
| try { |
| @@ -1518,6 +1504,15 @@ $endif |
| } catch (e) {} |
| return result; |
| } |
| +$else |
| + static String _safeTagName(element) { |
| + try { |
|
Alan Knight
2016/03/25 21:39:09
Don't we need an implementation of this for Dartiu
Jacob
2016/03/30 00:19:00
not sure I understand. this is an implementation f
|
| + // Safe as we plumb directly to a C++ native method. |
| + return element.tagName; |
| + } catch (e) {} |
| + return 'element tag unavailable'; |
| + } |
| +$endif |
| $if DART2JS |
| @DomName('Element.offsetParent') |
| @@ -1570,52 +1565,52 @@ $if DART2JS |
| $else |
| // Need to explicitly delegate because Element is no longer abstract for Dartium. |
| - bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditable_Getter_(unwrap_jso(this)); |
| - void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(unwrap_jso(this)); |
| + bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditable_Getter_(this); |
| + void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(this); |
| @DomName('Element.offsetParent') |
| @DocsEditable() |
| - Element get offsetParent => wrap_jso(_blink.BlinkElement.instance.offsetParent_Getter_(unwrap_jso(this))); |
| + Element get offsetParent => _blink.BlinkElement.instance.offsetParent_Getter_(this); |
| @DomName('Element.offsetHeight') |
| @DocsEditable() |
| - int get offsetHeight => _blink.BlinkElement.instance.offsetHeight_Getter_(unwrap_jso(this)); |
| + int get offsetHeight => _blink.BlinkElement.instance.offsetHeight_Getter_(this); |
| @DomName('Element.offsetLeft') |
| @DocsEditable() |
| - int get offsetLeft => _blink.BlinkElement.instance.offsetLeft_Getter_(unwrap_jso(this)); |
| + int get offsetLeft => _blink.BlinkElement.instance.offsetLeft_Getter_(this); |
| @DomName('Element.offsetTop') |
| @DocsEditable() |
| - int get offsetTop => _blink.BlinkElement.instance.offsetTop_Getter_(unwrap_jso(this)); |
| + int get offsetTop => _blink.BlinkElement.instance.offsetTop_Getter_(this); |
| @DomName('Element.offsetWidth') |
| @DocsEditable() |
| - int get offsetWidth => _blink.BlinkElement.instance.offsetWidth_Getter_(unwrap_jso(this)); |
| + int get offsetWidth => _blink.BlinkElement.instance.offsetWidth_Getter_(this); |
| @DomName('Element.scrollHeight') |
| @DocsEditable() |
| - int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(unwrap_jso(this)).round(); |
| + int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(this).round(); |
| @DomName('Element.scrollLeft') |
| @DocsEditable() |
| - int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(unwrap_jso(this)).round(); |
| + int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(this).round(); |
| @DomName('Element.scrollLeft') |
| @DocsEditable() |
| - set scrollLeft(int value) => _blink.BlinkElement.instance.scrollLeft_Setter_(unwrap_jso(this), value.round()); |
| + set scrollLeft(int value) => _blink.BlinkElement.instance.scrollLeft_Setter_(this, value.round()); |
| @DomName('Element.scrollTop') |
| @DocsEditable() |
| - int get scrollTop => _blink.BlinkElement.instance.scrollTop_Getter_(unwrap_jso(this)).round(); |
| + int get scrollTop => _blink.BlinkElement.instance.scrollTop_Getter_(this).round(); |
| @DomName('Element.scrollTop') |
| @DocsEditable() |
| - set scrollTop(int value) => _blink.BlinkElement.instance.scrollTop_Setter_(unwrap_jso(this), value.round()); |
| + set scrollTop(int value) => _blink.BlinkElement.instance.scrollTop_Setter_(this, value.round()); |
| @DomName('Element.scrollWidth') |
| @DocsEditable() |
| - int get scrollWidth => _blink.BlinkElement.instance.scrollWidth_Getter_(unwrap_jso(this)).round(); |
| + int get scrollWidth => _blink.BlinkElement.instance.scrollWidth_Getter_(this).round(); |
| $endif |
| $!MEMBERS |