Title: [263519] trunk/Source/WebCore
- Revision
- 263519
- Author
- [email protected]
- Date
- 2020-06-25 10:39:43 -0700 (Thu, 25 Jun 2020)
Log Message
Upstream macOS 11 additions to RenderThemeMac.mm and ThemeMac.mm
https://bugs.webkit.org/show_bug.cgi?id=213608
<rdar://problem/64758299>
Reviewed by Darin Adler.
Replace WebKitAdditions imports with the imported code. No change in behavior.
* css/html.css:
(input::-webkit-contacts-auto-fill-button):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::supportsLargeFormControls):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::createAttachmentPlaceholderImage):
(WebCore::RenderThemeMac::extraDefaultStyleSheet): Deleted.
Remove the override for extraDefaultStyleSheet altogether, since this was only used to temporarily hide the new
contact AutoFill button appearance from open source WebKit.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (263518 => 263519)
--- trunk/Source/WebCore/ChangeLog 2020-06-25 17:37:14 UTC (rev 263518)
+++ trunk/Source/WebCore/ChangeLog 2020-06-25 17:39:43 UTC (rev 263519)
@@ -1,3 +1,25 @@
+2020-06-25 Wenson Hsieh <[email protected]>
+
+ Upstream macOS 11 additions to RenderThemeMac.mm and ThemeMac.mm
+ https://bugs.webkit.org/show_bug.cgi?id=213608
+ <rdar://problem/64758299>
+
+ Reviewed by Darin Adler.
+
+ Replace WebKitAdditions imports with the imported code. No change in behavior.
+
+ * css/html.css:
+ (input::-webkit-contacts-auto-fill-button):
+ * platform/mac/ThemeMac.mm:
+ (WebCore::ThemeMac::supportsLargeFormControls):
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::createAttachmentPlaceholderImage):
+ (WebCore::RenderThemeMac::extraDefaultStyleSheet): Deleted.
+
+ Remove the override for extraDefaultStyleSheet altogether, since this was only used to temporarily hide the new
+ contact AutoFill button appearance from open source WebKit.
+
2020-06-25 Sergio Villar Senin <[email protected]>
Unreviewed build fix for WebXR enabled non-OpenXR builds.
Modified: trunk/Source/WebCore/css/html.css (263518 => 263519)
--- trunk/Source/WebCore/css/html.css 2020-06-25 17:37:14 UTC (rev 263518)
+++ trunk/Source/WebCore/css/html.css 2020-06-25 17:39:43 UTC (rev 263519)
@@ -597,7 +597,9 @@
}
input::-webkit-contacts-auto-fill-button {
-#if !(defined(HAVE_ALTERNATE_ICONS) && HAVE_ALTERNATE_ICONS)
+#if (defined(HAVE_ALTERNATE_ICONS) && HAVE_ALTERNATE_ICONS)
+ -webkit-mask-image: url('data:image/svg+xml,<svg viewBox="0 0 44 24" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M 30.25 9.25 L 36.5 15.75 L 42.75 9.25" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M 12 24 C 18.5647 24 24 18.5529 24 12 C 24 5.4353 18.553 0 11.9883 0 C 5.4353 0 0 5.4353 0 12 C 0 18.5529 5.4471 24 12 24 Z M 12 16.0118 C 8.4706 16.0118 5.7412 17.2706 4.5529 18.6823 C 2.9647 16.9176 2.0118 14.5765 2.0118 12 C 2.0118 6.447 6.4353 2 11.9883 2 C 17.5412 2 21.9883 6.447 22 12 C 22.0119 14.5765 21.0471 16.9176 19.4589 18.6941 C 18.2706 17.2823 15.5412 16.0118 12 16.0118 Z M 12 14.0118 C 14.2588 14.0353 16.0353 12.1059 16.0353 9.5765 C 16.0353 7.2 14.2588 5.2235 12 5.2235 C 9.7412 5.2235 7.9529 7.2 7.9647 9.5765 C 7.9765 12.1059 9.7412 13.9882 12 14.0118 Z"/></svg>');
+#else
-webkit-mask-image: url('data:image/svg+xml,<svg viewBox="0 0 44 24" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M 30.25 9.25 L 36.5 15.75 L 42.75 9.25" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="11" fill="none" stroke="black" stroke-width="2"/><path d="M 12 11.5 C 10.3 11.5 9 10.1 9 8.2 C 9 6.5 10.3 5 12 5 C 13.6 5 15 6.5 15 8.2 C 15 10.1 13.6 11.5 12 11.5 Z M 6.6 18 C 6.2 18 6 17.7 6 17.4 C 6 16.2 7.9 13 12 13 C 16.1 13 18 16.2 18 17.4 C 18 17.7 17.8 18 17.4 18 L 6.6 18 Z"/></svg>');
#endif
-webkit-mask-size: 22px 12px;
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (263518 => 263519)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2020-06-25 17:37:14 UTC (rev 263518)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2020-06-25 17:39:43 UTC (rev 263519)
@@ -120,10 +120,6 @@
namespace WebCore {
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/ThemeMacAdditions.mm>
-#endif
-
enum {
topMargin,
rightMargin,
@@ -986,6 +982,16 @@
return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion];
}
+#if HAVE(LARGE_CONTROL_SIZE)
+
+bool ThemeMac::supportsLargeFormControls()
+{
+ static bool hasSupport = [[NSAppearance currentAppearance] _usesMetricsAppearance];
+ return hasSupport;
}
+#endif // HAVE(LARGE_CONTROL_SIZE)
+
+}
+
#endif // PLATFORM(MAC)
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (263518 => 263519)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2020-06-25 17:37:14 UTC (rev 263518)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2020-06-25 17:39:43 UTC (rev 263519)
@@ -103,8 +103,6 @@
private:
RenderThemeMac();
- String extraDefaultStyleSheet() final;
-
#if ENABLE(VIDEO)
// Media controls
String mediaControlsStyleSheet() final;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (263518 => 263519)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2020-06-25 17:37:14 UTC (rev 263518)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2020-06-25 17:39:43 UTC (rev 263519)
@@ -2732,25 +2732,28 @@
icon->paint(context, layout.iconRect);
}
-#if HAVE(ALTERNATE_ICONS) && USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/RenderThemeMacAdditions.mm>
+static std::pair<RefPtr<Image>, float> createAttachmentPlaceholderImage(float deviceScaleFactor, const AttachmentLayout& layout)
+{
+#if HAVE(ALTERNATE_ICONS)
+ auto image = [NSImage _imageWithSystemSymbolName:@"arrow.down.circle"];
+ auto imageSize = FloatSize([image size]);
+ auto imageSizeScales = deviceScaleFactor * layout.iconRect.size() / imageSize;
+ imageSize.scale(std::min(imageSizeScales.width(), imageSizeScales.height()));
+ auto imageRect = NSMakeRect(0, 0, imageSize.width(), imageSize.height());
+ auto cgImage = [image CGImageForProposedRect:&imageRect context:nil hints:@{
+ NSImageHintSymbolFont : [NSFont systemFontOfSize:32],
+ NSImageHintSymbolScale : @(NSImageSymbolScaleMedium)
+ }];
+ return { BitmapImage::create(cgImage.get()), deviceScaleFactor };
#else
-
-static std::pair<RefPtr<Image>, float> createAttachmentPlaceholderImage(float deviceScaleFactor, const AttachmentLayout&)
-{
+ UNUSED_PARAM(layout);
if (deviceScaleFactor >= 2)
return { Image::loadPlatformResource("AttachmentPlaceholder@2x"), 2 };
return { Image::loadPlatformResource("AttachmentPlaceholder"), 1 };
+#endif
}
-String RenderThemeMac::extraDefaultStyleSheet()
-{
- return { };
-}
-
-#endif
-
static void paintAttachmentIconPlaceholder(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout)
{
auto [placeholderImage, imageScale] = createAttachmentPlaceholderImage(attachment.document().deviceScaleFactor(), layout);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes