Title: [176866] branches/safari-600.3-branch/Source

Diff

Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog	2014-12-05 21:16:49 UTC (rev 176866)
@@ -1,3 +1,34 @@
+2014-12-05  Dana Burkart  <[email protected]>
+
+        Merge r176810. <rdar://problem/19140827>
+
+    2014-12-04  Tim Horton  <[email protected]>
+
+            TextIndicator::createWithSelectionInFrame does synchronous IPC in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=139252
+            <rdar://problem/19140827>
+
+            Reviewed by Anders Carlsson.
+
+            * WebCore.exp.in:
+            * page/TextIndicator.cpp:
+            (WebCore::TextIndicator::createWithSelectionInFrame):
+            (WebCore::TextIndicator::TextIndicator):
+            * page/TextIndicator.h:
+            (WebCore::TextIndicator::selectionRectInWindowCoordinates):
+            (WebCore::TextIndicator::textBoundingRectInWindowCoordinates):
+            (WebCore::TextIndicator::selectionRectInScreenCoordinates): Deleted.
+            (WebCore::TextIndicator::textBoundingRectInScreenCoordinates): Deleted.
+            Go back to keeping the rects in "window" coordinates.
+
+            * page/mac/TextIndicatorWindow.h:
+            * page/mac/TextIndicatorWindow.mm:
+            (-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
+            (WebCore::TextIndicatorWindow::setTextIndicator):
+            Let callers pass in the contentRect instead of trying to share the code
+            to compute it, since it needs to be different for legacy and modern WebKit.
+
+
 2014-12-05  Babak Shafiei  <[email protected]>
 
         Merge r176855.

Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in	2014-12-05 21:16:49 UTC (rev 176866)
@@ -2296,7 +2296,7 @@
 __ZN7WebCore17ScrollbarThemeMac24removeOverhangAreaShadowEP7CALayer
 __ZN7WebCore17ScrollbarThemeMac27setUpOverhangAreaBackgroundEP7CALayerRKNS_5ColorE
 __ZN7WebCore17ScrollbarThemeMac28removeOverhangAreaBackgroundEP7CALayer
-__ZN7WebCore19TextIndicatorWindow16setTextIndicatorEN3WTF10PassRefPtrINS_13TextIndicatorEEEbNSt3__18functionIFvvEEE
+__ZN7WebCore19TextIndicatorWindow16setTextIndicatorEN3WTF10PassRefPtrINS_13TextIndicatorEEE6CGRectbNSt3__18functionIFvvEEE
 __ZN7WebCore19TextIndicatorWindowC1EP6NSView
 __ZN7WebCore19TextIndicatorWindowD1Ev
 __ZN7WebCore19applicationIsSafariEv

Modified: branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp	2014-12-05 21:16:49 UTC (rev 176866)
@@ -146,7 +146,7 @@
 
     // Store the selection rect in window coordinates, to be used subsequently
     // to determine if the indicator and selection still precisely overlap.
-    IntRect selectionRectInScreenCoordinates = frame.view()->contentsToScreen(selectionRect);
+    IntRect selectionRectInWindowCoordinates = frame.view()->contentsToWindow(selectionRect);
 
     Vector<FloatRect> textRects;
     frame.selection().getClippedVisibleTextRectangles(textRects);
@@ -154,23 +154,23 @@
     // The bounding rect of all the text rects can be different than the selection
     // rect when the selection spans multiple lines; the indicator doesn't actually
     // care where the selection highlight goes, just where the text actually is.
-    FloatRect textBoundingRectInScreenCoordinates;
-    Vector<FloatRect> textRectsInScreenCoordinates;
+    FloatRect textBoundingRectInWindowCoordinates;
+    Vector<FloatRect> textRectsInWindowCoordinates;
     for (const FloatRect& textRect : textRects) {
-        FloatRect textRectInScreenCoordinates = frame.view()->contentsToScreen(enclosingIntRect(textRect));
-        textRectsInScreenCoordinates.append(textRectInScreenCoordinates);
-        textBoundingRectInScreenCoordinates.unite(textRectInScreenCoordinates);
+        FloatRect textRectInWindowCoordinates = frame.view()->contentsToWindow(enclosingIntRect(textRect));
+        textRectsInWindowCoordinates.append(textRectInWindowCoordinates);
+        textBoundingRectInWindowCoordinates.unite(textRectInWindowCoordinates);
     }
 
     Vector<FloatRect> textRectsInBoundingRectCoordinates;
-    for (auto rect : textRectsInScreenCoordinates) {
-        rect.moveBy(-textBoundingRectInScreenCoordinates.location());
+    for (auto rect : textRectsInWindowCoordinates) {
+        rect.moveBy(-textBoundingRectInWindowCoordinates.location());
         textRectsInBoundingRectCoordinates.append(rect);
     }
 
     TextIndicatorData data;
-    data.selectionRectInScreenCoordinates = selectionRectInScreenCoordinates;
-    data.textBoundingRectInScreenCoordinates = textBoundingRectInScreenCoordinates;
+    data.selectionRectInWindowCoordinates = selectionRectInWindowCoordinates;
+    data.textBoundingRectInWindowCoordinates = textBoundingRectInWindowCoordinates;
     data.textRectsInBoundingRectCoordinates = textRectsInBoundingRectCoordinates;
     data.contentImageScaleFactor = frame.page()->deviceScaleFactor();
     data.contentImage = indicatorBitmap;
@@ -183,7 +183,7 @@
 TextIndicator::TextIndicator(const TextIndicatorData& data)
     : m_data(data)
 {
-    ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage->size() == enclosingIntRect(m_data.selectionRectInScreenCoordinates).size());
+    ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage->size() == enclosingIntRect(m_data.selectionRectInWindowCoordinates).size());
 
     if (textIndicatorsForTextRectsOverlap(m_data.textRectsInBoundingRectCoordinates)) {
         m_data.textRectsInBoundingRectCoordinates[0] = unionRect(m_data.textRectsInBoundingRectCoordinates);

Modified: branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h	2014-12-05 21:16:49 UTC (rev 176866)
@@ -51,8 +51,8 @@
 };
 
 struct TextIndicatorData {
-    FloatRect selectionRectInScreenCoordinates;
-    FloatRect textBoundingRectInScreenCoordinates;
+    FloatRect selectionRectInWindowCoordinates;
+    FloatRect textBoundingRectInWindowCoordinates;
     Vector<FloatRect> textRectsInBoundingRectCoordinates;
     float contentImageScaleFactor;
     RefPtr<Image> contentImageWithHighlight;
@@ -68,8 +68,8 @@
 
     ~TextIndicator();
 
-    FloatRect selectionRectInScreenCoordinates() const { return m_data.selectionRectInScreenCoordinates; }
-    FloatRect textBoundingRectInScreenCoordinates() const { return m_data.textBoundingRectInScreenCoordinates; }
+    FloatRect selectionRectInWindowCoordinates() const { return m_data.selectionRectInWindowCoordinates; }
+    FloatRect textBoundingRectInWindowCoordinates() const { return m_data.textBoundingRectInWindowCoordinates; }
     const Vector<FloatRect>& textRectsInBoundingRectCoordinates() const { return m_data.textRectsInBoundingRectCoordinates; }
     float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
     Image *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }

Modified: branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.h (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.h	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.h	2014-12-05 21:16:49 UTC (rev 176866)
@@ -48,7 +48,7 @@
     explicit TextIndicatorWindow(NSView *);
     ~TextIndicatorWindow();
 
-    void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, std::function<void ()> animationCompletionHandler);
+    void setTextIndicator(PassRefPtr<TextIndicator>, NSRect contentRect, bool fadeOut, std::function<void ()> animationCompletionHandler);
 
 private:
     void closeWindow();

Modified: branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm	2014-12-05 21:16:49 UTC (rev 176866)
@@ -171,7 +171,7 @@
         [textLayer setContents:(id)contentsImage.get()];
 
         FloatRect imageRect = textRect;
-        imageRect.move(_textIndicator->textBoundingRectInScreenCoordinates().location() - _textIndicator->selectionRectInScreenCoordinates().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->contentImageScaleFactor()];
@@ -266,7 +266,7 @@
     closeWindow();
 }
 
