[webkit-reviews] review granted: [Bug 127015] Support WebSelections in WK2 on iOS : [Attachment 223781] block selection part1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 10 19:42:35 PST 2014


Benjamin Poulain <benjamin at webkit.org> has granted Enrica Casucci
<enrica at apple.com>'s request for review:
Bug 127015: Support WebSelections in WK2 on iOS
https://bugs.webkit.org/show_bug.cgi?id=127015

Attachment 223781: block selection part1
https://bugs.webkit.org/attachment.cgi?id=223781&action=review

------- Additional Comments from Benjamin Poulain <benjamin at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=223781&action=review


> Source/WebKit2/Shared/ios/WKGestureTypes.h:77
> +typedef enum {
> +    WKNone = 0,
> +    WKWordIsNearTap = 1,
> +    WKIsBlockSelection = 2
> +} WKSelectionFlags;
> +

If this is only used by Objective-C++ and C++, you could use a typed enum
instead.

If those values are exclusive, I would use the name SelectionType instead of
SelectionFlags.

> Source/WebKit2/UIProcess/API/ios/WKInteractionView.mm:1077
> +    {

The bracket should be on the previous line.

> Source/WebKit2/WebProcess/WebPage/WebPage.h:1068
> +    const int blockSelectionStartWidth = 100;
> +    const int blockSelectionStartHeight = 100;

Does this have to be defined on the header? Could it be moved to the
implementation?

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:430
> +	   if (!range)
> +	       return range;

I would use "return nullptr". The code might be a little misleading otherwise.

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:438
> +	       if (boundingRect.isEmpty())

You could use instead "i == 0", which can be optimized by the compiler.

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:443
> +	   if (boundingRect.width() > m_blockSelectionDesiredSize.width() &&
boundingRect.height() > m_blockSelectionDesiredSize.height())

The same condition is repeated bellow. I think a nice little static inline
function naming this would be good.

> Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm:450
> +    if (!currentNode->isElementNode())
> +	   currentNode = currentNode->parentElement();

Now this is confusing me.
If we had a text node above, we now take its parent element? Is there a missing
return?


More information about the webkit-reviews mailing list