Refactor Media Control Elements to remove code duplication.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 04:01:13 +0000 (04:01 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 04:01:13 +0000 (04:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101877

Patch by Silvia Pfeiffer <silviapf@chromium.org> on 2012-12-04
Reviewed by Eric Carlson.

Instead of having two different types of inheritance trees for
MediaControlElement and MediaControlInputElement, this
creates a stand-alone virtual class MediaControlElement that
provides the common functions: show(), hide(), isShowing(),
setMediaController(), displayType(), isMediaControlElement(),
shadowPseudoId(), mediaController(), setDisplayType().

The individual elements inherit from MediaControlElement and
either HTMLInputElement or HTMLDivElement. They extend/override
the base functions as appropriate.

As part of this, the RenderXXX classes mixed in between the media
controls in MediaControlElements.cpp are also moved to
rendering/RenderMediaControls.h/cpp to follow common code separation.

No new tests since this is just a refactoring.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Build files extended with new files.

* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::textTracksIndexNotFound):
Replaced const with function, since it is used in multiple files.

* html/shadow/MediaControlElementTypes.cpp: new file
* html/shadow/MediaControlElementTypes.h: new file
Added new MediaControlElement class. Moved MediaControlDivElement and MediaControlInputElement
classes into these files from MediaControlElements.cpp/h. Moved MediaControlElementTypes enum
into these. Moved other media control element classes that are the basis for inheriting media
control elements into these (MediaControlTimeDisplayElement, MediaControlMuteButtonElement,
MediaControlSeekButtonElement, MediaControlVolumeSliderElement).

* html/shadow/MediaControlElements.cpp:
* html/shadow/MediaControlElements.h:
Removed common functions between media elements that are now in the common
base class MediaControlElement.
Also moved common base classes to MediaControlElementTypes.h/cpp

* html/shadow/MediaControls.cpp:
* html/shadow/MediaControls.h:
Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
to be consistent in inheritance tree. Updated copyright date.

* html/shadow/MediaControlsApple.cpp:
* html/shadow/MediaControlsApple.h:
Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
to be consistent in inheritance tree. Updated copyright dates.n

* html/shadow/MediaControlsChromium.cpp:
* html/shadow/MediaControlsChromium.h:
Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
to be consistent in inheritance tree.
Moved enclosure element definitions to common MediaControlElements.cpp/h
file through which different media elements are made available to different ports.

* html/shadow/MediaControlsChromiumAndroid.cpp:
* html/shadow/MediaControlsChromiumAndroid.h:
Moved enclosure for overlay button to MediaControlElements.cpp/h files
through which different media elements are made available to different ports.

* rendering/RenderMediaControlElements.cpp: new file
* rendering/RenderMediaControlElements.h: new file
Moved rendering classes for media control elements into these files from
MediaControlElements.cpp/h.

* rendering/RenderThemeMac.mm:
Added new RenderMediaControlElements.h file.

* rendering/RenderingAllInOne.cpp:
Added new RenderMediaControlEleemnt.cpp file.

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

24 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/shadow/MediaControlElementTypes.cpp [new file with mode: 0644]
Source/WebCore/html/shadow/MediaControlElementTypes.h [new file with mode: 0644]
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/html/shadow/MediaControlElements.h
Source/WebCore/html/shadow/MediaControls.cpp
Source/WebCore/html/shadow/MediaControls.h
Source/WebCore/html/shadow/MediaControlsApple.cpp
Source/WebCore/html/shadow/MediaControlsApple.h
Source/WebCore/html/shadow/MediaControlsChromium.cpp
Source/WebCore/html/shadow/MediaControlsChromium.h
Source/WebCore/html/shadow/MediaControlsChromiumAndroid.cpp
Source/WebCore/html/shadow/MediaControlsChromiumAndroid.h
Source/WebCore/rendering/RenderMediaControlElements.cpp [new file with mode: 0644]
Source/WebCore/rendering/RenderMediaControlElements.h [new file with mode: 0644]
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderingAllInOne.cpp

index 9afa724..a155b18 100644 (file)
@@ -1544,8 +1544,9 @@ SET(WebCore_SOURCES
     html/shadow/HTMLShadowElement.cpp
     html/shadow/ImageInnerElement.cpp
     html/shadow/InsertionPoint.cpp
-    html/shadow/MediaControls.cpp
+    html/shadow/MediaControlElementTypes.cpp
     html/shadow/MediaControlElements.cpp
+    html/shadow/MediaControls.cpp
     html/shadow/MediaControlsApple.cpp
     html/shadow/MeterShadowElement.cpp
     html/shadow/ProgressShadowElement.cpp
@@ -2127,6 +2128,8 @@ SET(WebCore_SOURCES
     rendering/RenderListMarker.cpp
     rendering/RenderMarquee.cpp
     rendering/RenderMedia.cpp
+    rendering/RenderMediaControlElements.cpp
+    rendering/RenderMediaControls.cpp
     rendering/RenderMenuList.cpp
     rendering/RenderMeter.cpp
     rendering/RenderMultiColumnBlock.cpp
index f4da6e5..fdb95cc 100644 (file)
@@ -1,3 +1,86 @@
+2012-12-04  Silvia Pfeiffer  <silviapf@chromium.org>
+
+        Refactor Media Control Elements to remove code duplication.
+        https://bugs.webkit.org/show_bug.cgi?id=101877
+
+        Reviewed by Eric Carlson.
+
+        Instead of having two different types of inheritance trees for
+        MediaControlElement and MediaControlInputElement, this
+        creates a stand-alone virtual class MediaControlElement that
+        provides the common functions: show(), hide(), isShowing(),
+        setMediaController(), displayType(), isMediaControlElement(),
+        shadowPseudoId(), mediaController(), setDisplayType().
+
+        The individual elements inherit from MediaControlElement and
+        either HTMLInputElement or HTMLDivElement. They extend/override
+        the base functions as appropriate.
+
+        As part of this, the RenderXXX classes mixed in between the media
+        controls in MediaControlElements.cpp are also moved to
+        rendering/RenderMediaControls.h/cpp to follow common code separation.
+
+        No new tests since this is just a refactoring.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        Build files extended with new files.
+
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::textTracksIndexNotFound):
+        Replaced const with function, since it is used in multiple files.
+
+        * html/shadow/MediaControlElementTypes.cpp: new file
+        * html/shadow/MediaControlElementTypes.h: new file
+        Added new MediaControlElement class. Moved MediaControlDivElement and MediaControlInputElement
+        classes into these files from MediaControlElements.cpp/h. Moved MediaControlElementTypes enum
+        into these. Moved other media control element classes that are the basis for inheriting media
+        control elements into these (MediaControlTimeDisplayElement, MediaControlMuteButtonElement,
+        MediaControlSeekButtonElement, MediaControlVolumeSliderElement).
+
+        * html/shadow/MediaControlElements.cpp:
+        * html/shadow/MediaControlElements.h:
+        Removed common functions between media elements that are now in the common
+        base class MediaControlElement.
+        Also moved common base classes to MediaControlElementTypes.h/cpp
+
+        * html/shadow/MediaControls.cpp:
+        * html/shadow/MediaControls.h:
+        Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
+        to be consistent in inheritance tree. Updated copyright date.
+
+        * html/shadow/MediaControlsApple.cpp:
+        * html/shadow/MediaControlsApple.h:
+        Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
+        to be consistent in inheritance tree. Updated copyright dates.n
+
+        * html/shadow/MediaControlsChromium.cpp:
+        * html/shadow/MediaControlsChromium.h:
+        Renamed MediaControlVolumeSliderElement to MediaControlPanelVolumeSliderElement
+        to be consistent in inheritance tree.
+        Moved enclosure element definitions to common MediaControlElements.cpp/h
+        file through which different media elements are made available to different ports.
+
+        * html/shadow/MediaControlsChromiumAndroid.cpp:
+        * html/shadow/MediaControlsChromiumAndroid.h:
+        Moved enclosure for overlay button to MediaControlElements.cpp/h files
+        through which different media elements are made available to different ports.
+
+        * rendering/RenderMediaControlElements.cpp: new file
+        * rendering/RenderMediaControlElements.h: new file
+        Moved rendering classes for media control elements into these files from
+        MediaControlElements.cpp/h.
+
+        * rendering/RenderThemeMac.mm:
+        Added new RenderMediaControlElements.h file.
+
+        * rendering/RenderingAllInOne.cpp:
+        Added new RenderMediaControlEleemnt.cpp file.
+
 2012-12-04  Kenneth Russell  <kbr@google.com>
 
         Associate URLs with GraphicsContext3D instances created for WebGL
index 7ee344a..ba7deec 100644 (file)
@@ -3560,10 +3560,12 @@ webcore_sources += \
        Source/WebCore/html/shadow/InsertionPoint.h \
        Source/WebCore/html/shadow/ImageInnerElement.cpp \
        Source/WebCore/html/shadow/ImageInnerElement.h \
-       Source/WebCore/html/shadow/MediaControls.cpp \
-       Source/WebCore/html/shadow/MediaControls.h \
        Source/WebCore/html/shadow/MediaControlElements.cpp \
        Source/WebCore/html/shadow/MediaControlElements.h \
+       Source/WebCore/html/shadow/MediaControlElementTypes.cpp \
+       Source/WebCore/html/shadow/MediaControlElementTypes.h \
+       Source/WebCore/html/shadow/MediaControls.cpp \
+       Source/WebCore/html/shadow/MediaControls.h \
        Source/WebCore/html/shadow/MediaControlsApple.cpp \
        Source/WebCore/html/shadow/MediaControlsApple.h \
        Source/WebCore/html/shadow/MeterShadowElement.cpp \
@@ -4325,6 +4327,10 @@ webcore_sources += \
        Source/WebCore/rendering/RenderMarquee.h \
        Source/WebCore/rendering/RenderMedia.cpp \
        Source/WebCore/rendering/RenderMedia.h \
+       Source/WebCore/rendering/RenderMediaControlElements.cpp \
+       Source/WebCore/rendering/RenderMediaControlElements.h \
+       Source/WebCore/rendering/RenderMediaControls.cpp \
+       Source/WebCore/rendering/RenderMediaControls.h \
        Source/WebCore/rendering/RenderMenuList.cpp \
        Source/WebCore/rendering/RenderMenuList.h \
        Source/WebCore/rendering/RenderMeter.cpp \
index 34cd638..095b2bb 100644 (file)
@@ -1873,7 +1873,10 @@ HEADERS += \
     html/shadow/ContentSelectorQuery.h \
     html/shadow/HTMLContentElement.h \
     html/shadow/HTMLShadowElement.h \
+    html/shadow/MediaControlElementTypes.h \
     html/shadow/MediaControlElements.h \
+    html/shadow/MediaControls.h \
+    html/shadow/MediaControlsApple.h \
     html/shadow/DetailsMarkerControl.h \
     html/track/InbandTextTrack.h \
     html/track/InbandTextTrackPrivate.h \
@@ -2409,6 +2412,8 @@ HEADERS += \
     rendering/RenderListItem.h \
     rendering/RenderListMarker.h \
     rendering/RenderMarquee.h \
+    rendering/RenderMediaControlElements.h \
+    rendering/RenderMediaControls.h \
     rendering/RenderMedia.h \
     rendering/RenderMenuList.h \
     rendering/RenderMeter.h \
@@ -3222,11 +3227,14 @@ enable?(VIDEO) {
         html/HTMLVideoElement.cpp \
         html/MediaController.cpp \
         html/MediaFragmentURIParser.cpp \
+        html/shadow/MediaControlElementTypes.cpp \
         html/shadow/MediaControlElements.cpp \
         html/TimeRanges.cpp \
         platform/graphics/MediaPlayer.cpp \
         rendering/RenderVideo.cpp \
-        rendering/RenderMedia.cpp
+        rendering/RenderMedia.cpp \
+        rendering/RenderMediaControls.cpp \
+        rendering/RenderMediaControlElements.cpp
 
     use?(QTKIT) {
         INCLUDEPATH += \
index 6fbe24c..2649443 100644 (file)
             'rendering/RenderMarquee.h',
             'rendering/RenderMedia.cpp',
             'rendering/RenderMedia.h',
+            'rendering/RenderMediaControlElements.cpp',
+            'rendering/RenderMediaControlElements.h',
             'rendering/RenderMediaControls.cpp',
             'rendering/RenderMediaControls.h',
             'rendering/RenderMediaControlsChromium.cpp',
             'html/shadow/InsertionPoint.h',
             'html/shadow/MediaControls.cpp',
             'html/shadow/MediaControls.h',
+            'html/shadow/MediaControlElementTypes.cpp',
+            'html/shadow/MediaControlElementTypes.h',
             'html/shadow/MediaControlElements.cpp',
             'html/shadow/MediaControlElements.h',
             'html/shadow/MediaControlsChromium.cpp',
index a9970e6..a8af90f 100755 (executable)
                                </FileConfiguration>
                        </File>
                        <File
+                               RelativePath="..\rendering\RenderMediaControlElements.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Production|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\rendering\RenderMediaControlElements.h"
+                               >
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
                                RelativePath="..\rendering\RenderMenuList.cpp"
                                >
                                <FileConfiguration
                                        >
                                </File>
                                <File
+                                       RelativePath="..\html\shadow\MediaControlElementTypes.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\html\shadow\MediaControlElementTypes.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\html\shadow\MediaControlElements.cpp"
                                        >
                                </File>
index 0d0f51b..c20c1c5 100644 (file)
                DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DD763BB10992C2C900740B8E /* libxml2.dylib */; };
                DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */; };
                DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14750B7D1BAF00A53FFD /* DOMTextEvent.h */; };
+               DE49B309165F2FE10010338D /* RenderMediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE49B307165F2FE10010338D /* RenderMediaControlElements.cpp */; };
+               DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */ = {isa = PBXBuildFile; fileRef = DE49B308165F2FE10010338D /* RenderMediaControlElements.h */; };
+               DEBCCDD416646EAF00A452E1 /* MediaControlElementTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = DE49B300165F2FC60010338D /* MediaControlElementTypes.h */; };
+               DEBCCDD516646EB200A452E1 /* MediaControlElementTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE49B2FF165F2FC60010338D /* MediaControlElementTypes.cpp */; };
                DF9AFD7213FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = DF9AFD7013FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h */; };
                DF9AFD7313FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = DF9AFD7113FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm */; };
                E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B17C53EAC1C1FBEE /* EventSource.h */; };
                DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; };
                DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreObjCExtras.h; sourceTree = "<group>"; };
                DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
