Title: [166145] trunk/Source
Revision
166145
Author
wei...@apple.com
Date
2014-03-23 14:41:17 -0700 (Sun, 23 Mar 2014)

Log Message

Simplify the HTMLConverter interface (Part 2)
https://bugs.webkit.org/show_bug.cgi?id=130654

Reviewed by Darin Adler.

../WebCore: 

Switch HTMLConverter from using an Objective-C interface to C functions.

* WebCore.exp.in:
* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeSelectionToPasteboard):
* editing/mac/EditorMac.mm:
(WebCore::Editor::dataSelectionForPasteboard):
(WebCore::Editor::writeSelectionToPasteboard):
* platform/ios/PasteboardIOS.mm:
* platform/mac/HTMLConverter.h:
* platform/mac/HTMLConverter.mm:
(WebCore::attributedStringFromRange):
(WebCore::editingAttributedStringFromRange):
* platform/mac/PasteboardMac.mm:

../WebKit/mac: 

* WebView/WebHTMLRepresentation.mm:
(-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView attributedSubstringFromRange:]):
(-[WebHTMLView attributedString]):
(-[WebHTMLView selectedAttributedString]):

../WebKit2: 

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::performDictionaryLookupForRange):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
(WebKit::WebPage::performDictionaryLookupAtLocation):
(WebKit::WebPage::performDictionaryLookupForSelection):
(WebKit::WebPage::performDictionaryLookupForRange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166144 => 166145)


--- trunk/Source/WebCore/ChangeLog	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/ChangeLog	2014-03-23 21:41:17 UTC (rev 166145)
@@ -1,3 +1,25 @@
+2014-03-23  Sam Weinig  <s...@webkit.org>
+
+        Simplify the HTMLConverter interface (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=130654
+
+        Reviewed by Darin Adler.
+
+        Switch HTMLConverter from using an Objective-C interface to C functions.
+
+        * WebCore.exp.in:
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::writeSelectionToPasteboard):
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::dataSelectionForPasteboard):
+        (WebCore::Editor::writeSelectionToPasteboard):
+        * platform/ios/PasteboardIOS.mm:
+        * platform/mac/HTMLConverter.h:
+        * platform/mac/HTMLConverter.mm:
+        (WebCore::attributedStringFromRange):
+        (WebCore::editingAttributedStringFromRange):
+        * platform/mac/PasteboardMac.mm:
+
 2014-03-23  Darin Adler  <da...@apple.com>
 
         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout

Modified: trunk/Source/WebCore/WebCore.exp.in (166144 => 166145)


--- trunk/Source/WebCore/WebCore.exp.in	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-03-23 21:41:17 UTC (rev 166145)
@@ -2109,7 +2109,6 @@
 .objc_class_name_WebCoreFullScreenWarningView
 .objc_class_name_WebCoreFullScreenWindow
 .objc_class_name_WebFontCache
-.objc_class_name_WebHTMLConverter
 .objc_class_name_WebWindowFadeAnimation
 .objc_class_name_WebWindowScaleAnimation
 __ZN7WebCore10FloatPointC1ERK8_NSPoint
@@ -2195,6 +2194,7 @@
 __ZN7WebCore32applicationIsAOLInstantMessengerEv
 __ZN7WebCore32contextMenuItemTagInspectElementEv
 __ZN7WebCore32contextMenuItemTagSmartCopyPasteEv
+__ZN7WebCore32editingAttributedStringFromRangeERNS_5RangeE
 __ZN7WebCore32useBlockedPlugInContextMenuTitleEv
 __ZN7WebCore33contextMenuItemTagTextReplacementEv
 __ZN7WebCore33postScriptDocumentTypeDescriptionEv

Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (166144 => 166145)


--- trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -297,12 +297,6 @@
     applyStyleToSelection(defaultStyle.get(), EditActionChangeAttributes);
 }
 
