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

Unified Diff: sky/engine/bindings-dart/core/dart/custom/DartFileCustom.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/DartFileCustom.cpp
diff --git a/sky/engine/platform/text/TextRunIterator.h b/sky/engine/bindings-dart/core/dart/custom/DartFileCustom.cpp
similarity index 51%
copy from sky/engine/platform/text/TextRunIterator.h
copy to sky/engine/bindings-dart/core/dart/custom/DartFileCustom.cpp
index 280ff3f155a50d1407e7ed4225cb587714c49ef0..13ccbd0d925c1400dbbb270b802c69b572338fc4 100644
--- a/sky/engine/platform/text/TextRunIterator.h
+++ b/sky/engine/bindings-dart/core/dart/custom/DartFileCustom.cpp
@@ -1,4 +1,5 @@
-// Copyright (C) 2013 Google Inc. All rights reserved.
+// Copyright 2012, 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,50 @@
// (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 "sky/engine/platform/text/TextRun.h"
+#include "bindings/core/dart/DartFile.h"
namespace blink {
-class TextRunIterator {
-public:
- TextRunIterator()
- : m_textRun(0)
- , m_offset(0)
- {
- }
+namespace DartFileInternal {
- TextRunIterator(const TextRun* textRun, unsigned offset)
- : m_textRun(textRun)
- , m_offset(offset)
- {
- }
+void constructorCallback(Dart_NativeArguments args)
+{
+ // FIXME: Implement this.
+ DART_UNIMPLEMENTED();
+}
- TextRunIterator(const TextRunIterator& other)
- : m_textRun(other.m_textRun)
- , m_offset(other.m_offset)
- {
- }
+void lastModifiedGetter(Dart_NativeArguments args)
+{
+ // The auto-generated getters return null when the method in the underlying
+ // implementation returns NaN. The File API says we should return the
+ // current time when the last modification time is unknown.
+ // Section 7.2 of the File API spec. http://dev.w3.org/2006/webapi/FileAPI/
- 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'; }
+ File* file = DartDOMWrapper::receiver<File>(args);
+ double lastModified = file->lastModifiedDate();
+ if (!isValidFileTime(lastModified))
+ lastModified = currentTimeMS();
- bool operator==(const TextRunIterator& other)
- {
- return m_offset == other.m_offset && m_textRun == other.m_textRun;
- }
+ // lastModified returns a number, not a Date instance.
+ // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs
+ int64_t returnValue = static_cast<int64_t>(floor(lastModified));
+ Dart_SetIntegerReturnValue(args, returnValue);
+}
- bool operator!=(const TextRunIterator& other) { return !operator==(other); }
+void lastModifiedDateGetter(Dart_NativeArguments args)
+{
+ File* file = DartDOMWrapper::receiver<File>(args);
+ double lastModified = file->lastModifiedDate();
+ if (!isValidFileTime(lastModified))
+ lastModified = currentTimeMS();
-private:
- const TextRun* m_textRun;
- int m_offset;
-};
+ // lastModifiedDate returns a Date instance.
+ // http://www.w3.org/TR/FileAPI/#file-attrs
+ Dart_SetReturnValue(args, DartUtilities::dateToDart(lastModified));
+}
+}
-} // namespace blink
-
-#endif // SKY_ENGINE_PLATFORM_TEXT_TEXTRUNITERATOR_H_
+}

Powered by Google App Engine
This is Rietveld 408576698