Bug 78136 - Initial upstreaming of selection handling code for BlackBerry port
Summary: Initial upstreaming of selection handling code for BlackBerry port
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nima Ghanavatian
URL:
Keywords:
Depends on:
Blocks: 73144
  Show dependency treegraph
 
Reported: 2012-02-08 11:55 PST by Nima Ghanavatian
Modified: 2012-02-13 23:31 PST (History)
3 users (show)

See Also:


Attachments
Patch (46.10 KB, patch)
2012-02-09 07:42 PST, Nima Ghanavatian
no flags Details | Formatted Diff | Diff
Patch (46.50 KB, patch)
2012-02-13 09:46 PST, Nima Ghanavatian
no flags Details | Formatted Diff | Diff
Patch (45.62 KB, patch)
2012-02-13 12:48 PST, Nima Ghanavatian
no flags Details | Formatted Diff | Diff
Patch (45.86 KB, patch)
2012-02-13 13:40 PST, Nima Ghanavatian
no flags Details | Formatted Diff | Diff
Patch (45.80 KB, patch)
2012-02-13 14:06 PST, Nima Ghanavatian
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nima Ghanavatian 2012-02-08 11:55:49 PST
Upstreaming SelectionHandler.cpp and SelectionHandler.h for the BlackBerry port
Comment 1 Rob Buis 2012-02-08 12:17:13 PST
Assign to Nima.
Comment 2 Nima Ghanavatian 2012-02-09 07:42:46 PST
Created attachment 126301 [details]
Patch
Comment 3 Rob Buis 2012-02-09 08:37:53 PST
Comment on attachment 126301 [details]
Patch

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

Looks good, but can be cleaned up a bit more.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:131
> +    IntPoint framePosition = m_webPage->frameOffset(m_webPage->focusedOrMainFrame());

The above can go into the if below, since if the if turns out to be false, these declarations are not needed.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:250
> +        if (character)

You can combine the above two statements

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:334
> +    FrameSelection* controller = focusedFrame->selection();

controller can be moved until after the if.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:380
> +    FrameSelection* controller = focusedFrame->selection();

Ditto.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:607
> +    ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());

Should ASSERT be moved up? We could crash in debug mode if m_webPage is null without any help.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:678
> +    (isStartCaret) ? return !isRTL : return isRTL;

No need for parentheses.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:725
> +        // Compare start and end and update.

end and?

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:2
> + * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.

Once you change anything here better add 2012.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:24
> +#include "TextGranularity.h"

You probably can get away with doing a forward reference to TextGranularity, and including it in the cpp.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:56
> +    bool findNextString(const WTF::String&, bool);

Would it be possible to use either WebString or WTF::String exclusively here? Could make the API more consistant.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:70
> +    bool lastUpdatedEndPointIsValid() const { return m_lastUpdatedEndPointIsValid; }

Better do a new line here.
Comment 4 Nima Ghanavatian 2012-02-13 09:46:04 PST
Created attachment 126786 [details]
Patch
Comment 5 Rob Buis 2012-02-13 11:33:43 PST
Comment on attachment 126786 [details]
Patch

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

Looks good, some things still need fixing.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:58
> +using namespace WebCore;

This means you can get rid of all the WebCore:: prefixes below.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:316
> +        // Extend x to bottom without modifying x.

Extend y?

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:646
> +    if (renderer)

You can do if (RenderObject* renderer =  ... ) here

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:68
> +    void caretPositionChanged();

caretPositionChanged should be private, it is not used outside of SelectionHandler.
Comment 6 Nima Ghanavatian 2012-02-13 12:48:58 PST
Created attachment 126808 [details]
Patch
Comment 7 Nima Ghanavatian 2012-02-13 12:58:26 PST
Comment on attachment 126808 [details]
Patch

submitted wrong patch =(
correct one coming shortly
Comment 8 Nima Ghanavatian 2012-02-13 13:40:31 PST
Created attachment 126821 [details]
Patch
Comment 9 Rob Buis 2012-02-13 13:57:11 PST
Comment on attachment 126821 [details]
Patch

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

Almost there, just a few things to fix.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:46
> +#include <BlackBerryPlatformIntRectRegion.h>

already included in header.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:141
> +

Maybe remove the empty line.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp:608
> +    ASSERT(m_webPage && m_inputHandler);

you probably mean m_webPage->m_inputHandler.

> Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h:34
> +class TextGranularity;

Not needed.
Comment 10 Nima Ghanavatian 2012-02-13 14:06:04 PST
Created attachment 126832 [details]
Patch
Comment 11 Rob Buis 2012-02-13 14:09:24 PST
Comment on attachment 126832 [details]
Patch

Looks good.
Comment 12 WebKit Review Bot 2012-02-13 23:31:36 PST
Comment on attachment 126832 [details]
Patch

Clearing flags on attachment: 126832

Committed r107674: <http://trac.webkit.org/changeset/107674>
Comment 13 WebKit Review Bot 2012-02-13 23:31:41 PST
All reviewed patches have been landed.  Closing bug.