-// FIXME: the following fuctions should be shared between Mac and iOS.
-static NSAttributedString *attributedStringForRange(Range& range)
-{
-    return [WebHTMLConverter attributedStringFromRange:&range];
-}
-
 static PassRefPtr<SharedBuffer> dataInRTFDFormat(NSAttributedString *string)
 {
     NSUInteger length = [string length];
@@ -330,7 +324,7 @@
 
 void Editor::writeSelectionToPasteboard(Pasteboard& pasteboard)
 {
-    NSAttributedString *attributedString = attributedStringForRange(*selectedRange());
+    NSAttributedString *attributedString = attributedStringFromRange(selectedRange());
 
     PasteboardWebContent content;
     content.canSmartCopyOrDelete = canSmartCopyOrDelete();

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (166144 => 166145)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -303,12 +303,7 @@
         range->setStart(enclosingAnchor, 0, IGNORE_EXCEPTION);
     return range;
 }
-
-static NSAttributedString *attributedStringForRange(Range& range)
-{
-    return [WebHTMLConverter attributedStringFromRange:&range];
-}
-
+    
 static PassRefPtr<SharedBuffer> dataInRTFDFormat(NSAttributedString *string)
 {
     NSUInteger length = [string length];
@@ -335,10 +330,10 @@
         return selectionInWebArchiveFormat();
 
     if (pasteboardType == String(NSRTFDPboardType))
-       return dataInRTFDFormat(attributedStringForRange(*adjustedSelectionRange()));
+       return dataInRTFDFormat(attributedStringFromRange(*adjustedSelectionRange()));
 
     if (pasteboardType == String(NSRTFPboardType)) {
-        NSAttributedString* attributedString = attributedStringForRange(*adjustedSelectionRange());
+        NSAttributedString* attributedString = attributedStringFromRange(*adjustedSelectionRange());
         // FIXME: Why is this attachment character stripping needed here, but not needed in writeSelectionToPasteboard?
         if ([attributedString containsAttachments])
             attributedString = attributedStringByStrippingAttachmentCharacters(attributedString);
@@ -350,7 +345,7 @@
 
 void Editor::writeSelectionToPasteboard(Pasteboard& pasteboard)
 {
-    NSAttributedString *attributedString = attributedStringForRange(*selectedRange());
+    NSAttributedString *attributedString = attributedStringFromRange(*selectedRange());
 
     PasteboardWebContent content;
     content.canSmartCopyOrDelete = canSmartCopyOrDelete();

Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (166144 => 166145)


--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -35,7 +35,6 @@
 #import "Frame.h"
 #import "FrameLoader.h"
 #import "FrameLoaderClient.h"
-#import "HTMLConverter.h"
 #import "HTMLElement.h"
 #import "HTMLNames.h"
 #import "HTMLParserIdioms.h"

Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.h (166144 => 166145)


--- trunk/Source/WebCore/platform/mac/HTMLConverter.h	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.h	2014-03-23 21:41:17 UTC (rev 166145)
@@ -23,66 +23,20 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-@class DOMDocument;
-@class DOMRange;
+#ifndef HTMLConverter_h
+#define HTMLConverter_h
 
-namespace WebCore {
-    class DocumentLoader;
-    class Range;
-}
+OBJC_CLASS NSAttributedString;
 
-class HTMLConverterCaches;
-
-@interface WebHTMLConverter : NSObject {
-    NSMutableAttributedString *_attrStr;
-    NSMutableDictionary *_documentAttrs;
-    NSURL *_baseURL;
-    DOMDocument *_document;
-    DOMRange *_domRange;
-    NSMutableArray *_domStartAncestors;
-    WebCore::DocumentLoader *_dataSource;
-    NSString *_standardFontFamily;
-    CGFloat _textSizeMultiplier;
-    CGFloat _webViewTextSizeMultiplier;
-    CGFloat _defaultTabInterval;
-    CGFloat _defaultFontSize;
-    CGFloat _minimumFontSize;
-    NSMutableArray *_textLists;
-    NSMutableArray *_textBlocks;
-    NSMutableArray *_textTables;
-    NSMutableDictionary *_textTableFooters;
-    NSMutableArray *_textTableSpacings;
-    NSMutableArray *_textTablePaddings;
-    NSMutableArray *_textTableRows;
-    NSMutableArray *_textTableRowArrays;
-    NSMutableArray *_textTableRowBackgroundColors;
-    NSMutableDictionary *_colorsForNodes;
-    NSMutableDictionary *_attributesForElements;
-    NSMutableDictionary *_fontCache;
-    NSMutableArray *_writingDirectionArray;
-    NSUInteger _domRangeStartIndex;
-    NSInteger _indexingLimit;
-    NSUInteger _thumbnailLimit;
-    NSInteger _errorCode;
-    NSInteger _quoteLevel;
-
-    std::unique_ptr<HTMLConverterCaches> _caches;
-
-    struct {
-        unsigned int isSoft:1;
-        unsigned int reachedStart:1;
-        unsigned int reachedEnd:1;
-        unsigned int isIndexing:1;
-        unsigned int isTesting:1;
-        unsigned int hasTrailingNewline:1;
-        unsigned int pad:26;
-    } _flags;
-}
-
-
-+ (NSAttributedString *)attributedStringFromRange:(WebCore::Range*)range;
+namespace WebCore {
+    
+class Range;
+    
+NSAttributedString *attributedStringFromRange(Range&);
 #if !PLATFORM(IOS)
-+ (NSAttributedString *)editingAttributedStringFromRange:(WebCore::Range*)range;
+NSAttributedString *editingAttributedStringFromRange(Range&);
 #endif
-@end
 
+}
+
+#endif // HTMLConverter_h

Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (166144 => 166145)


--- trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -428,6 +428,58 @@
 + (void)document:(NSObject **)outDocument attachment:(NSTextAttachment **)outAttachment forURL:(NSURL *)url;
 @end
 
+@interface WebHTMLConverter : NSObject {
+    NSMutableAttributedString *_attrStr;
+    NSMutableDictionary *_documentAttrs;
+    NSURL *_baseURL;
+    DOMDocument *_document;
+    DOMRange *_domRange;
+    NSMutableArray *_domStartAncestors;
+    WebCore::DocumentLoader *_dataSource;
+    NSString *_standardFontFamily;
+    CGFloat _textSizeMultiplier;
+    CGFloat _webViewTextSizeMultiplier;
+    CGFloat _defaultTabInterval;
+    CGFloat _defaultFontSize;
+    CGFloat _minimumFontSize;
+    NSMutableArray *_textLists;
+    NSMutableArray *_textBlocks;
+    NSMutableArray *_textTables;
+    NSMutableDictionary *_textTableFooters;
+    NSMutableArray *_textTableSpacings;
+    NSMutableArray *_textTablePaddings;
+    NSMutableArray *_textTableRows;
+    NSMutableArray *_textTableRowArrays;
+    NSMutableArray *_textTableRowBackgroundColors;
+    NSMutableDictionary *_colorsForNodes;
+    NSMutableDictionary *_attributesForElements;
+    NSMutableDictionary *_fontCache;
+    NSMutableArray *_writingDirectionArray;
+    NSUInteger _domRangeStartIndex;
+    NSInteger _indexingLimit;
+    NSUInteger _thumbnailLimit;
+    NSInteger _errorCode;
+    NSInteger _quoteLevel;
+
+    std::unique_ptr<HTMLConverterCaches> _caches;
+
+    struct {
+        unsigned int isSoft:1;
+        unsigned int reachedStart:1;
+        unsigned int reachedEnd:1;
+        unsigned int isIndexing:1;
+        unsigned int isTesting:1;
+        unsigned int hasTrailingNewline:1;
+        unsigned int pad:26;
+    } _flags;
+}
+
++ (NSAttributedString *)attributedStringFromRange:(Range*)range;
+#if !PLATFORM(IOS)
++ (NSAttributedString *)editingAttributedStringFromRange:(Range*)range;
+#endif
+@end
+
 @interface WebHTMLConverter(WebHTMLConverterInternal)
 
 - (id)init;
@@ -2578,3 +2630,19 @@
 }
 
 #endif
+
+namespace WebCore {
+    
+NSAttributedString *attributedStringFromRange(Range& range)
+{
+    return [WebHTMLConverter attributedStringFromRange:&range];
+}
+    
+#if !PLATFORM(IOS)
+NSAttributedString *editingAttributedStringFromRange(Range& range)
+{
+    return [WebHTMLConverter editingAttributedStringFromRange:&range];
+}
+#endif
+    
+}

Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (166144 => 166145)


--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -41,7 +41,6 @@
 #import "FrameLoaderClient.h"
 #import "HitTestResult.h"
 #import "HTMLAnchorElement.h"
-#import "HTMLConverter.h"
 #import "htmlediting.h"
 #import "HTMLNames.h"
 #import "Image.h"

Modified: trunk/Source/WebKit/mac/ChangeLog (166144 => 166145)


--- trunk/Source/WebKit/mac/ChangeLog	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-03-23 21:41:17 UTC (rev 166145)
@@ -1,3 +1,17 @@
+2014-03-23  Sam Weinig  <s...@webkit.org>
+
+        Simplify the HTMLConverter interface (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=130654
+
+        Reviewed by Darin Adler.
+
+        * WebView/WebHTMLRepresentation.mm:
+        (-[WebHTMLRepresentation attributedStringFrom:startOffset:to:endOffset:]):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView attributedSubstringFromRange:]):
+        (-[WebHTMLView attributedString]):
+        (-[WebHTMLView selectedAttributedString]):
+
 2014-03-23  Darin Adler  <da...@apple.com>
 
         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm (166144 => 166145)


--- trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -277,7 +277,7 @@
 
 - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset
 {
-    return [WebHTMLConverter editingAttributedStringFromRange:Range::create(core(startNode)->document(), core(startNode), startOffset, core(endNode), endOffset).get()];
+    return editingAttributedStringFromRange(*Range::create(core(startNode)->document(), core(startNode), startOffset, core(endNode), endOffset).get());
 }
 #endif
 

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (166144 => 166145)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -6170,9 +6170,9 @@
         return nil;
     }
 
-    NSAttributedString *result = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
+    NSAttributedString *result = editingAttributedStringFromRange(*range);
     
-    // [WebHTMLConverter editingAttributedStringFromRange:]  insists on inserting a trailing 
+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
     // whitespace at the end of the string which breaks the ATOK input method.  <rdar://problem/5400551>
     // To work around this we truncate the resultant string to the correct length.
     if ([result length] > nsRange.length) {
@@ -6642,7 +6642,7 @@
     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
     if (!attributedString) {
         Document* coreDocument = core(document);
-        attributedString = [WebHTMLConverter editingAttributedStringFromRange:Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument->childNodeCount()).get()];
+        attributedString = editingAttributedStringFromRange(*Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument->childNodeCount()).get());
     }
     return attributedString;
 }
