Title: [185470] trunk
Revision
185470
Author
[email protected]
Date
2015-06-11 13:50:34 -0700 (Thu, 11 Jun 2015)

Log Message

Add an appearance keyword for wireless playback / airplay icon
https://bugs.webkit.org/show_bug.cgi?id=145892
<rdar://problem/21344872>

Reviewed by Simon Fraser.

Source/WebCore:

Add a new "-webkit-appearance" value named "-apple-airplay"
which will be used to render an icon. This change simply
adds support for the value, and puts in hooks for drawing.

At the moment this is only going to be used by Airplay, so
the public-facing name is "-apple-airplay". However, the
implementation in Theme has a more generic name, in case
we hook it up for other ports later.

Test: fast/css/appearance-airplay.html

* css/CSSParser.cpp:
(WebCore::cssValueKeywordID): This new keyword should not get
translated into having a -webkit prefix.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): New mapping from
the Theme to the CSS value.
* css/CSSValueKeywords.in: Add "-apple-airplay".
* platform/ThemeTypes.h: New ControlPart.
* rendering/RenderTheme.cpp: Stub implementation of the rendering and
style update for the new appearance.
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::adjustWirelessPlaybackIconStyle):
(WebCore::RenderTheme::paintWirelessPlaybackIcon):
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::adjustWirelessPlaybackIconStyle):
(WebCore::RenderThemeMac::paintWirelessPlaybackIcon):

LayoutTests:

Simple test that makes sure we parse and evaluate
the new appearance value.

* fast/css/appearance-airplay-expected.txt: Added.
* fast/css/appearance-airplay.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185469 => 185470)


--- trunk/LayoutTests/ChangeLog	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/LayoutTests/ChangeLog	2015-06-11 20:50:34 UTC (rev 185470)
@@ -1,3 +1,17 @@
+2015-06-11  Dean Jackson  <[email protected]>
+
+        Add an appearance keyword for wireless playback / airplay icon
+        https://bugs.webkit.org/show_bug.cgi?id=145892
+        <rdar://problem/21344872>
+
+        Reviewed by Simon Fraser.
+
+        Simple test that makes sure we parse and evaluate
+        the new appearance value.
+
+        * fast/css/appearance-airplay-expected.txt: Added.
+        * fast/css/appearance-airplay.html: Added.
+
 2015-06-11  Alexey Proskuryakov  <[email protected]>
 
         Update plugins/embed-attributes-style.html to not use the QuickTime plug-in

Added: trunk/LayoutTests/fast/css/appearance-airplay-expected.txt (0 => 185470)


--- trunk/LayoutTests/fast/css/appearance-airplay-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/appearance-airplay-expected.txt	2015-06-11 20:50:34 UTC (rev 185470)
@@ -0,0 +1,10 @@
+Test the -apple-airplay appearance keyword value.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS filterStyle is '-apple-airplay'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/css/appearance-airplay-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css/appearance-airplay.html (0 => 185470)


--- trunk/LayoutTests/fast/css/appearance-airplay.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/appearance-airplay.html	2015-06-11 20:50:34 UTC (rev 185470)
@@ -0,0 +1,28 @@
+<!DOCTYPE>
+<html>
+<head>
+<script src=""
+<style>
+#target {
+  -webkit-appearance: -apple-airplay;
+}
+</style>
+</head>
+<body>
+<div id="target"></div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test the -apple-airplay appearance keyword value.");
+
+var target = document.getElementById("target");
+var filterStyle = window.getComputedStyle(target).getPropertyValue('-webkit-appearance');
+shouldBe('filterStyle', "'-apple-airplay'");
+
+successfullyParsed = true;
+
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/appearance-airplay.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (185469 => 185470)


--- trunk/Source/WebCore/ChangeLog	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/ChangeLog	2015-06-11 20:50:34 UTC (rev 185470)
@@ -1,3 +1,42 @@
+2015-06-11  Dean Jackson  <[email protected]>
+
+        Add an appearance keyword for wireless playback / airplay icon
+        https://bugs.webkit.org/show_bug.cgi?id=145892
+        <rdar://problem/21344872>
+
+        Reviewed by Simon Fraser.
+
+        Add a new "-webkit-appearance" value named "-apple-airplay"
+        which will be used to render an icon. This change simply
+        adds support for the value, and puts in hooks for drawing.
+
+        At the moment this is only going to be used by Airplay, so
+        the public-facing name is "-apple-airplay". However, the
+        implementation in Theme has a more generic name, in case
+        we hook it up for other ports later.
+
+        Test: fast/css/appearance-airplay.html
+
+        * css/CSSParser.cpp:
+        (WebCore::cssValueKeywordID): This new keyword should not get
+        translated into having a -webkit prefix.
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): New mapping from
+        the Theme to the CSS value.
+        * css/CSSValueKeywords.in: Add "-apple-airplay".
+        * platform/ThemeTypes.h: New ControlPart.
+        * rendering/RenderTheme.cpp: Stub implementation of the rendering and
+        style update for the new appearance.
+        (WebCore::RenderTheme::adjustStyle):
+        (WebCore::RenderTheme::paint):
+        (WebCore::RenderTheme::adjustWirelessPlaybackIconStyle):
+        (WebCore::RenderTheme::paintWirelessPlaybackIcon):
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::adjustWirelessPlaybackIconStyle):
+        (WebCore::RenderThemeMac::paintWirelessPlaybackIcon):
+
 2015-06-11  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r185464.