+               DE49B2FF165F2FC60010338D /* MediaControlElementTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlElementTypes.cpp; sourceTree = "<group>"; };
+               DE49B300165F2FC60010338D /* MediaControlElementTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlElementTypes.h; sourceTree = "<group>"; };
+               DE49B307165F2FE10010338D /* RenderMediaControlElements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControlElements.cpp; sourceTree = "<group>"; };
+               DE49B308165F2FE10010338D /* RenderMediaControlElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControlElements.h; sourceTree = "<group>"; };
                DF9AFD7013FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaPlayerPrivateAVFoundationObjC.h; path = objc/MediaPlayerPrivateAVFoundationObjC.h; sourceTree = "<group>"; };
                DF9AFD7113FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MediaPlayerPrivateAVFoundationObjC.mm; path = objc/MediaPlayerPrivateAVFoundationObjC.mm; sourceTree = "<group>"; };
                E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventSource.idl; sourceTree = "<group>"; };
                                572145CC15A51DA700AD119C /* ImageInnerElement.h */,
                                57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */,
                                57CF497314EE36D700ECFF14 /* InsertionPoint.h */,
+                               DE49B2FF165F2FC60010338D /* MediaControlElementTypes.cpp */,
+                               DE49B300165F2FC60010338D /* MediaControlElementTypes.h */,
                                417253A81354BBBC00360F2A /* MediaControlElements.cpp */,
                                417253A91354BBBC00360F2A /* MediaControlElements.h */,
                                4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */,
                                E4C279570CF9741900E97B98 /* RenderMedia.h */,
                                41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */,
                                41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */,
+                               DE49B307165F2FE10010338D /* RenderMediaControlElements.cpp */,
+                               DE49B308165F2FE10010338D /* RenderMediaControlElements.h */,
                                ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */,
                                ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */,
                                A454424C119B3687009BE912 /* RenderMeter.cpp */,
                                31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
                                15B8B7C91652C5220036EF55 /* JSWebKitCSSMixFunctionValue.h in Headers */,
                                93F72AF31666EDFC002A02BD /* LayerPool.h in Headers */,
+                               DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */,
+                               DEBCCDD416646EAF00A452E1 /* MediaControlElementTypes.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                CD27F6E7145770D30078207D /* MediaController.cpp in Sources */,
                                4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */,
                                1F3C3BEA135CAF3C00B8C1AC /* MediaControls.cpp in Sources */,
+                               DEBCCDD516646EB200A452E1 /* MediaControlElementTypes.cpp in Sources */,
                                97205AB71239291000B17380 /* MediaDocument.cpp in Sources */,
                                FD6F252C13F5EF0E0065165F /* MediaElementAudioSourceNode.cpp in Sources */,
                                4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */,
                                439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */,
                                E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */,
                                41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */,
+                               DE49B309165F2FE10010338D /* RenderMediaControlElements.cpp in Sources */,
                                ABDDFE790A5C6E7000A3E11D /* RenderMenuList.cpp in Sources */,
                                A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */,
                                BC45827F151299C10061A556 /* RenderMultiColumnBlock.cpp in Sources */,
index 047c8f5..00403f9 100644 (file)
@@ -247,6 +247,7 @@ public:
 
     void toggleTrackAtIndex(int index, bool exclusive = true);
     static int textTracksOffIndex() { return -1; }
+    static int textTracksIndexNotFound() { return -2; }
 
     bool userPrefersCaptions() const;
     bool userIsInterestedInThisTrackKind(String) const;
