Changeset 150770 in webkit


Ignore:
Timestamp:
May 27, 2013 12:27:06 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Find-on-page should be able to convert the active match to selection when clearing all matches
https://bugs.webkit.org/show_bug.cgi?id=116837

Patch by Andy Chen <andchen@blackberry.com> on 2013-05-27
Reviewed by Rob Buis.

PR 291903
Internally reviewed by Mike Fenton.

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPage::findNextString):

  • Api/WebPage.h:
  • WebKitSupport/InPageSearchManager.cpp:

(BlackBerry::WebKit::InPageSearchManager::findNextString):
(BlackBerry::WebKit::InPageSearchManager::clearTextMatches):

  • WebKitSupport/InPageSearchManager.h:

(InPageSearchManager):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r150760 r150770  
    47094709}
    47104710
    4711 bool WebPage::findNextString(const char* text, bool forward, bool caseSensitive, bool wrap, bool highlightAllMatches)
     4711bool WebPage::findNextString(const char* text, bool forward, bool caseSensitive, bool wrap, bool highlightAllMatches, bool selectActiveMatchOnClear)
    47124712{
    47134713    WebCore::FindOptions findOptions = WebCore::StartInSelection;
     
    47204720    // within the current frame as opposed to the entire Document, so we have to
    47214721    // provide our own wrapping code to wrap at the whole Document level.
    4722     return d->m_inPageSearchManager->findNextString(String::fromUTF8(text), findOptions, wrap, highlightAllMatches);
     4722    return d->m_inPageSearchManager->findNextString(String::fromUTF8(text), findOptions, wrap, highlightAllMatches, selectActiveMatchOnClear);
    47234723}
    47244724
  • trunk/Source/WebKit/blackberry/Api/WebPage.h

    r150756 r150770  
    231231    // Find the next utf8 string in the given direction.
    232232    // Case sensitivity, wrapping, and highlighting all matches are also toggleable.
    233     bool findNextString(const char*, bool forward, bool caseSensitive, bool wrap, bool highlightAllMatches);
     233    bool findNextString(const char*, bool forward, bool caseSensitive, bool wrap, bool highlightAllMatches, bool selectActiveMatchOnClear);
    234234
    235235    JSGlobalContextRef globalContext() const;
  • trunk/Source/WebKit/blackberry/ChangeLog

    r150766 r150770  
     12013-05-27  Andy Chen  <andchen@blackberry.com>
     2
     3        [BlackBerry] Find-on-page should be able to convert the active match to selection when clearing all matches
     4        https://bugs.webkit.org/show_bug.cgi?id=116837
     5
     6        Reviewed by Rob Buis.
     7
     8        PR 291903
     9        Internally reviewed by Mike Fenton.
     10
     11        * Api/WebPage.cpp:
     12        (BlackBerry::WebKit::WebPage::findNextString):
     13        * Api/WebPage.h:
     14        * WebKitSupport/InPageSearchManager.cpp:
     15        (BlackBerry::WebKit::InPageSearchManager::findNextString):
     16        (BlackBerry::WebKit::InPageSearchManager::clearTextMatches):
     17        * WebKitSupport/InPageSearchManager.h:
     18        (InPageSearchManager):
     19
    1202013-05-27  Eli Fidler  <efidler@rim.com>
    221
  • trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp

    r150140 r150770  
    8585}
    8686
    87 bool InPageSearchManager::findNextString(const String& text, FindOptions findOptions, bool wrap, bool highlightAllMatches)
     87bool InPageSearchManager::findNextString(const String& text, FindOptions findOptions, bool wrap, bool highlightAllMatches, bool selectActiveMatchOnClear)
    8888{
    8989    bool highlightAllMatchesStateChanged = m_highlightAllMatches != highlightAllMatches;
     
    9191
    9292    if (!text.length()) {
    93         clearTextMatches();
     93        clearTextMatches(selectActiveMatchOnClear);
    9494        cancelPendingScopingEffort();
    9595        m_activeSearchString = String();
     
    232232}
    233233
    234 void InPageSearchManager::clearTextMatches()
    235 {
     234void InPageSearchManager::clearTextMatches(bool selectActiveMatchOnClear)
     235{
     236    if (selectActiveMatchOnClear && m_activeMatch.get()) {
     237        VisibleSelection selection(m_activeMatch.get());
     238        m_activeMatch->ownerDocument()->frame()->selection()->setSelection(selection);
     239    }
    236240    m_webPage->m_page->unmarkAllTextMatches();
    237241    m_activeMatch = 0;
  • trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.h

    r127594 r150770  
    4040    ~InPageSearchManager();
    4141
    42     bool findNextString(const String&, WebCore::FindOptions, bool wrap, bool highlightAllMatches);
     42    bool findNextString(const String&, WebCore::FindOptions, bool wrap, bool highlightAllMatches, bool selectActiveMatchOnClear);
    4343    void frameUnloaded(const WebCore::Frame*);
    4444
     
    4747    friend class DeferredScopeStringMatches;
    4848
    49     void clearTextMatches();
     49    void clearTextMatches(bool selectActiveMatchOnClear = false);
    5050    void setActiveMatchAndMarker(PassRefPtr<WebCore::Range>);
    5151    bool findAndMarkText(const String&, WebCore::Range*, WebCore::Frame*, const WebCore::FindOptions&, bool /* isNewSearch */, bool /* startFromSelection */);
  • trunk/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp

    r150007 r150770  
    618618    // Our layout tests assume find will wrap and highlight all matches.
    619619    BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(),
    620         !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */);
     620        !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */, false /* selectActiveMatchOnClear */);
    621621
    622622    return mainFrame->page()->findString(nameStr, options);
Note: See TracChangeset for help on using the changeset viewer.