| Index: Source/bindings/v8/custom/V8TextTrackCueCustom.cpp
|
| diff --git a/Source/platform/LengthPoint.h b/Source/bindings/v8/custom/V8TextTrackCueCustom.cpp
|
| similarity index 55%
|
| copy from Source/platform/LengthPoint.h
|
| copy to Source/bindings/v8/custom/V8TextTrackCueCustom.cpp
|
| index 75497a1dcc3447a9f6d0598f6e67c4ef7eb9cc6d..905b2f3c91744cc98ad62bb1481e169110beee7e 100644
|
| --- a/Source/platform/LengthPoint.h
|
| +++ b/Source/bindings/v8/custom/V8TextTrackCueCustom.cpp
|
| @@ -27,39 +27,36 @@
|
| * OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef LengthPoint_h
|
| -#define LengthPoint_h
|
| +#include "config.h"
|
| +#include "V8TextTrackCue.h"
|
|
|
| -#include "platform/Length.h"
|
| +#include "V8VTTCue.h"
|
| +#include "core/frame/UseCounter.h"
|
|
|
| namespace WebCore {
|
|
|
| -struct LengthPoint {
|
| -public:
|
| - LengthPoint()
|
| - {
|
| +v8::Handle<v8::Value> toV8(TextTrackCue* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +{
|
| + return toV8(toVTTCue(impl), creationContext, isolate);
|
| +}
|
| +
|
| +// Custom constructor to make new TextTrackCue(...) return a VTTCue. This is legacy
|
| +// compat, not per spec, and should be removed at the earliest opportunity.
|
| +void V8TextTrackCue::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + if (UNLIKELY(info.Length() < 3)) {
|
| + throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TextTrackCue", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate());
|
| + return;
|
| }
|
| + V8TRYCATCH_VOID(double, startTime, static_cast<double>(info[0]->NumberValue()));
|
| + V8TRYCATCH_VOID(double, endTime, static_cast<double>(info[1]->NumberValue()));
|
| + V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, text, info[2]);
|
|
|
| - LengthPoint(Length x, Length y)
|
| - : m_x(x)
|
| - , m_y(y)
|
| - {
|
| - }
|
| -
|
| - bool operator==(const LengthPoint& o) const { return m_x == o.m_x && m_y == o.m_y; }
|
| - bool operator!=(const LengthPoint& o) const { return m_x != o.m_x || m_y != o.m_y; }
|
| -
|
| - void setX(Length x) { m_x = x; }
|
| - Length x() const { return m_x; }
|
| -
|
| - void setY(Length y) { m_y = y; }
|
| - Length y() const { return m_y; }
|
| -
|
| -private:
|
| - Length m_x;
|
| - Length m_y;
|
| -};
|
| + Document& document = *toDocument(getExecutionContext());
|
| + UseCounter::count(document, UseCounter::TextTrackCueConstructor);
|
| + VTTCue* impl = VTTCue::create(document, startTime, endTime, text).leakRef();
|
| + v8::Handle<v8::Object> wrapper = wrap(impl, info.Holder(), info.GetIsolate());
|
| + info.GetReturnValue().Set(wrapper);
|
| +}
|
|
|
| } // namespace WebCore
|
| -
|
| -#endif // LengthPoint_h
|
|
|