Rename FindIndicator{Window} to TextIndicator{Window}
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2014 19:17:20 +0000 (19:17 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2014 19:17:20 +0000 (19:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138302
<rdar://problem/18855190>

Reviewed by Anders Carlsson.

Rename FindIndicator{Window} to TextIndicator{Window} (and related),
because it will soon be used to indicate ranges of text that are not
necessarily find-in-page results.

FindController still has things named 'findIndicator' internally,
and I left the API alone (because all the API bits are actually find-specific),
but the actual FindIndicator/Window and the message to set it up, etc. are all
now called Text*.

* CMakeLists.txt:
* UIProcess/API/mac/WKView.mm:
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/TextIndicator.cpp: Renamed from Source/WebKit2/UIProcess/FindIndicator.cpp.
* UIProcess/TextIndicator.h: Renamed from Source/WebKit2/UIProcess/FindIndicator.h.
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
* UIProcess/ios/WKContentView.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
* UIProcess/mac/TextIndicatorWindow.h: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h.
* UIProcess/mac/TextIndicatorWindow.mm: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/FindController.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175476 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/TextIndicator.cpp [moved from Source/WebKit2/UIProcess/FindIndicator.cpp with 93% similarity]
Source/WebKit2/UIProcess/TextIndicator.h [moved from Source/WebKit2/UIProcess/FindIndicator.h with 88% similarity]
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/ios/WKContentView.h
Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm [deleted file]
Source/WebKit2/UIProcess/mac/PageClientImpl.h
Source/WebKit2/UIProcess/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h [moved from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h with 75% similarity]
Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm [new file with mode: 0644]
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebPage/FindController.cpp

index ee84ac4e49f056078854274ab04dfe782e2570dd..0be28825d294392936e9aca81aae6105352309a4 100644 (file)
@@ -289,7 +289,6 @@ set(WebKit2_SOURCES
     UIProcess/APISession.cpp
     UIProcess/BackingStore.cpp
     UIProcess/DrawingAreaProxy.cpp
-    UIProcess/FindIndicator.cpp
     UIProcess/FrameLoadState.cpp
     UIProcess/GeolocationPermissionRequestManagerProxy.cpp
     UIProcess/GeolocationPermissionRequestProxy.cpp
@@ -300,6 +299,7 @@ set(WebKit2_SOURCES
     UIProcess/ResponsivenessTimer.cpp
     UIProcess/StatisticsRequest.cpp
     UIProcess/TextCheckerCompletion.cpp
+    UIProcess/TextIndicator.cpp
     UIProcess/VisitedLinkProvider.cpp
     UIProcess/WebApplicationCacheManagerProxy.cpp
     UIProcess/WebBackForwardList.cpp
index 9f478ad241764ebc0baeb9bea480a7b9179a6527..d548fac157012ef707eb15f4bc61da462b8139e2 100644 (file)
@@ -1,3 +1,39 @@
+2014-11-03  Tim Horton  <timothy_horton@apple.com>
+
+        Rename FindIndicator{Window} to TextIndicator{Window}
+        https://bugs.webkit.org/show_bug.cgi?id=138302
+        <rdar://problem/18855190>
+
+        Reviewed by Anders Carlsson.
+
+        Rename FindIndicator{Window} to TextIndicator{Window} (and related),
+        because it will soon be used to indicate ranges of text that are not
+        necessarily find-in-page results.
+
+        FindController still has things named 'findIndicator' internally,
+        and I left the API alone (because all the API bits are actually find-specific),
+        but the actual FindIndicator/Window and the message to set it up, etc. are all
+        now called Text*.
+
+        * CMakeLists.txt:
+        * UIProcess/API/mac/WKView.mm:
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/TextIndicator.cpp: Renamed from Source/WebKit2/UIProcess/FindIndicator.cpp.
+        * UIProcess/TextIndicator.h: Renamed from Source/WebKit2/UIProcess/FindIndicator.h.
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        * UIProcess/mac/TextIndicatorWindow.h: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h.
+        * UIProcess/mac/TextIndicatorWindow.mm: Renamed from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm.
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/FindController.cpp:
+
 2014-11-03  Beth Dakin  <bdakin@apple.com>
 
         Implement action menus for editable text
index 59f2b68277e897408ab0cf5e2598e2528d2f4a9e..7279a82d6edcef3334ba1cb43cf3db91e78dbf24 100644 (file)
@@ -40,8 +40,6 @@
 #import "DataReference.h"
 #import "EditingRange.h"
 #import "EditorState.h"
-#import "FindIndicator.h"
-#import "FindIndicatorWindow.h"
 #import "LayerTreeContext.h"
 #import "Logging.h"
 #import "NativeWebKeyboardEvent.h"
@@ -53,6 +51,8 @@
 #import "StringUtilities.h"
 #import "TextChecker.h"
 #import "TextCheckerState.h"
+#import "TextIndicator.h"
+#import "TextIndicatorWindow.h"
 #import "TiledCoreAnimationDrawingAreaProxy.h"
 #import "ViewGestureController.h"
 #import "ViewSnapshotStore.h"
@@ -182,7 +182,7 @@ struct WKViewInterpretKeyEventsParameters {
     // For asynchronous validation.
     ValidationMap _validationMap;
 
-    std::unique_ptr<FindIndicatorWindow> _findIndicatorWindow;
+    std::unique_ptr<TextIndicatorWindow> _textIndicatorWindow;
 
     // We keep here the event when resending it to
     // the application to distinguish the case of a new event from one 
@@ -492,7 +492,7 @@ struct WKViewInterpretKeyEventsParameters {
 - (void)renewGState
 {
     // Hide the find indicator.
-    _data->_findIndicatorWindow = nullptr;
+    _data->_textIndicatorWindow = nullptr;
 
     // Update the view frame.
     if ([self window])
@@ -3041,17 +3041,17 @@ static void* keyValueObservingContext = &keyValueObservingContext;
     }
 }
 
-- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
+- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
 {
-    if (!findIndicator) {
-        _data->_findIndicatorWindow = nullptr;
+    if (!textIndicator) {
+        _data->_textIndicatorWindow = nullptr;
         return;
     }
 
-    if (!_data->_findIndicatorWindow)
-        _data->_findIndicatorWindow = std::make_unique<FindIndicatorWindow>(self);
+    if (!_data->_textIndicatorWindow)
+        _data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
 
-    _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
+    _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate);
 }
 
 - (CALayer *)_rootLayer
index 0168ec6c493bd65126e484e84a4945e9a6576af9..1ec2ec02e1bfd21d2397233e3ddad9142ba0e7db 100644 (file)
@@ -46,8 +46,8 @@ struct KeypressCommand;
 
 namespace WebKit {
 class DrawingAreaProxy;
-class FindIndicator;
 class LayerTreeContext;
+class TextIndicator;
 class ViewSnapshot;
 class WebContext;
 struct ActionMenuHitTestResult;
@@ -80,7 +80,7 @@ struct WebPageConfiguration;
 - (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize;
 - (NSRect)_convertToDeviceSpace:(NSRect)rect;
 - (NSRect)_convertToUserSpace:(NSRect)rect;
-- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
+- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
 
 - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
 - (CALayer *)_acceleratedCompositingModeRootLayer;
index 83135f637462a200afea270d2b1865d587b5e78e..a03a3609ed519479e231004f758106416be5d8e9 100644 (file)
@@ -54,7 +54,7 @@ struct Highlight;
 namespace WebKit {
 
 class DrawingAreaProxy;
-class FindIndicator;
+class TextIndicator;
 class NativeWebKeyboardEvent;
 class RemoteLayerTreeTransaction;
 class ViewSnapshot;
@@ -214,7 +214,7 @@ public:
     virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0;
 #endif
 
-    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
+    virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate) = 0;
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
     virtual void exitAcceleratedCompositingMode() = 0;
similarity index 93%
rename from Source/WebKit2/UIProcess/FindIndicator.cpp
rename to Source/WebKit2/UIProcess/TextIndicator.cpp
index 71e206b808569bd98a77942046410a4d1905bbb4..fe58d21d1006de80251d26fe46e3c64f6fc2a4d6 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "FindIndicator.h"
+#include "TextIndicator.h"
 
 #include "ShareableBitmap.h"
 #include <WebCore/GeometryUtilities.h>
 #include <WebCore/Path.h>
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
-#define ENABLE_LEGACY_FIND_INDICATOR_STYLE 1
+#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 1
 #else
-#define ENABLE_LEGACY_FIND_INDICATOR_STYLE 0
+#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 0
 #endif
 
 using namespace WebCore;
 
-#if ENABLE(LEGACY_FIND_INDICATOR_STYLE)
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
 static const float cornerRadius = 3.0;
 
 static const float shadowOffsetX = 0.0;
@@ -93,14 +93,14 @@ const float flatRimShadowBlurRadius = 2;
 
 namespace WebKit {
 
-PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle)
+PassRefPtr<TextIndicator> TextIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle)
 {
     RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(contentImageHandle);
     if (!contentImage)
         return 0;
     ASSERT(contentImageScaleFactor != 1 || contentImage->size() == enclosingIntRect(selectionRectInWindowCoordinates).size());
 
-    return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImage.release()));
+    return adoptRef(new TextIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImage.release()));
 }
 
 static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflateY)
@@ -113,7 +113,7 @@ static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflat
 
 static FloatRect outsetIndicatorRectIncludingShadow(const FloatRect rect)
 {
-#if ENABLE(LEGACY_FIND_INDICATOR_STYLE)
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
     FloatRect outsetRect = rect;
     outsetRect.move(-leftBorderThickness, -topBorderThickness);
     outsetRect.expand(leftBorderThickness + rightBorderThickness, topBorderThickness + bottomBorderThickness);
@@ -123,7 +123,7 @@ static FloatRect outsetIndicatorRectIncludingShadow(const FloatRect rect)
 #endif
 }
 
-static bool findIndicatorsForTextRectsOverlap(const Vector<FloatRect>& textRects)
+static bool textIndicatorsForTextRectsOverlap(const Vector<FloatRect>& textRects)
 {
     size_t count = textRects.size();
     if (count <= 1)
@@ -147,28 +147,28 @@ static bool findIndicatorsForTextRectsOverlap(const Vector<FloatRect>& textRects
     return false;
 }
 
-FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage)
+TextIndicator::TextIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage)
     : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates)
     , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates)
     , m_contentImageScaleFactor(contentImageScaleFactor)
     , m_contentImage(contentImage)
 {
-    if (findIndicatorsForTextRectsOverlap(m_textRectsInSelectionRectCoordinates)) {
+    if (textIndicatorsForTextRectsOverlap(m_textRectsInSelectionRectCoordinates)) {
         m_textRectsInSelectionRectCoordinates[0] = unionRect(m_textRectsInSelectionRectCoordinates);
         m_textRectsInSelectionRectCoordinates.shrink(1);
     }
 }
 
-FindIndicator::~FindIndicator()
+TextIndicator::~TextIndicator()
 {
 }
 
-FloatRect FindIndicator::frameRect() const
+FloatRect TextIndicator::frameRect() const
 {
     return outsetIndicatorRectIncludingShadow(m_selectionRectInWindowCoordinates);
 }
 
-#if ENABLE(LEGACY_FIND_INDICATOR_STYLE)
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
 static inline Color lightBorderColor()
 {
     return Color(lightBorderRed, lightBorderGreen, lightBorderBlue, lightBorderAlpha);
@@ -213,9 +213,9 @@ static inline Color flatDropShadowColor()
 }
 #endif
     
-void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& /*dirtyRect*/)
+void TextIndicator::draw(GraphicsContext& graphicsContext, const IntRect& /*dirtyRect*/)
 {
-#if ENABLE(LEGACY_FIND_INDICATOR_STYLE)
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
     for (size_t i = 0; i < m_textRectsInSelectionRectCoordinates.size(); ++i) {
         FloatRect textRect = m_textRectsInSelectionRectCoordinates[i];
         textRect.move(leftBorderThickness, topBorderThickness);
similarity index 88%
rename from Source/WebKit2/UIProcess/FindIndicator.h
rename to Source/WebKit2/UIProcess/TextIndicator.h
index a34973b8423622f39e43c41940e57d8aa47c7875..a476e70c86345ce0e1e67db3bb7ed0781184a988 100644 (file)
@@ -23,8 +23,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef FindIndicator_h
-#define FindIndicator_h
+#ifndef TextIndicator_h
+#define TextIndicator_h
 
 #include "ShareableBitmap.h"
 #include <WebCore/FloatRect.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
-    class GraphicsContext;
+class GraphicsContext;
 }
 
 namespace WebKit {
 
-class FindIndicator : public RefCounted<FindIndicator> {
+class TextIndicator : public RefCounted<TextIndicator> {
 public:
-    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle);
-    ~FindIndicator();
+    static PassRefPtr<TextIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle);
+    ~TextIndicator();
 
     WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
     WebCore::FloatRect frameRect() const;
@@ -51,7 +51,7 @@ public:
     void draw(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
 
 private:
-    FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage);
+    TextIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage);
 
     WebCore::FloatRect m_selectionRectInWindowCoordinates;
     Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates;
@@ -61,4 +61,4 @@ private:
 
 } // namespace WebKit
 
