Diff
Modified: branches/safari-600.3-branch/Source/WTF/wtf/Compiler.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WTF/wtf/Compiler.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WTF/wtf/Compiler.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -151,6 +151,14 @@
#define CONSTEXPR
#endif
+/* EXTERN_C */
+
+#ifdef __cplusplus
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C extern
+#endif
+
/* FALLTHROUGH */
#if !defined(FALLTHROUGH) && COMPILER_SUPPORTS(FALLTHROUGH_WARNINGS) && COMPILER(CLANG)
Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-11-20 04:27:19 UTC (rev 176377)
@@ -1,5 +1,23 @@
2014-11-19 Dana Burkart <dburk...@apple.com>
+ Merge r176363. rdar://problem/18840128
+
+ 2014-11-19 Tim Horton <timothy_hor...@apple.com>
+
+ Add an optional entry transition (from selection highlight) to TextIndicator
+ https://bugs.webkit.org/show_bug.cgi?id=138856
+ <rdar://problem/18840128>
+
+ Reviewed by Anders Carlsson.
+
+ * WebCore.exp.in:
+ Add an export.
+
+ * platform/spi/cocoa/QuartzCoreSPI.h:
+ Add some SPI.
+
+2014-11-19 Dana Burkart <dburk...@apple.com>
+
Merge r176296. rdar://problem/18912505
2014-11-18 Beth Dakin <bda...@apple.com>
Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in 2014-11-20 04:27:19 UTC (rev 176377)
@@ -786,6 +786,7 @@
__ZN7WebCore17openTemporaryFileERKN3WTF6StringERi
__ZN7WebCore17sRGBColorSpaceRefEv
__ZN7WebCore17setCookiesFromDOMERKNS_21NetworkStorageSessionERKNS_3URLES5_RKN3WTF6StringE
+__ZN7WebCore17snapshotFrameRectERNS_5FrameERKNS_7IntRectEj
__ZN7WebCore17snapshotSelectionERNS_5FrameEj
__ZN7WebCore17userVisibleStringEP5NSURL
__ZN7WebCore18DOMWindowExtensionC1EPNS_5FrameERNS_15DOMWrapperWorldE
Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-20 04:27:19 UTC (rev 176377)
@@ -3090,6 +3090,7 @@
86BE340315058CB200CE0FD8 /* PerformanceEntryList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86BE33FD15058CB200CE0FD8 /* PerformanceEntryList.cpp */; };
86BE340415058CB200CE0FD8 /* PerformanceEntryList.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BE33FE15058CB200CE0FD8 /* PerformanceEntryList.h */; };
86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D982F6125C154000AD9E3D /* DocumentTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 8729DF6E1A1D7F710022AB6B /* QuartzCoreSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 8729DF6D1A1D7F6C0022AB6B /* QuartzCoreSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8931DE5A14C44C44000DC9D2 /* JSBlobCustom.cpp */; };
898785F0122E1E87003AABDA /* JSFileException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 898785EE122E1E87003AABDA /* JSFileException.cpp */; };
898785F1122E1E87003AABDA /* JSFileException.h in Headers */ = {isa = PBXBuildFile; fileRef = 898785EF122E1E87003AABDA /* JSFileException.h */; };
@@ -10221,6 +10222,7 @@
86BE33FE15058CB200CE0FD8 /* PerformanceEntryList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceEntryList.h; sourceTree = "<group>"; };
86BE33FF15058CB200CE0FD8 /* PerformanceEntryList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceEntryList.idl; sourceTree = "<group>"; };
86D982F6125C154000AD9E3D /* DocumentTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTiming.h; sourceTree = "<group>"; };
+ 8729DF6D1A1D7F6C0022AB6B /* QuartzCoreSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuartzCoreSPI.h; sourceTree = "<group>"; };
892ABE5C16EEE2AA009F3587 /* JSNavigatorStorageQuota.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorStorageQuota.cpp; sourceTree = "<group>"; };
892ABE5D16EEE2AA009F3587 /* JSNavigatorStorageQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorStorageQuota.h; sourceTree = "<group>"; };
892ABE5F16EEE2E5009F3587 /* JSDOMWindowQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowQuota.h; sourceTree = "<group>"; };
@@ -16254,9 +16256,6 @@
65086DA619AC1719009AF46B /* cf */ = {
isa = PBXGroup;
children = (
- 65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
- CE8245EF19B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h */,
- CE8245F119B671D500AC0122 /* CFURLRequestSPI.h */,
);
path = cf;
sourceTree = "<group>";
@@ -16266,7 +16265,6 @@
children = (
65086DA619AC1719009AF46B /* cf */,
653EF83719A043AE0052202C /* cocoa */,
- A172182419DE182B00464D17 /* ios */,
9348428019F1A9190009D5AE /* mac */,
);
path = spi;
@@ -16276,8 +16274,7 @@
isa = PBXGroup;
children = (
2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */,
- 653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */,
- 1CF7E26E19D881EF00DD8F98 /* CGFontUnicodeSupportSPI.h */,
+ 8729DF6D1A1D7F6C0022AB6B /* QuartzCoreSPI.h */,
);
path = cocoa;
sourceTree = "<group>";
@@ -24955,6 +24952,7 @@
D6489D26166FFCF1007C031B /* JSHTMLTemplateElement.h in Headers */,
A80E7E9D0A1A83E3007FB8C5 /* JSHTMLTextAreaElement.h in Headers */,
A80E7B0C0A19D606007FB8C5 /* JSHTMLTitleElement.h in Headers */,
+ 8729DF6E1A1D7F710022AB6B /* QuartzCoreSPI.h in Headers */,
070756D414239A4F00414161 /* JSHTMLTrackElement.h in Headers */,
1A85B2110A1B258700D8C87C /* JSHTMLUListElement.h in Headers */,
6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */,
Copied: branches/safari-600.3-branch/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (from rev 176370, trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h) (0 => 176377)
--- branches/safari-600.3-branch/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (rev 0)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2014 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 <QuartzCore/QuartzCore.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <QuartzCore/CAColorMatrix.h>
+
+#ifdef __OBJC__
+#import <QuartzCore/CALayerPrivate.h>
+
+// FIXME: As a workaround for <rdar://problem/18985152>, we conditionally enclose the following
+// headers in an extern "C" linkage block to make it suitable for Objective-C++ use. Once this
+// bug has been fixed we can simply include header <QuartzCore/QuartzCorePrivate.h> instead of
+// including specific QuartzCore headers.
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#import <QuartzCore/CAContext.h>
+#import <QuartzCore/CAFilter.h>
+#import <QuartzCore/CATiledLayerPrivate.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif // __OBJC__
+
+#else
+
+#ifdef __OBJC__
+@interface CAContext : NSObject
+@end
+
+@interface CAContext (Details)
++ (CAContext *)remoteContextWithOptions:(NSDictionary *)dict;
++ (id)objectForSlot:(uint32_t)name;
+- (uint32_t)createImageSlot:(CGSize)size hasAlpha:(BOOL)flag;
+- (void)deleteSlot:(uint32_t)name;
+@end
+
+@interface CALayer (Details)
+- (CAContext *)context;
+- (CGSize)size;
+- (void *)regionBeingDrawn;
+- (void)setContentsChanged;
+@property BOOL acceleratesDrawing;
+@property BOOL allowsGroupBlending;
+@property BOOL canDrawConcurrently;
+@property BOOL contentsOpaque;
+@property BOOL needsLayoutOnGeometryChange;
+@property BOOL shadowPathIsBounds;
+@end
+
+@interface CATiledLayer (Details)
+- (void)displayInRect:(CGRect)rect levelOfDetail:(int)levelOfDetail options:(NSDictionary *)dictionary;
+- (void)setNeedsDisplayInRect:(CGRect)rect levelOfDetail:(int)levelOfDetail options:(NSDictionary *)dictionary;
+@end
+
+struct CAColorMatrix {
+ float m11, m12, m13, m14, m15;
+ float m21, m22, m23, m24, m25;
+ float m31, m32, m33, m34, m35;
+ float m41, m42, m43, m44, m45;
+};
+typedef struct CAColorMatrix CAColorMatrix;
+
+@interface NSValue (CADetails)
++ (NSValue *)valueWithCAColorMatrix:(CAColorMatrix)t;
+@end
+
+@interface CAFilter : NSObject <NSCopying, NSMutableCopying, NSCoding>
+@end
+
+@interface CAFilter (Details)
++ (CAFilter *)filterWithType:(NSString *)type;
+@property (copy) NSString *name;
+@end
+#endif // __OBJC__
+
+#endif
+
+EXTERN_C NSString * const kCATiledLayerRemoveImmediately;
+
+EXTERN_C NSString * const kCAFilterColorInvert;
+EXTERN_C NSString * const kCAFilterColorMatrix;
+EXTERN_C NSString * const kCAFilterColorMonochrome;
+EXTERN_C NSString * const kCAFilterColorHueRotate;
+EXTERN_C NSString * const kCAFilterColorSaturate;
+EXTERN_C NSString * const kCAFilterGaussianBlur;
+
+
+EXTERN_C NSString * const kCAFilterNormalBlendMode;
+EXTERN_C NSString * const kCAFilterMultiplyBlendMode;
+EXTERN_C NSString * const kCAFilterScreenBlendMode;
+EXTERN_C NSString * const kCAFilterOverlayBlendMode;
+EXTERN_C NSString * const kCAFilterDarkenBlendMode;
+EXTERN_C NSString * const kCAFilterLightenBlendMode;
+EXTERN_C NSString * const kCAFilterColorDodgeBlendMode;
+EXTERN_C NSString * const kCAFilterColorBurnBlendMode;
+EXTERN_C NSString * const kCAFilterSoftLightBlendMode;
+EXTERN_C NSString * const kCAFilterHardLightBlendMode;
+EXTERN_C NSString * const kCAFilterDifferenceBlendMode;
+EXTERN_C NSString * const kCAFilterExclusionBlendMode;
+
+EXTERN_C NSString * const kCAContextDisplayName;
Property changes: branches/safari-600.3-branch/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h
Added: svn:mergeinfo
/trunk/WebCore/platform/spi/cocoa/QuartzCoreSPI.h:53455
Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-20 04:27:19 UTC (rev 176377)
@@ -1,5 +1,63 @@
2014-11-19 Dana Burkart <dburk...@apple.com>
+ Merge r176363. rdar://problem/18840128
+
+ 2014-11-19 Tim Horton <timothy_hor...@apple.com>
+
+ Add an optional entry transition (from selection highlight) to TextIndicator
+ https://bugs.webkit.org/show_bug.cgi?id=138856
+ <rdar://problem/18840128>
+
+ Reviewed by Anders Carlsson.
+
+ * Shared/TextIndicator.cpp:
+ (WebKit::outsetIndicatorRectIncludingShadow):
+ (WebKit::TextIndicator::createWithRange):
+ (WebKit::snapshotSelectionWithHighlight):
+ (WebKit::TextIndicator::createWithSelectionInFrame):
+ (WebKit::TextIndicator::frameRect):
+ (WebKit::TextIndicator::Data::encode):
+ (WebKit::TextIndicator::Data::decode):
+ Remove TextIndicator::draw and related functions; drawing is handled entirely
+ by the TextIndicatorWindow now, and TextIndicator just stores the required data.
+
+ Unify outsetIndicatorRectIncludingShadow.
+
+ Add an argument to createWithRange/createWithSelectionInFrame to indicate
+ if the TextIndicator should transition from the selection highlight to
+ the yellow bubble.
+
+ If we're doing the transition, paint the selection into a second bitmap,
+ without forcing the text to black and without hiding the blue highlight.
+
+ Encode/decode the second bitmap.
+
+ * Shared/TextIndicator.h:
+ * UIProcess/mac/TextIndicatorWindow.h:
+ * UIProcess/mac/TextIndicatorWindow.mm:
+ (-[WKTextIndicatorView initWithFrame:textIndicator:margin:transitionFromSelectionColor:]):
+ (-[WKTextIndicatorView presentWithCompletionHandler:]):
+ (-[WKTextIndicatorView hideWithCompletionHandler:]):
+ (-[WKTextIndicatorView isFlipped]):
+ (WebKit::TextIndicatorWindow::TextIndicatorWindow):
+ (WebKit::TextIndicatorWindow::setTextIndicator):
+ (WebKit::TextIndicatorWindow::closeWindow):
+ (WebKit::TextIndicatorWindow::startFadeOutTimerFired):
+ Re-implement the bounce animation using CoreAnimation instead of
+ the WKSI-based WKWindowBounceAnimation*.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performDictionaryLookupForSelection):
+ (WebKit::WebPage::performDictionaryLookupOfCurrentSelection):
+ (WebKit::WebPage::performDictionaryLookupForRange):
+ (WebKit::WebPage::performActionMenuHitTestAtLocation):
+ * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
+ Use the aforementioned transition animation for performDictionaryLookupOfCurrentSelection,
+ the context menu lookup item, and for Data Detectors.
+
+2014-11-19 Dana Burkart <dburk...@apple.com>
+
Merge r176356. rdar://problem/18996776
2014-11-19 Beth Dakin <bda...@apple.com>
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.cpp (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.cpp 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.cpp 2014-11-20 04:27:19 UTC (rev 176377)
@@ -39,91 +39,35 @@
#include <WebCore/Document.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameSelection.h>
+#include <WebCore/FrameSnapshotting.h>
#include <WebCore/FrameView.h>
#include <WebCore/GeometryUtilities.h>
-#include <WebCore/Gradient.h>
#include <WebCore/GraphicsContext.h>
+#include <WebCore/ImageBuffer.h>
#include <WebCore/IntRect.h>
-#include <WebCore/Path.h>
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
-#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 1
-#else
-#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 0
-#endif
-
using namespace WebCore;
+// These should match the values in TextIndicatorWindow.
+// FIXME: Ideally these would only be in one place.
#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
-static const float cornerRadius = 3.0;
-
-static const float shadowOffsetX = 0.0;
-static const float shadowOffsetY = 1.0;
-static const float shadowBlurRadius = 3.0;
-
-static const int shadowRed = 0;
-static const int shadowGreen = 0;
-static const int shadowBlue = 0;
-static const int shadowAlpha = 204;
-
-static const float lightBorderThickness = 1.0;
-static const float horizontalPaddingInsideLightBorder = 3.0;
-static const float verticalPaddingInsideLightBorder = 1.0;
-
-static const float horizontalBorderInsideShadow = lightBorderThickness + horizontalPaddingInsideLightBorder;
-static const float verticalBorderInsideShadow = lightBorderThickness + verticalPaddingInsideLightBorder;
-
-static const float leftBorderThickness = horizontalBorderInsideShadow + shadowOffsetX + shadowBlurRadius / 2.0;
-static const float topBorderThickness = verticalBorderInsideShadow - shadowOffsetY + shadowBlurRadius / 2.0;
-static const float rightBorderThickness = horizontalBorderInsideShadow - shadowOffsetX + shadowBlurRadius / 2.0;
-static const float bottomBorderThickness = verticalBorderInsideShadow + shadowOffsetY + shadowBlurRadius / 2.0;
-
-static const float horizontalOutsetToCenterOfLightBorder = horizontalBorderInsideShadow - lightBorderThickness / 2.0;
-static const float verticalOutsetToCenterOfLightBorder = verticalBorderInsideShadow - lightBorderThickness / 2.0;
-
-static const int lightBorderRed = 245;
-static const int lightBorderGreen = 230;
-static const int lightBorderBlue = 0;
-static const int lightBorderAlpha = 255;
-
-static const int gradientDarkRed = 237;
-static const int gradientDarkGreen = 204;
-static const int gradientDarkBlue = 0;
-static const int gradientDarkAlpha = 255;
-
-static const int gradientLightRed = 242;
-static const int gradientLightGreen = 239;
-static const int gradientLightBlue = 0;
-static const int gradientLightAlpha = 255;
+const float horizontalBorder = 3;
+const float verticalBorder = 1;
+const float dropShadowBlurRadius = 1.5;
#else
-const float flatStyleHorizontalBorder = 2;
-const float flatStyleVerticalBorder = 1;
-const float flatShadowOffsetX = 0;
-const float flatShadowOffsetY = 5;
-const float flatShadowBlurRadius = 25;
-const float flatRimShadowBlurRadius = 2;
+const float horizontalBorder = 2;
+const float verticalBorder = 1;
+const float dropShadowBlurRadius = 12;
#endif
namespace WebKit {
-static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflateY)
-{
- FloatRect inflatedRect = rect;
- inflatedRect.inflateX(inflateX);
- inflatedRect.inflateY(inflateY);
- return inflatedRect;
-}
-
static FloatRect outsetIndicatorRectIncludingShadow(const FloatRect rect)
{
-#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
FloatRect outsetRect = rect;
- outsetRect.move(-leftBorderThickness, -topBorderThickness);
- outsetRect.expand(leftBorderThickness + rightBorderThickness, topBorderThickness + bottomBorderThickness);
+ outsetRect.inflateX(dropShadowBlurRadius + horizontalBorder);
+ outsetRect.inflateY(dropShadowBlurRadius + verticalBorder);
return outsetRect;
-#else
- return inflateRect(rect, flatShadowBlurRadius + flatStyleHorizontalBorder, flatShadowBlurRadius + flatStyleVerticalBorder);
-#endif
}
static bool textIndicatorsForTextRectsOverlap(const Vector<FloatRect>& textRects)
@@ -155,7 +99,7 @@
return adoptRef(new TextIndicator(data));
}
-PassRefPtr<TextIndicator> TextIndicator::createWithRange(const Range& range)
+PassRefPtr<TextIndicator> TextIndicator::createWithRange(const Range& range, PresentationTransition presentationTransition)
{
Frame* frame = range.startContainer()->document().frame();
@@ -165,21 +109,57 @@
VisibleSelection oldSelection = frame->selection().selection();
frame->selection().setSelection(&range);
- RefPtr<TextIndicator> indicator = TextIndicator::createWithSelectionInFrame(*WebFrame::fromCoreFrame(*frame));
+ RefPtr<TextIndicator> indicator = TextIndicator::createWithSelectionInFrame(*WebFrame::fromCoreFrame(*frame), presentationTransition);
frame->selection().setSelection(oldSelection);
return indicator.release();
}
-PassRefPtr<TextIndicator> TextIndicator::createWithSelectionInFrame(const WebFrame& frame)
+// FIXME (138889): Ideally the FrameSnapshotting functions would be more flexible
+// and we wouldn't have to implement this here.
+static PassRefPtr<ShareableBitmap> snapshotSelectionWithHighlight(Frame& frame)
{
+ auto& selection = frame.selection();
+
+ if (!selection.isRange())
+ return nullptr;
+
+ FloatRect selectionBounds = selection.selectionBounds();
+
+ // It is possible for the selection bounds to be empty; see https://bugs.webkit.org/show_bug.cgi?id=56645.
+ if (selectionBounds.isEmpty())
+ return nullptr;
+
+ std::unique_ptr<ImageBuffer> snapshot = snapshotFrameRect(frame, enclosingIntRect(selectionBounds), 0);
+
+ if (!snapshot)
+ return nullptr;
+
+ RefPtr<ShareableBitmap> sharedSnapshot = ShareableBitmap::createShareable(snapshot->internalSize(), ShareableBitmap::SupportsAlpha);
+ if (!sharedSnapshot)
+ return nullptr;
+
+ auto graphicsContext = sharedSnapshot->createGraphicsContext();
+ float deviceScaleFactor = frame.page()->deviceScaleFactor();
+ graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
+ graphicsContext->drawImageBuffer(snapshot.get(), ColorSpaceDeviceRGB, FloatPoint());
+
+ return sharedSnapshot.release();
+}
+
+PassRefPtr<TextIndicator> TextIndicator::createWithSelectionInFrame(const WebFrame& frame, PresentationTransition presentationTransition)
+{
Frame& coreFrame = *frame.coreFrame();
IntRect selectionRect = enclosingIntRect(coreFrame.selection().selectionBounds());
RefPtr<ShareableBitmap> indicatorBitmap = frame.createSelectionSnapshot();
if (!indicatorBitmap)
return nullptr;
+ RefPtr<ShareableBitmap> indicatorBitmapWithHighlight;
+ if (presentationTransition == PresentationTransition::BounceAndCrossfade)
+ indicatorBitmapWithHighlight = snapshotSelectionWithHighlight(coreFrame);
+
// Store the selection rect in window coordinates, to be used subsequently
// to determine if the indicator and selection still precisely overlap.
IntRect selectionRectInWindowCoordinates = coreFrame.view()->contentsToWindow(selectionRect);
@@ -210,6 +190,8 @@
data.textRectsInBoundingRectCoordinates = textRectsInBoundingRectCoordinates;
data.contentImageScaleFactor = frame.page()->deviceScaleFactor();
data.contentImage = indicatorBitmap;
+ data.contentImageWithHighlight = indicatorBitmapWithHighlight;
+ data.presentationTransition = presentationTransition;
return TextIndicator::create(data);
}
@@ -231,131 +213,26 @@
FloatRect TextIndicator::frameRect() const
{
- return outsetIndicatorRectIncludingShadow(m_data.textBoundingRectInWindowCoordinates);
+ return m_data.textBoundingRectInWindowCoordinates;
}
-#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
-static inline Color lightBorderColor()
-{
- return Color(lightBorderRed, lightBorderGreen, lightBorderBlue, lightBorderAlpha);
-}
-
-static inline Color shadowColor()
-{
- return Color(shadowRed, shadowGreen, shadowBlue, shadowAlpha);
-}
-
-static inline Color gradientLightColor()
-{
- return Color(gradientLightRed, gradientLightGreen, gradientLightBlue, gradientLightAlpha);
-}
-
-static inline Color gradientDarkColor()
-{
- return Color(gradientDarkRed, gradientDarkGreen, gradientDarkBlue, gradientDarkAlpha);
-}
-
-static Path pathWithRoundedRect(const FloatRect& pathRect, float radius)
-{
- Path path;
- path.addRoundedRect(pathRect, FloatSize(radius, radius));
-
- return path;
-}
-#else
-static inline Color flatHighlightColor()
-{
- return Color(255, 255, 0, 255);
-}
-
-static inline Color flatRimShadowColor()
-{
- return Color(0, 0, 0, 38);
-}
-
-static inline Color flatDropShadowColor()
-{
- return Color(0, 0, 0, 51);
-}
-#endif
-
-void TextIndicator::drawContentImage(WebCore::GraphicsContext& graphicsContext, WebCore::FloatRect textRect)
-{
- FloatRect imageRect = textRect;
- imageRect.move(m_data.textBoundingRectInWindowCoordinates.location() - m_data.selectionRectInWindowCoordinates.location());
- m_data.contentImage->paint(graphicsContext, m_data.contentImageScaleFactor, enclosingIntRect(textRect).location(), enclosingIntRect(imageRect));
-}
-
-void TextIndicator::draw(GraphicsContext& graphicsContext, const IntRect& /*dirtyRect*/)
-{
-#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
- for (auto& textRect : m_data.textRectsInBoundingRectCoordinates) {
- FloatRect borderedTextRect = textRect;
- borderedTextRect.move(leftBorderThickness, topBorderThickness);
-
- FloatRect outerPathRect = inflateRect(borderedTextRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder);
- FloatRect innerPathRect = inflateRect(borderedTextRect, horizontalPaddingInsideLightBorder, verticalPaddingInsideLightBorder);
-
- {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB);
- graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB);
- graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius));
- }
-
- {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.clip(pathWithRoundedRect(innerPathRect, cornerRadius));
- RefPtr<Gradient> gradient = Gradient::create(FloatPoint(innerPathRect.x(), innerPathRect.y()), FloatPoint(innerPathRect.x(), innerPathRect.maxY()));
- gradient->addColorStop(0, gradientLightColor());
- gradient->addColorStop(1, gradientDarkColor());
- graphicsContext.setFillGradient(gradient.releaseNonNull());
- graphicsContext.fillRect(outerPathRect);
- }
-
- {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness)));
-
- drawContentImage(graphicsContext, textRect);
- }
- }
-#else
- for (auto& textRect : m_data.textRectsInBoundingRectCoordinates) {
- FloatRect blurRect = textRect;
- blurRect.move(flatShadowBlurRadius + flatStyleHorizontalBorder, flatShadowBlurRadius + flatStyleVerticalBorder);
- FloatRect outerPathRect = inflateRect(blurRect, flatStyleHorizontalBorder, flatStyleVerticalBorder);
-
- {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.setShadow(FloatSize(), flatRimShadowBlurRadius, flatRimShadowColor(), ColorSpaceSRGB);
- graphicsContext.setFillColor(flatHighlightColor(), ColorSpaceSRGB);
- graphicsContext.fillRect(outerPathRect);
- graphicsContext.setShadow(FloatSize(flatShadowOffsetX, flatShadowOffsetY), flatShadowBlurRadius, flatDropShadowColor(), ColorSpaceSRGB);
- graphicsContext.fillRect(outerPathRect);
- }
-
- {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.translate(FloatSize(flatShadowBlurRadius + flatStyleHorizontalBorder, flatShadowBlurRadius + flatStyleVerticalBorder));
-
- drawContentImage(graphicsContext, textRect);
- }
- }
-#endif
-}
-
void TextIndicator::Data::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << selectionRectInWindowCoordinates;
encoder << textBoundingRectInWindowCoordinates;
encoder << textRectsInBoundingRectCoordinates;
encoder << contentImageScaleFactor;
+ encoder.encodeEnum(presentationTransition);
ShareableBitmap::Handle contentImageHandle;
if (contentImage)
contentImage->createHandle(contentImageHandle, SharedMemory::ReadOnly);
encoder << contentImageHandle;
+
+ ShareableBitmap::Handle contentImageWithHighlightHandle;
+ if (contentImageWithHighlight)
+ contentImageWithHighlight->createHandle(contentImageWithHighlightHandle, SharedMemory::ReadOnly);
+ encoder << contentImageWithHighlightHandle;
}
bool TextIndicator::Data::decode(IPC::ArgumentDecoder& decoder, TextIndicator::Data& textIndicatorData)
@@ -372,6 +249,9 @@
if (!decoder.decode(textIndicatorData.contentImageScaleFactor))
return false;
+ if (!decoder.decodeEnum(textIndicatorData.presentationTransition))
+ return false;
+
ShareableBitmap::Handle contentImageHandle;
if (!decoder.decode(contentImageHandle))
return false;
@@ -379,6 +259,13 @@
if (!contentImageHandle.isNull())
textIndicatorData.contentImage = ShareableBitmap::create(contentImageHandle, SharedMemory::ReadOnly);
+ ShareableBitmap::Handle contentImageWithHighlightHandle;
+ if (!decoder.decode(contentImageWithHighlightHandle))
+ return false;
+
+ if (!contentImageWithHighlightHandle.isNull())
+ textIndicatorData.contentImageWithHighlight = ShareableBitmap::create(contentImageWithHighlightHandle, SharedMemory::ReadOnly);
+
return true;
}
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/TextIndicator.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -32,6 +32,12 @@
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 1
+#else
+#define ENABLE_LEGACY_TEXT_INDICATOR_STYLE 0
+#endif
+
namespace WebCore {
class GraphicsContext;
class Range;
@@ -48,20 +54,29 @@
class TextIndicator : public RefCounted<TextIndicator> {
public:
+ enum class PresentationTransition {
+ None,
+ Bounce,
+ BounceAndCrossfade
+ };
+
struct Data {
WebCore::FloatRect selectionRectInWindowCoordinates;
WebCore::FloatRect textBoundingRectInWindowCoordinates;
Vector<WebCore::FloatRect> textRectsInBoundingRectCoordinates;
float contentImageScaleFactor;
+ RefPtr<ShareableBitmap> contentImageWithHighlight;
RefPtr<ShareableBitmap> contentImage;
+ PresentationTransition presentationTransition;
+
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, Data&);
};
static PassRefPtr<TextIndicator> create(const TextIndicator::Data&);
- static PassRefPtr<TextIndicator> createWithSelectionInFrame(const WebFrame&);
- static PassRefPtr<TextIndicator> createWithRange(const WebCore::Range&);
+ static PassRefPtr<TextIndicator> createWithSelectionInFrame(const WebFrame&, PresentationTransition);
+ static PassRefPtr<TextIndicator> createWithRange(const WebCore::Range&, PresentationTransition);
~TextIndicator();
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -2698,7 +2698,7 @@
- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
{
- [self _setTextIndicator:nil fadeOut:NO animate:NO];
+ [self _setTextIndicator:nil fadeOut:NO];
}
- (void)_accessibilityRegisterUIProcessTokens
@@ -3069,7 +3069,7 @@
}
}
-- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler
+- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler
{
if (!textIndicator) {
_data->_textIndicatorWindow = nullptr;
@@ -3079,12 +3079,12 @@
if (!_data->_textIndicatorWindow)
_data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
- _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate, WTF::move(completionHandler));
+ _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, WTF::move(completionHandler));
}
-- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
+- (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut
{
- [self _setTextIndicator:textIndicator fadeOut:fadeOut animate:animate animationCompletionHandler:[] {}];
+ [self _setTextIndicator:textIndicator fadeOut:fadeOut animationCompletionHandler:[] { }];
}
- (CALayer *)_rootLayer
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -80,8 +80,8 @@
- (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize;
- (NSRect)_convertToDeviceSpace:(NSRect)rect;
- (NSRect)_convertToUserSpace:(NSRect)rect;
-- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
-- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler;
+- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut;
+- (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler;
- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
- (CALayer *)_acceleratedCompositingModeRootLayer;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -214,7 +214,7 @@
virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0;
#endif
- virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate) = 0;
+ virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut) = 0;
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
virtual void exitAcceleratedCompositingMode() = 0;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-11-20 04:27:19 UTC (rev 176377)
@@ -3550,14 +3550,14 @@
m_findMatchesClient.didGetImageForMatchResult(this, WebImage::create(ShareableBitmap::create(contentImageHandle)).get(), matchIndex);
}
-void WebPageProxy::setTextIndicator(const TextIndicator::Data& indicatorData, bool fadeOut, bool animate)
+void WebPageProxy::setTextIndicator(const TextIndicator::Data& indicatorData, bool fadeOut)
{
- m_pageClient.setTextIndicator(TextIndicator::create(indicatorData), fadeOut, animate);
+ m_pageClient.setTextIndicator(TextIndicator::create(indicatorData), fadeOut);
}
-void WebPageProxy::clearTextIndicator(bool fadeOut, bool animate)
+void WebPageProxy::clearTextIndicator()
{
- m_pageClient.setTextIndicator(nullptr, fadeOut, animate);
+ m_pageClient.setTextIndicator(nullptr, false);
}
void WebPageProxy::didFindString(const String& string, uint32_t matchCount, int32_t matchIndex)
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -657,8 +657,8 @@
void hideFindUI();
void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
void didCountStringMatches(const String&, uint32_t matchCount);
- void setTextIndicator(const TextIndicator::Data&, bool fadeOut, bool animate);
- void clearTextIndicator(bool fadeOut, bool animate);
+ void setTextIndicator(const TextIndicator::Data&, bool fadeOut);
+ void clearTextIndicator();
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);
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2014-11-20 04:27:19 UTC (rev 176377)
@@ -223,8 +223,8 @@
# Find messages
DidCountStringMatches(String string, uint32_t matchCount)
- SetTextIndicator(WebKit::TextIndicator::Data indicator, bool fadeOut, bool animate)
- ClearTextIndicator(bool fadeOut, bool animate)
+ SetTextIndicator(WebKit::TextIndicator::Data indicator, bool fadeOut)
+ ClearTextIndicator()
DidFindString(String string, uint32_t matchCount, int32_t matchIndex)
DidFailToFindString(String string)
DidFindStringMatches(String string, Vector<Vector<WebCore::IntRect>> matches, int32_t firstIndexAfterSelection)
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -96,7 +96,7 @@
#endif
virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) override;
virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) override;
- virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate) override;
+ virtual void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut) override;
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
virtual void exitAcceleratedCompositingMode() override;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -438,7 +438,7 @@
return 0;
}
-void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
+void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut)
{
}
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -120,7 +120,7 @@
virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&);
#endif
- void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate);
+ void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut);
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode();
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -470,9 +470,9 @@
}
#endif
-void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate)
+void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut)
{
- [m_wkView _setTextIndicator:textIndicator fadeOut:fadeOut animate:animate];
+ [m_wkView _setTextIndicator:textIndicator fadeOut:fadeOut];
}
void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
@@ -549,7 +549,7 @@
// Run the animations serially because attaching another subwindow breaks the bounce animation.
// We could consider making the bounce NSAnimationNonblockingThreaded instead, which seems
// to work, but need to consider all of the implications.
- [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animate:YES animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] {
+ [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] {
[mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
[getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
}];
@@ -564,7 +564,7 @@
// FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>).
[getLULookupDefinitionModuleClass() hideDefinition];
- setTextIndicator(nil, false, true);
+ setTextIndicator(nil, false);
}
void PageClientImpl::dismissActionMenuPopovers()
@@ -698,6 +698,8 @@
void PageClientImpl::navigationGestureDidBegin()
{
+ // Hide the text indicator and action menu popovers if they are visible.
+ setTextIndicator(nullptr, false);
dismissActionMenuPopovers();
#if WK_API_ENABLED
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -28,14 +28,13 @@
#if PLATFORM(MAC)
-#import "WebKitSystemInterface.h"
#import <functional>
#import <wtf/Noncopyable.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
#import <wtf/RunLoop.h>
-@class WKTextIndicatorWindowAnimation;
+@class WKTextIndicatorView;
@class WKView;
namespace WebKit {
@@ -49,28 +48,19 @@
explicit TextIndicatorWindow(WKView *);
~TextIndicatorWindow();
- void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler);
+ void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, std::function<void ()> animationCompletionHandler);
private:
void closeWindow();
void startFadeOutTimerFired();
- void fadeOutAnimationCallback(double);
- void fadeOutAnimationDidEnd();
-
- void bounceAnimationCallback(double);
- void bounceAnimationDidEnd();
-
WKView* m_wkView;
RefPtr<TextIndicator> m_textIndicator;
RetainPtr<NSWindow> m_textIndicatorWindow;
+ RetainPtr<WKTextIndicatorView> m_textIndicatorView;
- WKWindowBounceAnimationContextRef m_bounceAnimationContext;
- RetainPtr<WKTextIndicatorWindowAnimation> m_bounceAnimation;
-
RunLoop::Timer<TextIndicatorWindow> m_startFadeOutTimer;
- RetainPtr<WKTextIndicatorWindowAnimation> m_fadeOutAnimation;
std::function<void ()> m_bounceAnimationCompletionHandler;
};
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -31,86 +31,233 @@
#import "TextIndicator.h"
#import "WKView.h"
#import <WebCore/GraphicsContext.h>
+#import <WebCore/QuartzCoreSPI.h>
+#import <WebCore/WebActionDisablingCALayerDelegate.h>
-static const double bounceAnimationDuration = 0.12;
-static const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
-static const double fadeOutAnimationDuration = 0.3;
+const CFTimeInterval bounceAnimationDuration = 0.12;
+const CFTimeInterval bounceWithCrossfadeAnimationDuration = 0.3;
+const CFTimeInterval timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
+const CFTimeInterval fadeOutAnimationDuration = 0.3;
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
+const CGFloat midBounceScale = 1.5;
+const CGFloat horizontalBorder = 3;
+const CGFloat verticalBorder = 1;
+const CGFloat borderWidth = 1.0;
+const CGFloat cornerRadius = 3;
+const CGFloat dropShadowOffsetX = 0;
+const CGFloat dropShadowOffsetY = 1;
+const CGFloat dropShadowBlurRadius = 1.5;
+#else
+const CGFloat midBounceScale = 1.2;
+const CGFloat horizontalBorder = 2;
+const CGFloat verticalBorder = 1;
+const CGFloat borderWidth = 0;
+const CGFloat cornerRadius = 0;
+const CGFloat dropShadowOffsetX = 0;
+const CGFloat dropShadowOffsetY = 5;
+const CGFloat dropShadowBlurRadius = 12;
+const CGFloat rimShadowBlurRadius = 2;
+#endif
+
+NSString *textLayerKey = @"TextLayer";
+NSString *dropShadowLayerKey = @"DropShadowLayer";
+NSString *rimShadowLayerKey = @"RimShadowLayer";
+
using namespace WebCore;
@interface WKTextIndicatorView : NSView {
RefPtr<WebKit::TextIndicator> _textIndicator;
+ RetainPtr<NSArray> _bounceLayers;
+ NSSize _margin;
}
-- (id)_initWithTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator;
+- (instancetype)initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator margin:(NSSize)margin;
+
+- (void)presentWithCompletionHandler:(void(^)(void))completionHandler;
+- (void)hideWithCompletionHandler:(void(^)(void))completionHandler;
+
@end
@implementation WKTextIndicatorView
-- (id)_initWithTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator
+- (instancetype)initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator margin:(NSSize)margin
{
- if ((self = [super initWithFrame:NSZeroRect]))
- _textIndicator = textIndicator;
+ if (!(self = [super initWithFrame:frame]))
+ return nil;
- return self;
-}
+ _textIndicator = textIndicator;
+ _margin = margin;
-- (void)drawRect:(NSRect)rect
-{
- GraphicsContext graphicsContext(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]));
+ self.wantsLayer = YES;
+ self.layer.anchorPoint = CGPointZero;
- _textIndicator->draw(graphicsContext, enclosingIntRect(rect));
-}
+ bool wantsCrossfade = _textIndicator->data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
-- (BOOL)isFlipped
-{
- return YES;
-}
+ FloatSize contentsImageLogicalSize = _textIndicator->data().contentImage->size();
+ contentsImageLogicalSize.scale(1 / _textIndicator->data().contentImageScaleFactor);
+ RetainPtr<CGImageRef> contentsImage;
+ if (wantsCrossfade)
+ contentsImage = _textIndicator->data().contentImageWithHighlight->makeCGImage();
+ else
+ contentsImage = _textIndicator->data().contentImage->makeCGImage();
-@end
+ RetainPtr<NSMutableArray> bounceLayers = adoptNS([[NSMutableArray alloc] init]);
-@interface WKTextIndicatorWindowAnimation : NSAnimation<NSAnimationDelegate> {
- WebKit::TextIndicatorWindow* _textIndicatorWindow;
- void (WebKit::TextIndicatorWindow::*_animationProgressCallback)(double progress);
- void (WebKit::TextIndicatorWindow::*_animationDidEndCallback)();
-}
+ RetainPtr<CGColorRef> highlightColor = [NSColor colorWithDeviceRed:1 green:1 blue:0 alpha:1].CGColor;
+ RetainPtr<CGColorRef> rimShadowColor = [NSColor colorWithDeviceWhite:0 alpha:0.15].CGColor;
+ RetainPtr<CGColorRef> dropShadowColor = [NSColor colorWithDeviceWhite:0 alpha:0.2].CGColor;
-- (id)_initWithTextIndicatorWindow:(WebKit::TextIndicatorWindow *)textIndicatorWindow animationDuration:(CFTimeInterval)duration animationProgressCallback:(void (WebKit::TextIndicatorWindow::*)(double progress))animationProgressCallback animationDidEndCallback:(void (WebKit::TextIndicatorWindow::*)())animationDidEndCallback;
-@end
+ RetainPtr<CGColorRef> borderColor = [NSColor colorWithDeviceRed:.96 green:.90 blue:0 alpha:1].CGColor;
+ RetainPtr<CGColorRef> gradientDarkColor = [NSColor colorWithDeviceRed:.929 green:.8 blue:0 alpha:1].CGColor;
+ RetainPtr<CGColorRef> gradientLightColor = [NSColor colorWithDeviceRed:.949 green:.937 blue:0 alpha:1].CGColor;
-@implementation WKTextIndicatorWindowAnimation
+ for (auto& textRect : _textIndicator->data().textRectsInBoundingRectCoordinates) {
+ FloatRect bounceLayerRect = textRect;
+ bounceLayerRect.move(_margin.width, _margin.height);
+ bounceLayerRect.inflateX(horizontalBorder);
+ bounceLayerRect.inflateY(verticalBorder);
-- (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];
+ RetainPtr<CALayer> bounceLayer = adoptNS([[CALayer alloc] init]);
+ [bounceLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+ [bounceLayer setFrame:bounceLayerRect];
+ [bounceLayer setOpacity:0];
+ [bounceLayers addObject:bounceLayer.get()];
+
+ FloatRect yellowHighlightRect(FloatPoint(), bounceLayerRect.size());
+ // FIXME (138888): Ideally we wouldn't remove the margin in this case, but we need to
+ // ensure that the yellow highlight and contentImageWithHighlight overlap precisely.
+ if (wantsCrossfade) {
+ yellowHighlightRect.inflateX(-horizontalBorder);
+ yellowHighlightRect.inflateY(-verticalBorder);
+ }
+
+ RetainPtr<CALayer> dropShadowLayer = adoptNS([[CALayer alloc] init]);
+ [dropShadowLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+ [dropShadowLayer setShadowColor:dropShadowColor.get()];
+ [dropShadowLayer setShadowRadius:dropShadowBlurRadius];
+ [dropShadowLayer setShadowOffset:CGSizeMake(dropShadowOffsetX, dropShadowOffsetY)];
+ [dropShadowLayer setShadowPathIsBounds:YES];
+ [dropShadowLayer setShadowOpacity:1];
+ [dropShadowLayer setFrame:yellowHighlightRect];
+ [dropShadowLayer setCornerRadius:cornerRadius];
+ [bounceLayer addSublayer:dropShadowLayer.get()];
+ [bounceLayer setValue:dropShadowLayer.get() forKey:dropShadowLayerKey];
+
+#if !ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
+ RetainPtr<CALayer> rimShadowLayer = adoptNS([[CALayer alloc] init]);
+ [rimShadowLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+ [rimShadowLayer setFrame:yellowHighlightRect];
+ [rimShadowLayer setShadowColor:rimShadowColor.get()];
+ [rimShadowLayer setShadowRadius:rimShadowBlurRadius];
+ [rimShadowLayer setShadowPathIsBounds:YES];
+ [rimShadowLayer setShadowOffset:CGSizeZero];
+ [rimShadowLayer setShadowOpacity:1];
+ [rimShadowLayer setFrame:yellowHighlightRect];
+ [rimShadowLayer setCornerRadius:cornerRadius];
+ [bounceLayer addSublayer:rimShadowLayer.get()];
+ [bounceLayer setValue:rimShadowLayer.get() forKey:rimShadowLayerKey];
+#endif
+
+#if ENABLE(LEGACY_TEXT_INDICATOR_STYLE)
+ RetainPtr<CAGradientLayer> textLayer = adoptNS([[CAGradientLayer alloc] init]);
+ [textLayer setColors:@[ (id)gradientLightColor.get(), (id)gradientDarkColor.get() ]];
+#else
+ RetainPtr<CALayer> textLayer = adoptNS([[CALayer alloc] init]);
+#endif
+ [textLayer setBackgroundColor:highlightColor.get()];
+ [textLayer setBorderColor:borderColor.get()];
+ [textLayer setBorderWidth:borderWidth];
+ [textLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+ [textLayer setContents:(id)contentsImage.get()];
+
+ FloatRect imageRect = textRect;
+ imageRect.move(_textIndicator->data().textBoundingRectInWindowCoordinates.location() - _textIndicator->data().selectionRectInWindowCoordinates.location());
+ [textLayer setContentsRect:CGRectMake(imageRect.x() / contentsImageLogicalSize.width(), imageRect.y() / contentsImageLogicalSize.height(), imageRect.width() / contentsImageLogicalSize.width(), imageRect.height() / contentsImageLogicalSize.height())];
+ [textLayer setContentsGravity:kCAGravityCenter];
+ [textLayer setContentsScale:_textIndicator->data().contentImageScaleFactor];
+ [textLayer setFrame:yellowHighlightRect];
+ [textLayer setCornerRadius:cornerRadius];
+ [bounceLayer setValue:textLayer.get() forKey:textLayerKey];
+ [bounceLayer addSublayer:textLayer.get()];
}
+
+ self.layer.sublayers = bounceLayers.get();
+ _bounceLayers = bounceLayers;
+
return self;
}
-- (void)setCurrentProgress:(NSAnimationProgress)progress
+- (void)presentWithCompletionHandler:(void(^)(void))completionHandler
{
- (_textIndicatorWindow->*_animationProgressCallback)(progress);
+ bool wantsCrossfade = _textIndicator->data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
+ double animationDuration = wantsCrossfade ? bounceWithCrossfadeAnimationDuration : bounceAnimationDuration;
+ RetainPtr<CAKeyframeAnimation> bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
+ [bounceAnimation setValues:@[
+ [NSValue valueWithCATransform3D:CATransform3DIdentity],
+ [NSValue valueWithCATransform3D:CATransform3DMakeScale(midBounceScale, midBounceScale, 1)],
+ [NSValue valueWithCATransform3D:CATransform3DIdentity]
+ ]];
+ [bounceAnimation setDuration:animationDuration];
+
+ RetainPtr<CABasicAnimation> crossfadeAnimation;
+ RetainPtr<CABasicAnimation> fadeShadowInAnimation;
+ if (wantsCrossfade) {
+ crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@"contents"];
+ RetainPtr<CGImageRef> contentsImage = _textIndicator->data().contentImage->makeCGImage();
+ [crossfadeAnimation setToValue:(id)contentsImage.get()];
+ [crossfadeAnimation setFillMode:kCAFillModeForwards];
+ [crossfadeAnimation setRemovedOnCompletion:NO];
+ [crossfadeAnimation setDuration:animationDuration];
+
+ fadeShadowInAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
+ [fadeShadowInAnimation setFromValue:@0];
+ [fadeShadowInAnimation setToValue:@1];
+ [fadeShadowInAnimation setFillMode:kCAFillModeForwards];
+ [fadeShadowInAnimation setRemovedOnCompletion:NO];
+ [fadeShadowInAnimation setDuration:animationDuration];
+ }
+
+ [CATransaction begin];
+ [CATransaction setCompletionBlock:completionHandler];
+ for (CALayer* bounceLayer in _bounceLayers.get()) {
+ [bounceLayer setOpacity:1];
+ [bounceLayer addAnimation:bounceAnimation.get() forKey:@"bounce"];
+ if (wantsCrossfade) {
+ [[bounceLayer valueForKey:textLayerKey] addAnimation:crossfadeAnimation.get() forKey:@"contentTransition"];
+ [[bounceLayer valueForKey:dropShadowLayerKey] addAnimation:fadeShadowInAnimation.get() forKey:@"fadeShadowIn"];
+ [[bounceLayer valueForKey:rimShadowLayerKey] addAnimation:fadeShadowInAnimation.get() forKey:@"fadeShadowIn"];
+ }
+ }
+ [CATransaction commit];
}
-- (void)animationDidEnd:(NSAnimation *)animation
+- (void)hideWithCompletionHandler:(void(^)(void))completionHandler
{
- ASSERT(animation == self);
+ RetainPtr<CABasicAnimation> fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
+ [fadeAnimation setFromValue:@1];
+ [fadeAnimation setToValue:@0];
+ [fadeAnimation setFillMode:kCAFillModeForwards];
+ [fadeAnimation setRemovedOnCompletion:NO];
+ [fadeAnimation setDuration:fadeOutAnimationDuration];
- (_textIndicatorWindow->*_animationDidEndCallback)();
+ [CATransaction begin];
+ [CATransaction setCompletionBlock:completionHandler];
+ [self.layer addAnimation:fadeAnimation.get() forKey:@"fadeOut"];
+ [CATransaction commit];
}
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
@end
namespace WebKit {
TextIndicatorWindow::TextIndicatorWindow(WKView *wkView)
: m_wkView(wkView)
- , m_bounceAnimationContext(0)
, m_startFadeOutTimer(RunLoop::main(), this, &TextIndicatorWindow::startFadeOutTimerFired)
{
}
@@ -120,7 +267,7 @@
closeWindow();
}
-void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler)
+void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, std::function<void ()> animationCompletionHandler)
{
if (m_textIndicator == textIndicator)
return;
@@ -134,32 +281,31 @@
return;
NSRect contentRect = m_textIndicator->frameRect();
+
+ CGFloat horizontalMargin = std::max(dropShadowBlurRadius * 2 + horizontalBorder, contentRect.size.width * 2);
+ CGFloat verticalMargin = std::max(dropShadowBlurRadius * 2 + verticalBorder, contentRect.size.height * 2);
+
+ contentRect = NSInsetRect(contentRect, -horizontalMargin, -verticalMargin);
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
+ windowFrameRect = [[m_wkView window] convertRectToScreen:windowFrameRect];
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_textIndicatorView = adoptNS([[WKTextIndicatorView alloc] initWithFrame:NSMakeRect(0, 0, [m_textIndicatorWindow frame].size.width, [m_textIndicatorWindow frame].size.height) textIndicator:m_textIndicator margin:CGSizeMake(horizontalMargin, verticalMargin)]);
+ [m_textIndicatorWindow setContentView:m_textIndicatorView.get()];
[[m_wkView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
[m_textIndicatorWindow setReleasedWhenClosed:NO];
- if (animate) {
- m_bounceAnimationCompletionHandler = WTF::move(animationCompletionHandler);
- // 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 (m_textIndicator->data().presentationTransition != TextIndicator::PresentationTransition::None) {
+ [m_textIndicatorView presentWithCompletionHandler:[animationCompletionHandler] {
+ animationCompletionHandler();
+ }];
}
if (fadeOut)
@@ -173,19 +319,6 @@
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;
@@ -193,47 +326,13 @@
void TextIndicatorWindow::startFadeOutTimerFired()
{
- ASSERT(!m_fadeOutAnimation);
-
- m_fadeOutAnimation = adoptNS([[WKTextIndicatorWindowAnimation alloc] _initWithTextIndicatorWindow:this animationDuration:fadeOutAnimationDuration
- animationProgressCallback:&TextIndicatorWindow::fadeOutAnimationCallback animationDidEndCallback:&TextIndicatorWindow::fadeOutAnimationDidEnd]);
- [m_fadeOutAnimation startAnimation];
+ RetainPtr<NSWindow> indicatorWindow = m_textIndicatorWindow;
+ [m_textIndicatorView hideWithCompletionHandler:[indicatorWindow] {
+ [[indicatorWindow parentWindow] removeChildWindow:indicatorWindow.get()];
+ [indicatorWindow close];
+ }];
}
-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;
- m_bounceAnimationCompletionHandler();
-}
-
} // namespace WebKit
#endif // PLATFORM(MAC)
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -273,7 +273,7 @@
return;
if (_hitTestResult.detectedDataTextIndicator) {
- _page->setTextIndicator(_hitTestResult.detectedDataTextIndicator->data(), false, true);
+ _page->setTextIndicator(_hitTestResult.detectedDataTextIndicator->data(), false);
_isShowingTextIndicator = YES;
}
}
@@ -283,7 +283,7 @@
if (!_isShowingTextIndicator)
return;
- _page->clearTextIndicator(false, true);
+ _page->clearTextIndicator();
_isShowingTextIndicator = NO;
}
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -29,6 +29,7 @@
#if ENABLE(CONTEXT_MENUS)
#import "DictionaryPopupInfo.h"
+#import "TextIndicator.h"
#import "WebCoreArgumentCoders.h"
#import "WebPage.h"
#import "WebPageProxyMessages.h"
@@ -43,7 +44,7 @@
void WebContextMenuClient::lookUpInDictionary(Frame* frame)
{
- m_page->performDictionaryLookupForSelection(frame, frame->selection().selection());
+ m_page->performDictionaryLookupForSelection(frame, frame->selection().selection(), TextIndicator::PresentationTransition::BounceAndCrossfade);
}
bool WebContextMenuClient::isSpeaking()
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2014-11-20 04:27:19 UTC (rev 176377)
@@ -314,12 +314,12 @@
#if !PLATFORM(IOS)
bool FindController::updateFindIndicator(Frame& selectedFrame, bool isShowingOverlay, bool shouldAnimate)
{
- RefPtr<TextIndicator> indicator = TextIndicator::createWithSelectionInFrame(*WebFrame::fromCoreFrame(selectedFrame));
+ RefPtr<TextIndicator> indicator = TextIndicator::createWithSelectionInFrame(*WebFrame::fromCoreFrame(selectedFrame), shouldAnimate ? TextIndicator::PresentationTransition::Bounce : TextIndicator::PresentationTransition::None);
if (!indicator)
return false;
m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInWindowCoordinates());
- m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), !isShowingOverlay, shouldAnimate));
+ m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), !isShowingOverlay));
m_isShowingFindIndicator = true;
return true;
@@ -330,7 +330,7 @@
if (!m_isShowingFindIndicator)
return;
- m_webPage->send(Messages::WebPageProxy::ClearTextIndicator(false, true));
+ m_webPage->send(Messages::WebPageProxy::ClearTextIndicator());
m_isShowingFindIndicator = false;
m_foundStringMatchIndex = -1;
didHideFindIndicator();
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-11-20 04:27:19 UTC (rev 176377)
@@ -44,6 +44,7 @@
#include "Plugin.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
+#include "TextIndicator.h"
#include <WebCore/DictationAlternative.h>
#include <WebCore/DragData.h>
#include <WebCore/Editor.h>
@@ -651,7 +652,7 @@
void speak(const String&);
void stopSpeaking();
- void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&);
+ void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&, TextIndicator::PresentationTransition);
#endif
bool isSmartInsertDeleteEnabled();
@@ -967,7 +968,7 @@
#if PLATFORM(COCOA)
void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
void performDictionaryLookupOfCurrentSelection();
- void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options);
+ void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options, TextIndicator::PresentationTransition);
void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (176376 => 176377)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-20 02:19:12 UTC (rev 176376)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-20 04:27:19 UTC (rev 176377)
@@ -489,24 +489,24 @@
if (!range)
return;
- performDictionaryLookupForRange(frame, *range, options);
+ performDictionaryLookupForRange(frame, *range, options, TextIndicator::PresentationTransition::Bounce);
}
-void WebPage::performDictionaryLookupForSelection(Frame* frame, const VisibleSelection& selection)
+void WebPage::performDictionaryLookupForSelection(Frame* frame, const VisibleSelection& selection, TextIndicator::PresentationTransition presentationTransition)
{
NSDictionary *options = nil;
RefPtr<Range> selectedRange = rangeForDictionaryLookupForSelection(selection, &options);
if (selectedRange)
- performDictionaryLookupForRange(frame, *selectedRange, options);
+ performDictionaryLookupForRange(frame, *selectedRange, options, presentationTransition);
}
void WebPage::performDictionaryLookupOfCurrentSelection()
{
Frame* frame = &m_page->focusController().focusedOrMainFrame();
- performDictionaryLookupForSelection(frame, frame->selection().selection());
+ performDictionaryLookupForSelection(frame, frame->selection().selection(), TextIndicator::PresentationTransition::BounceAndCrossfade);
}
-void WebPage::performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options)
+void WebPage::performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options, TextIndicator::PresentationTransition presentationTransition)
{
if (range.text().stripWhiteSpace().isEmpty())
return;
@@ -543,7 +543,7 @@
[scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
}];
- RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range);
+ RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range, presentationTransition);
if (!textIndicator)
return;
@@ -1035,7 +1035,7 @@
detectedDataBoundingBox.unite(frameView->contentsToWindow(quad.enclosingBoundingBox()));
actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
- actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange);
+ actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, TextIndicator::PresentationTransition::BounceAndCrossfade);
actionMenuResult.detectedDataOriginatingPageOverlay = overlay->pageOverlayID();
m_lastActionMenuRangeForSelection = mainResultRange;
@@ -1049,7 +1049,7 @@
actionMenuResult.actionContext = DataDetection::detectItemAroundHitTestResult(hitTestResult, detectedDataBoundingBox, detectedDataRange);
if (actionMenuResult.actionContext && detectedDataRange) {
actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
- actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange);
+ actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicator::PresentationTransition::BounceAndCrossfade);
m_lastActionMenuRangeForSelection = detectedDataRange;
}
}