2009-01-17 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Jan 2009 17:18:15 +0000 (17:18 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Jan 2009 17:18:15 +0000 (17:18 +0000)
        Reviewed by Adele Peterson

        Complete <rdar://problem/6293969>

        * DerivedSources.make: include mediaControlsQT.css for Mac build.

        * WebCore.xcodeproj/project.pbxproj: add mediaControlsQT.css

        * css/CSSPrimitiveValueMappings.h:
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): add MediaTimelineContainerPart,
        CSSValueMediaCurrentTimeDisplay, and CSSValueMediaTimeRemainingDisplay

        * css/CSSSelector.cpp:
        (WebCore::CSSSelector::extractPseudoType): include new media controller element styles
        * css/CSSSelector.h:
        (WebCore::CSSSelector::): Ditto.

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):  include new media
        controller element styles

        * css/CSSValueKeywords.in: add keywords for new media time display controls

        * css/mediaControls.css: adjust css for new control elements

        * css/mediaControlsQT.css: Added.

        * platform/ThemeTypes.h:
        (WebCore::): add media time display controls to ControlPart

        * platform/mac/WebCoreSystemInterface.h:
        * platform/mac/WebCoreSystemInterface.mm: pass controller style to WKSI functions

        * rendering/MediaControlElements.cpp:
        (WebCore::MediaTextDisplayElement::MediaTextDisplayElement): Added
        (WebCore::MediaTextDisplayElement::attachToParent): Added
        (WebCore::MediaTextDisplayElement::update): Added
        (WebCore::MediaTimeDisplayElement::MediaTimeDisplayElement): Added
        (WebCore::MediaControlInputElement::MediaControlInputElement): Added
        (WebCore::MediaControlInputElement::hitTest): Added
        (WebCore::MediaControlTimelineElement::defaultEventHandler): Update the time display when
        dragging the thumb
        * rendering/MediaControlElements.h:
        (WebCore::): Add MediaTextDisplayElement

        * rendering/RenderMedia.cpp:
        (WebCore::RenderMedia::createTimelineContainer): Added
        (WebCore::RenderMedia::createTimeline): Parent is now the timeline container
        (WebCore::RenderMedia::createCurrentTimeDisplay): Added
        (WebCore::RenderMedia::createTimeRemainingDisplay): Added
        (WebCore::RenderMedia::updateControls): Create new elements. Don't ever start the time update
        timer when the time display elements are not visible
        (WebCore::RenderMedia::formatTime): Handle negative times. Don't display 0 hours or minutes
        (WebCore::RenderMedia::updateTimeDisplay): Do nothing when the time display elements are not
        visible. Display time remaining as well as current time.
        (WebCore::RenderMedia::updateControlVisibility): Don't assume opacity should be set to 0 when
        visibility changes
        (WebCore::RenderMedia::forwardEvent): Call element hitTest() method instead of local function
        as we can't assume that all controls are rectangular
        * rendering/RenderMedia.h: Updated

        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::mouseEventIsInThumb): When slider is media timeline control, call
        element hitTest() method instead of assuming it is rectangular
        * rendering/RenderSlider.h: make mouseEventIsInThumb virtual

        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::paint): Deal with time display and timeline container
        * rendering/RenderTheme.h:
        (WebCore::RenderTheme::paintMediaTimelineContainer): Updated
        (WebCore::RenderTheme::paintMediaCurrentTime): Added
        (WebCore::RenderTheme::paintMediaTimeRemaining): Added

        * rendering/RenderThemeMac.h: Updated
        * rendering/RenderThemeMac.mm:
        (WebCore::):
        (WebCore::mediaControllerTheme):
        (WebCore::RenderThemeMac::adjustSliderThumbSize): Call WebKitSystemInterface to get the thumb
        size when appropriate
        (WebCore::RenderThemeMac::paintMediaFullscreenButton): pass controller style to render function
        (WebCore::RenderThemeMac::paintMediaMuteButton): Ditto
        (WebCore::RenderThemeMac::paintMediaPlayButton): Ditto
        (WebCore::RenderThemeMac::paintMediaSeekBackButton): Ditto
        (WebCore::RenderThemeMac::paintMediaSeekForwardButton): Ditto
        (WebCore::RenderThemeMac::paintMediaSliderTrack): Ditto
        (WebCore::RenderThemeMac::paintMediaSliderThumb): Ditto
        (WebCore::RenderThemeMac::paintMediaTimelineContainer): Added
        (WebCore::RenderThemeMac::paintMediaCurrentTime): Added
        (WebCore::RenderThemeMac::paintMediaTimeRemaining): Added
        (WebCore::RenderThemeMac::extraMediaControlsStyleSheet): Added
        (WebCore::RenderThemeMac::hitTestMediaControlPart): Added
        * rendering/style/RenderStyle.h: Updated
        (WebCore::):

2009-01-17  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Adele Peterson

        Complete <rdar://problem/6293969>

        * WebCoreSupport/WebSystemInterface.m:
        (InitWebCoreSystemInterface): Remove UseSharedMediaUI

2009-01-17  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Adele Peterson

        <rdar://problem/6293969>
        Update media controls rendering results for new controls CSS.

        * platform/mac/media/audio-controls-rendering-expected.txt:
        * platform/mac/media/video-controls-rendering-expected.txt:
        * platform/mac/media/video-display-toggle-expected.txt:

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

34 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
LayoutTests/platform/mac/media/video-controls-rendering-expected.txt
LayoutTests/platform/mac/media/video-display-toggle-expected.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSPrimitiveValueMappings.h
WebCore/css/CSSSelector.cpp
WebCore/css/CSSSelector.h
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSValueKeywords.in
WebCore/css/mediaControls.css
WebCore/css/mediaControlsQT.css [new file with mode: 0644]
WebCore/platform/ThemeTypes.h
WebCore/platform/mac/WebCoreSystemInterface.h
WebCore/platform/mac/WebCoreSystemInterface.mm
WebCore/rendering/MediaControlElements.cpp
WebCore/rendering/MediaControlElements.h
WebCore/rendering/RenderMedia.cpp
WebCore/rendering/RenderMedia.h
WebCore/rendering/RenderSlider.cpp
WebCore/rendering/RenderSlider.h
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderTheme.h
WebCore/rendering/RenderThemeMac.h
WebCore/rendering/RenderThemeMac.mm
WebCore/rendering/style/RenderStyle.h
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebSystemInterface.m
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceTiger.a