-#endif // FindIndicator_h
+#endif // TextIndicator_h
index 5e01a0dc53e21e5d12ed7a74c31b9bb066e06b5d..622d123dacedef5c6569963db19063cf1d929ecf 100644 (file)
@@ -41,7 +41,6 @@
 #include "DrawingAreaProxy.h"
 #include "DrawingAreaProxyMessages.h"
 #include "EventDispatcherMessages.h"
-#include "FindIndicator.h"
 #include "Logging.h"
 #include "NativeWebKeyboardEvent.h"
 #include "NativeWebMouseEvent.h"
@@ -55,6 +54,7 @@
 #include "PrintInfo.h"
 #include "TextChecker.h"
 #include "TextCheckerState.h"
+#include "TextIndicator.h"
 #include "WKContextPrivate.h"
 #include "WebBackForwardList.h"
 #include "WebBackForwardListItem.h"
@@ -3625,10 +3625,10 @@ void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& conten
     m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
 }
 
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
+void WebPageProxy::setTextIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
 {
-    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
-    m_pageClient.setFindIndicator(findIndicator.release(), fadeOut, animate);
+    RefPtr<TextIndicator> textIndicator = TextIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
+    m_pageClient.setTextIndicator(textIndicator.release(), fadeOut, animate);
 }
 
 void WebPageProxy::didFindString(const String& string, uint32_t matchCount, int32_t matchIndex)
