[Webkit-unassigned] [Bug 164437] Support TouchBar in WebKit

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 7 22:54:04 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=164437

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #294107|review?                     |review+
              Flags|                            |

--- Comment #30 from Darin Adler <darin at apple.com> ---
Comment on attachment 294107
  --> https://bugs.webkit.org/attachment.cgi?id=294107
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=294107&action=review

> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:750
> +    case NSTextAlignmentLeft: {

No need for these braces.

> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:755
> +    case NSTextAlignmentRight: {

Ditto.

> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:760
> +    case NSTextAlignmentCenter: {

Ditto.

> Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm:765
> +    case NSTextAlignmentJustified: {

Ditto.

> 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;
> +            }

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.

> Source/WebKit/mac/WebView/WebView.mm:901
> +    case NSTextAlignmentLeft: {

No braces needed here.

> Source/WebKit/mac/WebView/WebView.mm:906
> +    case NSTextAlignmentRight: {

Ditto.

> Source/WebKit/mac/WebView/WebView.mm:911
> +    case NSTextAlignmentCenter: {

Ditto.

> Source/WebKit/mac/WebView/WebView.mm:916
> +    case NSTextAlignmentJustified: {

Ditto.

> 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;
> +    }

Helper function for this conversion?

> 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;
> +                }

Helper function for this?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161108/ec17b953/attachment.html>


More information about the webkit-unassigned mailing list