index 59eda7d..0b1743d 100644 (file)
@@ -1,3 +1,15 @@
+2009-01-17  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Adele Peterson
+
+        <rdar://problem/6293969>
+
+        Update media controls rendering results for new controls CSS.
+
+        * platform/mac/media/audio-controls-rendering-expected.txt:
+        * platform/mac/media/video-controls-rendering-expected.txt:
+        * platform/mac/media/video-display-toggle-expected.txt:
+
 2009-01-16  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Oliver Hunt.
index f290148..30fc5fc 100644 (file)
@@ -24,7 +24,9 @@ layer at (8,42) size 17x16
 layer at (24,42) size 17x16
   RenderButton {INPUT} at (16,0) size 17x16
 layer at (40,42) size 136x16
-  RenderSlider {INPUT} at (32,0) size 136x16
+  RenderBlock (positioned) {DIV} at (32,0) size 136x16
+layer at (40,42) size 136x16
+  RenderSlider {INPUT} at (0,0) size 136x16
 layer at (42,43) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (175,42) size 17x16
@@ -41,7 +43,9 @@ layer at (8,76) size 17x16
 layer at (24,76) size 17x16
   RenderButton {INPUT} at (16,0) size 17x16
 layer at (40,76) size 256x16
-  RenderSlider {INPUT} at (32,0) size 256x16
+  RenderBlock (positioned) {DIV} at (32,0) size 256x16
+layer at (40,76) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,77) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,76) size 17x16
@@ -60,7 +64,9 @@ layer at (8,194) size 17x16
 layer at (24,194) size 17x16
   RenderButton {INPUT} at (16,84) size 17x16
 layer at (40,194) size 256x16
-  RenderSlider {INPUT} at (32,84) size 256x16
+  RenderBlock (positioned) {DIV} at (32,84) size 256x16
+layer at (40,194) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,195) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,194) size 17x16
index c022f21..ec3f0c9 100644 (file)
@@ -23,7 +23,9 @@ layer at (8,266) size 17x16
 layer at (24,266) size 17x16
   RenderButton {INPUT} at (16,224) size 17x16
 layer at (40,266) size 256x16
-  RenderSlider {INPUT} at (32,224) size 256x16
+  RenderBlock (positioned) {DIV} at (32,224) size 256x16
+layer at (40,266) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,267) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,266) size 17x16
@@ -40,7 +42,9 @@ layer at (8,506) size 17x16
 layer at (24,506) size 17x16
   RenderButton {INPUT} at (16,224) size 17x16
 layer at (40,506) size 256x16
-  RenderSlider {INPUT} at (32,224) size 256x16
+  RenderBlock (positioned) {DIV} at (32,224) size 256x16
+layer at (40,506) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,507) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,506) size 17x16
@@ -59,7 +63,9 @@ layer at (8,746) size 17x16
 layer at (24,746) size 17x16
   RenderButton {INPUT} at (16,224) size 17x16
 layer at (40,746) size 256x16
-  RenderSlider {INPUT} at (32,224) size 256x16
+  RenderBlock (positioned) {DIV} at (32,224) size 256x16
+layer at (40,746) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,747) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,746) size 17x16
index 2cd3d7e..3f97ef6 100644 (file)
@@ -20,7 +20,9 @@ layer at (8,250) size 17x16
 layer at (24,250) size 17x16
   RenderButton {INPUT} at (16,224) size 17x16
 layer at (40,250) size 256x16
-  RenderSlider {INPUT} at (32,224) size 256x16
+  RenderBlock (positioned) {DIV} at (32,224) size 256x16
+layer at (40,250) size 256x16
+  RenderSlider {INPUT} at (0,0) size 256x16
 layer at (42,251) size 13x14
   RenderBlock (relative positioned) {DIV} at (2,0) size 13x14
 layer at (295,250) size 17x16
index 09c23ff..c618c5c 100644 (file)
@@ -1,3 +1,99 @@
+2009-01-17  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Adele Peterson
+
+        Complete <rdar://problem/6293969>
+
+        * DerivedSources.make: include mediaControlsQT.css for Mac build.
+
+        * WebCore.xcodeproj/project.pbxproj: add mediaControlsQT.css
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): add MediaTimelineContainerPart, 
+        CSSValueMediaCurrentTimeDisplay, and CSSValueMediaTimeRemainingDisplay
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::extractPseudoType): include new media controller element styles
+        * css/CSSSelector.h: 
+        (WebCore::CSSSelector::): Ditto.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):  include new media 
+        controller element styles
+
+        * css/CSSValueKeywords.in: add keywords for new media time display controls
+
+        * css/mediaControls.css: adjust css for new control elements
+
+        * css/mediaControlsQT.css: Added.
+
+        * platform/ThemeTypes.h:
+        (WebCore::): add media time display controls to ControlPart
+
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm: pass controller style to WKSI functions
+
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaTextDisplayElement::MediaTextDisplayElement): Added
+        (WebCore::MediaTextDisplayElement::attachToParent): Added
+        (WebCore::MediaTextDisplayElement::update): Added
+        (WebCore::MediaTimeDisplayElement::MediaTimeDisplayElement): Added
+        (WebCore::MediaControlInputElement::MediaControlInputElement): Added
+        (WebCore::MediaControlInputElement::hitTest): Added
+        (WebCore::MediaControlTimelineElement::defaultEventHandler): Update the time display when
+        dragging the thumb
+        * rendering/MediaControlElements.h:
+        (WebCore::): Add MediaTextDisplayElement
+
+        * rendering/RenderMedia.cpp:
+        (WebCore::RenderMedia::createTimelineContainer): Added
+        (WebCore::RenderMedia::createTimeline): Parent is now the timeline container
+        (WebCore::RenderMedia::createCurrentTimeDisplay): Added
+        (WebCore::RenderMedia::createTimeRemainingDisplay): Added
+        (WebCore::RenderMedia::updateControls): Create new elements. Don't ever start the time update
+        timer when the time display elements are not visible
+        (WebCore::RenderMedia::formatTime): Handle negative times. Don't display 0 hours or minutes
+        (WebCore::RenderMedia::updateTimeDisplay): Do nothing when the time display elements are not
+        visible. Display time remaining as well as current time.
+        (WebCore::RenderMedia::updateControlVisibility): Don't assume opacity should be set to 0 when
+        visibility changes
+        (WebCore::RenderMedia::forwardEvent): Call element hitTest() method instead of local function
+        as we can't assume that all controls are rectangular
+        * rendering/RenderMedia.h: Updated
+
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::mouseEventIsInThumb): When slider is media timeline control, call 
+        element hitTest() method instead of assuming it is rectangular
+        * rendering/RenderSlider.h: make mouseEventIsInThumb virtual
+
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paint): Deal with time display and timeline container
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::paintMediaTimelineContainer): Updated
+        (WebCore::RenderTheme::paintMediaCurrentTime): Added
+        (WebCore::RenderTheme::paintMediaTimeRemaining): Added
+
+        * rendering/RenderThemeMac.h: Updated
+        * rendering/RenderThemeMac.mm:
+        (WebCore::):
+        (WebCore::mediaControllerTheme):
+        (WebCore::RenderThemeMac::adjustSliderThumbSize): Call WebKitSystemInterface to get the thumb
+        size when appropriate
+        (WebCore::RenderThemeMac::paintMediaFullscreenButton): pass controller style to render function
+        (WebCore::RenderThemeMac::paintMediaMuteButton): Ditto
+        (WebCore::RenderThemeMac::paintMediaPlayButton): Ditto
+        (WebCore::RenderThemeMac::paintMediaSeekBackButton): Ditto
+        (WebCore::RenderThemeMac::paintMediaSeekForwardButton): Ditto
+        (WebCore::RenderThemeMac::paintMediaSliderTrack): Ditto
+        (WebCore::RenderThemeMac::paintMediaSliderThumb): Ditto
+        (WebCore::RenderThemeMac::paintMediaTimelineContainer): Added
+        (WebCore::RenderThemeMac::paintMediaCurrentTime): Added
+        (WebCore::RenderThemeMac::paintMediaTimeRemaining): Added
+        (WebCore::RenderThemeMac::extraMediaControlsStyleSheet): Added
+        (WebCore::RenderThemeMac::hitTestMediaControlPart): Added
+        * rendering/style/RenderStyle.h: Updated
+        (WebCore::):
+
 2009-01-17  David Hyatt  <hyatt@apple.com>
 
         Inline a few methods in FrameView for speed.