index e19865321a364a733ba95399e6a2923ad105216f..3d2165f4b64346c8cb622078d7b12dc81904cfa7 100644 (file)
@@ -661,7 +661,7 @@ public:
     void hideFindUI();
     void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
     void didCountStringMatches(const String&, uint32_t matchCount);
-    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
+    void setTextIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
     void didFindString(const String&, uint32_t matchCount, int32_t matchIndex);
     void didFailToFindString(const String&);
     void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection);
index 91ba60b7e26c56b285f29e0c7c404ad6485b1919..3709dc8421f404a8c87b0511f72f85b9a03a2507 100644 (file)
@@ -228,7 +228,7 @@ messages -> WebPageProxy {
 
     # Find messages
     DidCountStringMatches(String string, uint32_t matchCount)
-    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate)
+    SetTextIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate)
     DidFindString(String string, uint32_t matchCount, int32_t matchIndex)
     DidFailToFindString(String string)
     DidFindStringMatches(String string, Vector<Vector<WebCore::IntRect>> matches, int32_t firstIndexAfterSelection)
index 136c6f9251d3585e0b7cf2716442a89ef22103f1..323dfd156f5141e8523ebba1537bf41072e63357 100644 (file)
@@ -96,7 +96,7 @@ private:
 #endif
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) override;
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) override;
-    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) override;
+    virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate) override;
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
     virtual void exitAcceleratedCompositingMode() override;
index 42d29612d54eaba3429a8e45bb139fb4adc2c24d..8c3bb114368255ad9f30de35353bdee35802fbcd 100644 (file)
 #import "APIData.h"
 #import "DataReference.h"
 #import "DownloadProxy.h"
-#import "FindIndicator.h"
 #import "InteractionInformationAtPosition.h"
 #import "NativeWebKeyboardEvent.h"
 #import "NavigationState.h"
+#import "TextIndicator.h"
 #import "ViewSnapshotStore.h"
 #import "WKContentView.h"
 #import "WKContentViewInteraction.h"
@@ -440,7 +440,7 @@ PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPagePr
     return 0;
 }
 
-void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
+void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
 {
 }
 
