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

Unified Diff: Source/core/html/track/DataCue.cpp

Issue 224833002: Implement DataCue interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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: Source/core/html/track/DataCue.cpp
diff --git a/Source/core/css/CSSTestHelper.cpp b/Source/core/html/track/DataCue.cpp
similarity index 59%
copy from Source/core/css/CSSTestHelper.cpp
copy to Source/core/html/track/DataCue.cpp
index 3b24d9c75e44f8dcf59fabefacdb7c7815c7587b..d74506c0041089782a8fdca698e42f466ffa640a 100644
--- a/Source/core/css/CSSTestHelper.cpp
+++ b/Source/core/html/track/DataCue.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Google Inc. All rights reserved.
+ * Copyright (c) 2014, CableLabs Inc. All rights reserved.
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 nit: This should use the Chromium header in the Bl
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,43 +28,52 @@
*/
#include "config.h"
-#include "CSSTestHelper.h"
+#include "core/html/track/DataCue.h"
-#include "core/css/CSSRuleList.h"
-#include "core/css/CSSStyleSheet.h"
-#include "core/css/RuleSet.h"
-#include "core/css/StyleSheetContents.h"
-#include "core/dom/Document.h"
-#include "wtf/text/WTFString.h"
+namespace WebCore {
-#include <gtest/gtest.h>
+DataCue::DataCue(ExecutionContext* context, double startTime, double endTime, ArrayBuffer* data, ExceptionState& exceptionState)
+ : TextTrackCue(startTime, endTime)
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 I'm surprised that there doesn't appear to be any
Brendan Long 2014/05/28 16:31:48 I don't see anything about that: http://www.w3.or
philipj_slow 2014/06/02 07:50:52 Right, there is no such restriction. Negative time
+ , m_executionContext(context)
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 DataCue should probably from ContextLifecycleObser
+{
+ ScriptWrappable::init(this);
+ setData(data, exceptionState);
+}
-namespace WebCore {
+DataCue::~DataCue()
+{
+}
+
+#ifndef NDEBUG
+String DataCue::toString() const
+{
+ return String::format("%p id=%s interval=%f-->%f)", this, id().utf8().data(), startTime(), endTime());
+}
+#endif
-CSSTestHelper::~CSSTestHelper()
+PassRefPtr<ArrayBuffer> DataCue::data() const
{
+ ASSERT(m_data);
+ return ArrayBuffer::create(m_data.get());
}
-CSSTestHelper::CSSTestHelper()
+void DataCue::setData(ArrayBuffer* data, ExceptionState& exceptionState)
{
- m_document = Document::create();
- TextPosition position;
- m_styleSheet = CSSStyleSheet::createInline(m_document.get(), KURL(), position, "UTF-8");
+ if (!data)
+ exceptionState.throwDOMException(InvalidNodeTypeError, "DataCue.data must be a non-null ArrayBuffer");
philipj_slow 2014/04/04 14:54:33 [StrictTypeChecking] in the IDL should take care o
Brendan Long 2014/04/04 15:07:22 I tried that and it still accepted null and string
fs 2014/04/04 17:10:35 Sounds like an issue with the bindings generator -
Brendan Long 2014/04/04 17:43:06 That looks like it would fix the null case. For st
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 Should this be exceptionState.throwTypeError() ins
+ else
+ m_data = ArrayBuffer::create(data);
}
-RuleSet& CSSTestHelper::ruleSet()
+String DataCue::text(bool& isNull) const
{
- RuleSet& ruleSet = m_styleSheet->contents()->ensureRuleSet(MediaQueryEvaluator(), RuleHasNoSpecialState);
- ruleSet.compactRulesIfNeeded();
- return ruleSet;
+ isNull = true;
+ return String();
philipj_slow 2014/04/04 14:54:33 "The text attribute, on getting, must return UTF-1
Brendan Long 2014/04/04 15:07:22 My problem is, how do we identify the encoding? As
acolwell GONE FROM CHROMIUM 2014/04/04 23:25:27 I agree with Philip here. It seems odd that we wou
Brendan Long 2014/05/28 16:31:48 There was some discussion about removing .text, bu
philipj_slow 2014/06/02 07:50:52 It's been removed now: https://github.com/w3c/html
}
-void CSSTestHelper::addCSSRules(const char* cssText)
+ExecutionContext* DataCue::executionContext() const
{
- TextPosition position;
- unsigned sheetLength = m_styleSheet->length();
- ASSERT_TRUE(m_styleSheet->contents()->parseStringAtPosition(cssText, position, true));
- ASSERT_TRUE(m_styleSheet->length() > sheetLength);
+ return m_executionContext;
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698