Title: [241124] trunk/Source/WebKit
Revision
241124
Author
achristen...@apple.com
Date
2019-02-07 10:22:12 -0800 (Thu, 07 Feb 2019)

Log Message

Shrink and hyphenate safe browsing warning text on watchOS
https://bugs.webkit.org/show_bug.cgi?id=194361
<rdar://problem/47466549>

Reviewed by Geoffrey Garen.

Some internationalizations use long words that didn't fit on small watches.

* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(fontOfSize):
(-[WKSafeBrowsingWarning addContent]):
(-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241123 => 241124)


--- trunk/Source/WebKit/ChangeLog	2019-02-07 16:45:38 UTC (rev 241123)
+++ trunk/Source/WebKit/ChangeLog	2019-02-07 18:22:12 UTC (rev 241124)
@@ -1,3 +1,18 @@
+2019-02-07  Alex Christensen  <achristen...@webkit.org>
+
+        Shrink and hyphenate safe browsing warning text on watchOS
+        https://bugs.webkit.org/show_bug.cgi?id=194361
+        <rdar://problem/47466549>
+
+        Reviewed by Geoffrey Garen.
+
+        Some internationalizations use long words that didn't fit on small watches.
+
+        * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
+        (fontOfSize):
+        (-[WKSafeBrowsingWarning addContent]):
+        (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
+
 2019-02-07  Miguel Gomez  <mago...@igalia.com>
 
         [WPE] Implement GStreamer based holepunch

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (241123 => 241124)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm	2019-02-07 16:45:38 UTC (rev 241123)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm	2019-02-07 18:22:12 UTC (rev 241124)
@@ -37,7 +37,7 @@
 constexpr CGFloat boxCornerRadius = 6;
 #if HAVE(SAFE_BROWSING)
 #if PLATFORM(WATCHOS)
-constexpr CGFloat marginSize = 10;
+constexpr CGFloat marginSize = 9;
 #else
 constexpr CGFloat marginSize = 20;
 #endif
@@ -88,7 +88,7 @@
     switch (size) {
     case WarningTextSize::Title:
 #if PLATFORM(WATCHOS)
-        return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
+        return [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
 #else
         return [UIFont preferredFontForTextStyle:UIFontTextStyleLargeTitle];
 #endif
@@ -289,10 +289,16 @@
     auto title = makeLabel([[[NSAttributedString alloc] initWithString:_warning->title() attributes:@{
         NSFontAttributeName:fontOfSize(WarningTextSize::Title),
         NSForegroundColorAttributeName:colorForItem(WarningItem::TitleText, self)
+#if PLATFORM(WATCHOS)
+        , NSHyphenationFactorDocumentAttribute:@1
+#endif
     }] autorelease]);
     auto warning = makeLabel([[[NSAttributedString alloc] initWithString:_warning->warning() attributes:@{
         NSFontAttributeName:fontOfSize(WarningTextSize::Body),
         NSForegroundColorAttributeName:colorForItem(WarningItem::MessageText, self)
+#if PLATFORM(WATCHOS)
+        , NSHyphenationFactorDocumentAttribute:@1
+#endif
     }] autorelease]);
     auto showDetails = makeButton(WarningItem::ShowDetailsButton, self, @selector(showDetailsClicked));
     auto goBack = makeButton(WarningItem::GoBackButton, self, @selector(goBackClicked));
@@ -368,7 +374,6 @@
 {
     ViewType *box = _box.get().get();
     ButtonType *showDetails = box.subviews.lastObject;
-    WTFLogAlways("SHOW DETAILS BUTTON? %@", showDetails);
     [showDetails removeFromSuperview];
 
     NSMutableAttributedString *text = [[_warning->details() mutableCopy] autorelease];
@@ -537,6 +542,9 @@
 #if !PLATFORM(MAC)
     self.scrollEnabled = NO;
 #endif
+#if PLATFORM(WATCHOS)
+    self.layoutManager.hyphenationFactor = 1;
+#endif
 
     return self;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to