[Form Validation] lengthy validation messages should be truncated with an ellipsis
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2017 02:47:06 +0000 (02:47 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2017 02:47:06 +0000 (02:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166747
<rdar://problem/29872021>

Reviewed by Simon Fraser.

Lengthy HTML validation messages should be truncated with an ellipsis.
Previously, they were truncated but there was no ellipsis.

No new tests, not easily testable. Manually tested on
- http://codepen.io/cdumez/full/zoOZmZ/ (last field)

* platform/ios/ValidationBubbleIOS.mm:
(WebCore::ValidationBubble::ValidationBubble):
* platform/mac/ValidationBubbleMac.mm:
(WebCore::ValidationBubble::ValidationBubble):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210425 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/ValidationBubbleIOS.mm
Source/WebCore/platform/mac/ValidationBubbleMac.mm

index c5e1549..54b217a 100644 (file)
@@ -1,3 +1,22 @@
+2017-01-05  Chris Dumez  <cdumez@apple.com>
+
+        [Form Validation] lengthy validation messages should be truncated with an ellipsis
+        https://bugs.webkit.org/show_bug.cgi?id=166747
+        <rdar://problem/29872021>
+
+        Reviewed by Simon Fraser.
+
+        Lengthy HTML validation messages should be truncated with an ellipsis.
+        Previously, they were truncated but there was no ellipsis.
+
+        No new tests, not easily testable. Manually tested on
+        - http://codepen.io/cdumez/full/zoOZmZ/ (last field)
+
+        * platform/ios/ValidationBubbleIOS.mm:
+        (WebCore::ValidationBubble::ValidationBubble):
+        * platform/mac/ValidationBubbleMac.mm:
+        (WebCore::ValidationBubble::ValidationBubble):
+
 2017-01-05  Simon Fraser  <simon.fraser@apple.com>
 
         Radio buttons have a fixed border radius making them look square when resized
index cd5aa10..fde4154 100644 (file)
@@ -111,7 +111,7 @@ ValidationBubble::ValidationBubble(UIView* view, const String& message)
     RetainPtr<UILabel> label = adoptNS([[getUILabelClass() alloc] initWithFrame:CGRectZero]);
     [label setText:message];
     [label setFont:[getUIFontClass() systemFontOfSize:14.0]];
-    [label setLineBreakMode:NSLineBreakByWordWrapping];
+    [label setLineBreakMode:NSLineBreakByTruncatingTail];
     [label setNumberOfLines:4];
     [popoverView addSubview:label.get()];
 
index 0ded82e..042e27d 100644 (file)
@@ -67,6 +67,7 @@ ValidationBubble::ValidationBubble(NSView* view, const String& message)
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
     [label setMaximumNumberOfLines:4];
 #endif
+    [[label cell] setTruncatesLastVisibleLine:YES];
     [popoverView addSubview:label.get()];
     NSSize labelSize = [label sizeThatFits:NSMakeSize(maxLabelWidth, CGFLOAT_MAX)];
     [label setFrame:NSMakeRect(horizontalPadding, verticalPadding, labelSize.width, labelSize.height)];