index cb7e09c51e076536d7de232fb8faccf4f8c65362..e51efa2e123d7907ceaee32819ce8106c199e867 100644 (file)
@@ -39,9 +39,9 @@ struct Highlight;
 
 namespace WebKit {
 class DrawingAreaProxy;
-class FindIndicator;
 class GeolocationPermissionRequestProxy;
 class RemoteLayerTreeTransaction;
+class TextIndicator;
 class WebContext;
 class WebFrameProxy;
 class WebPageProxy;
diff --git a/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm b/Source/WebKit2/UIProcess/mac/FindIndicatorWindow.mm
deleted file mode 100644 (file)
index c18c752..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "FindIndicatorWindow.h"
-
-#if PLATFORM(MAC)
-
-#import "FindIndicator.h"
-#import "WKView.h"
-#import <WebCore/GraphicsContext.h>
-
-static const double bounceAnimationDuration = 0.12;
-static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
-static const double fadeOutAnimationDuration = 0.3;
-
-using namespace WebCore;
-
-@interface WKFindIndicatorView : NSView {
-    RefPtr<WebKit::FindIndicator> _findIndicator;
-}
-
-- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator;
-@end
-
-@implementation WKFindIndicatorView
-
-- (id)_initWithFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator
-{
-    if ((self = [super initWithFrame:NSZeroRect]))
-        _findIndicator = findIndicator;
-
-    return self;
-}
-
-- (void)drawRect:(NSRect)rect
-{
-    GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]));
-
-    _findIndicator->draw(graphicsContext, enclosingIntRect(rect));
-}
-
-- (BOOL)isFlipped
-{
-    return YES;
-}
-
-@end
-
-@interface WKFindIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> {
-    WebKit::FindIndicatorWindow* _findIndicatorWindow;
-    void (WebKit::FindIndicatorWindow::*_animationProgressCallback)(double progress);
-    void (WebKit::FindIndicatorWindow::*_animationDidEndCallback)();
-}
-
-- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow 
-                 animationDuration:(CFTimeInterval)duration
-         animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
-           animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback;
-@end
-
-@implementation WKFindIndicatorWindowAnimation
-
-- (id)_initWithFindIndicatorWindow:(WebKit::FindIndicatorWindow *)findIndicatorWindow 
-                 animationDuration:(CFTimeInterval)animationDuration
-         animationProgressCallback:(void (WebKit::FindIndicatorWindow::*)(double progress))animationProgressCallback
-           animationDidEndCallback:(void (WebKit::FindIndicatorWindow::*)())animationDidEndCallback
-{
-    if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) {
-        _findIndicatorWindow = findIndicatorWindow;
-        _animationProgressCallback = animationProgressCallback;
-        _animationDidEndCallback = animationDidEndCallback;
-        [self setDelegate:self];
-        [self setAnimationBlockingMode:NSAnimationNonblocking];
-    }
-    return self;
-}
-
-- (void)setCurrentProgress:(NSAnimationProgress)progress
-{
-    (_findIndicatorWindow->*_animationProgressCallback)(progress);
-}
-
-- (void)animationDidEnd:(NSAnimation *)animation
-{
-    ASSERT(animation == self);
-
-    (_findIndicatorWindow->*_animationDidEndCallback)();
-}
-
-@end
-
-namespace WebKit {
-
-FindIndicatorWindow::FindIndicatorWindow(WKView *wkView)
-    : m_wkView(wkView)
-    , m_bounceAnimationContext(0)
-    , m_startFadeOutTimer(RunLoop::main(), this, &FindIndicatorWindow::startFadeOutTimerFired)
-{
-}
-
-FindIndicatorWindow::~FindIndicatorWindow()
-{
-    closeWindow();
-}
-
-void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
-{
-    if (m_findIndicator == findIndicator)
-        return;
-
-    m_findIndicator = findIndicator;
-
-    // Get rid of the old window.
-    closeWindow();
-
-    if (!m_findIndicator)
-        return;
-
-    NSRect contentRect = m_findIndicator->frameRect();
-    NSRect windowFrameRect = NSIntegralRect([m_wkView convertRect:contentRect toView:nil]);
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    windowFrameRect.origin = [[m_wkView window] convertBaseToScreen:windowFrameRect.origin];
-#pragma clang diagnostic pop
-    NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask];
-    
-    m_findIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect 
-                                                              styleMask:NSBorderlessWindowMask 
-                                                                backing:NSBackingStoreBuffered
-                                                                  defer:NO]);
-
-    [m_findIndicatorWindow setBackgroundColor:[NSColor clearColor]];
-    [m_findIndicatorWindow setOpaque:NO];
-    [m_findIndicatorWindow setIgnoresMouseEvents:YES];
-
-    RetainPtr<WKFindIndicatorView> findIndicatorView = adoptNS([[WKFindIndicatorView alloc] _initWithFindIndicator:m_findIndicator]);
-    [m_findIndicatorWindow setContentView:findIndicatorView.get()];
-
-    [[m_wkView window] addChildWindow:m_findIndicatorWindow.get() ordered:NSWindowAbove];
-    [m_findIndicatorWindow setReleasedWhenClosed:NO];
-
-    if (animate) {
-        // Start the bounce animation.
-        m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
-        m_bounceAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
-                                                                                    animationDuration:bounceAnimationDuration
-                                                                            animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
-                                                                              animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
-        [m_bounceAnimation startAnimation];
-    }
-
-    if (fadeOut)
-        m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
-}
-
-void FindIndicatorWindow::closeWindow()
-{
-    if (!m_findIndicatorWindow)
-        return;
-
-    m_startFadeOutTimer.stop();
-
-    if (m_fadeOutAnimation) {
-        [m_fadeOutAnimation stopAnimation];
-        m_fadeOutAnimation = nullptr;
-    }
-
-    if (m_bounceAnimation) {
-        [m_bounceAnimation stopAnimation];
-        m_bounceAnimation = nullptr;
-    }
-
-    if (m_bounceAnimationContext)
-        WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
-    
-    [[m_findIndicatorWindow parentWindow] removeChildWindow:m_findIndicatorWindow.get()];
-    [m_findIndicatorWindow close];
-    m_findIndicatorWindow = nullptr;
-}
-
-void FindIndicatorWindow::startFadeOutTimerFired()
-{
-    ASSERT(!m_fadeOutAnimation);
-    
-    m_fadeOutAnimation = adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
-                                                                                   animationDuration:fadeOutAnimationDuration
-                                                                           animationProgressCallback:&FindIndicatorWindow::fadeOutAnimationCallback
-                                                                             animationDidEndCallback:&FindIndicatorWindow::fadeOutAnimationDidEnd]);
-    [m_fadeOutAnimation startAnimation];
-}
-                        
-void FindIndicatorWindow::fadeOutAnimationCallback(double progress)
-{
-    ASSERT(m_fadeOutAnimation);
-
-    [m_findIndicatorWindow setAlphaValue:1.0 - progress];
-}
-
-void FindIndicatorWindow::fadeOutAnimationDidEnd()
-{
-    ASSERT(m_fadeOutAnimation);
-    ASSERT(m_findIndicatorWindow);
-
-    closeWindow();
-}
-
-void FindIndicatorWindow::bounceAnimationCallback(double progress)
-{
-    ASSERT(m_bounceAnimation);
-    ASSERT(m_bounceAnimationContext);
-
-    WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress);
-}
-
-void FindIndicatorWindow::bounceAnimationDidEnd()
-{
-    ASSERT(m_bounceAnimation);
-    ASSERT(m_bounceAnimationContext);
-    ASSERT(m_findIndicatorWindow);
-
-    WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
-    m_bounceAnimationContext = 0;
-}
-
-} // namespace WebKit
-
-#endif // PLATFORM(MAC)
index cbdaa93392f880c1b3e5527c9e868cde9c5191fe..1475827e97aca5a35625fb4489985a91c9282397 100644 (file)
@@ -42,7 +42,7 @@ class AlternativeTextUIController;
 }
 
 namespace WebKit {
-class FindIndicatorWindow;
+class TextIndicatorWindow;
 
 class PageClientImpl final : public PageClient
 #if ENABLE(FULLSCREEN_API)
@@ -120,7 +120,7 @@ private:
     virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
 #endif
 
-    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
+    void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate);
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
     virtual void exitAcceleratedCompositingMode();
