Title: [198239] trunk
Revision
198239
Author
[email protected]
Date
2016-03-15 16:13:34 -0700 (Tue, 15 Mar 2016)

Log Message

iOS <attachment> element should allow customization of action text color
https://bugs.webkit.org/show_bug.cgi?id=155513
<rdar://problem/24805991>

Reviewed by Simon Fraser.

Test: fast/attachment/attachment-action.html

* css/html.css:
(attachment):
On iOS (the only place it is used), <attachment> color should default to system blue.

* rendering/RenderThemeIOS.mm:
(WebCore::attachmentActionColor):
(WebCore::AttachmentInfo::AttachmentInfo):
Make use of the <attachment>'s CSS color for the action text.
This is a little weird because there are multiple bits of text in an
<attachment>, but only the action text ever changes color.

* fast/attachment/attachment-action-expected.html: Added.
* fast/attachment/attachment-action.html: Added.
* platform/ios-simulator/fast/attachment/attachment-label-highlight-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-progress-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-rendering-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-select-on-click-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-subtitle-expected.txt:
* platform/ios-simulator/fast/attachment/attachment-title-expected.txt:
Rebaseline some tests and add one that action text matches the requested color.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198238 => 198239)


--- trunk/LayoutTests/ChangeLog	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/ChangeLog	2016-03-15 23:13:34 UTC (rev 198239)
@@ -1,3 +1,22 @@
+2016-03-15  Tim Horton  <[email protected]>
+
+        iOS <attachment> element should allow customization of action text color
+        https://bugs.webkit.org/show_bug.cgi?id=155513
+        <rdar://problem/24805991>
+
+        Reviewed by Simon Fraser.
+
+        * fast/attachment/attachment-action-expected.html: Added.
+        * fast/attachment/attachment-action.html: Added.
+        * platform/ios-simulator/fast/attachment/attachment-label-highlight-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-progress-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-rendering-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-select-on-click-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-subtitle-expected.txt:
+        * platform/ios-simulator/fast/attachment/attachment-title-expected.txt:
+        Rebaseline some tests and add one that action text matches the requested color.
+
 2016-03-15  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r198148.

Added: trunk/LayoutTests/fast/attachment/attachment-action-expected.html (0 => 198239)


--- trunk/LayoutTests/fast/attachment/attachment-action-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-action-expected.html	2016-03-15 23:13:34 UTC (rev 198239)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<script>
+if (window.internals)
+    window.internals.settings.setAttachmentElementEnabled(true);
+</script>
+<style>
+div {
+    width: 300px;
+    height: 300px;
+}
+</style>
+<body>
+    <div style="background-color: -apple-system-blue;"><attachment action="" "></attachment></div>
+    <div style="background-color: -apple-system-green;"><attachment action="" "></attachment></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/attachment/attachment-action.html (0 => 198239)


