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

Unified Diff: Source/core/html/track/TextTrackCue.h

Issue 77853002: Move VTT functionality from TextTrackCue.* to VTTCue.* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address nits. Created 7 years, 1 month 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
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.cpp ('k') | Source/core/html/track/TextTrackCue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/TextTrackCue.h
diff --git a/Source/core/html/track/TextTrackCue.h b/Source/core/html/track/TextTrackCue.h
index 6230702e1df9816131332dae52c10dc65a903418..579838982f47d37f58cc747ea66c30be4b41bf97 100644
--- a/Source/core/html/track/TextTrackCue.h
+++ b/Source/core/html/track/TextTrackCue.h
@@ -39,32 +39,21 @@
namespace WebCore {
class Document;
-class DocumentFragment;
class ExceptionState;
-class ExecutionContext;
-class TextTrack;
class TextTrackCue;
// ----------------------------
-class TextTrackCueBox FINAL : public HTMLDivElement {
+class TextTrackCueBox : public HTMLDivElement {
public:
- static PassRefPtr<TextTrackCueBox> create(Document& document, TextTrackCue* cue)
+ static const AtomicString& textTrackCueBoxShadowPseudoId()
{
- return adoptRef(new TextTrackCueBox(document, cue));
+ DEFINE_STATIC_LOCAL(const AtomicString, trackDisplayBoxShadowPseudoId, ("-webkit-media-text-track-display", AtomicString::ConstructFromLiteral));
+ return trackDisplayBoxShadowPseudoId;
}
- TextTrackCue* getCue() const;
- void applyCSSProperties(const IntSize& videoSize);
-
- static const AtomicString& textTrackCueBoxShadowPseudoId();
-
protected:
- TextTrackCueBox(Document&, TextTrackCue*);
-
- virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
-
- TextTrackCue* m_cue;
+ TextTrackCueBox(Document&);
};
// ----------------------------
@@ -72,13 +61,15 @@ protected:
class TextTrackCue : public RefCounted<TextTrackCue>, public EventTargetWithInlineData {
REFCOUNTED_EVENT_TARGET(TextTrackCue);
public:
+ static bool isInfiniteOrNonNumber(double value, const char* method, ExceptionState&);
+
static const AtomicString& cueShadowPseudoId()
{
DEFINE_STATIC_LOCAL(const AtomicString, cue, ("cue", AtomicString::ConstructFromLiteral));
return cue;
}
- virtual ~TextTrackCue();
+ virtual ~TextTrackCue() { }
TextTrack* track() const;
void setTrack(TextTrack*);
@@ -95,149 +86,48 @@ public:
bool pauseOnExit() const { return m_pauseOnExit; }
void setPauseOnExit(bool);
- const String& vertical() const;
- void setVertical(const String&, ExceptionState&);
-
- bool snapToLines() const { return m_snapToLines; }
- void setSnapToLines(bool);
-
- int line() const { return m_linePosition; }
- void setLine(int, ExceptionState&);
-
- int position() const { return m_textPosition; }
- void setPosition(int, ExceptionState&);
-
- int size() const { return m_cueSize; }
- void setSize(int, ExceptionState&);
-
- const String& align() const;
- void setAlign(const String&, ExceptionState&);
-
- const String& text() const { return m_content; }
- void setText(const String&);
-
- void parseSettings(const String&);
-
int cueIndex();
void invalidateCueIndex();
- PassRefPtr<DocumentFragment> getCueAsHTML();
- PassRefPtr<DocumentFragment> createCueRenderingTree();
-
using EventTarget::dispatchEvent;
virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE;
- const String& regionId() const { return m_regionId; }
- void setRegionId(const String&);
- void notifyRegionWhenRemovingDisplayTree(bool);
-
bool isActive();
void setIsActive(bool);
- bool hasDisplayTree() const { return m_displayTree; }
- PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
- PassRefPtr<HTMLDivElement> element() const { return m_cueBackgroundBox; }
+ virtual void updateDisplay(const IntSize& videoSize, HTMLDivElement& container) = 0;
- void updateDisplayTree(double);
- void removeDisplayTree();
- void markFutureAndPastNodes(ContainerNode*, double, double);
-
- int calculateComputedLinePosition();
+ // FIXME: Consider refactoring to eliminate or merge the following three members.
+ // https://code.google.com/p/chromium/issues/detail?id=322434
+ virtual void updateDisplayTree(double movieTime) { }
+ virtual void removeDisplayTree() { }
+ virtual void notifyRegionWhenRemovingDisplayTree(bool notifyRegion) { }
virtual const AtomicString& interfaceName() const OVERRIDE;
- virtual ExecutionContext* executionContext() const OVERRIDE;
-
- std::pair<double, double> getCSSPosition() const;
-
- CSSValueID getCSSAlignment() const;
- int getCSSSize() const;
- CSSValueID getCSSWritingDirection() const;
- CSSValueID getCSSWritingMode() const;
-
- enum WritingDirection {
- Horizontal = 0,
- VerticalGrowingLeft,
- VerticalGrowingRight,
- NumberOfWritingDirections
- };
- WritingDirection getWritingDirection() const { return m_writingDirection; }
-
- enum CueAlignment {
- Start = 0,
- Middle,
- End,
- Left,
- Right,
- NumberOfAlignments
- };
- CueAlignment getAlignment() const { return m_cueAlignment; }
DEFINE_ATTRIBUTE_EVENT_LISTENER(enter);
DEFINE_ATTRIBUTE_EVENT_LISTENER(exit);
-protected:
- TextTrackCue(Document&, double start, double end, const String& content);
-
-private:
- Document& document() const;
-
- PassRefPtr<TextTrackCueBox> displayTreeInternal();
-
- void createVTTNodeTree();
- void copyVTTNodeToDOMTree(ContainerNode* VTTNode, ContainerNode* root);
+ virtual bool isVTTCue() const { return false; }
- std::pair<double, double> getPositionCoordinates() const;
+ virtual String toString() const;
- void determineTextDirection();
- void calculateDisplayParameters();
+protected:
+ TextTrackCue(double start, double end);
void cueWillChange();
- void cueDidChange();
-
- enum CueSetting {
- None,
- Vertical,
- Line,
- Position,
- Size,
- Align,
- RegionId
- };
- CueSetting settingName(const String&);
+ virtual void cueDidChange();
+private:
String m_id;
double m_startTime;
double m_endTime;
- String m_content;
- int m_linePosition;
- int m_computedLinePosition;
- int m_textPosition;
- int m_cueSize;
int m_cueIndex;
- WritingDirection m_writingDirection;
-
- CueAlignment m_cueAlignment;
-
- RefPtr<DocumentFragment> m_webVTTNodeTree;
TextTrack* m_track;
bool m_isActive;
bool m_pauseOnExit;
- bool m_snapToLines;
-
- RefPtr<HTMLDivElement> m_cueBackgroundBox;
-
- bool m_displayTreeShouldChange;
- RefPtr<TextTrackCueBox> m_displayTree;
-
- CSSValueID m_displayDirection;
-
- int m_displaySize;
-
- std::pair<float, float> m_displayPosition;
- String m_regionId;
- bool m_notifyRegion;
};
} // namespace WebCore
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.cpp ('k') | Source/core/html/track/TextTrackCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698