index 3dd615f..bd77060 100644 (file)
@@ -523,6 +523,9 @@ endif
 
 ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
     USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControls.css
+ifeq ($(OS),MACOS)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControlsQT.css
+endif
 endif
 
 UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS)
index 840efee..55ee073 100644 (file)
@@ -950,4 +950,3 @@ _wkSetUpFontCache
 _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
-_wkUseSharedMediaUI
index 62b5655..d1984ef 100644 (file)
                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalCurrentGraphicsContext.h; sourceTree = "<group>"; };
                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalCurrentGraphicsContext.mm; sourceTree = "<group>"; };
                070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mediaControls.css; sourceTree = "<group>"; };
+               07AFE5900F1446BD00841617 /* mediaControlsQT.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mediaControlsQT.css; sourceTree = "<group>"; };
                080081940ED3B2DD00C53BC0 /* WMLAnchorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLAnchorElement.cpp; sourceTree = "<group>"; };
                080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAnchorElement.h; sourceTree = "<group>"; };
                0804BF6C0EE09C3B0006C000 /* WMLDoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLDoElement.cpp; sourceTree = "<group>"; };
                F523D18402DE42E8018635CA /* css */ = {
                        isa = PBXGroup;
                        children = (
+                               07AFE5900F1446BD00841617 /* mediaControlsQT.css */,
                                070DD8F50F01868000727DEB /* mediaControls.css */,
                                93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
                                A80E6CBB0A1989CA007FB8C5 /* CSSBorderImageValue.cpp */,
index fcbf06a..1712372 100644 (file)
@@ -216,6 +216,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
         case MediaSliderThumbPart:
             m_value.ident = CSSValueMediaSliderthumb;
             break;
+        case MediaTimelineContainerPart:
+            m_value.ident = CSSValueMediaTimelineContainer;
+            break;
+        case MediaCurrentTimePart:
+            m_value.ident = CSSValueMediaCurrentTimeDisplay;
+            break;
+        case MediaTimeRemainingPart:
+            m_value.ident = CSSValueMediaTimeRemainingDisplay;
+            break;
         case MenulistPart:
             m_value.ident = CSSValueMenulist;
             break;
index 515b7cd..17fbd64 100644 (file)
@@ -104,11 +104,13 @@ void CSSSelector::extractPseudoType() const
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPanel, ("-webkit-media-controls-panel"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsMuteButton, ("-webkit-media-controls-mute-button"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPlayButton, ("-webkit-media-controls-play-button"));
-    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeDisplay, ("-webkit-media-controls-time-display"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsCurrentTimeDisplay, ("-webkit-media-controls-current-time-display"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeRemainingDisplay, ("-webkit-media-controls-time-remaining-display"));
     DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not("));
     DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child"));
     DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type"));
@@ -219,8 +221,11 @@ void CSSSelector::extractPseudoType() const
     } else if (m_value == mediaControlsPlayButton) {
         m_pseudoType = PseudoMediaControlsPlayButton;
         element = true;
-    } else if (m_value == mediaControlsTimeDisplay) {
-        m_pseudoType = PseudoMediaControlsTimeDisplay;
+    } else if (m_value == mediaControlsCurrentTimeDisplay) {
+        m_pseudoType = PseudoMediaControlsCurrentTimeDisplay;
+        element = true;
+    } else if (m_value == mediaControlsTimeRemainingDisplay) {
+        m_pseudoType = PseudoMediaControlsTimeRemainingDisplay;
         element = true;
     } else if (m_value == mediaControlsTimeline) {
         m_pseudoType = PseudoMediaControlsTimeline;
@@ -234,6 +239,9 @@ void CSSSelector::extractPseudoType() const
     } else if (m_value == mediaControlsFullscreenButton) {
         m_pseudoType = PseudoMediaControlsFullscreenButton;
         element = true;
+    } else if (m_value == mediaControlsTimelineContainer) {
+        m_pseudoType = PseudoMediaControlsTimelineContainer;
+        element = true;
     } else if (m_value == notStr)
         m_pseudoType = PseudoNot;
     else if (m_value == nthChild)
index 8da11d7..728c34d 100644 (file)
@@ -167,7 +167,9 @@ namespace WebCore {
             PseudoMediaControlsPanel,
             PseudoMediaControlsMuteButton,
             PseudoMediaControlsPlayButton,
-            PseudoMediaControlsTimeDisplay,
+            PseudoMediaControlsTimelineContainer,
+            PseudoMediaControlsCurrentTimeDisplay,
+            PseudoMediaControlsTimeRemainingDisplay,
             PseudoMediaControlsTimeline,
             PseudoMediaControlsSeekBackButton,
             PseudoMediaControlsSeekForwardButton,
index 1d6949a..356b355 100644 (file)
@@ -2377,8 +2377,14 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
             case CSSSelector::PseudoMediaControlsPlayButton:
                 dynamicPseudo = RenderStyle::MEDIA_CONTROLS_PLAY_BUTTON;
                 return true;
-            case CSSSelector::PseudoMediaControlsTimeDisplay:
-                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIME_DISPLAY;
+            case CSSSelector::PseudoMediaControlsTimelineContainer:
+                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIMELINE_CONTAINER;
+                 return true;
+            case CSSSelector::PseudoMediaControlsCurrentTimeDisplay:
+                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_CURRENT_TIME_DISPLAY;
+                return true;
+            case CSSSelector::PseudoMediaControlsTimeRemainingDisplay:
+                dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIME_REMAINING_DISPLAY;
                 return true;
             case CSSSelector::PseudoMediaControlsTimeline:
                 dynamicPseudo = RenderStyle::MEDIA_CONTROLS_TIMELINE;
index 3271166..936b635 100644 (file)
@@ -506,6 +506,9 @@ media-seek-back-button
 media-seek-forward-button
 media-slider
 media-sliderthumb
+media-timeline-container
+media-current-time-display
+media-time-remaining-display
 menulist
 menulist-button
 menulist-text
index 1dbb2c3..b94abbf 100644 (file)
@@ -35,6 +35,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
     width: 100%;
     height: 100%;
     -webkit-user-select: none;
+    z-index: 0;
 }
 
 video:-webkit-full-page-media::-webkit-media-controls-panel {
@@ -61,7 +62,22 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu
     height: 16px;
 }
 
-audio::-webkit-media-controls-time-display, video::-webkit-media-controls-time-display {
+audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
+    -webkit-user-select: none;
+    position: absolute;
+    padding: 0px 16px 0px 0px;
+    top: auto;
+    bottom: 0;
+    left: 32px;
+    right: 32px;
+    height: 16px;
+}
+
+audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
+    display: none;
+}
+
+audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
     display: none;
 }
 
@@ -70,8 +86,8 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
     position: absolute;
     top: auto;
     bottom: 0;
-    left: 32px;
-    right: 32px;
+    left: 0px;
+    right: 0px;
     height: 16px;
     padding: 0px 2px;
 }
@@ -86,7 +102,6 @@ audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-se
     height: 16px;
 }
 