index aa986eb4f68dbfb986dd5bb64d6e1ffd2505ea40..374fefbfb1b955b7823032a11f9dc9a0a76588ef 100644 (file)
 #import "DataReference.h"
 #import "DictionaryPopupInfo.h"
 #import "DownloadProxy.h"
-#import "FindIndicator.h"
 #import "NativeWebKeyboardEvent.h"
 #import "NativeWebWheelEvent.h"
 #import "NavigationState.h"
 #import "StringUtilities.h"
+#import "TextIndicator.h"
 #import "ViewSnapshotStore.h"
 #import "WKAPICast.h"
 #import "WKFullScreenWindowController.h"
@@ -467,9 +467,9 @@ PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page,
 }
 #endif
 
-void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
+void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
 {
-    [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
+    [m_wkView _setTextIndicator:textIndicator fadeOut:fadeOut animate:animate];
 }
 
 void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
@@ -685,7 +685,7 @@ void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntR
 void PageClientImpl::navigationGestureDidBegin()
 {
     // Hide the finde indicator if it's visible.
-    setFindIndicator(nullptr, false, false);
+    setTextIndicator(nullptr, false, false);
 
 #if WK_API_ENABLED
     if (m_webView)
similarity index 75%
rename from Source/WebKit2/UIProcess/mac/FindIndicatorWindow.h
rename to Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h
index 3752c8369398c611b833eaaf866832608b124e1c..9ef164d4ce8977d3047371422b308a23aac5e8da 100644 (file)
@@ -23,8 +23,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef FindIndicatorWindow_h
-#define FindIndicatorWindow_h
+#ifndef TextIndicatorWindow_h
+#define TextIndicatorWindow_h
 
 #if PLATFORM(MAC)
 
 #import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 
-@class WKFindIndicatorWindowAnimation;
+@class WKTextIndicatorWindowAnimation;
 @class WKView;
 
 namespace WebKit {
 
-class FindIndicator;
+class TextIndicator;
 
-class FindIndicatorWindow {
-    WTF_MAKE_NONCOPYABLE(FindIndicatorWindow);
+class TextIndicatorWindow {
+    WTF_MAKE_NONCOPYABLE(TextIndicatorWindow);
 
 public:
-    explicit FindIndicatorWindow(WKView *);
-    ~FindIndicatorWindow();
+    explicit TextIndicatorWindow(WKView *);
+    ~TextIndicatorWindow();
 
-    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
+    void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate);
 
 private:
     void closeWindow();
@@ -62,18 +62,18 @@ private:
     void bounceAnimationDidEnd();
 
     WKView* m_wkView;
-    RefPtr<FindIndicator> m_findIndicator;
-    RetainPtr<NSWindow> m_findIndicatorWindow;
+    RefPtr<TextIndicator> m_textIndicator;
+    RetainPtr<NSWindow> m_textIndicatorWindow;
 
     WKWindowBounceAnimationContextRef m_bounceAnimationContext;
-    RetainPtr<WKFindIndicatorWindowAnimation> m_bounceAnimation;
+    RetainPtr<WKTextIndicatorWindowAnimation> m_bounceAnimation;
 
-    RunLoop::Timer<FindIndicatorWindow> m_startFadeOutTimer;
-    RetainPtr<WKFindIndicatorWindowAnimation> m_fadeOutAnimation;
+    RunLoop::Timer<TextIndicatorWindow> m_startFadeOutTimer;
+    RetainPtr<WKTextIndicatorWindowAnimation> m_fadeOutAnimation;
 };
 
 } // namespace WebKit
 
-#endif // FindIndicatorWindow_h
+#endif // TextIndicatorWindow_h
 
 #endif // PLATFORM(MAC)
diff --git a/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm b/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm
new file mode 100644 (file)
index 0000000..5d658d5
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "TextIndicatorWindow.h"
+
+#if PLATFORM(MAC)
+
+#import "TextIndicator.h"
+#import "WKView.h"
+#import <WebCore/GraphicsContext.h>
+
+static const double bounceAnimationDuration = 0.12;
+static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
+static const double fadeOutAnimationDuration = 0.3;
+
+using namespace WebCore;
+
+@interface WKTextIndicatorView : NSView {
+    RefPtr<WebKit::TextIndicator> _textIndicator;
+}
+
+- (id)_initWithTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator;
+@end
+
+@implementation WKTextIndicatorView
+
+- (id)_initWithTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator
+{
+    if ((self = [super initWithFrame:NSZeroRect]))
+        _textIndicator = textIndicator;
+
+    return self;
+}
+
+- (void)drawRect:(NSRect)rect
+{
+    GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]));
+
+    _textIndicator->draw(graphicsContext, enclosingIntRect(rect));
+}
+
+- (BOOL)isFlipped
+{
+    return YES;
+}
+
+@end
+
+@interface WKTextIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> {
+    WebKit::TextIndicatorWindow* _textIndicatorWindow;
+    void (WebKit::TextIndicatorWindow::*_animationProgressCallback)(double progress);
+    void (WebKit::TextIndicatorWindow::*_animationDidEndCallback)();
+}
+
+- (id)_initWithTextIndicatorWindow:(WebKit::TextIndicatorWindow *)textIndicatorWindow animationDuration:(CFTimeInterval)duration animationProgressCallback:(void (WebKit::TextIndicatorWindow::*)(double progress))animationProgressCallback animationDidEndCallback:(void (WebKit::TextIndicatorWindow::*)())animationDidEndCallback;
+@end
+
+@implementation WKTextIndicatorWindowAnimation
+
+- (id)_initWithTextIndicatorWindow:(WebKit::TextIndicatorWindow *)textIndicatorWindow animationDuration:(CFTimeInterval)animationDuration animationProgressCallback:(void (WebKit::TextIndicatorWindow::*)(double progress))animationProgressCallback animationDidEndCallback:(void (WebKit::TextIndicatorWindow::*)())animationDidEndCallback
+{
+    if ((self = [super initWithDuration:animationDuration animationCurve:NSAnimationEaseInOut])) {
+        _textIndicatorWindow = textIndicatorWindow;
+        _animationProgressCallback = animationProgressCallback;
+        _animationDidEndCallback = animationDidEndCallback;
+        [self setDelegate:self];
+        [self setAnimationBlockingMode:NSAnimationNonblocking];
+    }
+    return self;
+}
+
+- (void)setCurrentProgress:(NSAnimationProgress)progress
+{
+    (_textIndicatorWindow->*_animationProgressCallback)(progress);
+}
+
+- (void)animationDidEnd:(NSAnimation *)animation
+{
+    ASSERT(animation == self);
+
+    (_textIndicatorWindow->*_animationDidEndCallback)();
+}
+
+@end
+
+namespace WebKit {
+
+TextIndicatorWindow::TextIndicatorWindow(WKView *wkView)
+    : m_wkView(wkView)
+    , m_bounceAnimationContext(0)
+    , m_startFadeOutTimer(RunLoop::main(), this, &TextIndicatorWindow::startFadeOutTimerFired)
+{
+}
+
+TextIndicatorWindow::~TextIndicatorWindow()
+{
+    closeWindow();
+}
+
+void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
+{
+    if (m_textIndicator == textIndicator)
+        return;
+
+    m_textIndicator = textIndicator;
+
+    // Get rid of the old window.
+    closeWindow();
+
+    if (!m_textIndicator)
+        return;
+
+    NSRect contentRect = m_textIndicator->frameRect();
+    NSRect windowFrameRect = NSIntegralRect([m_wkView convertRect:contentRect toView:nil]);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+    windowFrameRect.origin = [[m_wkView window] convertBaseToScreen:windowFrameRect.origin];
+#pragma clang diagnostic pop
+    NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask];
+    
+    m_textIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+
+    [m_textIndicatorWindow setBackgroundColor:[NSColor clearColor]];
+    [m_textIndicatorWindow setOpaque:NO];
+    [m_textIndicatorWindow setIgnoresMouseEvents:YES];
+
+    RetainPtr<WKTextIndicatorView> textIndicatorView = adoptNS([[WKTextIndicatorView alloc] _initWithTextIndicator:m_textIndicator]);
+    [m_textIndicatorWindow setContentView:textIndicatorView.get()];
+
+    [[m_wkView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
+    [m_textIndicatorWindow setReleasedWhenClosed:NO];
+
+    if (animate) {
+        // Start the bounce animation.
+        m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_textIndicatorWindow.get());
+        m_bounceAnimation = adoptNS([[WKTextIndicatorWindowAnimation alloc] _initWithTextIndicatorWindow:this animationDuration:bounceAnimationDuration
+            animationProgressCallback:&TextIndicatorWindow::bounceAnimationCallback animationDidEndCallback:&TextIndicatorWindow::bounceAnimationDidEnd]);
+        [m_bounceAnimation startAnimation];
+    }
+
+    if (fadeOut)
+        m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
+}
+
+void TextIndicatorWindow::closeWindow()
+{
+    if (!m_textIndicatorWindow)
+        return;
+
+    m_startFadeOutTimer.stop();
+
+    if (m_fadeOutAnimation) {
+        [m_fadeOutAnimation stopAnimation];
+        m_fadeOutAnimation = nullptr;
+    }
+
+    if (m_bounceAnimation) {
+        [m_bounceAnimation stopAnimation];
+        m_bounceAnimation = nullptr;
+    }
+
+    if (m_bounceAnimationContext)
+        WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
+    
+    [[m_textIndicatorWindow parentWindow] removeChildWindow:m_textIndicatorWindow.get()];
+    [m_textIndicatorWindow close];
+    m_textIndicatorWindow = nullptr;
+}
+
+void TextIndicatorWindow::startFadeOutTimerFired()
+{
+    ASSERT(!m_fadeOutAnimation);
+    
+    m_fadeOutAnimation = adoptNS([[WKTextIndicatorWindowAnimation alloc] _initWithTextIndicatorWindow:this animationDuration:fadeOutAnimationDuration
+        animationProgressCallback:&TextIndicatorWindow::fadeOutAnimationCallback animationDidEndCallback:&TextIndicatorWindow::fadeOutAnimationDidEnd]);
+    [m_fadeOutAnimation startAnimation];
+}
+
+void TextIndicatorWindow::fadeOutAnimationCallback(double progress)
+{
+    ASSERT(m_fadeOutAnimation);
+
+    [m_textIndicatorWindow setAlphaValue:1.0 - progress];
+}
+
+void TextIndicatorWindow::fadeOutAnimationDidEnd()
+{
+    ASSERT(m_fadeOutAnimation);
+    ASSERT(m_textIndicatorWindow);
+
+    closeWindow();
+}
+
+void TextIndicatorWindow::bounceAnimationCallback(double progress)
+{
+    ASSERT(m_bounceAnimation);
+    ASSERT(m_bounceAnimationContext);
+
+    WKWindowBounceAnimationSetAnimationProgress(m_bounceAnimationContext, progress);
+}
+
+void TextIndicatorWindow::bounceAnimationDidEnd()
+{
+    ASSERT(m_bounceAnimation);
+    ASSERT(m_bounceAnimationContext);
+    ASSERT(m_textIndicatorWindow);
+
+    WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext);
+    m_bounceAnimationContext = 0;
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(MAC)
index 56914cb379d661bbcf18c77ebdf74484748d26be..f0c843096f248d5cf08f07bf798fac1c4cb039c8 100644 (file)
                0FCB4E5118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */; };
                0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */; };
                0FCB4E5518BBE044000FCFC9 /* WKScrollView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */; };
