Changeset 69689 in webkit


Ignore:
Timestamp:
Oct 13, 2010 1:18:09 PM (14 years ago)
Author:
andersca@apple.com
Message:

Send over find indicator information to the UI process
https://bugs.webkit.org/show_bug.cgi?id=47612

Reviewed by Sam Weinig.

WebCore:

Export symbols needed by WebKit2.

  • WebCore.exp.in:

WebKit2:

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setFindIndicator):
Add stub.

  • UIProcess/WebPageProxy.messages.in:

Add SetFindIndicator.

  • WebProcess/WebPage/FindController.cpp:

(WebKit::FindController::FindController):
Initialize m_isShowingFindIndicator.

(WebKit::FindController::findString):
Update the find indicator if needed.

(WebKit::FindController::updateFindIndicator):
Compute find indicator information, paint the find indicator text into a
backing store and send it over.

(WebKit::FindController::resetFindIndicator):
Send a SetFindIndicator message with a null backing store.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69688 r69689  
     12010-10-13  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Send over find indicator information to the UI process
     6        https://bugs.webkit.org/show_bug.cgi?id=47612
     7
     8        Export symbols needed by WebKit2.
     9
     10        * WebCore.exp.in:
     11
    1122010-10-13  Gavin Barraclough  <barraclough@apple.com>
    213
  • trunk/WebCore/WebCore.exp.in

    r69625 r69689  
    352352__ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
    353353__ZN7WebCore15GraphicsContext4saveEv
     354__ZN7WebCore15GraphicsContext7restoreEv
    354355__ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
    355 __ZN7WebCore15GraphicsContext7restoreEv
    356356__ZN7WebCore15GraphicsContext9translateEff
    357357__ZN7WebCore15GraphicsContextC1EP9CGContext
     
    408408__ZN7WebCore16createFullMarkupEPKNS_5RangeE
    409409__ZN7WebCore16enclosingIntRectERK7_NSRect
     410__ZN7WebCore16enclosingIntRectERKNS_9FloatRectE
    410411__ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
    411412__ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPN3WTF10StringImplEPNS0_8JSStringEEES6_
     
    550551__ZN7WebCore4Font18shouldUseSmoothingEv
    551552__ZN7WebCore4Font21setShouldUseSmoothingEb
    552 __ZN7WebCore4FontaSERKS0_
    553553__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
    554554__ZN7WebCore4FontC1Ev
     555__ZN7WebCore4FontaSERKS0_
    555556__ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0EEE
    556557__ZN7WebCore4IconD1Ev
     
    687688__ZN7WebCore7nsColorERKNS_5ColorE
    688689__ZN7WebCore8Document11createRangeEv
     690__ZN7WebCore8Document12updateLayoutEv
    689691__ZN7WebCore8Document13svgExtensionsEv
    690692__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
  • trunk/WebKit2/ChangeLog

    r69688 r69689  
    1111        (WebKit::WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest):
    1212        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     13
     142010-10-13  Anders Carlsson  <andersca@apple.com>
     15
     16        Reviewed by Sam Weinig.
     17
     18        Send over find indicator information to the UI process
     19        https://bugs.webkit.org/show_bug.cgi?id=47612
     20
     21        * UIProcess/WebPageProxy.cpp:
     22        (WebKit::WebPageProxy::setFindIndicator):
     23        Add stub.
     24
     25        * UIProcess/WebPageProxy.messages.in:
     26        Add SetFindIndicator.
     27
     28        * WebProcess/WebPage/FindController.cpp:
     29        (WebKit::FindController::FindController):
     30        Initialize m_isShowingFindIndicator.
     31
     32        (WebKit::FindController::findString):
     33        Update the find indicator if needed.
     34
     35        (WebKit::FindController::updateFindIndicator):
     36        Compute find indicator information, paint the find indicator text into a
     37        backing store and send it over.
     38
     39        (WebKit::FindController::resetFindIndicator):
     40        Send a SetFindIndicator message with a null backing store.
    1341
    14422010-10-13  Anders Carlsson  <andersca@apple.com>
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r69538 r69689  
    957957}
    958958
     959void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
     960{
     961    // FIXME: Implement.
     962}
     963
    959964void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
    960965{
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r69574 r69689  
    3131#include "FindOptions.h"
    3232#include "GenericCallback.h"
     33#include "SharedMemory.h"
    3334#include "WKBase.h"
    3435#include "WebEvent.h"
     
    282283    // Find.
    283284    void didCountStringMatches(const String&, uint32_t numMatches);
     285    void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
    284286
    285287    void takeFocus(bool direction);
  • trunk/WebKit2/UIProcess/WebPageProxy.messages.in

    r69490 r69689  
    9494    # Find.
    9595    DidCountStringMatches(WTF::String string, uint32_t numMatches)
     96    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle)
    9697
    9798#if USE(ACCELERATED_COMPOSITING)
  • trunk/WebKit2/WebProcess/WebPage/FindController.cpp

    r69625 r69689  
    2626#include "FindController.h"
    2727
     28#include "BackingStore.h"
    2829#include "FindPageOverlay.h"
    2930#include "WebPage.h"
     31#include "WebPageProxyMessages.h"
     32#include "WebProcess.h"
    3033#include <WebCore/Frame.h>
     34#include <WebCore/FrameView.h>
     35#include <WebCore/GraphicsContext.h>
    3136#include <WebCore/Page.h>
    3237
     
    3843    : m_webPage(webPage)
    3944    , m_findPageOverlay(0)
     45    , m_isShowingFindIndicator(false)
    4046{
    4147}
     
    6975        if (selectedFrame)
    7076            selectedFrame->selection()->clear();
     77
     78        resetFindIndicator();
    7179    } else {
    7280        shouldShowOverlay = findOptions & FindOptionsShowOverlay;
     
    7886            if (numMatches > maxNumMatches)
    7987                shouldShowOverlay = false;
     88        }
     89
     90        if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame)) {
     91            // Either we shouldn't show the find indicator, or we couldn't update it.
     92            resetFindIndicator();
    8093        }
    8194    }
     
    112125}
    113126
     127bool FindController::updateFindIndicator(Frame* selectedFrame)
     128{
     129    if (!selectedFrame)
     130        return false;
     131
     132    IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
     133    Vector<FloatRect> textRects;
     134    selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
     135
     136    // Create a backing store and paint the find indicator text into it.
     137    RefPtr<BackingStore> findIndicatorTextBackingStore = BackingStore::createSharable(selectionRect.size());
     138    OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
     139
     140    graphicsContext->translate(-selectionRect.x(), -selectionRect.y());
     141    selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
     142    selectedFrame->document()->updateLayout();
     143   
     144    graphicsContext->clip(selectionRect);
     145    selectedFrame->view()->paint(graphicsContext.get(), selectionRect);
     146    selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
     147   
     148    SharedMemory::Handle handle;
     149    if (!findIndicatorTextBackingStore->createHandle(handle))
     150        return false;
     151
     152    // We want the selection rect in window coordinates.
     153    IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
     154
     155    // We want the text rects in selection rect coordinates.
     156    Vector<FloatRect> textRectsInSelectionRectCoordinates;
     157   
     158    for (size_t i = 0; i < textRects.size(); ++i) {
     159        IntRect textRectInSelectionRectCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(textRects[i]));
     160        textRectInSelectionRectCoordinates.move(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y());
     161
     162        textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     163    }           
     164   
     165    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle), m_webPage->pageID());
     166    m_isShowingFindIndicator = true;
     167
     168    return true;
     169}
     170
     171void FindController::resetFindIndicator()
     172{
     173    if (!m_isShowingFindIndicator)
     174        return;
     175
     176    SharedMemory::Handle handle;
     177    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle), m_webPage->pageID());
     178    m_isShowingFindIndicator = false;
     179}
     180
     181
    114182} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebPage/FindController.h

    r69616 r69689  
    5252
    5353private:
     54    bool updateFindIndicator(WebCore::Frame* selectedFrame);
     55    void resetFindIndicator();
     56   
    5457    WebPage* m_webPage;
    5558    FindPageOverlay* m_findPageOverlay;
     59
     60    // Whether the UI process is showing the find indicator. Note that this can be true even if
     61    // the find indicator isn't showing, but it will never be false when it is showing.
     62    bool m_isShowingFindIndicator;
    5663};
    5764
Note: See TracChangeset for help on using the changeset viewer.