2009-01-02 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 18:33:35 +0000 (18:33 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jan 2009 18:33:35 +0000 (18:33 +0000)
        Reviewed by Darin Adler

        https://bugs.webkit.org/show_bug.cgi?id=23043

        Pull media controls css out of html4.css into separate file. Don't generate
        wml, svg, or media css globals unless the feature is enabled.

        * DerivedSources.make:
            Don't include css for unused features.

        * WebCore.xcodeproj/project.pbxproj:
            include mediaControls.css

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::styleForElement):
            don't parse or add media css unless VIDEO feature is enabled and the target
            element is video or audio

        * css/html4.css:
            moved media controls css to mediaControls.css

        * css/mediaControls.css: Added.

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

WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSStyleSelector.cpp
WebCore/css/html4.css
WebCore/css/mediaControls.css [new file with mode: 0644]

index e6d6cb5..78dc09e 100644 (file)
@@ -1,3 +1,28 @@
+2009-01-02  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Darin Adler
+
+        https://bugs.webkit.org/show_bug.cgi?id=23043
+
+        Pull media controls css out of html4.css into separate file. Don't generate
+        wml, svg, or media css globals unless the feature is enabled.
+
+        * DerivedSources.make:
+            Don't include css for unused features.
+
+        * WebCore.xcodeproj/project.pbxproj:
+            include mediaControls.css
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForElement):
+            don't parse or add media css unless VIDEO feature is enabled and the target
+            element is video or audio
+
+        * css/html4.css:
+            moved media controls css to mediaControls.css
+
+        * css/mediaControls.css: Added.
+
 2009-01-02  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin Adler.
 2009-01-02  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin Adler.
index f57bc19..0f05ab3 100644 (file)
@@ -510,7 +510,20 @@ XPathGrammar.cpp : xml/XPathGrammar.y $(PROJECT_FILE)
 
 # user agent style sheets
 
 
 # user agent style sheets
 
-USER_AGENT_STYLE_SHEETS = $(WebCore)/css/html4.css $(WebCore)/css/quirks.css $(WebCore)/css/view-source.css $(WebCore)/css/svg.css $(WebCore)/css/wml.css $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css
+USER_AGENT_STYLE_SHEETS = $(WebCore)/css/html4.css $(WebCore)/css/quirks.css $(WebCore)/css/view-source.css $(WebCore)/css/themeWin.css $(WebCore)/css/themeWinQuirks.css 
+
+ifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/svg.css 
+endif
+
+ifeq ($(findstring ENABLE_WML,$(FEATURE_DEFINES)), ENABLE_WML)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/wml.css
+endif
+
+ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
+    USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControls.css
+endif
+
 UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS)
        perl $< $@ UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS)
 
 UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS)
        perl $< $@ UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS)
 
index 8a163c0..a553fdb 100644 (file)
                066C772F0AB603FD00238CC4 /* RenderFileUploadControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFileUploadControl.h; sourceTree = "<group>"; };
                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalCurrentGraphicsContext.h; sourceTree = "<group>"; };
                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalCurrentGraphicsContext.mm; sourceTree = "<group>"; };
                066C772F0AB603FD00238CC4 /* RenderFileUploadControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderFileUploadControl.h; sourceTree = "<group>"; };
                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalCurrentGraphicsContext.h; sourceTree = "<group>"; };
                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalCurrentGraphicsContext.mm; sourceTree = "<group>"; };
+               070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mediaControls.css; sourceTree = "<group>"; };
                080081940ED3B2DD00C53BC0 /* WMLAnchorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLAnchorElement.cpp; sourceTree = "<group>"; };
                080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAnchorElement.h; sourceTree = "<group>"; };
                0804BF6C0EE09C3B0006C000 /* WMLDoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLDoElement.cpp; sourceTree = "<group>"; };
                080081940ED3B2DD00C53BC0 /* WMLAnchorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLAnchorElement.cpp; sourceTree = "<group>"; };
                080081950ED3B2DD00C53BC0 /* WMLAnchorElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAnchorElement.h; sourceTree = "<group>"; };
                0804BF6C0EE09C3B0006C000 /* WMLDoElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLDoElement.cpp; sourceTree = "<group>"; };
                F523D18402DE42E8018635CA /* css */ = {
                        isa = PBXGroup;
                        children = (
                F523D18402DE42E8018635CA /* css */ = {
                        isa = PBXGroup;
                        children = (
+                               070DD8F50F01868000727DEB /* mediaControls.css */,
                                93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
                                A80E6CBB0A1989CA007FB8C5 /* CSSBorderImageValue.cpp */,
                                A80E6CDD0A1989CA007FB8C5 /* CSSBorderImageValue.h */,
                                93CA4C9C09DF93FA00DF8677 /* maketokenizer */,
                                A80E6CBB0A1989CA007FB8C5 /* CSSBorderImageValue.cpp */,
                                A80E6CDD0A1989CA007FB8C5 /* CSSBorderImageValue.h */,
index 7a9c020..f0159f3 100644 (file)
@@ -1088,6 +1088,16 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
     }
 #endif
 
     }
 #endif
 
+#if ENABLE(VIDEO)
+    static bool loadedMediaStyleSheet;
+    if (!loadedMediaStyleSheet && (e->hasTagName(videoTag) || e->hasTagName(audioTag))) {
+        loadedMediaStyleSheet = true;
+        CSSStyleSheet* mediaControlsSheet = parseUASheet(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet));
+        defaultStyle->addRulesFromSheet(mediaControlsSheet, screenEval());
+        defaultPrintStyle->addRulesFromSheet(mediaControlsSheet, printEval());
+    }
+#endif
+
     int firstUARule = -1, lastUARule = -1;
     int firstUserRule = -1, lastUserRule = -1;
     int firstAuthorRule = -1, lastAuthorRule = -1;
     int firstUARule = -1, lastUARule = -1;
     int firstUserRule = -1, lastUserRule = -1;
     int firstAuthorRule = -1, lastAuthorRule = -1;
index 8e8b437..4709a37 100644 (file)
@@ -593,84 +593,4 @@ iframe {
     border: 2px inset
 }
 
     border: 2px inset
 }
 