-
 audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
     -webkit-appearance: media-seek-forward-button;
     position: absolute;
diff --git a/WebCore/css/mediaControlsQT.css b/WebCore/css/mediaControlsQT.css
new file mode 100644 (file)
index 0000000..918c9bf
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2009 Apple Inc.  All rights reserved.
+ *
+ * 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 COMPUTER, 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 COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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. 
+ */
+
+/* alternate media controls */
+
+audio {
+    width: 200px;
+    height: 25px;
+}
+
+audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
+    -webkit-user-select: none;
+    position: absolute;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    z-index: 0;
+}
+
+video:-webkit-full-page-media::-webkit-media-controls-panel {
+    bottom: -16px;
+}
+
+audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
+    -webkit-appearance: media-mute-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    right: 0;
+    left: auto;
+    width: 30px;
+    height: 25px;
+}
+
+audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
+    -webkit-appearance: media-play-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 0px;
+    width: 30px;
+    height: 25px;
+}
+
+audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
+    -webkit-appearance: media-timeline-container;
+    -webkit-user-select: none;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 30px;
+    right: 30px;
+    height: 25px;
+}
+
+audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display {
+    -webkit-appearance: media-current-time-display;
+    -webkit-user-select: none;
+    display: inline-block;
+    position: absolute;
+    cursor: default;
+    font: -webkit-small-control;
+    font-size: .09em;
+    text-align: center;
+    overflow: hidden;
+    line-height: 13px;
+    top: auto;
+    bottom: 6px;
+    left: 0px;
+    height: 13px;
+    width: 45px;
+}
+
+audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display {
+    -webkit-appearance: media-time-remaining-display;
+    -webkit-user-select: none;
+    display: inline-block;
+    position: absolute;
+    cursor: default;
+    font: -webkit-small-control;
+    font-size: .09em;
+    text-align: center;
+    overflow: hidden;
+    line-height: 13px;
+    top: auto;
+    bottom: 6px;
+    right: 0px;
+    height: 13px;
+    width: 45px;
+}
+
+audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
+    -webkit-appearance: media-slider;
+    position: absolute;
+    top: auto;
+    bottom: 6px;
+    left: 45px;
+    right: 45px;
+    height: 13px;
+}
+
+audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
+    display: none;
+}
+
+audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
+    display: none;
+}
+
+audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
+    display: none;
+}
index 8d73ea3..ae85a63 100644 (file)
@@ -46,8 +46,9 @@ typedef unsigned ControlStates;
 enum ControlPart {
     NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart,
     ButtonBevelPart, DefaultButtonPart, ListboxPart, ListItemPart, 
-    MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart,
-    MediaSeekBackButtonPart, MediaSeekForwardButtonPart, MediaSliderPart, MediaSliderThumbPart,
+    MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart, MediaSeekBackButtonPart, 
+    MediaSeekForwardButtonPart, MediaSliderPart, MediaSliderThumbPart, MediaTimelineContainerPart,
+    MediaCurrentTimePart, MediaTimeRemainingPart, 
     MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart,
     SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
     SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
index 126533c..14d1713 100644 (file)
@@ -95,8 +95,8 @@ extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
 extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
 extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
 extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
-extern void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
-extern void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, BOOL active);
+extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
+extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active);
 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
 extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
@@ -105,8 +105,8 @@ extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response)
 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
-extern BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
-extern void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
+extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
+extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
 extern int (*wkQTMovieDataRate)(QTMovie*);
 extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
index d7ca824..b629b4e 100644 (file)
@@ -38,11 +38,10 @@ void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
 NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
 NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
 BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
