Implement :future pseudo class for the WebVTT ::cue pseudo element
https://bugs.webkit.org/show_bug.cgi?id=105473

Patch by Dima Gorbik <dgorbik@apple.com> on 2013-01-04
Reviewed by Antti Koivisto.

Source/WebCore:

This patch changes the approach of showing past/future node objects.
Before upper-level containers were used to put past and future nodes inside. Styles were applied
to containers. Now styles could be applied directly to nodes by using ::cue(:future).
That allows to style future/past WebVTT nodes even if they are nested.

Existing test was modified to cover new cases.

* css/CSSSelector.cpp: added :future pseudo class support.
(WebCore::CSSSelector::pseudoId):
(WebCore::nameToPseudoTypeMap):
(WebCore::CSSSelector::extractPseudoType):
* css/CSSSelector.h:
* css/SelectorChecker.cpp: ditto.
(WebCore::SelectorChecker::checkOneSelector):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithElement): define style sharing rules for WebVTT objects.
* css/mediaControls.css:
(video::-webkit-media-text-track-all-nodes):
(video::cue(:future)): added standard user-agent styles for the future nodes.
* dom/Element.cpp: setter functions don't have an argument now because WebVTT type enum was introduced and the right type is set
when the setter is being called.
(WebCore::Element::setIsWebVTTNode):
(WebCore):
(WebCore::Element::isWebVTTFutureNode):
(WebCore::Element::setIsWebVTTFutureNode):
* dom/Element.h:
(Element):
* dom/ElementRareData.h:
(ElementRareData):
* dom/NodeRareData.cpp:
(SameSizeAsNodeRareData): added a dummy enum value. Enum is integer type and is aligned in Windows when placed in the bitfield,
so it takes more space.
* dom/NodeRareData.h:
(WebCore::NodeRareData::NodeRareData):
(WebCore::NodeRareData::isWebVTTNode):
(WebCore::NodeRareData::setIsWebVTTNode):
(WebCore::NodeRareData::isWebVTTFutureNode):
(WebCore::NodeRareData::setIsWebVTTFutureNode):
(NodeRareData):
* html/shadow/MediaControlElements.cpp:
(WebCore):
* html/track/TextTrack.h: add a WebVTT node object type enum.
(TextTrack):
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::allNodesShadowPseudoId):
(WebCore::TextTrackCue::TextTrackCue):
(WebCore::TextTrackCue::getCueAsHTML):
(WebCore):
(WebCore::TextTrackCue::setNodeObjectFlags): determine if the node is future or past and mark as WebVTT node.
This combines the functionality related to marking nodes implemented before in updateDisplayTree and
markNodesAsWebVTTNodes.
(WebCore::TextTrackCue::updateDisplayTree):
(WebCore::TextTrackCue::getDisplayTree):
* html/track/TextTrackCue.h:
(TextTrackCue):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::constructTreeFromToken): no need to mark nodes as WebVTT nodes when parsing. This is done at the
rendering stage later.
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): the container name has changed.

LayoutTests:

Modified the track css matching test to cover :future pseudo-class case.

* media/track/captions-webvtt/captions-inner-timestamps.vtt: Removed.
* media/track/captions-webvtt/styling.vtt:
* media/track/track-css-matching-expected.txt:
* media/track/track-css-matching.html:
* media/track/track-cue-rendering-inner-timestamps-expected.txt: Removed.
* media/track/track-cue-rendering-inner-timestamps.html: The test was removed because it was based on the old
future/past nodes rendering logic.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138784 268f45cc-cd09-0410-ab3c-d52691b4dbfc