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

Unified Diff: sky/engine/bindings-dart/core/dart/custom/DartFormDataCustom.cpp

Issue 875013003: Import Dart bindings as of Blink r188698. This merely copies the files over and does not attach any… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/bindings-dart/core/dart/custom/DartFormDataCustom.cpp
diff --git a/sky/engine/platform/text/TextRunIterator.h b/sky/engine/bindings-dart/core/dart/custom/DartFormDataCustom.cpp
similarity index 51%
copy from sky/engine/platform/text/TextRunIterator.h
copy to sky/engine/bindings-dart/core/dart/custom/DartFormDataCustom.cpp
index 280ff3f155a50d1407e7ed4225cb587714c49ef0..6a1f4782fd0a30478571f036639641a813057399 100644
--- a/sky/engine/platform/text/TextRunIterator.h
+++ b/sky/engine/bindings-dart/core/dart/custom/DartFormDataCustom.cpp
@@ -1,4 +1,5 @@
-// Copyright (C) 2013 Google Inc. All rights reserved.
+// Copyright 2011, Google Inc.
+// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -26,53 +27,61 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef SKY_ENGINE_PLATFORM_TEXT_TEXTRUNITERATOR_H_
-#define SKY_ENGINE_PLATFORM_TEXT_TEXTRUNITERATOR_H_
+#include "config.h"
+#include "bindings/core/dart/DartFormData.h"
-#include "sky/engine/platform/text/TextRun.h"
+#include "bindings/core/dart/DartBlob.h"
+#include "bindings/core/dart/DartHTMLFormElement.h"
namespace blink {
-class TextRunIterator {
-public:
- TextRunIterator()
- : m_textRun(0)
- , m_offset(0)
- {
- }
+namespace DartFormDataInternal {
- TextRunIterator(const TextRun* textRun, unsigned offset)
- : m_textRun(textRun)
- , m_offset(offset)
+void appendCallback(Dart_NativeArguments args)
+{
+ Dart_Handle exception = 0;
{
- }
+ DOMFormData* receiver = DartDOMWrapper::receiver<DOMFormData>(args);
- TextRunIterator(const TextRunIterator& other)
- : m_textRun(other.m_textRun)
- , m_offset(other.m_offset)
- {
- }
+ DartStringAdapter name = DartUtilities::dartToString(args, 1, exception);
+ if (exception)
+ goto fail;
- unsigned offset() const { return m_offset; }
- void increment() { m_offset++; }
- bool atEnd() const { return !m_textRun || m_offset >= m_textRun->length(); }
- UChar current() const { return (*m_textRun)[m_offset]; }
- WTF::Unicode::Direction direction() const { return atEnd() ? WTF::Unicode::OtherNeutral : WTF::Unicode::direction(current()); }
- bool atParagraphSeparator() const { return current() == '\n'; }
+ Dart_Handle arg2 = Dart_GetNativeArgument(args, 2);
- bool operator==(const TextRunIterator& other)
- {
- return m_offset == other.m_offset && m_textRun == other.m_textRun;
- }
+ if (Dart_IsString(arg2)) {
+ ASSERT(Dart_GetNativeArgumentCount(args) == 3);
+
+ DartStringAdapter value = DartUtilities::dartToString(arg2, exception);
+ if (exception)
+ goto fail;
+
+ receiver->append(name, value);
+ return;
+ }
- bool operator!=(const TextRunIterator& other) { return !operator==(other); }
+ Blob* blob = DartBlob::toNativeWithNullCheck(arg2, exception);
+ if (exception)
+ goto fail;
-private:
- const TextRun* m_textRun;
- int m_offset;
-};
+ if (Dart_GetNativeArgumentCount(args) == 3) {
+ receiver->append(name, blob);
+ return;
+ }
+
+ DartStringAdapter filename = DartUtilities::dartToStringWithNullCheck(args, 3, exception);
+ if (exception)
+ goto fail;
+
+ receiver->append(name, blob, filename);
+ return;
+ }
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
-} // namespace blink
+}
-#endif // SKY_ENGINE_PLATFORM_TEXT_TEXTRUNITERATOR_H_
+}

Powered by Google App Engine
This is Rietveld 408576698