-void (*wkDrawMediaSliderTrack)(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
-BOOL (*wkUseSharedMediaUI)();
-BOOL (*wkHitTestMediaUIPart)(int part, CGRect bounds, CGPoint point);
-void (*wkDrawMediaUIPart)(int part, CGContextRef context, CGRect rect, BOOL active);
-void (*wkMeasureMediaUIPart)(int part, CGRect *bounds, CGSize *naturalSize);
+void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
+BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
+void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active);
+void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
 NSString* (*wkGetMIMETypeForExtension)(NSString*);
index 48ea3ab..8ad2bd6 100644 (file)
@@ -38,6 +38,8 @@
 #include "FloatConversion.h"
 #include "Frame.h"
 #include "HTMLNames.h"
+#include "MouseEvent.h"
+#include "RenderMedia.h"
 #include "RenderSlider.h"
 #include "RenderTheme.h"
 
@@ -68,6 +70,40 @@ MediaControlShadowRootElement::MediaControlShadowRootElement(Document* doc, HTML
 
 // ----------------------------
 
+MediaTextDisplayElement::MediaTextDisplayElement(Document* doc, RenderStyle::PseudoId pseudo, HTMLMediaElement* mediaElement) 
+    : HTMLDivElement(divTag, doc)
+    , m_mediaElement(mediaElement)
+{
+    RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(pseudo);
+    RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style);
+    if (renderer) {
+        setRenderer(renderer);
+        renderer->setStyle(style);
+    }
+    setAttached();
+    setInDocument(true);
+}
+
+void MediaTextDisplayElement::attachToParent(Element* parent)
+{
+    parent->addChild(this);
+    if (renderer())
+        parent->renderer()->addChild(renderer());
+}
+
+void MediaTextDisplayElement::update()
+{
+    if (renderer())
+        renderer()->updateFromElement();
+}
+
+MediaTimeDisplayElement::MediaTimeDisplayElement(Document* doc, HTMLMediaElement* element, bool currentTime)
+    : MediaTextDisplayElement(doc, currentTime ? RenderStyle::MEDIA_CONTROLS_CURRENT_TIME_DISPLAY : RenderStyle::MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, element)
+{
+}
+
+// ----------------------------
+
 MediaControlInputElement::MediaControlInputElement(Document* doc, RenderStyle::PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement) 
     : HTMLInputElement(inputTag, doc)
     , m_mediaElement(mediaElement)
@@ -211,6 +247,7 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event)
         ExceptionCode ec;
         m_mediaElement->setCurrentTime(time, ec);
     }
+
     // Media element stays in non-paused state when it reaches end. If the slider is now dragged
     // to some other position the playback resumes which does not match usual media player UIs.
     // Get the expected behavior by pausing explicitly in this case.
@@ -218,10 +255,13 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event)
         ExceptionCode ec;
         m_mediaElement->pause(ec);
     }
+
     // Pause playback during drag, but do it without using DOM API which would generate events 
     bool inDragMode = slider && slider->inDragMode();
     if (inDragMode != oldInDragMode)
         m_mediaElement->setPausedInternal(inDragMode);
+    if (inDragMode)
+        static_cast<RenderMedia*>(m_mediaElement->renderer())->updateTimeDisplay();
 }
 
 void MediaControlTimelineElement::update(bool updateDuration) 
index 4741534..c1c9574 100644 (file)
@@ -61,6 +61,25 @@ private:
     HTMLMediaElement* m_mediaElement;    
 };
 
+ // ----------------------------
+class MediaTextDisplayElement : public HTMLDivElement
+{
+public:
+    MediaTextDisplayElement(Document*, RenderStyle::PseudoId, HTMLMediaElement*);
+    void attachToParent(Element*);
+    void update();
+protected:
+    HTMLMediaElement* m_mediaElement;   
+};
+
+// ----------------------------
+
+class MediaTimeDisplayElement : public MediaTextDisplayElement {
+public:
+    MediaTimeDisplayElement(Document*, HTMLMediaElement*, bool currentTime);
+};
+
 // ----------------------------
 
 class MediaControlInputElement : public HTMLInputElement {
index 366f02b..1d66af6 100644 (file)
@@ -82,6 +82,11 @@ RenderMedia::~RenderMedia()
 void RenderMedia::destroy()
 {
     if (m_controlsShadowRoot && m_controlsShadowRoot->renderer()) {
+
+        // detach the panel before removing the shadow renderer to prevent a crash in m_controlsShadowRoot->detach() 
+        //  when display: style changes
+        m_panel->detach();
+
         removeChild(m_controlsShadowRoot->renderer());
         m_controlsShadowRoot->detach();
     }
@@ -186,27 +191,41 @@ void RenderMedia::createSeekForwardButton()
     m_seekForwardButton->attachToParent(m_panel.get());
 }
 
+void RenderMedia::createTimelineContainer()
+{
+    ASSERT(!m_timelineContainer);
+    RenderStyle* style = getCachedPseudoStyle(RenderStyle::MEDIA_CONTROLS_TIMELINE_CONTAINER);
+    m_timelineContainer = new HTMLDivElement(HTMLNames::divTag, document());
+    RenderObject* renderer = m_timelineContainer->createRenderer(renderArena(), style);
+    if (renderer) {
+        m_timelineContainer->setRenderer(renderer);
+        renderer->setStyle(style);
+        m_timelineContainer->setAttached();
+        m_timelineContainer->setInDocument(true);
+        m_panel->addChild(m_timelineContainer);
+        m_panel->renderer()->addChild(renderer);
+    }
+}
+
 void RenderMedia::createTimeline()
 {
     ASSERT(!m_timeline);
     m_timeline = new MediaControlTimelineElement(document(), mediaElement());
-    m_timeline->attachToParent(m_panel.get());
+    m_timeline->attachToParent(m_timelineContainer.get());
 }
   
-void RenderMedia::createTimeDisplay()
+void RenderMedia::createCurrentTimeDisplay()
 {
-    ASSERT(!m_timeDisplay);
-    RenderStyle* style = getCachedPseudoStyle(RenderStyle::MEDIA_CONTROLS_TIME_DISPLAY);
-    m_timeDisplay = new HTMLDivElement(HTMLNames::divTag, document());
-    RenderObject* renderer = m_timeDisplay->createRenderer(renderArena(), style);
-    if (renderer) {
-        m_timeDisplay->setRenderer(renderer);
-        renderer->setStyle(style);
-        m_timeDisplay->setAttached();
-        m_timeDisplay->setInDocument(true);
-        m_panel->addChild(m_timeDisplay);
-        m_panel->renderer()->addChild(renderer);
-    }
+    ASSERT(!m_currentTimeDisplay);
+    m_currentTimeDisplay = new MediaTimeDisplayElement(document(), mediaElement(), true);
+    m_currentTimeDisplay->attachToParent(m_timelineContainer.get());
+}
+
+void RenderMedia::createTimeRemainingDisplay()
+{
+    ASSERT(!m_timeRemainingDisplay);
+    m_timeRemainingDisplay = new MediaTimeDisplayElement(document(), mediaElement(), false);
+    m_timeRemainingDisplay->attachToParent(m_timelineContainer.get());
 }
 
 void RenderMedia::createFullscreenButton()
@@ -230,10 +249,12 @@ void RenderMedia::updateControls()
             m_panel = 0;
             m_muteButton = 0;
             m_playButton = 0;
+            m_timelineContainer = 0;
             m_timeline = 0;
             m_seekBackButton = 0;
             m_seekForwardButton = 0;
-            m_timeDisplay = 0;
+            m_currentTimeDisplay = 0;
+            m_timeRemainingDisplay = 0;
             m_fullscreenButton = 0;
             m_controlsShadowRoot = 0;
         }
