<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166145] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166145">166145</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-03-23 14:41:17 -0700 (Sun, 23 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreeditingiosEditorIOSmm">trunk/Source/WebCore/editing/ios/EditorIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosPasteboardIOSmm">trunk/Source/WebCore/platform/ios/PasteboardIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacHTMLConverterh">trunk/Source/WebCore/platform/mac/HTMLConverter.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacHTMLConvertermm">trunk/Source/WebCore/platform/mac/HTMLConverter.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPasteboardMacmm">trunk/Source/WebCore/platform/mac/PasteboardMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLRepresentationmm">trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-03-23  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        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:
+
</ins><span class="cx"> 2014-03-23  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2109,7 +2109,6 @@
</span><span class="cx"> .objc_class_name_WebCoreFullScreenWarningView
</span><span class="cx"> .objc_class_name_WebCoreFullScreenWindow
</span><span class="cx"> .objc_class_name_WebFontCache
</span><del>-.objc_class_name_WebHTMLConverter
</del><span class="cx"> .objc_class_name_WebWindowFadeAnimation
</span><span class="cx"> .objc_class_name_WebWindowScaleAnimation
</span><span class="cx"> __ZN7WebCore10FloatPointC1ERK8_NSPoint
</span><span class="lines">@@ -2195,6 +2194,7 @@
</span><span class="cx"> __ZN7WebCore32applicationIsAOLInstantMessengerEv
</span><span class="cx"> __ZN7WebCore32contextMenuItemTagInspectElementEv
</span><span class="cx"> __ZN7WebCore32contextMenuItemTagSmartCopyPasteEv
</span><ins>+__ZN7WebCore32editingAttributedStringFromRangeERNS_5RangeE
</ins><span class="cx"> __ZN7WebCore32useBlockedPlugInContextMenuTitleEv
</span><span class="cx"> __ZN7WebCore33contextMenuItemTagTextReplacementEv
</span><span class="cx"> __ZN7WebCore33postScriptDocumentTypeDescriptionEv
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingiosEditorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -297,12 +297,6 @@
</span><span class="cx">     applyStyleToSelection(defaultStyle.get(), EditActionChangeAttributes);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: the following fuctions should be shared between Mac and iOS.
-static NSAttributedString *attributedStringForRange(Range&amp; range)
-{
-    return [WebHTMLConverter attributedStringFromRange:&amp;range];
-}
-
</del><span class="cx"> static PassRefPtr&lt;SharedBuffer&gt; dataInRTFDFormat(NSAttributedString *string)
</span><span class="cx"> {
</span><span class="cx">     NSUInteger length = [string length];
</span><span class="lines">@@ -330,7 +324,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Editor::writeSelectionToPasteboard(Pasteboard&amp; pasteboard)
</span><span class="cx"> {
</span><del>-    NSAttributedString *attributedString = attributedStringForRange(*selectedRange());
</del><ins>+    NSAttributedString *attributedString = attributedStringFromRange(selectedRange());
</ins><span class="cx"> 
</span><span class="cx">     PasteboardWebContent content;
</span><span class="cx">     content.canSmartCopyOrDelete = canSmartCopyOrDelete();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -303,12 +303,7 @@
</span><span class="cx">         range-&gt;setStart(enclosingAnchor, 0, IGNORE_EXCEPTION);
</span><span class="cx">     return range;
</span><span class="cx"> }
</span><del>-
-static NSAttributedString *attributedStringForRange(Range&amp; range)
-{
-    return [WebHTMLConverter attributedStringFromRange:&amp;range];
-}
-
</del><ins>+    
</ins><span class="cx"> static PassRefPtr&lt;SharedBuffer&gt; dataInRTFDFormat(NSAttributedString *string)
</span><span class="cx"> {
</span><span class="cx">     NSUInteger length = [string length];
</span><span class="lines">@@ -335,10 +330,10 @@
</span><span class="cx">         return selectionInWebArchiveFormat();
</span><span class="cx"> 
</span><span class="cx">     if (pasteboardType == String(NSRTFDPboardType))
</span><del>-       return dataInRTFDFormat(attributedStringForRange(*adjustedSelectionRange()));
</del><ins>+       return dataInRTFDFormat(attributedStringFromRange(*adjustedSelectionRange()));
</ins><span class="cx"> 
</span><span class="cx">     if (pasteboardType == String(NSRTFPboardType)) {
</span><del>-        NSAttributedString* attributedString = attributedStringForRange(*adjustedSelectionRange());
</del><ins>+        NSAttributedString* attributedString = attributedStringFromRange(*adjustedSelectionRange());
</ins><span class="cx">         // FIXME: Why is this attachment character stripping needed here, but not needed in writeSelectionToPasteboard?
</span><span class="cx">         if ([attributedString containsAttachments])
</span><span class="cx">             attributedString = attributedStringByStrippingAttachmentCharacters(attributedString);
</span><span class="lines">@@ -350,7 +345,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Editor::writeSelectionToPasteboard(Pasteboard&amp; pasteboard)
</span><span class="cx"> {
</span><del>-    NSAttributedString *attributedString = attributedStringForRange(*selectedRange());
</del><ins>+    NSAttributedString *attributedString = attributedStringFromRange(*selectedRange());
</ins><span class="cx"> 
</span><span class="cx">     PasteboardWebContent content;
</span><span class="cx">     content.canSmartCopyOrDelete = canSmartCopyOrDelete();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosPasteboardIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #import &quot;Frame.h&quot;
</span><span class="cx"> #import &quot;FrameLoader.h&quot;
</span><span class="cx"> #import &quot;FrameLoaderClient.h&quot;
</span><del>-#import &quot;HTMLConverter.h&quot;
</del><span class="cx"> #import &quot;HTMLElement.h&quot;
</span><span class="cx"> #import &quot;HTMLNames.h&quot;
</span><span class="cx"> #import &quot;HTMLParserIdioms.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacHTMLConverterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.h (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -23,66 +23,20 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-@class DOMDocument;
-@class DOMRange;
</del><ins>+#ifndef HTMLConverter_h
+#define HTMLConverter_h
</ins><span class="cx"> 
</span><del>-namespace WebCore {
-    class DocumentLoader;
-    class Range;
-}
</del><ins>+OBJC_CLASS NSAttributedString;
</ins><span class="cx"> 
</span><del>-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&lt;HTMLConverterCaches&gt; _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;
</del><ins>+namespace WebCore {
+    
+class Range;
+    
+NSAttributedString *attributedStringFromRange(Range&amp;);
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><del>-+ (NSAttributedString *)editingAttributedStringFromRange:(WebCore::Range*)range;
</del><ins>+NSAttributedString *editingAttributedStringFromRange(Range&amp;);
</ins><span class="cx"> #endif
</span><del>-@end
</del><span class="cx"> 
</span><ins>+}
+
+#endif // HTMLConverter_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacHTMLConvertermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -428,6 +428,58 @@
</span><span class="cx"> + (void)document:(NSObject **)outDocument attachment:(NSTextAttachment **)outAttachment forURL:(NSURL *)url;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@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&lt;HTMLConverterCaches&gt; _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
+
</ins><span class="cx"> @interface WebHTMLConverter(WebHTMLConverterInternal)
</span><span class="cx"> 
</span><span class="cx"> - (id)init;
</span><span class="lines">@@ -2578,3 +2630,19 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><ins>+
+namespace WebCore {
+    
+NSAttributedString *attributedStringFromRange(Range&amp; range)
+{
+    return [WebHTMLConverter attributedStringFromRange:&amp;range];
+}
+    
+#if !PLATFORM(IOS)
+NSAttributedString *editingAttributedStringFromRange(Range&amp; range)
+{
+    return [WebHTMLConverter editingAttributedStringFromRange:&amp;range];
+}
+#endif
+    
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPasteboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> #import &quot;FrameLoaderClient.h&quot;
</span><span class="cx"> #import &quot;HitTestResult.h&quot;
</span><span class="cx"> #import &quot;HTMLAnchorElement.h&quot;
</span><del>-#import &quot;HTMLConverter.h&quot;
</del><span class="cx"> #import &quot;htmlediting.h&quot;
</span><span class="cx"> #import &quot;HTMLNames.h&quot;
</span><span class="cx"> #import &quot;Image.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-03-23  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        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]):
+
</ins><span class="cx"> 2014-03-23  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLRepresentationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -277,7 +277,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset
</span><span class="cx"> {
</span><del>-    return [WebHTMLConverter editingAttributedStringFromRange:Range::create(core(startNode)-&gt;document(), core(startNode), startOffset, core(endNode), endOffset).get()];
</del><ins>+    return editingAttributedStringFromRange(*Range::create(core(startNode)-&gt;document(), core(startNode), startOffset, core(endNode), endOffset).get());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -6170,9 +6170,9 @@
</span><span class="cx">         return nil;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    NSAttributedString *result = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
</del><ins>+    NSAttributedString *result = editingAttributedStringFromRange(*range);
</ins><span class="cx">     
</span><del>-    // [WebHTMLConverter editingAttributedStringFromRange:]  insists on inserting a trailing 
</del><ins>+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
</ins><span class="cx">     // whitespace at the end of the string which breaks the ATOK input method.  &lt;rdar://problem/5400551&gt;
</span><span class="cx">     // To work around this we truncate the resultant string to the correct length.
</span><span class="cx">     if ([result length] &gt; nsRange.length) {
</span><span class="lines">@@ -6642,7 +6642,7 @@
</span><span class="cx">     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
</span><span class="cx">     if (!attributedString) {
</span><span class="cx">         Document* coreDocument = core(document);
</span><del>-        attributedString = [WebHTMLConverter editingAttributedStringFromRange:Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument-&gt;childNodeCount()).get()];
</del><ins>+        attributedString = editingAttributedStringFromRange(*Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument-&gt;childNodeCount()).get());
</ins><span class="cx">     }
</span><span class="cx">     return attributedString;
</span><span class="cx"> }
</span><span class="lines">@@ -6661,7 +6661,10 @@
</span><span class="cx">         Frame* coreFrame = core([self _frame]);
</span><span class="cx">         if (coreFrame) {
</span><span class="cx">             RefPtr&lt;Range&gt; range = coreFrame-&gt;selection().selection().toNormalizedRange();
</span><del>-            attributedString = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
</del><ins>+            if (range)
+                attributedString = editingAttributedStringFromRange(*range);
+            else
+                attributedString = [[[NSAttributedString alloc] init] autorelease];
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return attributedString;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-03-23  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        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):
+
</ins><span class="cx"> 2014-03-23  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit::resistanceForDelta() truncates 'scaleDistance' to integer value using abs()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -882,7 +882,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&amp;);
</span><del>-    void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range*, NSDictionary *options);
</del><ins>+    void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&amp;, NSDictionary *options);
</ins><span class="cx"> 
</span><span class="cx">     void windowAndViewFramesChanged(const WebCore::FloatRect&amp; windowFrameInScreenCoordinates, const WebCore::FloatRect&amp; windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect&amp; viewFrameInWindowCoordinates, const WebCore::FloatPoint&amp; accessibilityViewCoordinates);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::performDictionaryLookupForRange(Frame*, Range*, NSDictionary *)
</del><ins>+void WebPage::performDictionaryLookupForRange(Frame*, Range&amp;, NSDictionary *)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (166144 => 166145)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -347,10 +347,10 @@
</span><span class="cx">     if (!range)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    result.string = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
</del><ins>+    result.string = editingAttributedStringFromRange(*range);
</ins><span class="cx">     NSAttributedString* attributedString = result.string.get();
</span><span class="cx">     
</span><del>-    // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing 
</del><ins>+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
</ins><span class="cx">     // whitespace at the end of the string which breaks the ATOK input method.  &lt;rdar://problem/5400551&gt;
</span><span class="cx">     // To work around this we truncate the resultant string to the correct length.
</span><span class="cx">     if ([attributedString length] &gt; editingRange.length) {
</span><span class="lines">@@ -441,10 +441,10 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    result.string = [WebHTMLConverter editingAttributedStringFromRange:range.get()];
</del><ins>+    result.string = editingAttributedStringFromRange(*range);
</ins><span class="cx">     NSAttributedString* attributedString = result.string.get();
</span><span class="cx">     
</span><del>-    // [WebHTMLConverter editingAttributedStringFromRange:] insists on inserting a trailing 
</del><ins>+    // WebCore::editingAttributedStringFromRange() insists on inserting a trailing
</ins><span class="cx">     // whitespace at the end of the string which breaks the ATOK input method.  &lt;rdar://problem/5400551&gt;
</span><span class="cx">     // To work around this we truncate the resultant string to the correct length.
</span><span class="cx">     if ([attributedString length] &gt; editingRange.length) {
</span><span class="lines">@@ -552,7 +552,7 @@
</span><span class="cx">     if (!finalRange)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    performDictionaryLookupForRange(frame, finalRange.get(), options);
</del><ins>+    performDictionaryLookupForRange(frame, *finalRange, options);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::performDictionaryLookupForSelection(Frame* frame, const VisibleSelection&amp; selection)
</span><span class="lines">@@ -579,19 +579,19 @@
</span><span class="cx">     // Since we already have the range we want, we just need to grab the returned options.
</span><span class="cx">     WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, &amp;options);
</span><span class="cx"> 
</span><del>-    performDictionaryLookupForRange(frame, selectedRange.get(), options);
</del><ins>+    performDictionaryLookupForRange(frame, *selectedRange, options);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::performDictionaryLookupForRange(Frame* frame, Range* range, NSDictionary *options)
</del><ins>+void WebPage::performDictionaryLookupForRange(Frame* frame, Range&amp; range, NSDictionary *options)
</ins><span class="cx"> {
</span><del>-    if (range-&gt;text().stripWhiteSpace().isEmpty())
</del><ins>+    if (range.text().stripWhiteSpace().isEmpty())
</ins><span class="cx">         return;
</span><span class="cx">     
</span><del>-    RenderObject* renderer = range-&gt;startContainer()-&gt;renderer();
</del><ins>+    RenderObject* renderer = range.startContainer()-&gt;renderer();
</ins><span class="cx">     const RenderStyle&amp; style = renderer-&gt;style();
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;FloatQuad&gt; quads;
</span><del>-    range-&gt;textQuads(quads);
</del><ins>+    range.textQuads(quads);
</ins><span class="cx">     if (quads.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -601,7 +601,7 @@
</span><span class="cx">     dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().ascent() * pageScaleFactor()));
</span><span class="cx">     dictionaryPopupInfo.options = (CFDictionaryRef)options;
</span><span class="cx"> 
</span><del>-    NSAttributedString *nsAttributedString = [WebHTMLConverter editingAttributedStringFromRange:range];
</del><ins>+    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range);
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSMutableAttributedString&gt; scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>