Changeset 112361 in webkit


Ignore:
Timestamp:
Mar 27, 2012 8:47:00 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Text selection - selection gets broken in test.com/individuals.htm
https://bugs.webkit.org/show_bug.cgi?id=82292

Change to check and avoid text selection across frames.

Internal reviewed by Mike Fenton

Patch by Sean Wang <Xuewen.Wang@torchmobile.com.cn> on 2012-03-27
Reviewed by Rob Buis.

  • WebKitSupport/SelectionHandler.cpp:

(BlackBerry::WebKit::visiblePositionForPointIgnoringClipping):

support selection across frames, so check if the *framePoint* is in
the *frame*.

(BlackBerry::WebKit::SelectionHandler::setSelection):

function returns a null VisablePosition, it stands for a invalid position
or a position in the different frames, therefor we don't execute setting
handle's position.

Location:
trunk/Source/WebKit/blackberry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r112287 r112361  
     12012-03-27  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
     2
     3        [BlackBerry] Text selection - selection gets broken in test.com/individuals.htm
     4        https://bugs.webkit.org/show_bug.cgi?id=82292
     5
     6        Change to check and avoid text selection across frames.
     7
     8        Internal reviewed by Mike Fenton
     9
     10        Reviewed by Rob Buis.
     11
     12        * WebKitSupport/SelectionHandler.cpp:
     13        (BlackBerry::WebKit::visiblePositionForPointIgnoringClipping):
     14            support selection across frames, so check if the *framePoint* is in
     15            the *frame*.
     16        (BlackBerry::WebKit::SelectionHandler::setSelection):
     17            function returns a null VisablePosition, it stands for a invalid position
     18            or a position in the different frames, therefor we don't execute setting
     19            handle's position.
     20
    1212012-03-27  Andrew Lo  <anlo@rim.com>
    222
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

    r111259 r112361  
    139139
    140140    Node* node = result.innerNode();
    141     if (!node)
     141    if (!node || node->document() != frame.document())
    142142        return VisiblePosition();
    143143
     
    451451        controller->setSelection(VisibleSelection(controller->selection().start(), controller->selection().end(), true /* isDirectional */));
    452452
     453    // We don't return early in the following, so that we can do input field scrolling if the
     454    // handle is outside the bounds of the field. This can be extended to handle sub-region
     455    // scrolling as well
    453456    if (startIsValid) {
    454457        relativeStart = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, start);
    455458
    456         // Set the selection with validation.
    457         newSelection.setBase(visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(start)));
    458 
    459         // Reset the selection using the existing extent without validation.
    460         newSelection.setWithoutValidation(newSelection.base(), controller->selection().end());
     459        VisiblePosition base = visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(start));
     460        if (base.isNotNull()) {
     461            // The function setBase validates the "base"
     462            newSelection.setBase(base);
     463            newSelection.setWithoutValidation(newSelection.base(), controller->selection().end());
     464            // Don't return early.
     465        }
    461466    }
    462467
     
    464469        relativeEnd = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, end);
    465470
    466         // Set the selection with validation.
    467         newSelection.setExtent(visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(end)));
    468 
    469         // Reset the selection using the existing base without validation.
    470         newSelection.setWithoutValidation(controller->selection().start(), newSelection.extent());
     471        VisiblePosition extent = visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(end));
     472        if (extent.isNotNull()) {
     473            // The function setExtent validates the "extent"
     474            newSelection.setExtent(extent);
     475            newSelection.setWithoutValidation(controller->selection().start(), newSelection.extent());
     476            // Don't return early.
     477        }
    471478    }
    472479
Note: See TracChangeset for help on using the changeset viewer.