Modified: trunk/Source/WebCore/css/CSSParser.cpp (185469 => 185470)


--- trunk/Source/WebCore/css/CSSParser.cpp	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2015-06-11 20:50:34 UTC (rev 185470)
@@ -12830,7 +12830,11 @@
         // This makes the string one character longer.
         // On iOS we don't want to change values starting with -apple-system to -webkit-system.
         // FIXME: Remove this mangling without breaking the web.
-        if ((hasPrefix(buffer, length, "-apple-") && !hasPrefix(buffer, length, "-apple-system")) || hasPrefix(buffer, length, "-khtml-")) {
+        // FIXME: The better way to do this would be to mark up CSSValueKeywords.in with
+        // commands that indicate if the keyword should support a translation.
+        // https://bugs.webkit.org/show_bug.cgi?id=145883
+
+        if ((hasPrefix(buffer, length, "-apple-") && !hasPrefix(buffer, length, "-apple-system") && memcmp(buffer, "-apple-airplay", length)) || hasPrefix(buffer, length, "-khtml-")) {
             memmove(buffer + 7, buffer + 6, length + 1 - 6);
             memcpy(buffer, "-webkit", 7);
             ++length;

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (185469 => 185470)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2015-06-11 20:50:34 UTC (rev 185470)
@@ -616,6 +616,9 @@
         m_value.valueID = CSSValueImageControlsButton;
         break;
 #endif
+    case WirelessPlaybackIconPart:
+        m_value.valueID = CSSValueAppleAirplay;
+        break;
     }
 }
 

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (185469 => 185470)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2015-06-11 20:50:34 UTC (rev 185470)
@@ -760,6 +760,7 @@
 continuous-capacity-level-indicator
 discrete-capacity-level-indicator
 rating-level-indicator
+-apple-airplay
 #if defined(ENABLE_SERVICE_CONTROLS) && ENABLE_SERVICE_CONTROLS
 image-controls-button
 #endif

Modified: trunk/Source/WebCore/platform/ThemeTypes.h (185469 => 185470)


--- trunk/Source/WebCore/platform/ThemeTypes.h	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/platform/ThemeTypes.h	2015-06-11 20:50:34 UTC (rev 185470)
@@ -46,6 +46,7 @@
     SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
     SearchFieldCancelButtonPart, SnapshottedPluginOverlayPart, TextFieldPart,
     RelevancyLevelIndicatorPart, ContinuousCapacityLevelIndicatorPart, DiscreteCapacityLevelIndicatorPart, RatingLevelIndicatorPart,
+    WirelessPlaybackIconPart,
 #if ENABLE(SERVICE_CONTROLS)
     ImageControlsButtonPart,
 #endif

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (185469 => 185470)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2015-06-11 20:50:34 UTC (rev 185470)
@@ -257,6 +257,8 @@
     case AttachmentPart:
         return adjustAttachmentStyle(styleResolver, style, element);
 #endif
+    case WirelessPlaybackIconPart:
+        return adjustWirelessPlaybackIconStyle(styleResolver, style, element);
     default:
         break;
     }
@@ -399,6 +401,8 @@
     case AttachmentPart:
         return paintAttachment(o, paintInfo, integralSnappedRect);
 #endif
+    case WirelessPlaybackIconPart:
+        return paintWirelessPlaybackIcon(o, paintInfo, integralSnappedRect);
     default:
         break;
     }
@@ -995,6 +999,15 @@
 }
 #endif
 
+void RenderTheme::adjustWirelessPlaybackIconStyle(StyleResolver&, RenderStyle&, Element*) const
+{
+}
+
+bool RenderTheme::paintWirelessPlaybackIcon(const RenderObject&, const PaintInfo&, const IntRect&)
+{
+    return false;
+}
+
 #if ENABLE(DATALIST_ELEMENT)
 LayoutUnit RenderTheme::sliderTickSnappingThreshold() const
 {

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (185469 => 185470)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2015-06-11 20:50:34 UTC (rev 185470)
@@ -326,6 +326,9 @@
     virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&);
 #endif
 
+    virtual void adjustWirelessPlaybackIconStyle(StyleResolver&, RenderStyle&, Element*) const;
+    virtual bool paintWirelessPlaybackIcon(const RenderObject&, const PaintInfo&, const IntRect&);
+
     virtual void adjustProgressBarStyle(StyleResolver&, RenderStyle&, Element*) const;
     virtual bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (185469 => 185470)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2015-06-11 20:50:34 UTC (rev 185470)
@@ -173,6 +173,9 @@
     virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&) override;
 #endif
 
+    virtual void adjustWirelessPlaybackIconStyle(StyleResolver&, RenderStyle&, Element*) const override;
+    virtual bool paintWirelessPlaybackIcon(const RenderObject&, const PaintInfo&, const IntRect&) override;
+
 private:
     virtual String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override;
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (185469 => 185470)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-06-11 20:23:34 UTC (rev 185469)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-06-11 20:50:34 UTC (rev 185470)
@@ -2613,6 +2613,15 @@
 
 #endif // ENABLE(ATTACHMENT_ELEMENT)
 
+void RenderThemeMac::adjustWirelessPlaybackIconStyle(StyleResolver&, RenderStyle&, Element*) const
+{
+}
+
+bool RenderThemeMac::paintWirelessPlaybackIcon(const RenderObject&, const PaintInfo&, const IntRect&)
+{
+    return false;
+}
+
 } // namespace WebCore
 
 #endif // !PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to