Title: [176418] trunk/Source/WebKit2
- Revision
- 176418
- Author
- [email protected]
- Date
- 2014-11-20 14:26:10 -0800 (Thu, 20 Nov 2014)
Log Message
TextIndicator should have getters for TextIndicator::Data properties
https://bugs.webkit.org/show_bug.cgi?id=138920
Reviewed by Beth Dakin.
Instead of having clients reach into the data(), add getters.
Remove frameRect(), which is identical to the textBoundingRectInWindowCoordinates getter.
Remove declarations for draw/drawContentImage, which were already removed.
* Shared/TextIndicator.cpp:
(WebKit::TextIndicator::frameRect): Deleted.
* Shared/TextIndicator.h:
(WebKit::TextIndicator::textBoundingRectInWindowCoordinates):
(WebKit::TextIndicator::textRectsInBoundingRectCoordinates):
(WebKit::TextIndicator::contentImageScaleFactor):
(WebKit::TextIndicator::contentImageWithHighlight):
(WebKit::TextIndicator::contentImage):
* UIProcess/mac/TextIndicatorWindow.mm:
(-[WKTextIndicatorView initWithFrame:textIndicator:margin:]):
(-[WKTextIndicatorView presentWithCompletionHandler:]):
(WebKit::TextIndicatorWindow::setTextIndicator):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (176417 => 176418)
--- trunk/Source/WebKit2/ChangeLog 2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-20 22:26:10 UTC (rev 176418)
@@ -1,5 +1,29 @@
2014-11-20 Tim Horton <[email protected]>
+ TextIndicator should have getters for TextIndicator::Data properties
+ https://bugs.webkit.org/show_bug.cgi?id=138920
+
+ Reviewed by Beth Dakin.
+
+ Instead of having clients reach into the data(), add getters.
+ Remove frameRect(), which is identical to the textBoundingRectInWindowCoordinates getter.
+ Remove declarations for draw/drawContentImage, which were already removed.
+
+ * Shared/TextIndicator.cpp:
+ (WebKit::TextIndicator::frameRect): Deleted.
+ * Shared/TextIndicator.h:
+ (WebKit::TextIndicator::textBoundingRectInWindowCoordinates):
+ (WebKit::TextIndicator::textRectsInBoundingRectCoordinates):
+ (WebKit::TextIndicator::contentImageScaleFactor):
+ (WebKit::TextIndicator::contentImageWithHighlight):
+ (WebKit::TextIndicator::contentImage):
+ * UIProcess/mac/TextIndicatorWindow.mm:
+ (-[WKTextIndicatorView initWithFrame:textIndicator:margin:]):
+ (-[WKTextIndicatorView presentWithCompletionHandler:]):
+ (WebKit::TextIndicatorWindow::setTextIndicator):
+
+2014-11-20 Tim Horton <[email protected]>
+
Cancel DataDetectors menu earlier if we know it can't be presented
https://bugs.webkit.org/show_bug.cgi?id=138922
<rdar://problem/18950441>
Modified: trunk/Source/WebKit2/Shared/TextIndicator.cpp (176417 => 176418)
--- trunk/Source/WebKit2/Shared/TextIndicator.cpp 2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/Shared/TextIndicator.cpp 2014-11-20 22:26:10 UTC (rev 176418)
@@ -211,11 +211,6 @@
{
}
-FloatRect TextIndicator::frameRect() const
-{
- return m_data.textBoundingRectInWindowCoordinates;
-}
-
void TextIndicator::Data::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << selectionRectInWindowCoordinates;
Modified: trunk/Source/WebKit2/Shared/TextIndicator.h (176417 => 176418)
--- trunk/Source/WebKit2/Shared/TextIndicator.h 2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/Shared/TextIndicator.h 2014-11-20 22:26:10 UTC (rev 176418)
@@ -67,7 +67,6 @@
float contentImageScaleFactor;
RefPtr<ShareableBitmap> contentImageWithHighlight;
RefPtr<ShareableBitmap> contentImage;
-
PresentationTransition presentationTransition;
void encode(IPC::ArgumentEncoder&) const;
@@ -81,20 +80,20 @@
~TextIndicator();
WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_data.selectionRectInWindowCoordinates; }
-
+ WebCore::FloatRect textBoundingRectInWindowCoordinates() const { return m_data.textBoundingRectInWindowCoordinates; }
+ const Vector<WebCore::FloatRect>& textRectsInBoundingRectCoordinates() const { return m_data.textRectsInBoundingRectCoordinates; }
+ float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
+ ShareableBitmap *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }
+ ShareableBitmap *contentImage() const { return m_data.contentImage.get(); }
PresentationTransition presentationTransition() const { return m_data.presentationTransition; }
+
void setPresentationTransition(PresentationTransition transition) { m_data.presentationTransition = transition; }
- WebCore::FloatRect frameRect() const;
Data data() const { return m_data; }
- void draw(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
-
private:
TextIndicator(const TextIndicator::Data&);
- void drawContentImage(WebCore::GraphicsContext&, WebCore::FloatRect textRect);
-
Data m_data;
};
Modified: trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm (176417 => 176418)
--- trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm 2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm 2014-11-20 22:26:10 UTC (rev 176418)
@@ -92,15 +92,15 @@
self.wantsLayer = YES;
self.layer.anchorPoint = CGPointZero;
- bool wantsCrossfade = _textIndicator->data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
+ bool wantsCrossfade = _textIndicator->presentationTransition() == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
- FloatSize contentsImageLogicalSize = _textIndicator->data().contentImage->size();
- contentsImageLogicalSize.scale(1 / _textIndicator->data().contentImageScaleFactor);
+ FloatSize contentsImageLogicalSize = _textIndicator->contentImage()->size();
+ contentsImageLogicalSize.scale(1 / _textIndicator->contentImageScaleFactor());
RetainPtr<CGImageRef> contentsImage;
if (wantsCrossfade)
- contentsImage = _textIndicator->data().contentImageWithHighlight->makeCGImage();
+ contentsImage = _textIndicator->contentImageWithHighlight()->makeCGImage();
else
- contentsImage = _textIndicator->data().contentImage->makeCGImage();
+ contentsImage = _textIndicator->contentImage()->makeCGImage();
RetainPtr<NSMutableArray> bounceLayers = adoptNS([[NSMutableArray alloc] init]);
@@ -112,7 +112,7 @@
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;
- for (auto& textRect : _textIndicator->data().textRectsInBoundingRectCoordinates) {
+ for (auto& textRect : _textIndicator->textRectsInBoundingRectCoordinates()) {
FloatRect bounceLayerRect = textRect;
bounceLayerRect.move(_margin.width, _margin.height);
bounceLayerRect.inflateX(horizontalBorder);
@@ -172,10 +172,10 @@
[textLayer setContents:(id)contentsImage.get()];
FloatRect imageRect = textRect;
- imageRect.move(_textIndicator->data().textBoundingRectInWindowCoordinates.location() - _textIndicator->data().selectionRectInWindowCoordinates.location());
+ imageRect.move(_textIndicator->textBoundingRectInWindowCoordinates().location() - _textIndicator->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 setContentsScale:_textIndicator->contentImageScaleFactor()];
[textLayer setFrame:yellowHighlightRect];
[textLayer setCornerRadius:cornerRadius];
[bounceLayer setValue:textLayer.get() forKey:textLayerKey];
@@ -190,7 +190,7 @@
- (void)presentWithCompletionHandler:(void(^)(void))completionHandler
{
- bool wantsCrossfade = _textIndicator->data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
+ bool wantsCrossfade = _textIndicator->presentationTransition() == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
double animationDuration = wantsCrossfade ? bounceWithCrossfadeAnimationDuration : bounceAnimationDuration;
RetainPtr<CAKeyframeAnimation> bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
[bounceAnimation setValues:@[
@@ -204,7 +204,7 @@
RetainPtr<CABasicAnimation> fadeShadowInAnimation;
if (wantsCrossfade) {
crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@"contents"];
- RetainPtr<CGImageRef> contentsImage = _textIndicator->data().contentImage->makeCGImage();
+ RetainPtr<CGImageRef> contentsImage = _textIndicator->contentImage()->makeCGImage();
[crossfadeAnimation setToValue:(id)contentsImage.get()];
[crossfadeAnimation setFillMode:kCAFillModeForwards];
[crossfadeAnimation setRemovedOnCompletion:NO];
@@ -280,7 +280,7 @@
if (!m_textIndicator)
return;
- NSRect contentRect = m_textIndicator->frameRect();
+ NSRect contentRect = m_textIndicator->textBoundingRectInWindowCoordinates();
CGFloat horizontalMargin = std::max(dropShadowBlurRadius * 2 + horizontalBorder, contentRect.size.width * 2);
CGFloat verticalMargin = std::max(dropShadowBlurRadius * 2 + verticalBorder, contentRect.size.height * 2);
@@ -302,7 +302,7 @@
[[m_wkView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
[m_textIndicatorWindow setReleasedWhenClosed:NO];
- if (m_textIndicator->data().presentationTransition != TextIndicator::PresentationTransition::None) {
+ if (m_textIndicator->presentationTransition() != TextIndicator::PresentationTransition::None) {
[m_textIndicatorView presentWithCompletionHandler:[animationCompletionHandler] {
animationCompletionHandler();
}];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes