| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 class TouchList : public RefCounted<TouchList>, public ScriptWrappable { | 36 class TouchList : public RefCounted<TouchList>, public ScriptWrappable { |
| 37 public: | 37 public: |
| 38 static PassRefPtr<TouchList> create() | 38 static PassRefPtr<TouchList> create() |
| 39 { | 39 { |
| 40 return adoptRef(new TouchList); | 40 return adoptRef(new TouchList); |
| 41 } | 41 } |
| 42 | 42 |
| 43 static PassRefPtr<TouchList> create(Vector<RefPtr<Touch> >& touches) |
| 44 { |
| 45 return adoptRef(new TouchList(touches)); |
| 46 } |
| 47 |
| 43 unsigned length() const { return m_values.size(); } | 48 unsigned length() const { return m_values.size(); } |
| 44 | 49 |
| 45 Touch* item(unsigned); | 50 Touch* item(unsigned); |
| 46 const Touch* item(unsigned) const; | 51 const Touch* item(unsigned) const; |
| 47 | 52 |
| 48 void append(const PassRefPtr<Touch> touch) { m_values.append(touch); } | 53 void append(const PassRefPtr<Touch> touch) { m_values.append(touch); } |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 TouchList() | 56 TouchList() |
| 52 { | 57 { |
| 53 ScriptWrappable::init(this); | 58 ScriptWrappable::init(this); |
| 54 } | 59 } |
| 55 | 60 |
| 61 TouchList(Vector<RefPtr<Touch> >& touches) |
| 62 { |
| 63 m_values.swap(touches); |
| 64 ScriptWrappable::init(this); |
| 65 } |
| 66 |
| 56 Vector<RefPtr<Touch> > m_values; | 67 Vector<RefPtr<Touch> > m_values; |
| 57 }; | 68 }; |
| 58 | 69 |
| 59 } // namespace WebCore | 70 } // namespace WebCore |
| 60 | 71 |
| 61 #endif /* TouchList_h */ | 72 #endif /* TouchList_h */ |
| OLD | NEW |