-               0FCB4E6018BBE3D9000FCFC9 /* FindIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */; };
-               0FCB4E6118BBE3D9000FCFC9 /* FindIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */; };
+               0FCB4E6018BBE3D9000FCFC9 /* TextIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5618BBE3D9000FCFC9 /* TextIndicatorWindow.h */; };
+               0FCB4E6118BBE3D9000FCFC9 /* TextIndicatorWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5718BBE3D9000FCFC9 /* TextIndicatorWindow.mm */; };
                0FCB4E6218BBE3D9000FCFC9 /* PageClientImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */; };
                0FCB4E6318BBE3D9000FCFC9 /* PageClientImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */; };
                0FCB4E6618BBE3D9000FCFC9 /* WKPrintingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */; };
                1A90C1EE1264FD50003E44D4 /* WebFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */; };
                1A90C1F41264FD71003E44D4 /* FindController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1F21264FD71003E44D4 /* FindController.h */; };
                1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C1F31264FD71003E44D4 /* FindController.cpp */; };
-               1A910071126675C4001842F5 /* FindIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A91006F126675C3001842F5 /* FindIndicator.h */; };
-               1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A910070126675C4001842F5 /* FindIndicator.cpp */; };
+               1A910071126675C4001842F5 /* TextIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A91006F126675C3001842F5 /* TextIndicator.h */; };
+               1A910072126675C4001842F5 /* TextIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A910070126675C4001842F5 /* TextIndicator.cpp */; };
                1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */; };
                1A92DC1312F8BAB90017AF65 /* LayerTreeContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A92DC1212F8BAB90017AF65 /* LayerTreeContext.cpp */; };
                1A9E32891821636900F5D04C /* _WKRemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9E32871821636900F5D04C /* _WKRemoteObjectRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0FCB4E4118BBE044000FCFC9 /* WKGeolocationProviderIOSObjCSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKGeolocationProviderIOSObjCSecurityOrigin.mm; path = ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm; sourceTree = "<group>"; };
                0FCB4E4418BBE044000FCFC9 /* WKScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKScrollView.h; path = ios/WKScrollView.h; sourceTree = "<group>"; };
                0FCB4E4518BBE044000FCFC9 /* WKScrollView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollView.mm; path = ios/WKScrollView.mm; sourceTree = "<group>"; };
-               0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicatorWindow.h; sourceTree = "<group>"; };
-               0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindIndicatorWindow.mm; sourceTree = "<group>"; };
+               0FCB4E5618BBE3D9000FCFC9 /* TextIndicatorWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextIndicatorWindow.h; sourceTree = "<group>"; };
+               0FCB4E5718BBE3D9000FCFC9 /* TextIndicatorWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextIndicatorWindow.mm; sourceTree = "<group>"; };
                0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImpl.h; sourceTree = "<group>"; };
                0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImpl.mm; sourceTree = "<group>"; };
                0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; };
                1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFindOptions.h; sourceTree = "<group>"; };
                1A90C1F21264FD71003E44D4 /* FindController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindController.h; sourceTree = "<group>"; };
                1A90C1F31264FD71003E44D4 /* FindController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindController.cpp; sourceTree = "<group>"; };
-               1A91006F126675C3001842F5 /* FindIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindIndicator.h; sourceTree = "<group>"; };
-               1A910070126675C4001842F5 /* FindIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindIndicator.cpp; sourceTree = "<group>"; };
+               1A91006F126675C3001842F5 /* TextIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextIndicator.h; sourceTree = "<group>"; };
+               1A910070126675C4001842F5 /* TextIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextIndicator.cpp; sourceTree = "<group>"; };
                1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeContext.h; sourceTree = "<group>"; };
                1A92DC1212F8BAB90017AF65 /* LayerTreeContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerTreeContext.cpp; sourceTree = "<group>"; };
                1A9E32871821636900F5D04C /* _WKRemoteObjectRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKRemoteObjectRegistry.h; sourceTree = "<group>"; };
                                BC2652121182608100243E12 /* DrawingAreaProxy.cpp */,
                                BC2652131182608100243E12 /* DrawingAreaProxy.h */,
                                1A6422FC12DD08FE00CAAE2C /* DrawingAreaProxy.messages.in */,