@@ -248,17 +269,23 @@ void RenderMedia::updateControls()
         createPanel();
         createMuteButton();
         createPlayButton();
+        createTimelineContainer();
         createTimeline();
         createSeekBackButton();
         createSeekForwardButton();
-        createTimeDisplay();
+        createCurrentTimeDisplay();
+        createTimeRemainingDisplay();
         createFullscreenButton();
     }
-    
-    if (media->paused() || media->ended() || media->networkState() < HTMLMediaElement::LOADED_METADATA)
-        m_timeUpdateTimer.stop();
-    else
+
+    if (media->paused() || media->ended() || media->networkState() < HTMLMediaElement::LOADED_METADATA) {
+        if (m_timeUpdateTimer.isActive())
+            m_timeUpdateTimer.stop();
+    } else if (style()->visibility() == VISIBLE && m_timeline && m_timeline->renderer() && m_timeline->renderer()->style()->display() != NONE ) {
         m_timeUpdateTimer.startRepeating(cTimeUpdateRepeatDelay);
+    }
+
+    m_previousVisible = style()->visibility();
     
     if (m_muteButton)
         m_muteButton->update();
@@ -287,30 +314,45 @@ String RenderMedia::formatTime(float time)
 {
     if (!isfinite(time))
         time = 0;
-    int seconds = (int)time
+    int seconds = (int)fabsf(time)
     int hours = seconds / (60 * 60);
     int minutes = (seconds / 60) % 60;
     seconds %= 60;
-    return String::format("%02d:%02d:%02d", hours, minutes, seconds);
+    if (hours) {
+        if (hours > 9)
+            return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
+        else
+            return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
+    }
+    else
+        return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
 }
 
 void RenderMedia::updateTimeDisplay()
 {
-    if (!m_timeDisplay)
+    if (!m_currentTimeDisplay || !m_currentTimeDisplay->renderer() || m_currentTimeDisplay->renderer()->style()->display() == NONE || style()->visibility() != VISIBLE)
         return;
-    String timeString = formatTime(mediaElement()->currentTime());
+    float now = mediaElement()->currentTime();
+    float duration = mediaElement()->duration();
+
+    String timeString = formatTime(now);
     ExceptionCode ec;
-    m_timeDisplay->setInnerText(timeString, ec);
-}
+    m_currentTimeDisplay->setInnerText(timeString, ec);
     
+    timeString = formatTime(now - duration);
+    m_timeRemainingDisplay->setInnerText(timeString, ec);
+}
+
 void RenderMedia::updateControlVisibility() 
 {
     if (!m_panel || !m_panel->renderer())
         return;
+
     // Don't fade for audio controls.
     HTMLMediaElement* media = mediaElement();
     if (player() && !player()->hasVideo() || !media->isVideo())
         return;
+
     // do fading manually, css animations don't work well with shadow trees
     bool visible = style()->visibility() == VISIBLE && (m_mouseOver || media->paused() || media->ended() || media->networkState() < HTMLMediaElement::LOADED_METADATA);
     if (visible == (m_opacityAnimationTo > 0))
@@ -320,7 +362,7 @@ void RenderMedia::updateControlVisibility()
         // don't fade gradually if it the element has just changed visibility
         m_previousVisible = style()->visibility();
         m_opacityAnimationTo = m_previousVisible == VISIBLE ? 1.0f : 0;
-        changeOpacity(m_panel.get(), 0);
+        changeOpacity(m_panel.get(), m_opacityAnimationTo);
         return;
     }
 
index 8f48caf..a4670e9 100644 (file)
@@ -40,6 +40,7 @@ class MediaControlPlayButtonElement;
 class MediaControlSeekButtonElement;
 class MediaControlTimelineElement;
 class MediaControlFullscreenButtonElement;
+class MediaTimeDisplayElement;
 class MediaPlayer;
 
 class RenderMedia : public RenderReplaced {
@@ -66,6 +67,7 @@ public:
     void updateFromElement();
     void updatePlayer();
     void updateControls();
+    void updateTimeDisplay();
     
     void forwardEvent(Event*);
 
@@ -75,17 +77,19 @@ public:
 
 private:
     void createControlsShadowRoot();
+    void destroyControlsShadowRoot();
     void createPanel();
     void createMuteButton();
     void createPlayButton();
     void createSeekBackButton();
     void createSeekForwardButton();
+    void createTimelineContainer();
     void createTimeline();
-    void createTimeDisplay();
+    void createCurrentTimeDisplay();
+    void createTimeRemainingDisplay();
     void createFullscreenButton();
     
     void timeUpdateTimerFired(Timer<RenderMedia>*);
-    void updateTimeDisplay();
     
     void updateControlVisibility();
     void changeOpacity(HTMLElement*, float opacity);
@@ -99,7 +103,9 @@ private:
     RefPtr<MediaControlSeekButtonElement> m_seekForwardButton;
     RefPtr<MediaControlTimelineElement> m_timeline;
     RefPtr<MediaControlFullscreenButtonElement> m_fullscreenButton;
-    RefPtr<HTMLElement> m_timeDisplay;
+    RefPtr<HTMLElement> m_timelineContainer;
+    RefPtr<MediaTimeDisplayElement> m_currentTimeDisplay;
+    RefPtr<MediaTimeDisplayElement> m_timeRemainingDisplay;
     EventTargetNode* m_lastUnderNode;
     EventTargetNode* m_nodeUnderMouse;
     
index 040fa31..d2256cb 100644 (file)
@@ -31,6 +31,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLDivElement.h"
 #include "HTMLNames.h"
+#include "MediaControlElements.h"
 #include "MouseEvent.h"
 #include "RenderTheme.h"
 #include <wtf/MathExtras.h>
@@ -258,10 +259,16 @@ bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt)
 {
     if (!m_thumb || !m_thumb->renderer())
         return false;
-    FloatPoint localPoint = m_thumb->renderer()->absoluteToLocal(FloatPoint(evt->pageX(), evt->pageY()), false, true);
-    IntRect thumbBounds = m_thumb->renderer()->borderBox();
-    return thumbBounds.contains(roundedIntPoint(localPoint));
+
+    if (style()->appearance() == MediaSliderPart) {
+        MediaControlInputElement *sliderThumb = static_cast<MediaControlInputElement*>(m_thumb->renderer()->node());
+        IntPoint absPoint(evt->pageX(), evt->pageY());
+        return sliderThumb->hitTest(absPoint);
+    } else {
+        FloatPoint localPoint = m_thumb->renderer()->absoluteToLocal(FloatPoint(evt->pageX(), evt->pageY()), false, true);
+        IntRect thumbBounds = m_thumb->renderer()->borderBox();
+        return thumbBounds.contains(roundedIntPoint(localPoint));
+    }
 }
 
 void RenderSlider::setValueForPosition(int position)