diff --git a/Source/WebCore/html/shadow/MediaControlElementTypes.cpp b/Source/WebCore/html/shadow/MediaControlElementTypes.cpp
new file mode 100644 (file)
index 0000000..7c120c2
--- /dev/null
@@ -0,0 +1,334 @@
+/*
+ * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO)
+#include "MediaControlElementTypes.h"
+
+#include "CSSValueKeywords.h"
+#include "FloatConversion.h"
+#include "HTMLNames.h"
+#include "MouseEvent.h"
+#include "RenderMedia.h"
+#include "RenderMediaControlElements.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+class Event;
+
+// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in.
+static const float cSkipRepeatDelay = 0.1f;
+static const float cSkipTime = 0.2f;
+static const float cScanRepeatDelay = 1.5f;
+static const float cScanMaximumRate = 8;
+
+HTMLMediaElement* toParentMediaElement(Node* node)
+{
+    if (!node)
+        return 0;
+    Node* mediaNode = node->shadowHost();
+    if (!mediaNode)
+        mediaNode = node;
+    if (!mediaNode || !mediaNode->isElementNode() || !static_cast<Element*>(mediaNode)->isMediaElement())
+        return 0;
+
+    return static_cast<HTMLMediaElement*>(mediaNode);
+}
+
+MediaControlElementType mediaControlElementType(Node* node)
+{
+    ASSERT(node->isMediaControlElement());
+    HTMLElement* element = toHTMLElement(node);
+    if (element->hasTagName(inputTag))
+        return static_cast<MediaControlInputElement*>(element)->displayType();
+    return static_cast<MediaControlDivElement*>(element)->displayType();
+}
+
+#if ENABLE(VIDEO_TRACK)
+const AtomicString& trackIndexAttributeName()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, name, ("x-webkit-track-index", AtomicString::ConstructFromLiteral));
+    return name;
+}
+
+int trackListIndexForElement(Element* element)
+{
+    const AtomicString trackIndexAttributeValue = element->getAttribute(trackIndexAttributeName());
+    if (trackIndexAttributeValue.isNull() || trackIndexAttributeValue.isEmpty())
+        return HTMLMediaElement::textTracksIndexNotFound();
+    bool ok;
+    int trackIndex = trackIndexAttributeValue.toInt(&ok);
+    if (!ok)
+        return HTMLMediaElement::textTracksIndexNotFound();
+    return trackIndex;
+}
+#endif
+
+MediaControlElement::MediaControlElement(MediaControlElementType displayType, HTMLElement* element)
+    : m_mediaController(0)
+    , m_displayType(displayType)
+    , m_element(element)
+{
+}
+
+void MediaControlElement::hide()
+{
+    m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
+}
+
+void MediaControlElement::show()
+{
+    m_element->removeInlineStyleProperty(CSSPropertyDisplay);
+}
+
+bool MediaControlElement::isShowing() const
+{
+    const StylePropertySet* propertySet = m_element->inlineStyle();
+    // Following the code from show() and hide() above, we only have
+    // to check for the presense of inline display.
+    return (!propertySet || !propertySet->getPropertyCSSValue(CSSPropertyDisplay));
+}
+
+void MediaControlElement::setDisplayType(MediaControlElementType displayType)
+{
+    if (displayType == m_displayType)
+        return;
+
+    m_displayType = displayType;
+    if (RenderObject* object = m_element->renderer())
+        object->repaint();
+}
+
+// ----------------------------
+
+MediaControlDivElement::MediaControlDivElement(Document* document, MediaControlElementType displayType)
+    : HTMLDivElement(divTag, document)
+    , MediaControlElement(displayType, this)
+{
+}
+
+// ----------------------------
+
+MediaControlInputElement::MediaControlInputElement(Document* document, MediaControlElementType displayType)
+    : HTMLInputElement(inputTag, document, 0, false)
+    , MediaControlElement(displayType, this)
+{
+}
+
+// ----------------------------
+
+MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document, MediaControlElementType displayType)
+    : MediaControlDivElement(document, displayType)
+    , m_currentValue(0)
+{
+}
+
+void MediaControlTimeDisplayElement::setCurrentValue(float time)
+{
+    m_currentValue = time;
+}
+
+RenderObject* MediaControlTimeDisplayElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderMediaControlTimeDisplay(this);
+}
+
+// ----------------------------
+
+MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* document, MediaControlElementType displayType)
+    : MediaControlInputElement(document, displayType)
+{
+}
+
+void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
+{
+    if (event->type() == eventNames().clickEvent) {
+        mediaController()->setMuted(!mediaController()->muted());
+        event->setDefaultHandled();
+    }
+
+    HTMLInputElement::defaultEventHandler(event);
+}
+
+void MediaControlMuteButtonElement::changedMute()
+{
+    updateDisplayType();
+}
+
+void MediaControlMuteButtonElement::updateDisplayType()
+{
+    setDisplayType(mediaController()->muted() ? MediaUnMuteButton : MediaMuteButton);
+}
+
+// ----------------------------
+
+MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, MediaControlElementType displayType)
+    : MediaControlInputElement(document, displayType)
+    , m_actionOnStop(Nothing)
+    , m_seekType(Skip)
+    , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
+{
+}
+
+void MediaControlSeekButtonElement::defaultEventHandler(Event* event)
+{
+    // Set the mousedown and mouseup events as defaultHandled so they
+    // do not trigger drag start or end actions in MediaControlPanelElement.
+    if (event->type() == eventNames().mousedownEvent || event->type() == eventNames().mouseupEvent)
+        event->setDefaultHandled();
+}
+
+void MediaControlSeekButtonElement::setActive(bool flag, bool pause)
+{
+    if (flag == active())
+        return;
+
+    if (flag)
+        startTimer();
+    else
+        stopTimer();
+
+    MediaControlInputElement::setActive(flag, pause);
+}
+
+void MediaControlSeekButtonElement::startTimer()
+{
+    m_seekType = mediaController()->supportsScanning() ? Scan : Skip;
+
+    if (m_seekType == Skip) {
+        // Seeking by skipping requires the video to be paused during seeking.
+        m_actionOnStop = mediaController()->paused() ? Nothing : Play;
+        mediaController()->pause();
+    } else {
+        // Seeking by scanning requires the video to be playing during seeking.
+        m_actionOnStop = mediaController()->paused() ? Pause : Nothing;
+        mediaController()->play();
+        mediaController()->setPlaybackRate(nextRate());
+    }
+
+    m_seekTimer.start(0, m_seekType == Skip ? cSkipRepeatDelay : cScanRepeatDelay);
+}
+
+void MediaControlSeekButtonElement::stopTimer()
+{
+    if (m_seekType == Scan)
+        mediaController()->setPlaybackRate(mediaController()->defaultPlaybackRate());
+
+    if (m_actionOnStop == Play)
+        mediaController()->play();
+    else if (m_actionOnStop == Pause)
+        mediaController()->pause();
+
+    if (m_seekTimer.isActive())
+        m_seekTimer.stop();
+}
+
+float MediaControlSeekButtonElement::nextRate() const
+{
+    float rate = std::min(cScanMaximumRate, fabsf(mediaController()->playbackRate() * 2));
+    if (!isForwardButton())
+        rate *= -1;
+    return rate;
+}
+
+void MediaControlSeekButtonElement::seekTimerFired(Timer<MediaControlSeekButtonElement>*)
+{
+    if (m_seekType == Skip) {
+        ExceptionCode ec;
+        float skipTime = isForwardButton() ? cSkipTime : -cSkipTime;
+        mediaController()->setCurrentTime(mediaController()->currentTime() + skipTime, ec);
+    } else
+        mediaController()->setPlaybackRate(nextRate());
+}
+
+// ----------------------------
+
+MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(Document* document)
+    : MediaControlInputElement(document, MediaVolumeSlider)
+    , m_clearMutedOnUserInteraction(false)
+{
+}
+
+void MediaControlVolumeSliderElement::defaultEventHandler(Event* event)
+{
+    // Left button is 0. Rejects mouse events not from left button.
+    if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
+        return;
+
+    if (!attached())
+        return;
+
+    MediaControlInputElement::defaultEventHandler(event);
+
+    if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
+        return;
+
+    float volume = narrowPrecisionToFloat(value().toDouble());
+    if (volume != mediaController()->volume()) {
+        ExceptionCode ec = 0;
+        mediaController()->setVolume(volume, ec);
+        ASSERT(!ec);
+    }
+    if (m_clearMutedOnUserInteraction)
+        mediaController()->setMuted(false);
+}
+
+bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents()
+{
+    if (!attached())
+        return false;
+
+    return MediaControlInputElement::willRespondToMouseMoveEvents();
+}
+
+bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents()
+{
+    if (!attached())
+        return false;
+
+    return MediaControlInputElement::willRespondToMouseClickEvents();
+}
+
+void MediaControlVolumeSliderElement::setVolume(float volume)
+{
+    if (value().toFloat() != volume)
+        setValue(String::number(volume));
+}
+
+void MediaControlVolumeSliderElement::setClearMutedOnUserInteraction(bool clearMute)
+{
+    m_clearMutedOnUserInteraction = clearMute;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO)
diff --git a/Source/WebCore/html/shadow/MediaControlElementTypes.h b/Source/WebCore/html/shadow/MediaControlElementTypes.h
new file mode 100644 (file)
index 0000000..91b0c8a
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#ifndef MediaControlElementTypes_h
+#define MediaControlElementTypes_h
+
+#if ENABLE(VIDEO)
+
+#include "HTMLDivElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLMediaElement.h"
+#include "MediaControllerInterface.h"
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+// Must match WebKitSystemInterface.h
+enum MediaControlElementType {
+    MediaEnterFullscreenButton = 0,
+    MediaMuteButton,
+    MediaPlayButton,
+    MediaSeekBackButton,
+    MediaSeekForwardButton,
+    MediaSlider,
+    MediaSliderThumb,
+    MediaRewindButton,
+    MediaReturnToRealtimeButton,
+    MediaShowClosedCaptionsButton,
+    MediaHideClosedCaptionsButton,
+    MediaUnMuteButton,
+    MediaPauseButton,
+    MediaTimelineContainer,
+    MediaCurrentTimeDisplay,
+    MediaTimeRemainingDisplay,
+    MediaStatusDisplay,
+    MediaControlsPanel,
+    MediaVolumeSliderContainer,
+    MediaVolumeSlider,
+    MediaVolumeSliderThumb,
+    MediaFullScreenVolumeSlider,
+    MediaFullScreenVolumeSliderThumb,
+    MediaVolumeSliderMuteButton,
+    MediaTextTrackDisplayContainer,
+    MediaTextTrackDisplay,
+    MediaExitFullscreenButton,
+    MediaOverlayPlayButton,
+    MediaClosedCaptionsContainer,
+    MediaClosedCaptionsTrackList,
+};
+
+HTMLMediaElement* toParentMediaElement(Node*);
+inline HTMLMediaElement* toParentMediaElement(RenderObject* renderer) { return toParentMediaElement(renderer->node()); }
+
+MediaControlElementType mediaControlElementType(Node*);
+
+#if ENABLE(VIDEO_TRACK)
+const AtomicString& trackIndexAttributeName();
+int trackListIndexForElement(Element*);
+#endif
+
+// ----------------------------
+
+class MediaControlElement {
+public:
+    virtual void hide();
+    virtual void show();
+    virtual bool isShowing() const;
+
+    virtual MediaControlElementType displayType() { return m_displayType; }
+    virtual const AtomicString& shadowPseudoId() const = 0;
+
+    virtual void setMediaController(MediaControllerInterface* controller) { m_mediaController = controller; }
+    virtual MediaControllerInterface* mediaController() const { return m_mediaController; }
+
+protected:
+    explicit MediaControlElement(MediaControlElementType, HTMLElement*);
+    ~MediaControlElement() { }
+
+    virtual void setDisplayType(MediaControlElementType);
+    virtual bool isMediaControlElement() const { return true; }
+
+private:
+    MediaControllerInterface* m_mediaController;
+    MediaControlElementType m_displayType;
+    HTMLElement* m_element;
+};
+
+// ----------------------------
+
+class MediaControlDivElement : public HTMLDivElement, public MediaControlElement {
+protected:
+    virtual bool isMediaControlElement() const OVERRIDE { return MediaControlElement::isMediaControlElement(); }
+    explicit MediaControlDivElement(Document*, MediaControlElementType);
+};
+
+// ----------------------------
+
+class MediaControlInputElement : public HTMLInputElement, public MediaControlElement {
+protected:
+    virtual bool isMediaControlElement() const OVERRIDE { return MediaControlElement::isMediaControlElement(); }
+    explicit MediaControlInputElement(Document*, MediaControlElementType);
+
+private:
+    virtual void updateDisplayType() { }
+};
+
+// ----------------------------
+
+class MediaControlTimeDisplayElement : public MediaControlDivElement {
+public:
+    void setCurrentValue(float);
+    float currentValue() const { return m_currentValue; }
+
+protected:
+    explicit MediaControlTimeDisplayElement(Document*, MediaControlElementType);
+
+private:
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
+
+    float m_currentValue;
+};
+
+// ----------------------------
+
+class MediaControlMuteButtonElement : public MediaControlInputElement {
+public:
+    void changedMute();
+
+    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
+
+protected:
+    explicit MediaControlMuteButtonElement(Document*, MediaControlElementType);
+
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+
+private:
+    virtual void updateDisplayType() OVERRIDE;
+};
+
+// ----------------------------
+
+class MediaControlSeekButtonElement : public MediaControlInputElement {
+public:
+    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
+
+protected:
+    explicit MediaControlSeekButtonElement(Document*, MediaControlElementType);
+
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+    virtual bool isForwardButton() const = 0;
+
+private:
+    void setActive(bool /*flag*/ = true, bool /*pause*/ = false);
+
+    void startTimer();
+    void stopTimer();
+    float nextRate() const;
+    void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
+
+    enum ActionType { Nothing, Play, Pause };
+    ActionType m_actionOnStop;
+    enum SeekType { Skip, Scan };
+    SeekType m_seekType;
+    Timer<MediaControlSeekButtonElement> m_seekTimer;
+};
+
+// ----------------------------
+
+class MediaControlVolumeSliderElement : public MediaControlInputElement {
+public:
+    virtual bool willRespondToMouseMoveEvents() OVERRIDE;
+    virtual bool willRespondToMouseClickEvents() OVERRIDE;
+    void setVolume(float);
+    void setClearMutedOnUserInteraction(bool);
+
+protected:
+    explicit MediaControlVolumeSliderElement(Document*);
+
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+
+private:
+    bool m_clearMutedOnUserInteraction;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO)
+
+#endif // MediaControlElementTypes_h
index 6ae55f3..6880934 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "config.h"
 
 #if ENABLE(VIDEO)
-
 #include "MediaControlElements.h"
 
-#include "CSSStyleDeclaration.h"
-#include "CSSValueKeywords.h"
 #include "DOMTokenList.h"
 #include "EventNames.h"
 #include "EventTarget.h"
 #include "FloatConversion.h"
-#include "FloatPoint.h"
 #include "Frame.h"
-#include "HTMLDivElement.h"
-#include "HTMLMediaElement.h"
-#include "HTMLNames.h"
 #include "HTMLVideoElement.h"
 #include "Language.h"
-#include "LayoutRepainter.h"
 #include "LocalizedStrings.h"
 #include "MediaControls.h"
 #include "MouseEvent.h"
 #include "Page.h"
 #include "PageGroup.h"
-#include "RenderDeprecatedFlexibleBox.h"
-#include "RenderInline.h"
-#include "RenderMedia.h"
+#include "RenderMediaControlElements.h"
 #include "RenderSlider.h"
-#include "RenderText.h"
 #include "RenderTheme.h"
 #include "RenderVideo.h"
-#include "RenderView.h"
-#include "ScriptController.h"
 #include "Settings.h"