-/* media controls */
-/* FIXME this is not the final styling */
-
-audio {
-    width: 200px;
-    height: 16px;
-}
-
-audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
-    position: absolute;
-    bottom: 0;
-    width: 100%;
-    height: 100%;
-    -webkit-user-select: none;
-}
-
-video:-webkit-full-page-media::-webkit-media-controls-panel {
-    bottom: -16px;
-}
-
-audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
-    -webkit-appearance: media-mute-button;
-    position: absolute;
-    top: auto;
-    bottom: 0;
-    left: 0;
-    width: 17px;
-    height: 16px;
-}
-
-audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
-    -webkit-appearance: media-play-button;
-    position: absolute;
-    top: auto;
-    bottom: 0;
-    left: 16px;
-    width: 17px;
-    height: 16px;
-}
-
-audio::-webkit-media-controls-time-display, video::-webkit-media-controls-time-display {
-    display: none;
-}
-
-audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
-    -webkit-appearance: media-slider;
-    position: absolute;
-    top: auto;
-    bottom: 0;
-    left: 32px;
-    right: 32px;
-    height: 16px;
-    padding: 0px 2px;
-}
-
-audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
-    -webkit-appearance: media-seek-back-button;
-    position: absolute;
-    top: auto;
-    bottom: 0;
-    right: 16px;
-    width: 17px;
-    height: 16px;
-}
-
-
-audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
-    -webkit-appearance: media-seek-forward-button;
-    position: absolute;
-    top: auto;
-    bottom: 0;
-    right: 0;
-    width: 17px;
-    height: 16px;
-}
-
-audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
-    display: none;
-}
-
 /* noscript is handled internally, as it depends on settings */
 /* noscript is handled internally, as it depends on settings */
diff --git a/WebCore/css/mediaControls.css b/WebCore/css/mediaControls.css
new file mode 100644 (file)
index 0000000..1dbb2c3
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+/* media controls */
+
+audio {
+    width: 200px;
+    height: 16px;
+}
+
+audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
+    position: absolute;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    -webkit-user-select: none;
+}
+
+video:-webkit-full-page-media::-webkit-media-controls-panel {
+    bottom: -16px;
+}
+
+audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
+    -webkit-appearance: media-mute-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 0;
+    width: 17px;
+    height: 16px;
+}
+
+audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
+    -webkit-appearance: media-play-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 16px;
+    width: 17px;
+    height: 16px;
+}
+
+audio::-webkit-media-controls-time-display, video::-webkit-media-controls-time-display {
+    display: none;
+}
+
+audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
+    -webkit-appearance: media-slider;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    left: 32px;
+    right: 32px;
+    height: 16px;
+    padding: 0px 2px;
+}
+
+audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
+    -webkit-appearance: media-seek-back-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    right: 16px;
+    width: 17px;
+    height: 16px;
+}
+
+
+audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
+    -webkit-appearance: media-seek-forward-button;
+    position: absolute;
+    top: auto;
+    bottom: 0;
+    right: 0;
+    width: 17px;
+    height: 16px;
+}
+
+audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
+    display: none;
+}