| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Composition_h | 31 #ifndef TextDecoder_h |
| 32 #define Composition_h | 32 #define TextDecoder_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/Dictionary.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/ArrayBufferView.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/text/TextCodec.h" |
| 38 #include "wtf/text/TextEncoding.h" |
| 38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 42 class Composition : public RefCounted<Composition>, public ScriptWrappable { | 43 class ExceptionState; |
| 44 |
| 45 class TextDecoder : public RefCounted<TextDecoder> { |
| 43 public: | 46 public: |
| 44 static PassRefPtr<Composition> create(); | 47 static PassRefPtr<TextDecoder> create(const String& label, const Dictionary&
, ExceptionState&); |
| 45 ~Composition(); | 48 virtual ~TextDecoder(); |
| 46 | 49 |
| 47 String text() const { return m_text; } | 50 // Implement the IDL |
| 48 void setText(const String& text) { m_text = text; } | 51 String encoding() const; |
| 52 String decode(ArrayBufferView*, const Dictionary&, ExceptionState&); |
| 53 String decode(ExceptionState& es) { return decode(0, Dictionary(), es); } |
| 49 | 54 |
| 50 int selectionStart() const { return m_selectionStart; } | 55 using RefCounted<TextDecoder>::ref; |
| 51 void setSelectionStart(int selectionStart) { selectionStart = m_selectionSta
rt; } | 56 using RefCounted<TextDecoder>::deref; |
| 52 | |
| 53 int selectionEnd() const { return m_selectionEnd; } | |
| 54 void setSelectionEnd(int selectionEnd) { selectionEnd = m_selectionEnd; } | |
| 55 | |
| 56 const Vector<unsigned>& getSegments() const; | |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 Composition(); | 59 TextDecoder(const String& encoding, bool fatal); |
| 60 | 60 |
| 61 String m_text; | 61 WTF::TextEncoding m_encoding; |
| 62 int m_selectionStart; | 62 OwnPtr<WTF::TextCodec> m_codec; |
| 63 int m_selectionEnd; | 63 bool m_fatal; |
| 64 Vector<unsigned> m_segments; | |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace WebCore | 66 } // namespace WebCore |
| 68 | 67 |
| 69 #endif // Composition_h | 68 #endif // TextDecoder_h |
| OLD | NEW |