-#include "StyleResolver.h"
-#include "Text.h"
 #if ENABLE(VIDEO_TRACK)
 #include "TextTrack.h"
 #include "TextTrackList.h"
 namespace WebCore {
 
 using namespace HTMLNames;
-using namespace std;
-
-// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in.
-static const float cSkipRepeatDelay = 0.1f;
-static const float cSkipTime = 0.2f;
-static const float cScanRepeatDelay = 1.5f;
-static const float cScanMaximumRate = 8;
 
 #if ENABLE(VIDEO_TRACK)
 static const char* textTracksOffAttrValue = "-1"; // This must match HTMLMediaElement::textTracksOffIndex()
-static const int textTracksIndexNotFound = -2;
-#endif
-
-HTMLMediaElement* toParentMediaElement(Node* node)
-{
-    if (!node)
-        return 0;
-    Node* mediaNode = node->shadowHost();
-    if (!mediaNode)
-        mediaNode = node;
-    if (!mediaNode || !mediaNode->isElementNode() || !static_cast<Element*>(mediaNode)->isMediaElement())
-        return 0;
-
-    return static_cast<HTMLMediaElement*>(mediaNode);
-}
-
-MediaControlElementType mediaControlElementType(Node* node)
-{
-    ASSERT(node->isMediaControlElement());
-    HTMLElement* element = toHTMLElement(node);
-    if (element->hasTagName(inputTag))
-        return static_cast<MediaControlInputElement*>(element)->displayType();
-    return static_cast<MediaControlElement*>(element)->displayType();
-}
-
-#if ENABLE(VIDEO_TRACK)
-static const AtomicString& trackIndexAttributeName()
-{
-    DEFINE_STATIC_LOCAL(AtomicString, name, ("x-webkit-track-index", AtomicString::ConstructFromLiteral));
-    return name;
-}
-
-static int trackListIndexForElement(Element* element)
-{
-    const AtomicString trackIndexAttributeValue = element->getAttribute(trackIndexAttributeName());
-    if (trackIndexAttributeValue.isNull() || trackIndexAttributeValue.isEmpty())
-        return textTracksIndexNotFound;
-    bool ok;
-    int trackIndex = trackIndexAttributeValue.toInt(&ok);
-    if (!ok)
-        return textTracksIndexNotFound;
-    return trackIndex;
-}
 #endif
 
-// ----------------------------
-
-MediaControlElement::MediaControlElement(Document* document)
-    : HTMLDivElement(divTag, document)
-    , m_mediaController(0)
-{
-}
-
-void MediaControlElement::show()
-{
-    removeInlineStyleProperty(CSSPropertyDisplay);
-}
-
-void MediaControlElement::hide()
-{
-    setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
-}
-
-bool MediaControlElement::isShowing() const
-{
-    const StylePropertySet* propertySet = inlineStyle();
-    // Following the code from show() and hide() above, we only have
-    // to check for the presense of inline display.
-    return (!propertySet || !propertySet->getPropertyCSSValue(CSSPropertyDisplay));
-}
-
-// ----------------------------
-
-inline MediaControlPanelElement::MediaControlPanelElement(Document* document)
-    : MediaControlElement(document)
+MediaControlPanelElement::MediaControlPanelElement(Document* document)
+    : MediaControlDivElement(document, MediaControlsPanel)
     , m_canBeDragged(false)
     , m_isBeingDragged(false)
     , m_isDisplayed(false)
@@ -169,11 +77,6 @@ PassRefPtr<MediaControlPanelElement> MediaControlPanelElement::create(Document*
     return adoptRef(new MediaControlPanelElement(document));
 }
 
-MediaControlElementType MediaControlPanelElement::displayType() const
-{
-    return MediaControlsPanel;
-}
-
 const AtomicString& MediaControlPanelElement::shadowPseudoId() const
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-panel", AtomicString::ConstructFromLiteral));
@@ -245,7 +148,6 @@ void MediaControlPanelElement::stopTimer()
         m_transitionTimer.stop();
 }
 
-
 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelElement>*)
 {
     if (!m_opaque)
@@ -318,7 +220,7 @@ void MediaControlPanelElement::makeTransparent()
 
 void MediaControlPanelElement::defaultEventHandler(Event* event)
 {
-    MediaControlElement::defaultEventHandler(event);
+    MediaControlDivElement::defaultEventHandler(event);
 
     if (event->isMouseEvent()) {
         LayoutPoint location = static_cast<MouseEvent*>(event)->absoluteLocation();
@@ -353,63 +255,66 @@ void MediaControlPanelElement::setIsDisplayed(bool isDisplayed)
 
 // ----------------------------
 
-inline MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* document)
-    : MediaControlElement(document)
+MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(Document* document)
+    // Mapping onto same MediaControlElementType as panel element, since it has similar properties.
+    : MediaControlDivElement(document, MediaControlsPanel)
 {
 }
 
-PassRefPtr<MediaControlTimelineContainerElement> MediaControlTimelineContainerElement::create(Document* document)
+PassRefPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclosureElement::create(Document* document)
 {
-    RefPtr<MediaControlTimelineContainerElement> element = adoptRef(new MediaControlTimelineContainerElement(document));
-    element->hide();
-    return element.release();
+    return adoptRef(new MediaControlPanelEnclosureElement(document));
 }
 
-MediaControlElementType MediaControlTimelineContainerElement::displayType() const
+const AtomicString& MediaControlPanelEnclosureElement::shadowPseudoId() const
 {
-    return MediaTimelineContainer;
-}
-
-const AtomicString& MediaControlTimelineContainerElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline-container", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-enclosure", AtomicString::ConstructFromLiteral));
     return id;
 }
 
 // ----------------------------
 
-class RenderMediaVolumeSliderContainer : public RenderBlock {
-public:
-    RenderMediaVolumeSliderContainer(Node*);
-
-private:
-    virtual void layout();
-};
+MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(Document* document)
+    // Mapping onto same MediaControlElementType as panel element, since it has similar properties.
+    : MediaControlDivElement(document, MediaControlsPanel)
+{
+}
 
-RenderMediaVolumeSliderContainer::RenderMediaVolumeSliderContainer(Node* node)
-    : RenderBlock(node)
+PassRefPtr<MediaControlOverlayEnclosureElement> MediaControlOverlayEnclosureElement::create(Document* document)
 {
+    return adoptRef(new MediaControlOverlayEnclosureElement(document));
 }
 
-void RenderMediaVolumeSliderContainer::layout()
+const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const
 {
-    RenderBlock::layout();
+    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclosure", AtomicString::ConstructFromLiteral));
+    return id;
+}
 
-    if (style()->display() == NONE || !nextSibling() || !nextSibling()->isBox())
-        return;
+// ----------------------------
 
-    RenderBox* buttonBox = toRenderBox(nextSibling());
-    int absoluteOffsetTop = buttonBox->localToAbsolute(FloatPoint(0, -size().height())).y();
+MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* document)
+    : MediaControlDivElement(document, MediaTimelineContainer)
+{
+}
 
-    LayoutStateDisabler layoutStateDisabler(view());
+PassRefPtr<MediaControlTimelineContainerElement> MediaControlTimelineContainerElement::create(Document* document)
+{
+    RefPtr<MediaControlTimelineContainerElement> element = adoptRef(new MediaControlTimelineContainerElement(document));
+    element->hide();
+    return element.release();
+}
 
-    // If the slider would be rendered outside the page, it should be moved below the controls.
-    if (UNLIKELY(absoluteOffsetTop < 0))
-        setY(buttonBox->offsetTop() + theme()->volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
+const AtomicString& MediaControlTimelineContainerElement::shadowPseudoId() const
+{
+    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline-container", AtomicString::ConstructFromLiteral));
+    return id;
 }
 
-inline MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContainerElement(Document* document)
-    : MediaControlElement(document)
+// ----------------------------
+
+MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContainerElement(Document* document)
+    : MediaControlDivElement(document, MediaVolumeSliderContainer)
 {
 }
 
@@ -441,11 +346,6 @@ void MediaControlVolumeSliderContainerElement::defaultEventHandler(Event* event)
     hide();
 }
 
-MediaControlElementType MediaControlVolumeSliderContainerElement::displayType() const
-{
-    return MediaVolumeSliderContainer;
-}
-
 const AtomicString& MediaControlVolumeSliderContainerElement::shadowPseudoId() const
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider-container", AtomicString::ConstructFromLiteral));
@@ -454,8 +354,8 @@ const AtomicString& MediaControlVolumeSliderContainerElement::shadowPseudoId() c
 
 // ----------------------------
 
-inline MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* document)
-    : MediaControlElement(document)
+MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* document)
+    : MediaControlDivElement(document, MediaStatusDisplay)
     , m_stateBeingDisplayed(Nothing)
 {
 }
@@ -502,77 +402,16 @@ void MediaControlStatusDisplayElement::update()
     }
 }
 
-MediaControlElementType MediaControlStatusDisplayElement::displayType() const
-{
-    return MediaStatusDisplay;
-}
-
 const AtomicString& MediaControlStatusDisplayElement::shadowPseudoId() const
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-status-display", AtomicString::ConstructFromLiteral));
     return id;
 }
 
-// ----------------------------
-    
-MediaControlInputElement::MediaControlInputElement(Document* document, MediaControlElementType displayType)
-    : HTMLInputElement(inputTag, document, 0, false)
-    , m_mediaController(0)
-    , m_displayType(displayType)
-{
-}
-
-void MediaControlInputElement::show()
-{
-    removeInlineStyleProperty(CSSPropertyDisplay);
-}
-
-void MediaControlInputElement::hide()
-{
-    setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
-}
-
-
-void MediaControlInputElement::setDisplayType(MediaControlElementType displayType)
-{
-    if (displayType == m_displayType)
-        return;
-
-    m_displayType = displayType;
-    if (RenderObject* object = renderer())
-        object->repaint();
-}
 
 // ----------------------------
 
-inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* document, MediaControlElementType displayType)
-    : MediaControlInputElement(document, displayType)
-{
-}
-
-void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
-{
-    if (event->type() == eventNames().clickEvent) {
-        mediaController()->setMuted(!mediaController()->muted());
-        event->setDefaultHandled();
-    }
-
-    HTMLInputElement::defaultEventHandler(event);
-}
-
-void MediaControlMuteButtonElement::changedMute()
-{
-    updateDisplayType();
-}
-
-void MediaControlMuteButtonElement::updateDisplayType()
-{
-    setDisplayType(mediaController()->muted() ? MediaUnMuteButton : MediaMuteButton);
-}
-
-// ----------------------------
-
-inline MediaControlPanelMuteButtonElement::MediaControlPanelMuteButtonElement(Document* document, MediaControls* controls)
+MediaControlPanelMuteButtonElement::MediaControlPanelMuteButtonElement(Document* document, MediaControls* controls)
     : MediaControlMuteButtonElement(document, MediaMuteButton)
     , m_controls(controls)
 {
@@ -604,7 +443,7 @@ const AtomicString& MediaControlPanelMuteButtonElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement(Document* document)
+MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement(Document* document)
     : MediaControlMuteButtonElement(document, MediaMuteButton)
 {
 }
@@ -625,7 +464,7 @@ const AtomicString& MediaControlVolumeSliderMuteButtonElement::shadowPseudoId()
 
 // ----------------------------
 
-inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document)
+MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document)
     : MediaControlInputElement(document, MediaPlayButton)
 {
 }
@@ -664,7 +503,7 @@ const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Document* document)
+MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(Document* document)
     : MediaControlInputElement(document, MediaOverlayPlayButton)
 {
 }
@@ -691,7 +530,6 @@ void MediaControlOverlayPlayButtonElement::updateDisplayType()
 {
     if (mediaController()->canPlay()) {
         show();
-        setDisplayType(MediaOverlayPlayButton);
     } else
         hide();
 }