@@ -6661,7 +6661,10 @@
         Frame* coreFrame = core([self _frame]);
         if (coreFrame) {
             RefPtr<Range> range = coreFrame->selection().selection().toNormalizedRange();
-            attributedString = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
+            if (range)
+                attributedString = editingAttributedStringFromRange(*range);
+            else
+                attributedString = [[[NSAttributedString alloc] init] autorelease];
         }
     }
     return attributedString;

Modified: trunk/Source/WebKit2/ChangeLog (166144 => 166145)


--- trunk/Source/WebKit2/ChangeLog	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-23 21:41:17 UTC (rev 166145)
@@ -1,3 +1,20 @@
+2014-03-23  Sam Weinig  <s...@webkit.org>
+
+        Simplify the HTMLConverter interface (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=130654
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::performDictionaryLookupForRange):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::getAttributedSubstringFromRange):
+        (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
+        (WebKit::WebPage::performDictionaryLookupAtLocation):
+        (WebKit::WebPage::performDictionaryLookupForSelection):
+        (WebKit::WebPage::performDictionaryLookupForRange):
+
 2014-03-23  David Kilzer  <ddkil...@apple.com>
 
         WebKit::resistanceForDelta() truncates 'scaleDistance' to integer value using abs()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (166144 => 166145)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-03-23 21:41:17 UTC (rev 166145)
@@ -882,7 +882,7 @@
 
 #if PLATFORM(COCOA)
     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
-    void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range*, NSDictionary *options);
+    void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options);
 
     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (166144 => 166145)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -171,7 +171,7 @@
     notImplemented();
 }
 