index 2667672..95ceb0b 100644 (file)
@@ -44,7 +44,7 @@ namespace WebCore {
         virtual void layout();
         virtual void updateFromElement();
         
-        bool mouseEventIsInThumb(MouseEvent*);
+        virtual bool mouseEventIsInThumb(MouseEvent*);
 
         void setValueForPosition(int position);
         double setPositionFromValue(bool inLayout = false);
index aa18407..b2388fb 100644 (file)
@@ -268,6 +268,12 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf
             if (o->parent()->isSlider())
                 return paintMediaSliderThumb(o, paintInfo, r);
             break;
+        case MediaTimeRemainingPart:
+            return paintMediaTimeRemaining(o, paintInfo, r);
+        case MediaCurrentTimePart:
+            return paintMediaCurrentTime(o, paintInfo, r);
+        case MediaTimelineContainerPart:
+            return paintMediaTimelineContainer(o, paintInfo, r);
         case MenulistButtonPart:
         case TextFieldPart:
         case TextAreaPart:
index f948936..b2fc742 100644 (file)
@@ -144,6 +144,7 @@ public:
     virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return 0; };
 
 #if ENABLE(VIDEO)
+    // Media controls
     virtual bool hitTestMediaControlPart(RenderObject*, const IntPoint& absPoint);
 #endif
 
@@ -203,6 +204,9 @@ protected:
     virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
     virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
     virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+    virtual bool paintMediaTimelineContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+    virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+    virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
 
 public:
     // Methods for state querying
index a1da7ff..46bce3d 100644 (file)
@@ -109,6 +109,7 @@ protected:
     virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 
+#if ENABLE(VIDEO)
     virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
@@ -116,6 +117,14 @@ protected:
     virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+    virtual bool paintMediaTimelineContainer(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+    virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+    virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+    // Media controls
+    virtual bool hitTestMediaControlPart(RenderObject*, const IntPoint& absPoint);
+    virtual String extraMediaControlsStyleSheet();
+#endif
 
 private:
     IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
index e98a096..9d990f8 100644 (file)
@@ -37,6 +37,7 @@
 #import "RenderView.h"
 #import "SharedBuffer.h"
 #import "WebCoreSystemInterface.h"
+#import "UserAgentStyleSheets.h"
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 #import <wtf/RetainPtr.h>
@@ -1139,23 +1140,6 @@ bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::Paint
     return false;
 }
 
-const int sliderThumbWidth = 15;
-const int sliderThumbHeight = 15;
-const int mediaSliderThumbWidth = 13;
-const int mediaSliderThumbHeight = 14;
-
-void RenderThemeMac::adjustSliderThumbSize(RenderObject* o) const
-{
-    float zoomLevel = o->style()->effectiveZoom();
-    if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) {
-        o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed));
-        o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed));
-    } else if (o->style()->appearance() == MediaSliderThumbPart) {
-        o->style()->setWidth(Length(mediaSliderThumbWidth, Fixed));
-        o->style()->setHeight(Length(mediaSliderThumbHeight, Fixed));
-    }
-}
-
 bool RenderThemeMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
     NSSearchFieldCell* search = this->search();
@@ -1387,6 +1371,71 @@ bool RenderThemeMac::paintSearchFieldResultsButton(RenderObject* o, const Render
     return false;
 }
 
+#if ENABLE(VIDEO)
+typedef enum {
+    MediaControllerThemeClassic   = 1,
+    MediaControllerThemeQT        = 2
+} MediaControllerThemeStyle;
+
+static int mediaControllerTheme()
+{
+    static const long minimumQuickTimeVersion = 0x07600000; // 7.6
+    static SInt32 quickTimeVersion = 0;
+
+    if (!quickTimeVersion) {
+        OSErr err;
+        err = Gestalt(gestaltQuickTime, &quickTimeVersion);
+        if (err != noErr)
+            return MediaControllerThemeClassic;
+    }
+    if (quickTimeVersion < minimumQuickTimeVersion)
+        return MediaControllerThemeClassic;
+
+    // keep the feature off for now without an explicit opt-in
+    Boolean validKey;
+    Boolean useQTMediaUI = CFPreferencesGetAppBooleanValue(CFSTR("UseQuickTimeMediaUI"), CFSTR("com.apple.WebCore"), &validKey);
+    if (!validKey || !useQTMediaUI)
+        return MediaControllerThemeClassic;
+
+    return MediaControllerThemeQT;
+}
+#endif
+
+const int sliderThumbWidth = 15;
+const int sliderThumbHeight = 15;
+const int mediaSliderThumbWidth = 13;
+const int mediaSliderThumbHeight = 14;
+
+void RenderThemeMac::adjustSliderThumbSize(RenderObject* o) const
+{
+    float zoomLevel = o->style()->effectiveZoom();
+    if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) {
+        o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed));
+        o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed));
+    } 
+
+#if ENABLE(VIDEO)
+    else if (o->style()->appearance() == MediaSliderThumbPart) {
+        int width = mediaSliderThumbWidth;
+        int height = mediaSliderThumbHeight;
+        
+        if (mediaControllerTheme() == MediaControllerThemeQT) {
+            CGSize  size;
+            
+            wkMeasureMediaUIPart(MediaSliderThumb, MediaControllerThemeQT, NULL, &size);
+            width = size.width;
+            height = size.height;
+        }
+
+        o->style()->setWidth(Length(width, Fixed));
+        o->style()->setHeight(Length(height, Fixed));
+    }
+#endif
+}
+
+
+#if ENABLE(VIDEO)
+
 bool RenderThemeMac::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
     Node* node = o->element();