@@ -702,90 +540,10 @@ const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const
     return id;
 }
 
-// ----------------------------
-
-inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, MediaControlElementType displayType)
-    : MediaControlInputElement(document, displayType)
-    , m_actionOnStop(Nothing)
-    , m_seekType(Skip)
-    , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
-{
-}
-
-void MediaControlSeekButtonElement::defaultEventHandler(Event* event)
-{
-    // Set the mousedown and mouseup events as defaultHandled so they
-    // do not trigger drag start or end actions in MediaControlPanelElement.
-    if (event->type() == eventNames().mousedownEvent || event->type() == eventNames().mouseupEvent)
-        event->setDefaultHandled();
-}
-
-void MediaControlSeekButtonElement::setActive(bool flag, bool pause)
-{
-    if (flag == active())
-        return;
-
-    if (flag)
-        startTimer();
-    else
-        stopTimer();
-
-    MediaControlInputElement::setActive(flag, pause);
-}
-
-void MediaControlSeekButtonElement::startTimer()
-{
-    m_seekType = mediaController()->supportsScanning() ? Scan : Skip;
-
-    if (m_seekType == Skip) {
-        // Seeking by skipping requires the video to be paused during seeking.
-        m_actionOnStop = mediaController()->paused() ? Nothing : Play;
-        mediaController()->pause();
-    } else {
-        // Seeking by scanning requires the video to be playing during seeking.
-        m_actionOnStop = mediaController()->paused() ? Pause : Nothing;
-        mediaController()->play();
-        mediaController()->setPlaybackRate(nextRate());
-    }
-
-    m_seekTimer.start(0, m_seekType == Skip ? cSkipRepeatDelay : cScanRepeatDelay);
-}
-
-void MediaControlSeekButtonElement::stopTimer()
-{
-    if (m_seekType == Scan)
-        mediaController()->setPlaybackRate(mediaController()->defaultPlaybackRate());
-
-    if (m_actionOnStop == Play)
-        mediaController()->play();
-    else if (m_actionOnStop == Pause)
-        mediaController()->pause();
-
-    if (m_seekTimer.isActive())
-        m_seekTimer.stop();
-}
-
-float MediaControlSeekButtonElement::nextRate() const
-{
-    float rate = std::min(cScanMaximumRate, fabsf(mediaController()->playbackRate() * 2));
-    if (!isForwardButton())
-        rate *= -1;
-    return rate;
-}
-
-void MediaControlSeekButtonElement::seekTimerFired(Timer<MediaControlSeekButtonElement>*)
-{
-    if (m_seekType == Skip) {
-        ExceptionCode ec;
-        float skipTime = isForwardButton() ? cSkipTime : -cSkipTime;
-        mediaController()->setCurrentTime(mediaController()->currentTime() + skipTime, ec);
-    } else
-        mediaController()->setPlaybackRate(nextRate());
-}
 
 // ----------------------------
 
-inline MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement(Document* document)
+MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement(Document* document)
     : MediaControlSeekButtonElement(document, MediaSeekForwardButton)
 {
 }
@@ -806,7 +564,7 @@ const AtomicString& MediaControlSeekForwardButtonElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement(Document* document)
+MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement(Document* document)
     : MediaControlSeekButtonElement(document, MediaSeekBackButton)
 {
 }
@@ -827,7 +585,7 @@ const AtomicString& MediaControlSeekBackButtonElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* document)
+MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* document)
     : MediaControlInputElement(document, MediaRewindButton)
 {
 }
@@ -846,7 +604,7 @@ void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
         ExceptionCode ignoredCode;
         mediaController()->setCurrentTime(max(0.0f, mediaController()->currentTime() - 30), ignoredCode);
         event->setDefaultHandled();
-    }    
+    }
     HTMLInputElement::defaultEventHandler(event);
 }
 
@@ -858,7 +616,7 @@ const AtomicString& MediaControlRewindButtonElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* document)
+MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* document)
     : MediaControlInputElement(document, MediaReturnToRealtimeButton)
 {
 }
@@ -889,27 +647,7 @@ const AtomicString& MediaControlReturnToRealtimeButtonElement::shadowPseudoId()
 
 // ----------------------------
 
-inline MediaControlClosedCaptionsContainerElement::MediaControlClosedCaptionsContainerElement(Document* document)
-    : MediaControlElement(document)
-{
-}
-
-PassRefPtr<MediaControlClosedCaptionsContainerElement> MediaControlClosedCaptionsContainerElement::create(Document* document)
-{
-    RefPtr<MediaControlClosedCaptionsContainerElement> element = adoptRef(new MediaControlClosedCaptionsContainerElement(document));
-    element->hide();
-    return element.release();
-}
-
-const AtomicString& MediaControlClosedCaptionsContainerElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-closed-captions-container", AtomicString::ConstructFromLiteral));
-    return id;
-}
-
-// ----------------------------
-
-inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(Document* document, MediaControls* controls)
+MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(Document* document, MediaControls* controls)
     : MediaControlInputElement(document, MediaShowClosedCaptionsButton)
 #if PLATFORM(MAC)
     , m_controls(controls)
@@ -966,8 +704,28 @@ const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoI
 
 // ----------------------------
 
-inline MediaControlClosedCaptionsTrackListElement::MediaControlClosedCaptionsTrackListElement(Document* document, MediaControls* controls)
-    : MediaControlElement(document)
+MediaControlClosedCaptionsContainerElement::MediaControlClosedCaptionsContainerElement(Document* document)
+    : MediaControlDivElement(document, MediaClosedCaptionsContainer)
+{
+}
+
+PassRefPtr<MediaControlClosedCaptionsContainerElement> MediaControlClosedCaptionsContainerElement::create(Document* document)
+{
+    RefPtr<MediaControlClosedCaptionsContainerElement> element = adoptRef(new MediaControlClosedCaptionsContainerElement(document));
+    element->hide();
+    return element.release();
+}
+
+const AtomicString& MediaControlClosedCaptionsContainerElement::shadowPseudoId() const
+{
+    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-closed-captions-container", AtomicString::ConstructFromLiteral));
+    return id;
+}
+
+// ----------------------------
+
+MediaControlClosedCaptionsTrackListElement::MediaControlClosedCaptionsTrackListElement(Document* document, MediaControls* controls)
+    : MediaControlDivElement(document, MediaClosedCaptionsTrackList)
     , m_controls(controls)
 {
 }
@@ -996,9 +754,9 @@ void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event* even
         // tell the HTMLMediaElement to enable that track.
 
         int trackIndex = trackListIndexForElement(toElement(target));
-        if (trackIndex == textTracksIndexNotFound)
+        if (trackIndex == HTMLMediaElement::textTracksIndexNotFound())
             return;
-        
+
         HTMLMediaElement* mediaElement = toParentMediaElement(this);
         if (!mediaElement)
             return;
@@ -1010,7 +768,7 @@ void MediaControlClosedCaptionsTrackListElement::defaultEventHandler(Event* even
         updateDisplay();
     }
 
-    MediaControlElement::defaultEventHandler(event);
+    MediaControlDivElement::defaultEventHandler(event);
 #endif
 }
 