-void WebPage::performDictionaryLookupForRange(Frame*, Range*, NSDictionary *)
+void WebPage::performDictionaryLookupForRange(Frame*, Range&, NSDictionary *)
 {
     notImplemented();
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (166144 => 166145)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2014-03-23 21:37:56 UTC (rev 166144)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2014-03-23 21:41:17 UTC (rev 166145)
@@ -347,10 +347,10 @@
     if (!range)
         return;
 
-    result.string = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
+    result.string = editingAttributedStringFromRange(*range);
     NSAttributedString* attributedString = result.string.get();
     
-    // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing 
+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
     // whitespace at the end of the string which breaks the ATOK input method.  <rdar://problem/5400551>
     // To work around this we truncate the resultant string to the correct length.
     if ([attributedString length] > editingRange.length) {
@@ -441,10 +441,10 @@
         return;
     }
 
-    result.string = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
+    result.string = editingAttributedStringFromRange(*range);
     NSAttributedString* attributedString = result.string.get();
     
-    // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing 
+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
     // whitespace at the end of the string which breaks the ATOK input method.  <rdar://problem/5400551>
     // To work around this we truncate the resultant string to the correct length.
     if ([attributedString length] > editingRange.length) {
@@ -552,7 +552,7 @@
     if (!finalRange)
         return;
 
-    performDictionaryLookupForRange(frame, finalRange.get(), options);
+    performDictionaryLookupForRange(frame, *finalRange, options);
 }
 
 void WebPage::performDictionaryLookupForSelection(Frame* frame, const VisibleSelection& selection)
@@ -579,19 +579,19 @@
     // Since we already have the range we want, we just need to grab the returned options.
     WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, &options);
 
-    performDictionaryLookupForRange(frame, selectedRange.get(), options);
+    performDictionaryLookupForRange(frame, *selectedRange, options);
 }
 
-void WebPage::performDictionaryLookupForRange(Frame* frame, Range* range, NSDictionary *options)
+void WebPage::performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options)
 {
-    if (range->text().stripWhiteSpace().isEmpty())
+    if (range.text().stripWhiteSpace().isEmpty())
         return;
     
-    RenderObject* renderer = range->startContainer()->renderer();
+    RenderObject* renderer = range.startContainer()->renderer();
     const RenderStyle& style = renderer->style();
 
     Vector<FloatQuad> quads;
-    range->textQuads(quads);
+    range.textQuads(quads);
     if (quads.isEmpty())
         return;
 
@@ -601,7 +601,7 @@
     dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().ascent() * pageScaleFactor()));
     dictionaryPopupInfo.options = (CFDictionaryRef)options;
 
-    NSAttributedString *nsAttributedString = [WebHTMLConverter editingAttributedStringFromRange:range];
+    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range);
 
     RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to