WebKit Bugzilla
Attachment 356963 Details for
Bug 192535
: Safe browsing warning should layout buttons vertically in narrow WKWebViews
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192535-20181210085511.patch (text/plain), 3.66 KB, created by
Alex Christensen
on 2018-12-10 08:55:12 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-12-10 08:55:12 PST
Size:
3.66 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 239015) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2018-12-08 Alex Christensen <achristensen@webkit.org> >+ >+ Safe browsing warning should layout buttons vertically in narrow WKWebViews >+ https://bugs.webkit.org/show_bug.cgi?id=192535 >+ <rdar://problem/46308364> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ They're usually next to each other, but in narrow WKWebViews they currently get clipped. >+ In order to make it more likely that both buttons are completely visible, put one above >+ the other if the WKWebView is too narrow to completely show both. This also helps with >+ languages where the translations of "Go Back" or "Show Details" are rendered wider than English. >+ >+ * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: >+ (buttonWidth): >+ (-[WKSafeBrowsingWarning addContent]): >+ > 2018-12-08 Alex Christensen <achristensen@webkit.org> > > Don't programmatically capitalize safe browsing warning buttons >Index: Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (revision 239015) >+++ Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (working copy) >@@ -217,6 +217,17 @@ static ButtonType *makeButton(WarningIte > #endif > } > >+#if HAVE(SAFE_BROWSING) >+static CGFloat buttonWidth(ButtonType *button) >+{ >+#if PLATFORM(MAC) >+ return button.frame.size.width; >+#else >+ return button.titleLabel.intrinsicContentSize.width; >+#endif >+} >+#endif >+ > static ViewType *makeLabel(NSAttributedString *attributedString) > { > #if PLATFORM(MAC) >@@ -306,14 +317,25 @@ - (void)addContent > > [[title.topAnchor anchorWithOffsetToAnchor:exclamationPoint.topAnchor] constraintEqualToAnchor:[exclamationPoint.bottomAnchor anchorWithOffsetToAnchor:title.bottomAnchor]], > >- [goBack.topAnchor constraintEqualToAnchor:showDetails.topAnchor], >- [[showDetails.trailingAnchor anchorWithOffsetToAnchor:goBack.leadingAnchor] constraintEqualToConstant:marginSize], >- > [[box.topAnchor anchorWithOffsetToAnchor:title.topAnchor] constraintEqualToConstant:marginSize], > [[title.bottomAnchor anchorWithOffsetToAnchor:warning.topAnchor] constraintEqualToConstant:marginSize], > [[warning.bottomAnchor anchorWithOffsetToAnchor:goBack.topAnchor] constraintEqualToConstant:marginSize], >- [[goBack.bottomAnchor anchorWithOffsetToAnchor:box.bottomAnchor] constraintEqualToConstant:marginSize] > ]]; >+ >+ bool needsVerticalButtonLayout = buttonWidth(showDetails) + buttonWidth(goBack) + 3 * marginSize > self.frame.size.width; >+ if (needsVerticalButtonLayout) { >+ [NSLayoutConstraint activateConstraints:@[ >+ [[showDetails.trailingAnchor anchorWithOffsetToAnchor:box.trailingAnchor] constraintEqualToConstant:marginSize], >+ [[goBack.bottomAnchor anchorWithOffsetToAnchor:showDetails.topAnchor] constraintEqualToConstant:marginSize], >+ [[goBack.bottomAnchor anchorWithOffsetToAnchor:box.bottomAnchor] constraintEqualToConstant:marginSize * 2 + showDetails.frame.size.height], >+ ]]; >+ } else { >+ [NSLayoutConstraint activateConstraints:@[ >+ [[showDetails.trailingAnchor anchorWithOffsetToAnchor:goBack.leadingAnchor] constraintEqualToConstant:marginSize], >+ [goBack.topAnchor constraintEqualToAnchor:showDetails.topAnchor], >+ [[goBack.bottomAnchor anchorWithOffsetToAnchor:box.bottomAnchor] constraintEqualToConstant:marginSize], >+ ]]; >+ } > #endif > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192535
:
356905
| 356963