@@ -1041,7 +799,7 @@ void MediaControlClosedCaptionsTrackListElement::updateDisplay()
     for (unsigned i = 0, length = menuItems.size(); i < length; ++i) {
         RefPtr<Element> trackItem = menuItems[i];
         int trackIndex = trackListIndexForElement(trackItem.get());
-        if (trackIndex != textTracksIndexNotFound) {
+        if (trackIndex != HTMLMediaElement::textTracksIndexNotFound()) {
             if (trackIndex == HTMLMediaElement::textTracksOffIndex()) {
                 if (captionsVisible)
                     trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
@@ -1228,15 +986,14 @@ const AtomicString& MediaControlTimelineElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(Document* document)
-    : MediaControlInputElement(document, MediaVolumeSlider)
-    , m_clearMutedOnUserInteraction(false)
+MediaControlPanelVolumeSliderElement::MediaControlPanelVolumeSliderElement(Document* document)
+    : MediaControlVolumeSliderElement(document)
 {
 }
 
-PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::create(Document* document)
+PassRefPtr<MediaControlPanelVolumeSliderElement> MediaControlPanelVolumeSliderElement::create(Document* document)
 {
-    RefPtr<MediaControlVolumeSliderElement> slider = adoptRef(new MediaControlVolumeSliderElement(document));
+    RefPtr<MediaControlPanelVolumeSliderElement> slider = adoptRef(new MediaControlPanelVolumeSliderElement(document));
     slider->createShadowSubtree();
     slider->setType("range");
     slider->setAttribute(precisionAttr, "float");
@@ -1244,58 +1001,7 @@ PassRefPtr<MediaControlVolumeSliderElement> MediaControlVolumeSliderElement::cre
     return slider.release();
 }
 
-void MediaControlVolumeSliderElement::defaultEventHandler(Event* event)
-{
-    // Left button is 0. Rejects mouse events not from left button.
-    if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
-        return;
-
-    if (!attached())
-        return;
-
-    MediaControlInputElement::defaultEventHandler(event);
-
-    if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
-        return;
-
-    float volume = narrowPrecisionToFloat(value().toDouble());
-    if (volume != mediaController()->volume()) {
-        ExceptionCode ec = 0;
-        mediaController()->setVolume(volume, ec);
-        ASSERT(!ec);
-    }
-    if (m_clearMutedOnUserInteraction)
-        mediaController()->setMuted(false);
-}
-
-bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents()
-{
-    if (!attached())
-        return false;
-
-    return MediaControlInputElement::willRespondToMouseMoveEvents();
-}
-
-bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents()
-{
-    if (!attached())
-        return false;
-
-    return MediaControlInputElement::willRespondToMouseClickEvents();
-}
-
-void MediaControlVolumeSliderElement::setVolume(float volume)
-{
-    if (value().toFloat() != volume)
-        setValue(String::number(volume));
-}
-
-void MediaControlVolumeSliderElement::setClearMutedOnUserInteraction(bool clearMute)
-{
-    m_clearMutedOnUserInteraction = clearMute;
-}
-
-const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const
+const AtomicString& MediaControlPanelVolumeSliderElement::shadowPseudoId() const
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider", AtomicString::ConstructFromLiteral));
     return id;
@@ -1303,7 +1009,7 @@ const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const
 
 // ----------------------------
 
-inline MediaControlFullscreenVolumeSliderElement::MediaControlFullscreenVolumeSliderElement(Document* document)
+MediaControlFullscreenVolumeSliderElement::MediaControlFullscreenVolumeSliderElement(Document* document)
     : MediaControlVolumeSliderElement(document)
 {
 }
@@ -1326,16 +1032,14 @@ const AtomicString& MediaControlFullscreenVolumeSliderElement::shadowPseudoId()
 
 // ----------------------------
 
-inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, MediaControls*)
+MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document)
     : MediaControlInputElement(document, MediaEnterFullscreenButton)
 {
 }
 
-PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElement::create(Document* document, MediaControls* controls)
+PassRefPtr<MediaControlFullscreenButtonElement> MediaControlFullscreenButtonElement::create(Document* document)
 {
-    ASSERT(controls);
-
-    RefPtr<MediaControlFullscreenButtonElement> button = adoptRef(new MediaControlFullscreenButtonElement(document, controls));
+    RefPtr<MediaControlFullscreenButtonElement> button = adoptRef(new MediaControlFullscreenButtonElement(document));
     button->createShadowSubtree();
     button->setType("button");
     button->hide();
@@ -1346,10 +1050,10 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
 {
     if (event->type() == eventNames().clickEvent) {
 #if ENABLE(FULLSCREEN_API)
-        // Only use the new full screen API if the fullScreenEnabled setting has 
+        // Only use the new full screen API if the fullScreenEnabled setting has
         // been explicitly enabled. Otherwise, use the old fullscreen API. This
         // allows apps which embed a WebView to retain the existing full screen
-        // video implementation without requiring them to implement their own full 
+        // video implementation without requiring them to implement their own full
         // screen behavior.
         if (document()->settings() && document()->settings()->fullScreenEnabled()) {
             if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == toParentMediaElement(this))
@@ -1377,7 +1081,7 @@ void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen)
 
 // ----------------------------
 
-inline MediaControlFullscreenVolumeMinButtonElement::MediaControlFullscreenVolumeMinButtonElement(Document* document)
+MediaControlFullscreenVolumeMinButtonElement::MediaControlFullscreenVolumeMinButtonElement(Document* document)
     : MediaControlInputElement(document, MediaUnMuteButton)
 {
 }
@@ -1408,7 +1112,7 @@ const AtomicString& MediaControlFullscreenVolumeMinButtonElement::shadowPseudoId
 
 // ----------------------------
 
-inline MediaControlFullscreenVolumeMaxButtonElement::MediaControlFullscreenVolumeMaxButtonElement(Document* document)
+MediaControlFullscreenVolumeMaxButtonElement::MediaControlFullscreenVolumeMaxButtonElement(Document* document)
 : MediaControlInputElement(document, MediaMuteButton)
 {
 }
@@ -1439,67 +1143,16 @@ const AtomicString& MediaControlFullscreenVolumeMaxButtonElement::shadowPseudoId
 
 // ----------------------------
 
-class RenderMediaControlTimeDisplay : public RenderDeprecatedFlexibleBox {
-public:
-    RenderMediaControlTimeDisplay(Node*);
-
-private:
-    virtual void layout();
-};
-
-RenderMediaControlTimeDisplay::RenderMediaControlTimeDisplay(Node* node)
-    : RenderDeprecatedFlexibleBox(node)
-{
-}
-
-// We want the timeline slider to be at least 100 pixels wide.
-// FIXME: Eliminate hard-coded widths altogether.
-static const int minWidthToDisplayTimeDisplays = 45 + 100 + 45;
-
-void RenderMediaControlTimeDisplay::layout()
-{
-    RenderDeprecatedFlexibleBox::layout();
-    RenderBox* timelineContainerBox = parentBox();
-    while (timelineContainerBox && timelineContainerBox->isAnonymous())
-        timelineContainerBox = timelineContainerBox->parentBox();
-
-    if (timelineContainerBox && timelineContainerBox->width() < minWidthToDisplayTimeDisplays)
-        setWidth(0);
-}
-
-inline MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document)
-    : MediaControlElement(document)
-    , m_currentValue(0)
-{
-}
-
-void MediaControlTimeDisplayElement::setCurrentValue(float time)
-{
-    m_currentValue = time;
-}
-
-RenderObject* MediaControlTimeDisplayElement::createRenderer(RenderArena* arena, RenderStyle*)
+MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement(Document* document)
+    : MediaControlTimeDisplayElement(document, MediaTimeRemainingDisplay)
 {
-    return new (arena) RenderMediaControlTimeDisplay(this);
 }
 
-// ----------------------------
-
 PassRefPtr<MediaControlTimeRemainingDisplayElement> MediaControlTimeRemainingDisplayElement::create(Document* document)
 {
     return adoptRef(new MediaControlTimeRemainingDisplayElement(document));
 }
 
-MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement(Document* document)
-    : MediaControlTimeDisplayElement(document)
-{
-}
-
-MediaControlElementType MediaControlTimeRemainingDisplayElement::displayType() const
-{
-    return MediaTimeRemainingDisplay;
-}
-
 const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() const
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-time-remaining-display", AtomicString::ConstructFromLiteral));
@@ -1508,19 +1161,14 @@ const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() co
 
 // ----------------------------
 
-PassRefPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurrentTimeDisplayElement::create(Document* document)
-{
-    return adoptRef(new MediaControlCurrentTimeDisplayElement(document));
-}
-
 MediaControlCurrentTimeDisplayElement::MediaControlCurrentTimeDisplayElement(Document* document)
-    : MediaControlTimeDisplayElement(document)
+    : MediaControlTimeDisplayElement(document, MediaCurrentTimeDisplay)
 {
 }
 
-MediaControlElementType MediaControlCurrentTimeDisplayElement::displayType() const
+PassRefPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurrentTimeDisplayElement::create(Document* document)
 {
-    return MediaCurrentTimeDisplay;
+    return adoptRef(new MediaControlCurrentTimeDisplayElement(document));
 }
 
 const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() const
@@ -1533,33 +1181,8 @@ const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() cons
 
 #if ENABLE(VIDEO_TRACK)
 
-class RenderTextTrackContainerElement : public RenderBlock {
-public:
-    RenderTextTrackContainerElement(Node*);
-
-private:
-    virtual void layout();
-};
-
-RenderTextTrackContainerElement::RenderTextTrackContainerElement(Node* node)
-    : RenderBlock(node)
-{
-}
-
-void RenderTextTrackContainerElement::layout()
-{
-    RenderBlock::layout();
-    if (style()->display() == NONE)
-        return;
-
-    ASSERT(mediaControlElementType(node()) == MediaTextTrackDisplayContainer);
-
-    LayoutStateDisabler layoutStateDisabler(view());
-    static_cast<MediaControlTextTrackContainerElement*>(node())->updateSizes();
-}
-
-inline MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document* document)
-    : MediaControlElement(document)
+MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(Document* document)
+    : MediaControlDivElement(document, MediaTextTrackDisplayContainer)
     , m_fontSize(0)
 {
 }
index e050328..02656cc 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #define MediaControlElements_h
 
 #if ENABLE(VIDEO)
-
-#include "HTMLDivElement.h"
-#include "HTMLInputElement.h"
-#include "MediaControllerInterface.h"
-#include "RenderBlock.h"
-
-// These are the shadow elements used in RenderMedia
+#include "MediaControlElementTypes.h"
 
 namespace WebCore {
 
-class Event;
-class Frame;
-class HTMLMediaElement;
-class MediaControls;
-
-// Must match WebKitSystemInterface.h
-enum MediaControlElementType {
-    MediaEnterFullscreenButton = 0,
-    MediaMuteButton,
-    MediaPlayButton,
-    MediaSeekBackButton,
-    MediaSeekForwardButton,
-    MediaSlider,
-    MediaSliderThumb,
-    MediaRewindButton,
-    MediaReturnToRealtimeButton,
-    MediaShowClosedCaptionsButton,
-    MediaHideClosedCaptionsButton,
-    MediaUnMuteButton,
-    MediaPauseButton,
-    MediaTimelineContainer,
-    MediaCurrentTimeDisplay,
-    MediaTimeRemainingDisplay,
-    MediaStatusDisplay,
-    MediaControlsPanel,
-    MediaVolumeSliderContainer,
-    MediaVolumeSlider,
-    MediaVolumeSliderThumb,
-    MediaFullScreenVolumeSlider,
-    MediaFullScreenVolumeSliderThumb,
-    MediaVolumeSliderMuteButton,
-    MediaTextTrackDisplayContainer,
-    MediaTextTrackDisplay,
-    MediaExitFullscreenButton,
-    MediaOverlayPlayButton,
-    MediaClosedCaptionsContainer,
-    MediaClosedCaptionsTrackList,
-};
-
-HTMLMediaElement* toParentMediaElement(Node*);
-inline HTMLMediaElement* toParentMediaElement(RenderObject* renderer) { return toParentMediaElement(renderer->node()); }
-
-MediaControlElementType mediaControlElementType(Node*);
-
-// ----------------------------
-
-class MediaControlElement : public HTMLDivElement {
-public:
-    void hide();
-    void show();
-    bool isShowing() const;
-
-    virtual MediaControlElementType displayType() const = 0;
-
-    void setMediaController(MediaControllerInterface* controller) { m_mediaController = controller; }
-    MediaControllerInterface* mediaController() const { return m_mediaController; }
-
-protected:
-    MediaControlElement(Document*);
-
-private:
-    virtual bool isMediaControlElement() const { return true; }
-
-    MediaControllerInterface* m_mediaController;   
-};
-
 // ----------------------------
 
-class MediaControlPanelElement : public MediaControlElement {
+class MediaControlPanelElement : public MediaControlDivElement {
 public:
     static PassRefPtr<MediaControlPanelElement> create(Document*);
 
@@ -123,10 +52,10 @@ public:
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
 private:
-    MediaControlPanelElement(Document*);
-    virtual MediaControlElementType displayType() const;
-    virtual const AtomicString& shadowPseudoId() const;
-    virtual void defaultEventHandler(Event*);
+    explicit MediaControlPanelElement(Document*);
+
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
     void startDrag(const LayoutPoint& eventLocation);
     void continueDrag(const LayoutPoint& eventLocation);
@@ -150,91 +79,68 @@ private:
 
 // ----------------------------
 
-class MediaControlTimelineContainerElement : public MediaControlElement {
+class MediaControlPanelEnclosureElement : public MediaControlDivElement {
 public:
-    static PassRefPtr<MediaControlTimelineContainerElement> create(Document*);
+    static PassRefPtr<MediaControlPanelEnclosureElement> create(Document*);
 
 private:
-    MediaControlTimelineContainerElement(Document*);
-    virtual const AtomicString& shadowPseudoId() const;
-
-    virtual MediaControlElementType displayType() const;
+    explicit MediaControlPanelEnclosureElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlVolumeSliderContainerElement : public MediaControlElement {
+class MediaControlOverlayEnclosureElement : public MediaControlDivElement {
 public:
-    static PassRefPtr<MediaControlVolumeSliderContainerElement> create(Document*);
-
-    virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
+    static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document*);
 
 private:
-    MediaControlVolumeSliderContainerElement(Document*);
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-    virtual void defaultEventHandler(Event*);
-    virtual MediaControlElementType displayType() const;
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlOverlayEnclosureElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlStatusDisplayElement : public MediaControlElement {
+class MediaControlTimelineContainerElement : public MediaControlDivElement {
 public:
-    static PassRefPtr<MediaControlStatusDisplayElement> create(Document*);
-
-    void update();
+    static PassRefPtr<MediaControlTimelineContainerElement> create(Document*);
 
 private:
-    MediaControlStatusDisplayElement(Document*);
-
-    virtual MediaControlElementType displayType() const;
-    virtual const AtomicString& shadowPseudoId() const;
-
-    enum StateBeingDisplayed { Nothing, Loading, LiveBroadcast };
-    StateBeingDisplayed m_stateBeingDisplayed;
+    explicit MediaControlTimelineContainerElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlInputElement : public HTMLInputElement {
+class MediaControlVolumeSliderContainerElement : public MediaControlDivElement {
 public:
-    void hide();
-    void show();
-
-    MediaControlElementType displayType() const { return m_displayType; }
-
-    void setMediaController(MediaControllerInterface* controller) { m_mediaController = controller; }
-    MediaControllerInterface* mediaController() const { return m_mediaController; }
-
-protected:
-    MediaControlInputElement(Document*, MediaControlElementType);
+    static PassRefPtr<MediaControlVolumeSliderContainerElement> create(Document*);
 
-    void setDisplayType(MediaControlElementType);
+    virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
 
 private:
-    virtual bool isMediaControlElement() const { return true; }
+    explicit MediaControlVolumeSliderContainerElement(Document*);
 
-    virtual void updateDisplayType() { }
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
-    MediaControllerInterface* m_mediaController;
-    MediaControlElementType m_displayType;
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlMuteButtonElement : public MediaControlInputElement {
+class MediaControlStatusDisplayElement : public MediaControlDivElement {
 public:
-    void changedMute();
-
-    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
+    static PassRefPtr<MediaControlStatusDisplayElement> create(Document*);
 
-protected:
-    MediaControlMuteButtonElement(Document*, MediaControlElementType);
-    virtual void defaultEventHandler(Event*);
+    void update();
 
 private:
-    virtual void updateDisplayType();
+    explicit MediaControlStatusDisplayElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+
+    enum StateBeingDisplayed { Nothing, Loading, LiveBroadcast };
+    StateBeingDisplayed m_stateBeingDisplayed;
 };
 
 // ----------------------------
@@ -246,10 +152,10 @@ public:
     virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
 
 private:
-    MediaControlPanelMuteButtonElement(Document*, MediaControls*);
+    explicit MediaControlPanelMuteButtonElement(Document*, MediaControls*);
 
-    virtual void defaultEventHandler(Event*);
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
     MediaControls* m_controls;
 };
@@ -261,9 +167,8 @@ public:
     static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(Document*);
 
 private:
-    MediaControlVolumeSliderMuteButtonElement(Document*);
-
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlVolumeSliderMuteButtonElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 
@@ -273,14 +178,14 @@ class MediaControlPlayButtonElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlPlayButtonElement> create(Document*);
 
-    virtual void defaultEventHandler(Event*);
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
-    virtual void updateDisplayType();
+    virtual void updateDisplayType() OVERRIDE;
 
 private:
-    MediaControlPlayButtonElement(Document*);
+    explicit MediaControlPlayButtonElement(Document*);
 
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
 // ----------------------------
@@ -289,38 +194,13 @@ class MediaControlOverlayPlayButtonElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document*);
 
-    virtual void defaultEventHandler(Event*);
-    virtual void updateDisplayType();
+    virtual void updateDisplayType() OVERRIDE;
 
 private:
     explicit MediaControlOverlayPlayButtonElement(Document*);
 
-    virtual const AtomicString& shadowPseudoId() const;
-};
-
-// ----------------------------
-class MediaControlSeekButtonElement : public MediaControlInputElement {
-public:
-    virtual void defaultEventHandler(Event*);
-    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
-
-protected:
-    MediaControlSeekButtonElement(Document*, MediaControlElementType);
-
-private:
-    virtual bool isForwardButton() const = 0;
-    virtual void setActive(bool /*flag*/ = true, bool /*pause*/ = false);
-
-    void startTimer();
-    void stopTimer();
-    float nextRate() const;
-    void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
-
-    enum ActionType { Nothing, Play, Pause };
-    ActionType m_actionOnStop;
-    enum SeekType { Skip, Scan };
-    SeekType m_seekType;
-    Timer<MediaControlSeekButtonElement> m_seekTimer;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
 // ----------------------------
@@ -330,10 +210,10 @@ public:
     static PassRefPtr<MediaControlSeekForwardButtonElement> create(Document*);
 
 private:
-    MediaControlSeekForwardButtonElement(Document*);
+    explicit MediaControlSeekForwardButtonElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 
-    virtual bool isForwardButton() const { return true; }
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual bool isForwardButton() const OVERRIDE { return true; }
 };
 
 // ----------------------------
@@ -343,10 +223,10 @@ public:
     static PassRefPtr<MediaControlSeekBackButtonElement> create(Document*);
 
 private:
-    MediaControlSeekBackButtonElement(Document*);
+    explicit MediaControlSeekBackButtonElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 
-    virtual bool isForwardButton() const { return false; }
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual bool isForwardButton() const OVERRIDE { return false; }
 };
 
 // ----------------------------
@@ -355,13 +235,13 @@ class MediaControlRewindButtonElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlRewindButtonElement> create(Document*);
 
-    virtual void defaultEventHandler(Event*);
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
 private:
-    MediaControlRewindButtonElement(Document*);
+    explicit MediaControlRewindButtonElement(Document*);
 
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
 // ----------------------------
@@ -370,14 +250,14 @@ class MediaControlReturnToRealtimeButtonElement : public MediaControlInputElemen
 public:
     static PassRefPtr<MediaControlReturnToRealtimeButtonElement> create(Document*);
 
-    virtual void defaultEventHandler(Event*);
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
 private:
-    MediaControlReturnToRealtimeButtonElement(Document*);
+    explicit MediaControlReturnToRealtimeButtonElement(Document*);
 
-    virtual const AtomicString& shadowPseudoId() const;
-};    
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
+};
 
 // ----------------------------
 
@@ -386,12 +266,14 @@ public:
     static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(Document*, MediaControls*);
 
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
-    virtual void defaultEventHandler(Event*);
-    virtual void updateDisplayType();
+
+    virtual void updateDisplayType() OVERRIDE;
 
 private:
-    MediaControlToggleClosedCaptionsButtonElement(Document*, MediaControls*);
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlToggleClosedCaptionsButtonElement(Document*, MediaControls*);
+
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
 #if PLATFORM(MAC)
     MediaControls* m_controls;
@@ -400,7 +282,7 @@ private:
 
 // ----------------------------
 
-class MediaControlClosedCaptionsContainerElement : public MediaControlElement {
+class MediaControlClosedCaptionsContainerElement : public MediaControlDivElement {
 public:
     static PassRefPtr<MediaControlClosedCaptionsContainerElement> create(Document*);
 
@@ -408,18 +290,15 @@ public:
 
 private:
     MediaControlClosedCaptionsContainerElement(Document*);
-
-    virtual MediaControlElementType displayType() const { return MediaClosedCaptionsContainer; }
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlClosedCaptionsTrackListElement : public MediaControlElement {
+class MediaControlClosedCaptionsTrackListElement : public MediaControlDivElement {
 public:
     static PassRefPtr<MediaControlClosedCaptionsTrackListElement> create(Document*, MediaControls*);
 
-    virtual void defaultEventHandler(Event*);
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
     void updateDisplay();
@@ -428,8 +307,8 @@ public:
 private:
     MediaControlClosedCaptionsTrackListElement(Document*, MediaControls*);
 
-    virtual MediaControlElementType displayType() const { return MediaClosedCaptionsTrackList; }
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
     typedef Vector<RefPtr<Element> > TrackMenuItems;
     TrackMenuItems menuItems;
@@ -442,65 +321,56 @@ class MediaControlTimelineElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlTimelineElement> create(Document*, MediaControls*);
 
-    virtual void defaultEventHandler(Event*);
     virtual bool willRespondToMouseClickEvents() OVERRIDE;
+
     void setPosition(float);
     void setDuration(float);
 
 private:
-    MediaControlTimelineElement(Document*, MediaControls*);
+    explicit MediaControlTimelineElement(Document*, MediaControls*);
 
-    virtual const AtomicString& shadowPseudoId() const;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 
     MediaControls* m_controls;
 };
 
 // ----------------------------
 
-class MediaControlVolumeSliderElement : public MediaControlInputElement {
+class MediaControlFullscreenButtonElement : public MediaControlInputElement {
 public:
-    static PassRefPtr<MediaControlVolumeSliderElement> create(Document*);
+    static PassRefPtr<MediaControlFullscreenButtonElement> create(Document*);
 
-    virtual void defaultEventHandler(Event*);
-    virtual bool willRespondToMouseMoveEvents() OVERRIDE;
-    virtual bool willRespondToMouseClickEvents() OVERRIDE;
-    void setVolume(float);
-    void setClearMutedOnUserInteraction(bool);
+    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
-protected:
-    MediaControlVolumeSliderElement(Document*);
+    virtual void setIsFullscreen(bool);
 
 private:
-    virtual const AtomicString& shadowPseudoId() const;
-    bool m_clearMutedOnUserInteraction;
+    explicit MediaControlFullscreenButtonElement(Document*);
+
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
 // ----------------------------
 
-class MediaControlFullscreenButtonElement : public MediaControlInputElement {
+class MediaControlPanelVolumeSliderElement : public MediaControlVolumeSliderElement {
 public:
-    static PassRefPtr<MediaControlFullscreenButtonElement> create(Document*, MediaControls*);
-
-    virtual void defaultEventHandler(Event*);
-    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
-    void setIsFullscreen(bool);
+    static PassRefPtr<MediaControlPanelVolumeSliderElement> create(Document*);
 
 private:
-    MediaControlFullscreenButtonElement(Document*, MediaControls*);
-
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlPanelVolumeSliderElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
-
 // ----------------------------
 
 class MediaControlFullscreenVolumeSliderElement : public MediaControlVolumeSliderElement {
 public:
     static PassRefPtr<MediaControlFullscreenVolumeSliderElement> create(Document*);
-    
+
 private:
-    MediaControlFullscreenVolumeSliderElement(Document*);
-    
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlFullscreenVolumeSliderElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
@@ -508,14 +378,13 @@ private:
 class MediaControlFullscreenVolumeMinButtonElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlFullscreenVolumeMinButtonElement> create(Document*);
-    
-    virtual void defaultEventHandler(Event*);
+
     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
 private:
-    MediaControlFullscreenVolumeMinButtonElement(Document*);
-    
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlFullscreenVolumeMinButtonElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
 // ----------------------------
@@ -523,32 +392,17 @@ private:
 class MediaControlFullscreenVolumeMaxButtonElement : public MediaControlInputElement {
 public:
     static PassRefPtr<MediaControlFullscreenVolumeMaxButtonElement> create(Document*);
-    
-    virtual void defaultEventHandler(Event*);
-    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
-
-private:
-    MediaControlFullscreenVolumeMaxButtonElement(Document*);
-    
-    virtual const AtomicString& shadowPseudoId() const;
-};
-
-// ----------------------------
-
-class MediaControlTimeDisplayElement : public MediaControlElement {
-public:
-    void setCurrentValue(float);
-    float currentValue() const { return m_currentValue; }
 
-protected:
-    MediaControlTimeDisplayElement(Document*);
+    virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
 
 private:
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+    explicit MediaControlFullscreenVolumeMaxButtonElement(Document*);
 
-    float m_currentValue;
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
+    virtual void defaultEventHandler(Event*) OVERRIDE;
 };
 
+
 // ----------------------------
 
 class MediaControlTimeRemainingDisplayElement : public MediaControlTimeDisplayElement {
@@ -556,10 +410,8 @@ public:
     static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(Document*);
 
 private:
-    MediaControlTimeRemainingDisplayElement(Document*);
-
-    virtual MediaControlElementType displayType() const;
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlTimeRemainingDisplayElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
 
 // ----------------------------
@@ -569,16 +421,15 @@ public:
     static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(Document*);
 
 private:
-    MediaControlCurrentTimeDisplayElement(Document*);
-
-    virtual MediaControlElementType displayType() const;
-    virtual const AtomicString& shadowPseudoId() const;
+    explicit MediaControlCurrentTimeDisplayElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 };
+
 // ----------------------------
 
 #if ENABLE(VIDEO_TRACK)
-class MediaControlTextTrackContainerElement : public MediaControlElement {
+
+class MediaControlTextTrackContainerElement : public MediaControlDivElement {
 public:
     static PassRefPtr<MediaControlTextTrackContainerElement> create(Document*);
 
@@ -586,18 +437,16 @@ public:
     void updateSizes();
 
 private:
-    MediaControlTextTrackContainerElement(Document*);
+    explicit MediaControlTextTrackContainerElement(Document*);
+    virtual const AtomicString& shadowPseudoId() const OVERRIDE;
 
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
-    virtual MediaControlElementType displayType() const { return MediaTextTrackDisplayContainer; }
-    virtual const AtomicString& shadowPseudoId() const;
 
     IntRect m_videoDisplaySize;
     float m_fontSize;
 };
 
 #endif
-// ----------------------------
 
 } // namespace WebCore
 
index b5e9ff7..dcb7d91 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index 2580502..9860542 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -128,7 +128,7 @@ protected:
     MediaControlCurrentTimeDisplayElement* m_currentTimeDisplay;
     MediaControlTimelineElement* m_timeline;
     MediaControlPanelMuteButtonElement* m_panelMuteButton;
-    MediaControlVolumeSliderElement* m_volumeSlider;
+    MediaControlPanelVolumeSliderElement* m_volumeSlider;
     MediaControlToggleClosedCaptionsButtonElement* m_toggleClosedCaptionsButton;
     MediaControlFullscreenButtonElement* m_fullScreenButton;
 
index 93733ae..52d674c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -168,7 +168,7 @@ PassRefPtr<MediaControlsApple> MediaControlsApple::createControls(Document* docu
     }
 
     // FIXME: Only create when needed <http://webkit.org/b/57163>
-    RefPtr<MediaControlFullscreenButtonElement> fullScreenButton = MediaControlFullscreenButtonElement::create(document, controls.get());
+    RefPtr<MediaControlFullscreenButtonElement> fullScreenButton = MediaControlFullscreenButtonElement::create(document);
     controls->m_fullScreenButton = fullScreenButton.get();
     panel->appendChild(fullScreenButton.release(), ec, true);
 
@@ -178,7 +178,7 @@ PassRefPtr<MediaControlsApple> MediaControlsApple::createControls(Document* docu
     if (document->page()->theme()->usesMediaControlVolumeSlider()) {
         RefPtr<MediaControlVolumeSliderContainerElement> volumeSliderContainer = MediaControlVolumeSliderContainerElement::create(document);
 
-        RefPtr<MediaControlVolumeSliderElement> slider = MediaControlVolumeSliderElement::create(document);
+        RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolumeSliderElement::create(document);
         controls->m_volumeSlider = slider.get();
         volumeSliderContainer->appendChild(slider.release(), ec, true);
         if (ec)
index a1ee896..9e3914c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index 28b77cf..5ca467a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,33 +33,6 @@ using namespace std;
 
 namespace WebCore {
 
-MediaControlChromiumEnclosureElement::MediaControlChromiumEnclosureElement(Document* document)
-    : MediaControlElement(document)
-{
-}
-
-MediaControlElementType MediaControlChromiumEnclosureElement::displayType() const
-{
-    // Mapping onto same MediaControlElementType as panel element, since it has similar properties.
-    return MediaControlsPanel;
-}
-
-MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(Document* document)
-    : MediaControlChromiumEnclosureElement(document)
-{
-}
-
-PassRefPtr<MediaControlPanelEnclosureElement> MediaControlPanelEnclosureElement::create(Document* document)
-{
-    return adoptRef(new MediaControlPanelEnclosureElement(document));
-}
-
-const AtomicString& MediaControlPanelEnclosureElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-enclosure"));
-    return id;
-}
-
 MediaControlsChromium::MediaControlsChromium(Document* document)
     : MediaControls(document)
     , m_durationDisplay(0)
@@ -128,7 +101,7 @@ bool MediaControlsChromium::initializeControls(Document* document)
     if (ec)
         return false;
 
-    RefPtr<MediaControlVolumeSliderElement> slider = MediaControlVolumeSliderElement::create(document);
+    RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolumeSliderElement::create(document);
     m_volumeSlider = slider.get();
     m_volumeSlider->setClearMutedOnUserInteraction(true);
     panel->appendChild(slider.release(), ec, true);
@@ -143,7 +116,7 @@ bool MediaControlsChromium::initializeControls(Document* document)
             return false;
     }
 
-    RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document, this);
+    RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document);
     m_fullScreenButton = fullscreenButton.get();
     panel->appendChild(fullscreenButton.release(), ec, true);
     if (ec)
index a61ddb1..5c10708 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 namespace WebCore {
 
-class MediaControlChromiumEnclosureElement : public MediaControlElement {
-protected:
-    explicit MediaControlChromiumEnclosureElement(Document*);
-
-private:
-    virtual MediaControlElementType displayType() const;
-};
-
-class MediaControlPanelEnclosureElement : public MediaControlChromiumEnclosureElement {
-public:
-    static PassRefPtr<MediaControlPanelEnclosureElement> create(Document*);
-
-private:
-    explicit MediaControlPanelEnclosureElement(Document*);
-    virtual const AtomicString& shadowPseudoId() const;
-};
-
 class MediaControlsChromium : public MediaControls {
 public:
     // Called from port-specific parent create function to create custom controls.
index 6c9eadf..ea11bb3 100644 (file)
 
 namespace WebCore {
 
-MediaControlOverlayEnclosureElement::MediaControlOverlayEnclosureElement(Document* document)
-    : MediaControlChromiumEnclosureElement(document)
-{
-}
-
-PassRefPtr<MediaControlOverlayEnclosureElement> MediaControlOverlayEnclosureElement::create(Document* document)
-{
-    return adoptRef(new MediaControlOverlayEnclosureElement(document));
-}
-
-const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclosure", AtomicString::ConstructFromLiteral));
-    return id;
-}
-
 MediaControlsChromiumAndroid::MediaControlsChromiumAndroid(Document* document)
     : MediaControlsChromium(document)
     , m_overlayPlayButton(0)
index c192582..44a1f79 100644 (file)
 
 namespace WebCore {
 
-class MediaControlOverlayPlayButtonElement;
-
-class MediaControlOverlayEnclosureElement : public MediaControlChromiumEnclosureElement {
-public:
-    static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document*);
-
-private:
-    explicit MediaControlOverlayEnclosureElement(Document*);
-    virtual const AtomicString& shadowPseudoId() const;
-};
-
 class MediaControlsChromiumAndroid : public MediaControlsChromium {
 public:
     static PassRefPtr<MediaControlsChromiumAndroid> createControls(Document*);
diff --git a/Source/WebCore/rendering/RenderMediaControlElements.cpp b/Source/WebCore/rendering/RenderMediaControlElements.cpp
new file mode 100644 (file)
index 0000000..47bac2c
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google 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 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO)
+#include "RenderMediaControlElements.h"
+
+#include "RenderTheme.h"
+#include "RenderView.h"
+
+namespace WebCore {
+
+RenderMediaVolumeSliderContainer::RenderMediaVolumeSliderContainer(Node* node)
+    : RenderBlock(node)
+{
+}
+
+void RenderMediaVolumeSliderContainer::layout()
+{
+    RenderBlock::layout();
+
+    if (style()->display() == NONE || !nextSibling() || !nextSibling()->isBox())
+        return;
+
+    RenderBox* buttonBox = toRenderBox(nextSibling());
+    int absoluteOffsetTop = buttonBox->localToAbsolute(FloatPoint(0, -size().height())).y();
+
+    LayoutStateDisabler layoutStateDisabler(view());
+
+    // If the slider would be rendered outside the page, it should be moved below the controls.
+    if (UNLIKELY(absoluteOffsetTop < 0))
+        setY(buttonBox->offsetTop() + theme()->volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
+}
+
+// ----------------------------
+
+RenderMediaControlTimeDisplay::RenderMediaControlTimeDisplay(Node* node)
+    : RenderDeprecatedFlexibleBox(node)
+{
+}
+
+// We want the timeline slider to be at least 100 pixels wide.
+// FIXME: Eliminate hard-coded widths altogether.
+static const int minWidthToDisplayTimeDisplays = 45 + 100 + 45;
+
+void RenderMediaControlTimeDisplay::layout()
+{
+    RenderDeprecatedFlexibleBox::layout();
+    RenderBox* timelineContainerBox = parentBox();
+    while (timelineContainerBox && timelineContainerBox->isAnonymous())
+        timelineContainerBox = timelineContainerBox->parentBox();
+
+    if (timelineContainerBox && timelineContainerBox->width() < minWidthToDisplayTimeDisplays)
+        setWidth(0);
+}
+
+// ----------------------------
+
+#if ENABLE(VIDEO_TRACK)
+
+RenderTextTrackContainerElement::RenderTextTrackContainerElement(Node* node)
+    : RenderBlock(node)
+{
+}
+
+void RenderTextTrackContainerElement::layout()
+{
+    RenderBlock::layout();
+    if (style()->display() == NONE)
+        return;
+
+    ASSERT(mediaControlElementType(node()) == MediaTextTrackDisplayContainer);
+
+    LayoutStateDisabler layoutStateDisabler(view());
+    static_cast<MediaControlTextTrackContainerElement*>(node())->updateSizes();
+}
+
+#endif // ENABLE(VIDEO_TRACK)
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO)
+
diff --git a/Source/WebCore/rendering/RenderMediaControlElements.h b/Source/WebCore/rendering/RenderMediaControlElements.h
new file mode 100644 (file)
index 0000000..2265d71
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google 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 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.
+ */
+
+#ifndef RenderMediaControlElements_h
+#define RenderMediaControlElements_h
+
+#if ENABLE(VIDEO)
+
+#include "MediaControlElements.h"
+#include "RenderBlock.h"
+#include "RenderDeprecatedFlexibleBox.h"
+
+namespace WebCore {
+
+class RenderMediaVolumeSliderContainer : public RenderBlock {
+public:
+    RenderMediaVolumeSliderContainer(Node*);
+
+private:
+    virtual void layout();
+};
+
+// ----------------------------
+
+class RenderMediaControlTimeDisplay : public RenderDeprecatedFlexibleBox {
+public:
+    RenderMediaControlTimeDisplay(Node*);
+
+private:
+    virtual void layout();
+};
+
+// ----------------------------
+
+#if ENABLE(VIDEO_TRACK)
+
+class RenderTextTrackContainerElement : public RenderBlock {
+public:
+    RenderTextTrackContainerElement(Node*);
+
+private:
+    virtual void layout();
+};
+
+#endif // ENABLE(VIDEO_TRACK)
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO)
+
+#endif // RenderMediaControlElements_h
+
index fadd090..1ffa6aa 100644 (file)
@@ -27,6 +27,7 @@
 #import "MediaControlElements.h"
 #import "PaintInfo.h"
 #import "RenderMedia.h"
+#import "RenderMediaControlElements.h"
 #import "RenderMediaControls.h"
 #import "RenderView.h"
 #import "TimeRanges.h"
index 3e155db..e5f6256 100644 (file)
@@ -74,6 +74,7 @@
 #include "RenderListMarker.cpp"
 #include "RenderMarquee.cpp"
 #include "RenderMedia.cpp"
+#include "RenderMediaControlElements.cpp"
 #include "RenderMediaControls.cpp"
 #include "RenderMenuList.cpp"
 #include "RenderMeter.cpp"