Index: Source/WebCore/bindings/dart/resources/dom_implementation.dart |
diff --git a/Source/WebCore/bindings/dart/resources/dom_implementation.dart b/Source/WebCore/bindings/dart/resources/dom_implementation.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c0d79593d6b04b249601e4dd1c93256b4da500ab |
--- /dev/null |
+++ b/Source/WebCore/bindings/dart/resources/dom_implementation.dart |
@@ -0,0 +1,91 @@ |
+class Utils { |
+ static List convertToList(List list) { |
+ // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it. |
+ final length = list.length; |
+ List result = new List(length); |
+ result.copyFrom(list, 0, 0, length); |
+ return result; |
+ } |
+ |
+ static makeNotImplementedException() { |
+ return const NotImplementedException(); |
+ } |
+} |
+ |
+/* |
+ * [NPObjectBase] is native wrapper class injected from embedder's code. |
+ */ |
+class NPObject extends DOMWrapperBase { |
+ _get(String propertyName) native "NPObject_get"; |
+ _invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"; |
+ |
+ static _createNPObject() => new NPObject._createNPObject(); |
+ NPObject._createNPObject(); |
+} |
+ |
+// layoutTestController implementation. |
+// FIXME: provide a separate lib for layoutTestController. |
+ |
+var layoutTestController; |
+ |
+class LayoutTestController { |
+ final NPObject _npObject; |
+ |
+ LayoutTestController._(this._npObject); |
+ |
+ dumpAsText() => _npObject._invoke('dumpAsText'); |
+ notifyDone() => _npObject._invoke('notifyDone'); |
+ setCanOpenWindows() => _npObject._invoke('setCanOpenWindows'); |
+ waitUntilDone() => _npObject._invoke('waitUntilDone'); |
+ |
+ static _initLayoutTestController(var npObject) { |
+ layoutTestController = new LayoutTestController._(npObject); |
+ } |
+} |
+ |
+class DOMWindowCrossFrameImplementation extends DOMType implements DOMWindow { |
+ // Fields. |
+ History get history() native "DOMWindow_history_cross_frame_Getter"; |
+ Location get location() native "DOMWindow_location_cross_frame_Getter"; |
+ bool get closed() native "DOMWindow_closed_Getter"; |
+ int get length() native "DOMWindow_length_Getter"; |
+ DOMWindow get opener() native "DOMWindow_opener_Getter"; |
+ DOMWindow get parent() native "DOMWindow_parent_Getter"; |
+ DOMWindow get top() native "DOMWindow_top_Getter"; |
+ |
+ // Methods. |
+ void focus() native "DOMWindow_focus_Callback"; |
+ void blur() native "DOMWindow_blur_Callback"; |
+ void close() native "DOMWindow_close_Callback"; |
+ void postMessage([_arg0, _arg1, _arg2]) native "DOMWindow_postMessage_Callback"; |
+ |
+ // Implementation support. |
+ static DOMWindowCrossFrameImplementation _createDOMWindowCrossFrameImplementation() => new DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImplementation(); |
+ DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImplementation(); |
+ |
+ String get typeName() => "DOMWindow"; |
+} |
+ |
+class HistoryCrossFrameImplementation extends DOMType implements History { |
+ // Methods. |
+ void back() native "History_back_Callback"; |
+ void forward() native "History_forward_Callback"; |
+ void go(int distance) native "History_go_Callback"; |
+ |
+ // Implementation support. |
+ static HistoryCrossFrameImplementation _createHistoryCrossFrameImplementation() => new HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(); |
+ HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(); |
+ |
+ String get typeName() => "History"; |
+} |
+ |
+class LocationCrossFrameImplementation extends DOMType implements Location { |
+ // Fields. |
+ void set href(String) native "Location_href_Setter"; |
+ |
+ // Implementation support. |
+ static LocationCrossFrameImplementation _createLocationCrossFrameImplementation() => new LocationCrossFrameImplementation._createLocationCrossFrameImplementation(); |
+ LocationCrossFrameImplementation._createLocationCrossFrameImplementation(); |
+ |
+ String get typeName() => "Location"; |
+} |