Changeset 241124 in webkit


Ignore:
Timestamp:
Feb 7, 2019 10:22:12 AM (5 years ago)
Author:
achristensen@apple.com
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:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r241120 r241124  
     12019-02-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Shrink and hyphenate safe browsing warning text on watchOS
     4        https://bugs.webkit.org/show_bug.cgi?id=194361
     5        <rdar://problem/47466549>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Some internationalizations use long words that didn't fit on small watches.
     10
     11        * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
     12        (fontOfSize):
     13        (-[WKSafeBrowsingWarning addContent]):
     14        (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
     15
    1162019-02-07  Miguel Gomez  <magomez@igalia.com>
    217
  • trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm

    r240014 r241124  
    3838#if HAVE(SAFE_BROWSING)
    3939#if PLATFORM(WATCHOS)
    40 constexpr CGFloat marginSize = 10;
     40constexpr CGFloat marginSize = 9;
    4141#else
    4242constexpr CGFloat marginSize = 20;
     
    8989    case WarningTextSize::Title:
    9090#if PLATFORM(WATCHOS)
    91         return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
     91        return [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
    9292#else
    9393        return [UIFont preferredFontForTextStyle:UIFontTextStyleLargeTitle];
     
    290290        NSFontAttributeName:fontOfSize(WarningTextSize::Title),
    291291        NSForegroundColorAttributeName:colorForItem(WarningItem::TitleText, self)
     292#if PLATFORM(WATCHOS)
     293        , NSHyphenationFactorDocumentAttribute:@1
     294#endif
    292295    }] autorelease]);
    293296    auto warning = makeLabel([[[NSAttributedString alloc] initWithString:_warning->warning() attributes:@{
    294297        NSFontAttributeName:fontOfSize(WarningTextSize::Body),
    295298        NSForegroundColorAttributeName:colorForItem(WarningItem::MessageText, self)
     299#if PLATFORM(WATCHOS)
     300        , NSHyphenationFactorDocumentAttribute:@1
     301#endif
    296302    }] autorelease]);
    297303    auto showDetails = makeButton(WarningItem::ShowDetailsButton, self, @selector(showDetailsClicked));
     
    369375    ViewType *box = _box.get().get();
    370376    ButtonType *showDetails = box.subviews.lastObject;
    371     WTFLogAlways("SHOW DETAILS BUTTON? %@", showDetails);
    372377    [showDetails removeFromSuperview];
    373378
     
    538543    self.scrollEnabled = NO;
    539544#endif
     545#if PLATFORM(WATCHOS)
     546    self.layoutManager.hyphenationFactor = 1;
     547#endif
    540548
    541549    return self;
Note: See TracChangeset for help on using the changeset viewer.