<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:darin@apple.com" title="Darin Adler <darin@apple.com>"> <span class="fn">Darin Adler</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - Support TouchBar in WebKit"
href="https://bugs.webkit.org/show_bug.cgi?id=164437">bug 164437</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Attachment #294107 Flags</td>
<td>review?
</td>
<td>review+
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Support TouchBar in WebKit"
href="https://bugs.webkit.org/show_bug.cgi?id=164437#c30">Comment # 30</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Support TouchBar in WebKit"
href="https://bugs.webkit.org/show_bug.cgi?id=164437">bug 164437</a>
from <span class="vcard"><a class="email" href="mailto:darin@apple.com" title="Darin Adler <darin@apple.com>"> <span class="fn">Darin Adler</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=294107&action=diff" name="attach_294107" title="Patch">attachment 294107</a> <a href="attachment.cgi?id=294107&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=294107&action=review">https://bugs.webkit.org/attachment.cgi?id=294107&action=review</a>
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:750
> + case NSTextAlignmentLeft: {</span >
No need for these braces.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:755
> + case NSTextAlignmentRight: {</span >
Ditto.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:760
> + case NSTextAlignmentCenter: {</span >
Ditto.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:765
> + case NSTextAlignmentJustified: {</span >
Ditto.
<span class="quote">> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:1043
> + NSTextAlignment textAlignment;
> + switch (editorState.postLayoutData().textAlignment) {
> + case NoAlignment:
> + textAlignment = NSTextAlignmentNatural;
> + break;
> + case LeftAlignment:
> + textAlignment = NSTextAlignmentLeft;
> + break;
> + case RightAlignment:
> + textAlignment = NSTextAlignmentRight;
> + break;
> + case CenterAlignment:
> + textAlignment = NSTextAlignmentCenter;
> + break;
> + case JustifiedAlignment:
> + textAlignment = NSTextAlignmentJustified;
> + break;
> + }</span >
I’d like to see a helper function, inlined probably, for this conversion, so we can do things like ASSERT_NOT_REACHED if it’s an unknown value rather than leaving the textAlignment uninitialized, and also so the large switch statement isn’t so distracting in the middle of the code.
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:901
> + case NSTextAlignmentLeft: {</span >
No braces needed here.
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:906
> + case NSTextAlignmentRight: {</span >
Ditto.
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:911
> + case NSTextAlignmentCenter: {</span >
Ditto.
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:916
> + case NSTextAlignmentJustified: {</span >
Ditto.
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:6863
> + switch ([nsResult resultType]) {
> + case NSTextCheckingTypeSpelling:
> + result.type = WebCore::TextCheckingTypeSpelling;
> + break;
> + case NSTextCheckingTypeReplacement:
> + result.type = WebCore::TextCheckingTypeReplacement;
> + break;
> + case NSTextCheckingTypeCorrection:
> + result.type = WebCore::TextCheckingTypeCorrection;
> + break;
> + default:
> + result.type = WebCore::TextCheckingTypeNone;
> + }</span >
Helper function for this conversion?
<span class="quote">> Source/WebKit/mac/WebView/WebView.mm:9484
> + NSTextAlignment textAlignment;
> + switch (style->textAlign()) {
> + case RIGHT:
> + case WEBKIT_RIGHT:
> + textAlignment = NSTextAlignmentRight;
> + break;
> + case LEFT:
> + case WEBKIT_LEFT:
> + textAlignment = NSTextAlignmentLeft;
> + break;
> + case CENTER:
> + case WEBKIT_CENTER:
> + textAlignment = NSTextAlignmentCenter;
> + break;
> + case JUSTIFY:
> + textAlignment = NSTextAlignmentJustified;
> + break;
> + case TASTART:
> + textAlignment = style->isLeftToRightDirection() ? NSTextAlignmentLeft : NSTextAlignmentRight;
> + break;
> + case TAEND:
> + textAlignment = style->isLeftToRightDirection() ? NSTextAlignmentRight : NSTextAlignmentLeft;
> + break;
> + }</span >
Helper function for this?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>