Diff
Modified: trunk/Source/WebCore/ChangeLog (101412 => 101413)
--- trunk/Source/WebCore/ChangeLog 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebCore/ChangeLog 2011-11-29 21:29:00 UTC (rev 101413)
@@ -1,3 +1,18 @@
+2011-11-15 Anders Carlsson <[email protected]>
+
+ EditorClient::showCorrectionPanel should pass the string bounding box in root view coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=72408
+
+ Reviewed by Sam Weinig.
+
+ Rename windowRectForRange to rootViewRectForRange and use contentsToRootView instead of contentsToWindow.
+
+ * editing/SpellingCorrectionController.cpp:
+ (WebCore::SpellingCorrectionController::show):
+ (WebCore::SpellingCorrectionController::correctionPanelTimerFired):
+ (WebCore::SpellingCorrectionController::rootViewRectForRange):
+ * editing/SpellingCorrectionController.h:
+
2011-11-29 Ojan Vafai <[email protected]>
invalid cast in WebCore::toRenderBox / WebCore::RenderBox::firstChildBox
Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.cpp (101412 => 101413)
--- trunk/Source/WebCore/editing/SpellingCorrectionController.cpp 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.cpp 2011-11-29 21:29:00 UTC (rev 101413)
@@ -155,7 +155,7 @@
void SpellingCorrectionController::show(PassRefPtr<Range> rangeToReplace, const String& replacement)
{
- FloatRect boundingBox = windowRectForRange(rangeToReplace.get());
+ FloatRect boundingBox = rootViewRectForRange(rangeToReplace.get());
if (boundingBox.isEmpty())
return;
m_correctionPanelInfo.replacedString = plainText(rangeToReplace.get());
@@ -298,7 +298,7 @@
break;
m_correctionPanelInfo.isActive = true;
m_correctionPanelInfo.replacedString = plainText(m_correctionPanelInfo.rangeToBeReplaced.get());
- FloatRect boundingBox = windowRectForRange(m_correctionPanelInfo.rangeToBeReplaced.get());
+ FloatRect boundingBox = rootViewRectForRange(m_correctionPanelInfo.rangeToBeReplaced.get());
if (!boundingBox.isEmpty())
client()->showCorrectionPanel(m_correctionPanelInfo.panelType, boundingBox, m_correctionPanelInfo.replacedString, m_correctionPanelInfo.replacementString, Vector<String>());
}
@@ -316,7 +316,7 @@
String topSuggestion = suggestions.first();
suggestions.remove(0);
m_correctionPanelInfo.isActive = true;
- FloatRect boundingBox = windowRectForRange(m_correctionPanelInfo.rangeToBeReplaced.get());
+ FloatRect boundingBox = rootViewRectForRange(m_correctionPanelInfo.rangeToBeReplaced.get());
if (!boundingBox.isEmpty())
client()->showCorrectionPanel(m_correctionPanelInfo.panelType, boundingBox, m_correctionPanelInfo.replacedString, topSuggestion, suggestions);
}
@@ -362,7 +362,7 @@
return client() && client()->isAutomaticSpellingCorrectionEnabled();
}
-FloatRect SpellingCorrectionController::windowRectForRange(const Range* range) const
+FloatRect SpellingCorrectionController::rootViewRectForRange(const Range* range) const
{
FrameView* view = m_frame->view();
if (!view)
@@ -373,7 +373,7 @@
size_t size = textQuads.size();
for (size_t i = 0; i < size; ++i)
boundingRect.unite(textQuads[i].boundingBox());
- return view->contentsToWindow(IntRect(boundingRect));
+ return view->contentsToRootView(IntRect(boundingRect));
}
void SpellingCorrectionController::respondToChangedSelection(const VisibleSelection& oldSelection)
Modified: trunk/Source/WebCore/editing/SpellingCorrectionController.h (101412 => 101413)
--- trunk/Source/WebCore/editing/SpellingCorrectionController.h 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebCore/editing/SpellingCorrectionController.h 2011-11-29 21:29:00 UTC (rev 101413)
@@ -124,7 +124,7 @@
EditorClient* client();
TextCheckerClient* textChecker();
- FloatRect windowRectForRange(const Range*) const;
+ FloatRect rootViewRectForRange(const Range*) const;
void markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand(EditCommand*);
EditorClient* m_client;
Modified: trunk/Source/WebKit/mac/ChangeLog (101412 => 101413)
--- trunk/Source/WebKit/mac/ChangeLog 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-11-29 21:29:00 UTC (rev 101413)
@@ -1,3 +1,20 @@
+2011-11-15 Anders Carlsson <[email protected]>
+
+ EditorClient::showCorrectionPanel should pass the string bounding box in root view coordinates
+ https://bugs.webkit.org/show_bug.cgi?id=72408
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/CorrectionPanel.mm:
+ (CorrectionPanel::show):
+ Convert the bounding rect to web view coordinates.
+
+ * WebView/WebView.mm:
+ (-[WebView _convertPointFromRootView:]):
+ (-[WebView _convertRectFromRootView:]):
+ * WebView/WebViewInternal.h:
+ Add helper methods for converting from root view coordinates to web view coordinates.
+
2011-11-29 Roland Steiner <[email protected]>
<style scoped>: add ENABLE(STYLE_SCOPED) flag to WebKit
Modified: trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm (101412 => 101413)
--- trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm 2011-11-29 21:29:00 UTC (rev 101413)
@@ -24,6 +24,7 @@
*/
#import "CorrectionPanel.h"
+#import "WebViewInternal.h"
#import "WebViewPrivate.h"
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
@@ -74,7 +75,7 @@
[alternativeStrings addObject:(NSString*)alternativeReplacementStrings[i]];
}
- [[NSSpellChecker sharedSpellChecker] showCorrectionIndicatorOfType:indicatorType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:[view convertRect:boundingBoxOfReplacedString fromView:nil] view:m_view.get() completionHandler:^(NSString* acceptedString) {
+ [[NSSpellChecker sharedSpellChecker] showCorrectionIndicatorOfType:indicatorType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:[view _convertRectFromRootView:boundingBoxOfReplacedString] view:m_view.get() completionHandler:^(NSString* acceptedString) {
handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType);
}];
}
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (101412 => 101413)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2011-11-29 21:29:00 UTC (rev 101413)
@@ -6301,7 +6301,16 @@
}
#endif
+- (NSPoint)_convertPointFromRootView:(NSPoint)point
+{
+ return NSMakePoint(point.x, [self bounds].size.height - point.y);
+}
+- (NSRect)_convertRectFromRootView:(NSRect)rect
+{
+ return NSMakeRect(rect.origin.x, [self bounds].size.height - rect.origin.y, rect.size.width, rect.size.height);
+}
+
@end
@implementation WebView (WebViewDeviceOrientation)
Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (101412 => 101413)
--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2011-11-29 21:22:55 UTC (rev 101412)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h 2011-11-29 21:29:00 UTC (rev 101413)
@@ -188,4 +188,8 @@
- (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer;
#endif
+// Conversion functions between WebCore root view coordinates and web view coordinates.
+- (NSPoint)_convertPointFromRootView:(NSPoint)point;
+- (NSRect)_convertRectFromRootView:(NSRect)rect;
+
@end