darling-WebCore/html/HTMLTrackElement.h

103 lines
3.4 KiB
C
Raw Permalink Normal View History

2017-08-12 16:38:52 +00:00
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
2018-08-04 14:51:43 +00:00
* Copyright (C) 2011-2017 Apple Inc. All rights reserved.
2017-08-12 16:38:52 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
2023-01-25 00:42:21 +00:00
#if ENABLE(VIDEO)
2017-08-12 16:38:52 +00:00
2023-01-25 00:42:21 +00:00
#include "ActiveDOMObject.h"
2017-08-12 16:38:52 +00:00
#include "HTMLElement.h"
#include "LoadableTextTrack.h"
namespace WebCore {
class HTMLMediaElement;
2023-01-25 00:42:21 +00:00
class HTMLTrackElement final : public HTMLElement, public ActiveDOMObject, public TextTrackClient {
WTF_MAKE_ISO_ALLOCATED(HTMLTrackElement);
2017-08-12 16:38:52 +00:00
public:
static Ref<HTMLTrackElement> create(const QualifiedName&, Document&);
2023-01-25 00:42:21 +00:00
const AtomString& kind();
void setKind(const AtomString&);
2017-08-12 16:38:52 +00:00
2023-01-25 00:42:21 +00:00
const AtomString& srclang() const;
const AtomString& label() const;
2017-08-12 16:38:52 +00:00
bool isDefault() const;
enum ReadyState { NONE = 0, LOADING = 1, LOADED = 2, TRACK_ERROR = 3 };
2023-01-25 00:42:21 +00:00
ReadyState readyState() const;
2017-08-12 16:38:52 +00:00
void setReadyState(ReadyState);
LoadableTextTrack& track();
void scheduleLoad();
enum LoadStatus { Failure, Success };
void didCompleteLoad(LoadStatus);
2023-01-25 00:42:21 +00:00
RefPtr<HTMLMediaElement> mediaElement() const;
const AtomString& mediaElementCrossOriginAttribute() const;
2017-08-12 16:38:52 +00:00
private:
HTMLTrackElement(const QualifiedName&, Document&);
virtual ~HTMLTrackElement();
2023-01-25 00:42:21 +00:00
// ActiveDOMObject.
const char* activeDOMObjectName() const final;
bool virtualHasPendingActivity() const final;
2017-08-12 16:38:52 +00:00
2023-01-25 00:42:21 +00:00
void parseAttribute(const QualifiedName&, const AtomString&) final;
InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
void removedFromAncestor(RemovalType, ContainerNode&) final;
2017-08-12 16:38:52 +00:00
bool isURLAttribute(const Attribute&) const final;
2023-01-25 00:42:21 +00:00
// EventTarget.
void eventListenersDidChange() final;
2017-08-12 16:38:52 +00:00
2023-01-25 00:42:21 +00:00
void loadTimerFired();
2017-08-12 16:38:52 +00:00
// TextTrackClient
2018-08-04 14:51:43 +00:00
void textTrackModeChanged(TextTrack&) final;
void textTrackKindChanged(TextTrack&) final;
void textTrackAddCues(TextTrack&, const TextTrackCueList&) final;
void textTrackRemoveCues(TextTrack&, const TextTrackCueList&) final;
void textTrackAddCue(TextTrack&, TextTrackCue&) final;
void textTrackRemoveCue(TextTrack&, TextTrackCue&) final;
2017-08-12 16:38:52 +00:00
bool canLoadURL(const URL&);
RefPtr<LoadableTextTrack> m_track;
Timer m_loadTimer;
2023-01-25 00:42:21 +00:00
bool m_hasRelevantLoadEventsListener { false };
2017-08-12 16:38:52 +00:00
};
}
#endif