-                               1A910070126675C4001842F5 /* FindIndicator.cpp */,
+                               1A910070126675C4001842F5 /* TextIndicator.cpp */,
                                1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */,
                                1AE00D5F1831792100087DD7 /* FrameLoadState.h */,
-                               1A91006F126675C3001842F5 /* FindIndicator.h */,
+                               1A91006F126675C3001842F5 /* TextIndicator.h */,
                                BC17753E118BABF0007D9E9A /* GenericCallback.h */,
                                BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */,
                                BC06F44812DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.h */,
                        children = (
                                B878B613133428DC006888E9 /* CorrectionPanel.h */,
                                B878B614133428DC006888E9 /* CorrectionPanel.mm */,
-                               0FCB4E5618BBE3D9000FCFC9 /* FindIndicatorWindow.h */,
-                               0FCB4E5718BBE3D9000FCFC9 /* FindIndicatorWindow.mm */,
+                               0FCB4E5618BBE3D9000FCFC9 /* TextIndicatorWindow.h */,
+                               0FCB4E5718BBE3D9000FCFC9 /* TextIndicatorWindow.mm */,
                                1AFDE65B1954E8D500C48FFA /* LegacySessionStateCoding.cpp */,
                                0FCB4E5818BBE3D9000FCFC9 /* PageClientImpl.h */,
                                0FCB4E5918BBE3D9000FCFC9 /* PageClientImpl.mm */,
                                1A7C6CDB1378950800B9C04D /* EnvironmentVariables.h in Headers */,
                                1AA575FB1496B52600A4EE06 /* EventDispatcher.h in Headers */,
                                1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
-                               1A910071126675C4001842F5 /* FindIndicator.h in Headers */,
+                               1A910071126675C4001842F5 /* TextIndicator.h in Headers */,
                                515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
                                BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
                                1ABC3DFC1899F51C004F0626 /* WKNavigationDelegate.h in Headers */,
                                51654EFE184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.h in Headers */,
                                BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */,
                                A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */,
-                               0FCB4E6018BBE3D9000FCFC9 /* FindIndicatorWindow.h in Headers */,
+                               0FCB4E6018BBE3D9000FCFC9 /* TextIndicatorWindow.h in Headers */,
                                BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */,
                                BCB0B0DE12305A8C00B1341E /* InjectedBundleUserMessageCoders.h in Headers */,
                                1AE49A4911FFA8CE0048B464 /* JSNPMethod.h in Headers */,
                                1AA576021496B97900A4EE06 /* EventDispatcherMessageReceiver.cpp in Sources */,
                                1A1E093318861D3800D2DC49 /* WebProgressTrackerClient.cpp in Sources */,
                                1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */,
-                               1A910072126675C4001842F5 /* FindIndicator.cpp in Sources */,
+                               1A910072126675C4001842F5 /* TextIndicator.cpp in Sources */,
                                BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
                                378E1A4918208CD60031007A /* WKNSString.mm in Sources */,
                                1AAF08B719269E6D00B6390C /* WebUserContentControllerMessageReceiver.cpp in Sources */,
                                BCBAAC72144E61990053F82F /* WKBrowsingContextController.mm in Sources */,
                                BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */,
                                51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,
-                               0FCB4E6118BBE3D9000FCFC9 /* FindIndicatorWindow.mm in Sources */,
+                               0FCB4E6118BBE3D9000FCFC9 /* TextIndicatorWindow.mm in Sources */,
                                BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */,
                                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */,
                                935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */,
index 98ac6aa8197b7d1e2b16cb4eefa5434f850bd3ce..c1c8445c5944f360f1f831e0ddb066e2bd7667b9 100644 (file)
@@ -368,7 +368,7 @@ bool FindController::updateFindIndicator(Frame& selectedFrame, bool isShowingOve
         textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     }            
 
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay, shouldAnimate));
+    m_webPage->send(Messages::WebPageProxy::SetTextIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay, shouldAnimate));
     m_findIndicatorRect = selectionRectInWindowCoordinates;
     m_isShowingFindIndicator = true;
 
@@ -381,7 +381,7 @@ void FindController::hideFindIndicator()
         return;
 
     ShareableBitmap::Handle handle;
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false, true));
+    m_webPage->send(Messages::WebPageProxy::SetTextIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false, true));
     m_isShowingFindIndicator = false;
     m_foundStringMatchIndex = -1;
     didHideFindIndicator();