@@ -1394,7 +1443,7 @@ bool RenderThemeMac::paintMediaFullscreenButton(RenderObject* o, const RenderObj
         return false;
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(MediaFullscreenButton, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(MediaFullscreenButton, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
@@ -1410,7 +1459,7 @@ bool RenderThemeMac::paintMediaMuteButton(RenderObject* o, const RenderObject::P
         return false;
     
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
@@ -1426,7 +1475,7 @@ bool RenderThemeMac::paintMediaPlayButton(RenderObject* o, const RenderObject::P
         return false;
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
@@ -1437,7 +1486,7 @@ bool RenderThemeMac::paintMediaSeekBackButton(RenderObject* o, const RenderObjec
         return false;
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(MediaSeekBackButton, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(MediaSeekBackButton, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
@@ -1448,7 +1497,7 @@ bool RenderThemeMac::paintMediaSeekForwardButton(RenderObject* o, const RenderOb
         return false;
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(MediaSeekForwardButton, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(MediaSeekForwardButton, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
@@ -1472,7 +1521,7 @@ bool RenderThemeMac::paintMediaSliderTrack(RenderObject* o, const RenderObject::
         currentTime = player->currentTime();
     }
  
-    wkDrawMediaSliderTrack(paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration);
+    wkDrawMediaSliderTrack(mediaControllerTheme(), paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration);
     return false;
 }
 
@@ -1483,10 +1532,63 @@ bool RenderThemeMac::paintMediaSliderThumb(RenderObject* o, const RenderObject::
         return false;
 
     LocalCurrentGraphicsContext localContext(paintInfo.context);
-    wkDrawMediaUIPart(MediaSliderThumb, paintInfo.context->platformContext(), r, node->active());
+    wkDrawMediaUIPart(MediaSliderThumb, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
+    return false;
+}
+
+bool RenderThemeMac::paintMediaTimelineContainer(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+    Node* node = o->element();
+    if (!node)
+        return false;
+
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaTimelineContainer, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
+    return false;
+}
+
+bool RenderThemeMac::paintMediaCurrentTime(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+    Node* node = o->element();
+    if (!node)
+        return false;
+
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaCurrentTimeDisplay, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
     return false;
 }
 
+bool RenderThemeMac::paintMediaTimeRemaining(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+    Node* node = o->element();
+    if (!node)
+        return false;
+
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaTimeRemainingDisplay, mediaControllerTheme(), paintInfo.context->platformContext(), r, node->active());
+    return false;
+}
+
+String RenderThemeMac::extraMediaControlsStyleSheet()
+{
+    if (mediaControllerTheme() == MediaControllerThemeQT) 
+        return String(mediaControlsQTUserAgentStyleSheet, sizeof(mediaControlsQTUserAgentStyleSheet));
+    else
+        return String();
+}
+
+bool RenderThemeMac::hitTestMediaControlPart(RenderObject* o, const IntPoint& absPoint)
+{
+    if (mediaControllerTheme() == MediaControllerThemeQT) {
+        ControlPart part = o->style()->appearance();
+        FloatPoint localPoint = o->absoluteToLocal(absPoint, false, true);  // respect transforms
+        return wkHitTestMediaUIPart(part - MediaFullscreenButtonPart, MediaControllerThemeQT, CGRect(o->borderBox()), CGPoint(localPoint));
+    }
+    else
+        return RenderTheme::hitTestMediaControlPart(o, absPoint);
+}
+#endif
+
 NSPopUpButtonCell* RenderThemeMac::popupButton() const
 {
     if (!m_popupButton) {
index 0492b16..85e51fe 100644 (file)
@@ -111,8 +111,9 @@ public:
     // static pseudo styles. Dynamic ones are produced on the fly.
     enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
                     SLIDER_THUMB, SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
-                    MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIME_DISPLAY,
-                    MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON , MEDIA_CONTROLS_FULLSCREEN_BUTTON,
+                    MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
+                    MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, MEDIA_CONTROLS_SEEK_BACK_BUTTON, 
+                    MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, 
                     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER };
     static const int FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON;
 
index 32238ae..1303162 100644 (file)
@@ -1,3 +1,12 @@
+2009-01-17  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Adele Peterson
+
+        Complete <rdar://problem/6293969>
+
+        * WebCoreSupport/WebSystemInterface.m:
+        (InitWebCoreSystemInterface): Remove UseSharedMediaUI
+
 2009-01-15  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Dan Bernstein
index e7ef03b..52f5583 100644 (file)
@@ -93,7 +93,5 @@ void InitWebCoreSystemInterface(void)
     INIT(SupportsMultipartXMixedReplace);
 #endif
 
-    INIT(UseSharedMediaUI);
-
     didInit = true;
 }
index ad107de..0aca1a7 100644 (file)
@@ -200,11 +200,15 @@ typedef enum {
     WKMediaUIPartTimeRemainingDisplay= 11
 } WKMediaUIPart;
 
-BOOL WKUseSharedMediaUI();
-BOOL WKHitTestMediaUIPart(int part, CGRect bounds, CGPoint point);
-void WKMeasureMediaUIPart(int part, CGRect *bounds, CGSize *naturalSize);
-void WKDrawMediaUIPart(int part, CGContextRef context, CGRect rect, BOOL active);
-void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
+typedef enum {
+    WKMediaControllerThemeClassic   = 1,
+    WKMediaControllerThemeQT        = 2
+} WKMediaControllerThemeStyle;
+
+BOOL WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
+void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
+void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, BOOL active);
+void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration);
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && defined(__x86_64__)
 mach_port_t WKInitializeRenderServer(void);
index 4890aee..539905d 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 6a92383..d556a39 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceTiger.a and b/WebKitLibraries/libWebKitSystemInterfaceTiger.a differ