-void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, std::function<void ()> animationCompletionHandler)
+void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, NSRect contentRect, bool fadeOut, std::function<void ()> animationCompletionHandler)
 {
     if (m_textIndicator == textIndicator)
         return;
@@ -279,7 +279,6 @@
     if (!m_textIndicator)
         return;
 
-    NSRect contentRect = m_textIndicator->textBoundingRectInScreenCoordinates();
     CGFloat horizontalMargin = std::max(dropShadowBlurRadius * 2 + horizontalBorder, contentRect.size.width * 2);
     CGFloat verticalMargin = std::max(dropShadowBlurRadius * 2 + verticalBorder, contentRect.size.height * 2);
 

Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-12-05 21:16:49 UTC (rev 176866)
@@ -1,3 +1,20 @@
+2014-12-05  Dana Burkart  <[email protected]>
+
+        Merge r176810. <rdar://problem/19140827>
+
+    2014-12-04  Tim Horton  <[email protected]>
+
+            TextIndicator::createWithSelectionInFrame does synchronous IPC in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=139252
+            <rdar://problem/19140827>
+
+            Reviewed by Anders Carlsson.
+
+            * WebView/WebView.mm:
+            (-[WebView _setTextIndicator:fadeOut:animationCompletionHandler:]):
+            Adjust to the WebCore changes.
+
+
 2014-12-04  Dana Burkart  <[email protected]>
 
         Merge r173235. <rdar://problem/19072083>

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm	2014-12-05 21:16:49 UTC (rev 176866)
@@ -8604,7 +8604,8 @@
     if (!_private->textIndicatorWindow)
         _private->textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
 
-    _private->textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, WTF::move(completionHandler));
+    NSRect contentRect = [self.window convertRectToScreen:textIndicator->textBoundingRectInWindowCoordinates()];
+    _private->textIndicatorWindow->setTextIndicator(textIndicator, contentRect, fadeOut, WTF::move(completionHandler));
 }
 
 - (void)_clearTextIndicator

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-12-05 21:16:49 UTC (rev 176866)
@@ -1,5 +1,35 @@
 2014-12-05  Dana Burkart  <[email protected]>
 
