Changeset 149826 in webkit


Ignore:
Timestamp:
May 9, 2013 11:32:48 AM (11 years ago)
Author:
mifenton@rim.com
Message:

[BlackBerry] Style updates required based on new check-webkit-style
https://bugs.webkit.org/show_bug.cgi?id=115857

Reviewed by Rob Buis.

Update SelectionHandler to match check-webkit-style updates.

  • WebKitSupport/SelectionHandler.cpp:

(BlackBerry::WebKit::shouldExtendSelectionInDirection):
(BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
(BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
(BlackBerry::WebKit::adjustCaretRects):
(BlackBerry::WebKit::SelectionHandler::clipPointToVisibleContainer):
(BlackBerry::WebKit::regionRectListContainsPoint):

  • WebKitSupport/SelectionHandler.h:

(SelectionHandler):

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

Legend:

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

    r149820 r149826  
     12013-05-09  Mike Fenton <mifenton@rim.com>
     2
     3        [BlackBerry] Style updates required based on new check-webkit-style
     4        https://bugs.webkit.org/show_bug.cgi?id=115857
     5
     6        Reviewed by Rob Buis.
     7
     8        Update SelectionHandler to match check-webkit-style updates.
     9
     10        * WebKitSupport/SelectionHandler.cpp:
     11        (BlackBerry::WebKit::shouldExtendSelectionInDirection):
     12        (BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
     13        (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
     14        (BlackBerry::WebKit::adjustCaretRects):
     15        (BlackBerry::WebKit::SelectionHandler::clipPointToVisibleContainer):
     16        (BlackBerry::WebKit::regionRectListContainsPoint):
     17        * WebKitSupport/SelectionHandler.h:
     18        (SelectionHandler):
     19
    1202013-05-09  Mike Fenton  <mifenton@rim.com>
    221
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

    r149816 r149826  
    318318    if ((character == KEYCODE_LEFT || character == KEYCODE_RIGHT)
    319319        && (!inSameLine(selection.visibleStart(), tempSelection.selection().visibleStart())
    320            || !inSameLine(selection.visibleEnd(), tempSelection.selection().visibleEnd())))
     320            || !inSameLine(selection.visibleEnd(), tempSelection.selection().visibleEnd())))
    321321        return false;
    322322
     
    373373        return 0;
    374374
    375     FrameSelection* controller = focusedFrame->selection();
    376 
    377     WebCore::IntRect caretRect = isStartHandle ? controller->selection().visibleStart().absoluteCaretBounds()
    378                                       : controller->selection().visibleEnd().absoluteCaretBounds();
     375    VisibleSelection activeSelection = focusedFrame->selection()->selection();
     376
     377    WebCore::IntRect caretRect = isStartHandle ? activeSelection.visibleStart().absoluteCaretBounds() : activeSelection.visibleEnd().absoluteCaretBounds();
    379378
    380379    WebCore::IntRect nodeBoundingBox = focusedFrame->document()->focusedNode()->renderer()->absoluteBoundingBoxRect();
     
    391390        character = 0;
    392391
    393     VisiblePosition newVisiblePosition = isStartHandle ? controller->selection().extent() : controller->selection().base();
     392    VisiblePosition newVisiblePosition = isStartHandle ? activeSelection.extent() : activeSelection.base();
    394393    // Extend the selection to the bounds of the box before doing incremental scroll if the point is outside the node.
    395394    // Don't extend selection and handle the character at the same time.
     
    403402
    404403    // If no selection will be changed, return the character to extend using navigation.
    405     if (controller->selection() == newSelection)
     404    if (activeSelection == newSelection)
    406405        return character;
    407406
     
    411410
    412411// Returns true if handled.
    413 bool SelectionHandler::updateOrHandleInputSelection(VisibleSelection& newSelection, const WebCore::IntPoint& relativeStart
    414                                                     , const WebCore::IntPoint& relativeEnd)
     412bool SelectionHandler::updateOrHandleInputSelection(VisibleSelection& newSelection, const WebCore::IntPoint& relativeStart, const WebCore::IntPoint& relativeEnd)
    415413{
    416414    ASSERT(m_webPage->m_inputHandler->isInputMode());
     
    10091007}
    10101008
    1011 static void adjustCaretRects(WebCore::IntRect& startCaret, bool isStartCaretClippedOut,
    1012                              WebCore::IntRect& endCaret, bool isEndCaretClippedOut,
    1013                              const std::vector<Platform::IntRect> rectList,
    1014                              const WebCore::IntPoint& startReferencePoint,
    1015                              const WebCore::IntPoint& endReferencePoint,
    1016                              bool isRTL)
     1009static void adjustCaretRects(WebCore::IntRect& startCaret, bool isStartCaretClippedOut, WebCore::IntRect& endCaret, bool isEndCaretClippedOut,
     1010    const std::vector<Platform::IntRect> rectList, const WebCore::IntPoint& startReferencePoint, const WebCore::IntPoint& endReferencePoint, bool isRTL)
    10171011{
    10181012    // startReferencePoint is the best guess at the top left of the selection; endReferencePoint is the best guess at the bottom right.
     
    10431037        // Compare and update the start and end carets with their respective reference points.
    10441038        if (!isStartCaretClippedOut && comparePointsToReferencePoint(
    1045                     caretComparisonPointForRect(currentRect, true, isRTL),
    1046                     caretComparisonPointForRect(startCaret, true, isRTL),
    1047                     startReferencePoint, isRTL) > 0) {
    1048             startCaret.setLocation(caretLocationForRect(currentRect, true, isRTL));
    1049             startCaret.setHeight(currentRect.height());
     1039            caretComparisonPointForRect(currentRect, true, isRTL),
     1040            caretComparisonPointForRect(startCaret, true, isRTL),
     1041            startReferencePoint, isRTL) > 0) {
     1042                startCaret.setLocation(caretLocationForRect(currentRect, true, isRTL));
     1043                startCaret.setHeight(currentRect.height());
    10501044        }
    10511045
    10521046        if (!isEndCaretClippedOut && comparePointsToReferencePoint(
    1053                     caretComparisonPointForRect(currentRect, false, isRTL),
    1054                     caretComparisonPointForRect(endCaret, false, isRTL),
    1055                     endReferencePoint, !isRTL) > 0) {
    1056             endCaret.setLocation(caretLocationForRect(currentRect, false, isRTL));
    1057             endCaret.setHeight(currentRect.height());
     1047            caretComparisonPointForRect(currentRect, false, isRTL),
     1048            caretComparisonPointForRect(endCaret, false, isRTL),
     1049            endReferencePoint, !isRTL) > 0) {
     1050                endCaret.setLocation(caretLocationForRect(currentRect, false, isRTL));
     1051                endCaret.setHeight(currentRect.height());
    10581052        }
    10591053    }
     
    10681062
    10691063    if (m_webPage->m_inputHandler->isInputMode()
    1070             && frame->document()->focusedNode()
    1071             && frame->document()->focusedNode()->renderer()) {
    1072         WebCore::IntRect boundingBox(frame->document()->focusedNode()->renderer()->absoluteBoundingBoxRect());
    1073         boundingBox.inflate(-1);
    1074         clippedPoint = WebCore::IntPoint(clamp(boundingBox.x(), clippedPoint.x(), boundingBox.maxX()), clamp(boundingBox.y(), clippedPoint.y(), boundingBox.maxY()));
     1064        && frame->document()->focusedNode()
     1065        && frame->document()->focusedNode()->renderer()) {
     1066            WebCore::IntRect boundingBox(frame->document()->focusedNode()->renderer()->absoluteBoundingBoxRect());
     1067            boundingBox.inflate(-1);
     1068            clippedPoint = WebCore::IntPoint(clamp(boundingBox.x(), clippedPoint.x(), boundingBox.maxX()), clamp(boundingBox.y(), clippedPoint.y(), boundingBox.maxY()));
    10751069    }
    10761070
     
    11001094
    11011095    std::vector<Platform::IntRect> rectList = region.rects();
    1102     for (unsigned int i = 0; i < rectList.size(); i++) {
     1096    for (unsigned i = 0; i < rectList.size(); i++) {
    11031097        if (rectList[i].contains(point))
    11041098            return true;
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h

    r149685 r149826  
    9090    void regionForTextQuads(WTF::Vector<WebCore::FloatQuad>&, BlackBerry::Platform::IntRectRegion&, bool shouldClipToVisibleContent = true) const;
    9191    WebCore::IntRect clippingRectForVisibleContent() const;
    92     bool updateOrHandleInputSelection(WebCore::VisibleSelection& newSelection, const WebCore::IntPoint& relativeStart
    93                                       , const WebCore::IntPoint& relativeEnd);
     92    bool updateOrHandleInputSelection(WebCore::VisibleSelection& newSelection, const WebCore::IntPoint& relativeStart, const WebCore::IntPoint& relativeEnd);
    9493    WebCore::Node* DOMContainerNodeForVisiblePosition(const WebCore::VisiblePosition&) const;
    9594    bool shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPoint&, const WebCore::IntRect&, bool startCaret = true) const;
Note: See TracChangeset for help on using the changeset viewer.