--- trunk/LayoutTests/fast/attachment/attachment-action.html	                        (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-action.html	2016-03-15 23:13:34 UTC (rev 198239)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<script>
+if (window.internals)
+    window.internals.settings.setAttachmentElementEnabled(true);
+</script>
+<style>
+div {
+    width: 300px;
+    height: 300px;
+}
+</style>
+<body>
+    <div style="background-color: -apple-system-blue;"><attachment action="" Action"></attachment></div>
+    <div style="background-color: -apple-system-green;"><attachment action="" Action" style="color: -apple-system-green;"></attachment></div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-disabled-rendering-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-disabled-rendering-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-disabled-rendering-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -7,5 +7,5 @@
         RenderText {#text} at (0,0) size 766x19
           text run at (0,0) width 766: "This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner."
       RenderBlock (anonymous) at (0,36) size 784x0
-        RenderBlock {ATTACHMENT} at (0,0) size 0x0
+        RenderBlock {ATTACHMENT} at (0,0) size 0x0 [color=#007AFF]
         RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-label-highlight-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-label-highlight-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-label-highlight-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -3,12 +3,12 @@
 layer at (0,0) size 800x284
   RenderBlock {HTML} at (0,0) size 800x284
     RenderBody {BODY} at (8,8) size 784x268
-      RenderAttachment {ATTACHMENT} at (0,15) size 160x119
-      RenderAttachment {ATTACHMENT} at (160,15) size 160x119
-      RenderAttachment {ATTACHMENT} at (320,15) size 160x119
-      RenderAttachment {ATTACHMENT} at (480,15) size 160x119
-      RenderAttachment {ATTACHMENT} at (0,149) size 160x119
-      RenderAttachment {ATTACHMENT} at (160,149) size 160x119
+      RenderAttachment {ATTACHMENT} at (0,15) size 160x119 [color=#007AFF]
+      RenderAttachment {ATTACHMENT} at (160,15) size 160x119 [color=#007AFF]
+      RenderAttachment {ATTACHMENT} at (320,15) size 160x119 [color=#007AFF]
+      RenderAttachment {ATTACHMENT} at (480,15) size 160x119 [color=#007AFF]
+      RenderAttachment {ATTACHMENT} at (0,149) size 160x119 [color=#007AFF]
+      RenderAttachment {ATTACHMENT} at (160,149) size 160x119 [color=#007AFF]
       RenderText {#text} at (0,0) size 0x0
 selection start: position 0 of child 2 {ATTACHMENT} of body
 selection end:   position 1 of child 7 {ATTACHMENT} of body

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-progress-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-progress-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-progress-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -3,27 +3,27 @@
 layer at (0,0) size 800x284
   RenderBlock {HTML} at (0,0) size 800x284
     RenderBody {BODY} at (8,8) size 784x268
-      RenderAttachment {ATTACHMENT} at (0,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (0,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (160,0) size 4x19
         text run at (160,0) width 4: " "
-      RenderAttachment {ATTACHMENT} at (164,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (164,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (324,0) size 4x19
         text run at (324,0) width 4: " "
-      RenderAttachment {ATTACHMENT} at (328,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (328,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (488,0) size 4x19
         text run at (488,0) width 4: " "
-      RenderAttachment {ATTACHMENT} at (492,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (492,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (652,0) size 4x19
         text run at (652,0) width 4: " "
-      RenderAttachment {ATTACHMENT} at (0,149) size 160x119
+      RenderAttachment {ATTACHMENT} at (0,149) size 160x119 [color=#007AFF]
       RenderText {#text} at (160,134) size 4x19
         text run at (160,134) width 4: " "
-      RenderAttachment {ATTACHMENT} at (164,149) size 160x119
+      RenderAttachment {ATTACHMENT} at (164,149) size 160x119 [color=#007AFF]
       RenderText {#text} at (324,134) size 4x19
         text run at (324,134) width 4: " "
-      RenderAttachment {ATTACHMENT} at (328,149) size 160x119
+      RenderAttachment {ATTACHMENT} at (328,149) size 160x119 [color=#007AFF]
       RenderText {#text} at (488,134) size 4x19
         text run at (488,134) width 4: " "
-      RenderAttachment {ATTACHMENT} at (492,149) size 160x119
+      RenderAttachment {ATTACHMENT} at (492,149) size 160x119 [color=#007AFF]
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-rendering-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-rendering-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-rendering-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -7,5 +7,5 @@
         RenderText {#text} at (0,0) size 326x19
           text run at (0,0) width 326: "This tests that attachments have a custom renderer."
       RenderBlock (anonymous) at (0,36) size 784x119
-        RenderAttachment {ATTACHMENT} at (0,0) size 160x119
+        RenderAttachment {ATTACHMENT} at (0,0) size 160x119 [color=#007AFF]
         RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -6,6 +6,6 @@
       RenderBlock {DIV} at (0,0) size 784x134
         RenderText {#text} at (0,0) size 73x19
           text run at (0,0) width 73: "text before "
-        RenderAttachment {ATTACHMENT} at (72,15) size 161x119
+        RenderAttachment {ATTACHMENT} at (72,15) size 161x119 [color=#007AFF]
         RenderText {#text} at (232,0) size 63x19
           text run at (232,0) width 63: " text after"

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-select-on-click-inside-user-select-all-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -6,6 +6,6 @@
       RenderBlock {DIV} at (0,0) size 784x134
         RenderText {#text} at (0,0) size 73x19
           text run at (0,0) width 73: "text before "
-        RenderAttachment {ATTACHMENT} at (72,15) size 161x119
+        RenderAttachment {ATTACHMENT} at (72,15) size 161x119 [color=#007AFF]
         RenderText {#text} at (232,0) size 63x19
           text run at (232,0) width 63: " text after"

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-subtitle-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-subtitle-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-subtitle-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -3,6 +3,6 @@
 layer at (0,0) size 800x150
   RenderBlock {HTML} at (0,0) size 800x150
     RenderBody {BODY} at (8,8) size 784x134
-      RenderAttachment {ATTACHMENT} at (0,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (0,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-title-expected.txt (198238 => 198239)


--- trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-title-expected.txt	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/LayoutTests/platform/ios-simulator/fast/attachment/attachment-title-expected.txt	2016-03-15 23:13:34 UTC (rev 198239)
@@ -3,6 +3,6 @@
 layer at (0,0) size 800x150
   RenderBlock {HTML} at (0,0) size 800x150
     RenderBody {BODY} at (8,8) size 784x134
-      RenderAttachment {ATTACHMENT} at (0,15) size 160x119
+      RenderAttachment {ATTACHMENT} at (0,15) size 160x119 [color=#007AFF]
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0

Modified: trunk/Source/WebCore/ChangeLog (198238 => 198239)


--- trunk/Source/WebCore/ChangeLog	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/Source/WebCore/ChangeLog	2016-03-15 23:13:34 UTC (rev 198239)
@@ -1,3 +1,24 @@
+2016-03-15  Tim Horton  <[email protected]>
+
+        iOS <attachment> element should allow customization of action text color
+        https://bugs.webkit.org/show_bug.cgi?id=155513
+        <rdar://problem/24805991>
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/attachment/attachment-action.html
+
+        * css/html.css:
+        (attachment):
+        On iOS (the only place it is used), <attachment> color should default to system blue.
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::attachmentActionColor):
+        (WebCore::AttachmentInfo::AttachmentInfo):
+        Make use of the <attachment>'s CSS color for the action text.
+        This is a little weird because there are multiple bits of text in an
+        <attachment>, but only the action text ever changes color.
+
 2016-03-15  Zalan Bujtas  <[email protected]>
 
         Delay HTMLFormControlElement::focus() call until after layout is finished.

Modified: trunk/Source/WebCore/css/html.css (198238 => 198239)


--- trunk/Source/WebCore/css/html.css	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/Source/WebCore/css/html.css	2016-03-15 23:13:34 UTC (rev 198239)
@@ -1236,6 +1236,9 @@
 #if defined(ENABLE_ATTACHMENT_ELEMENT) && ENABLE_ATTACHMENT_ELEMENT
 attachment {
     -webkit-appearance: attachment;
+#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
+    color: -apple-system-blue;
+#endif
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (198238 => 198239)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2016-03-15 23:10:26 UTC (rev 198238)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2016-03-15 23:13:34 UTC (rev 198239)
@@ -1357,8 +1357,12 @@
     }));
     return adoptCF(CTFontCreateWithFontDescriptor(emphasizedFontDescriptor.get(), 0, nullptr));
 }
-static UIColor *attachmentActionColor() { return [getUIColorClass() systemBlueColor]; }
 
+static UIColor *attachmentActionColor(const RenderAttachment& attachment)
+{
+    return [getUIColorClass() colorWithCGColor:cachedCGColor(attachment.style().visitedDependentColor(CSSPropertyColor))];
+}
+
 static RetainPtr<CTFontRef> attachmentTitleFont()
 {
     RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortCaption1, RenderThemeIOS::contentSizeCategory(), 0));
@@ -1560,7 +1564,7 @@
             yOffset += iconRect.height() + attachmentItemMargin;
         }
     } else
-        buildSingleLine(action, attachmentActionFont().get(), attachmentActionColor());
+        buildSingleLine(action, attachmentActionFont().get(), attachmentActionColor(attachment));
 
     buildTitleLines(attachment);
     buildSingleLine(subtitle, attachmentSubtitleFont().get(), attachmentSubtitleColor());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to