+        Merge r176810. <rdar://problem/19140827>
+
+    2014-12-04  Tim Horton  <[email protected]>
+
+            TextIndicator::createWithSelectionInFrame does synchronous IPC in WebKit2
+            https://bugs.webkit.org/show_bug.cgi?id=139252
+            <rdar://problem/19140827>
+
+            Reviewed by Anders Carlsson.
+
+            It turns out contentsToScreen requires sync IPC in Mac WebKit2, which we
+            really don't want to be doing here (especially since the UI process will often
+            be sitting in waitForAndDispatchImmediately waiting for didPerformActionMenuHitTest).
+
+            Go back to keeping TextIndicator rects in "window" coordinates and do the conversion
+            in each of the WebKits instead of trying to share that code.
+
+            * Shared/WebCoreArgumentCoders.cpp:
+            (IPC::ArgumentCoder<TextIndicatorData>::encode):
+            (IPC::ArgumentCoder<TextIndicatorData>::decode):
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]):
+            * WebProcess/WebPage/FindController.cpp:
+            (WebKit::FindController::updateFindIndicator):
+            (WebKit::FindController::drawRect):
+            Adjust to the WebCore changes.
+
+
+2014-12-05  Dana Burkart  <[email protected]>
+
         Merge r173566. <rdar://problem/19150984>
 
     2014-09-11  Andy Estes  <[email protected]>

Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2014-12-05 21:16:49 UTC (rev 176866)
@@ -2172,8 +2172,8 @@
 
 void ArgumentCoder<TextIndicatorData>::encode(ArgumentEncoder& encoder, const TextIndicatorData& textIndicatorData)
 {
-    encoder << textIndicatorData.selectionRectInScreenCoordinates;
-    encoder << textIndicatorData.textBoundingRectInScreenCoordinates;
+    encoder << textIndicatorData.selectionRectInWindowCoordinates;
+    encoder << textIndicatorData.textBoundingRectInWindowCoordinates;
     encoder << textIndicatorData.textRectsInBoundingRectCoordinates;
     encoder << textIndicatorData.contentImageScaleFactor;
     encoder.encodeEnum(textIndicatorData.presentationTransition);
@@ -2191,10 +2191,10 @@
 
 bool ArgumentCoder<TextIndicatorData>::decode(ArgumentDecoder& decoder, TextIndicatorData& textIndicatorData)
 {
-    if (!decoder.decode(textIndicatorData.selectionRectInScreenCoordinates))
+    if (!decoder.decode(textIndicatorData.selectionRectInWindowCoordinates))
         return false;
 
-    if (!decoder.decode(textIndicatorData.textBoundingRectInScreenCoordinates))
+    if (!decoder.decode(textIndicatorData.textBoundingRectInWindowCoordinates))
         return false;
 
     if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-12-05 21:16:49 UTC (rev 176866)
@@ -3081,7 +3081,8 @@
     if (!_data->_textIndicatorWindow)
         _data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
 
-    _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, WTF::move(completionHandler));
+    NSRect contentRect = [self.window convertRectToScreen:[self convertRect:textIndicator->textBoundingRectInWindowCoordinates() toView:nil]];
+    _data->_textIndicatorWindow->setTextIndicator(textIndicator, contentRect, fadeOut, WTF::move(completionHandler));
 }
 
 - (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut

Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp (176865 => 176866)


--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2014-12-05 21:10:39 UTC (rev 176865)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2014-12-05 21:16:49 UTC (rev 176866)
@@ -318,7 +318,7 @@
     if (!indicator)
         return false;
 
-    m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInScreenCoordinates());
+    m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInWindowCoordinates());
     m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), !isShowingOverlay));
     m_isShowingFindIndicator = true;
 
@@ -450,7 +450,7 @@
         return;
 
     if (Frame* selectedFrame = frameWithSelection(m_webPage->corePage())) {
-        IntRect findIndicatorRect = selectedFrame->view()->contentsToScreen(enclosingIntRect(selectedFrame->selection().selectionBounds()));
+        IntRect findIndicatorRect = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection().selectionBounds()));
 
         if (findIndicatorRect != m_findIndicatorRect)
             hideFindIndicator();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to