BUILD FIX (r150140): Frame::editor() should return a reference for iOS, too
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 01:24:19 +0000 (01:24 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 01:24:19 +0000 (01:24 +0000)
* platform/ios/ClipboardIOS.mm:
(WebCore::ClipboardIOS::ClipboardIOS):
(WebCore::ClipboardIOS::hasData):
(WebCore::ClipboardIOS::clearData):
(WebCore::ClipboardIOS::clearAllData):
(WebCore::ClipboardIOS::getData):
(WebCore::ClipboardIOS::setData):
(WebCore::ClipboardIOS::types):
(WebCore::ClipboardIOS::writeRange):
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::getStringSelection):
(WebCore::Pasteboard::writeSelection):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::writeImage):
(WebCore::Pasteboard::plainText):
(WebCore::documentFragmentWithRTF):
(WebCore::Pasteboard::documentFragmentForPasteboardItemAtIndex):
(WebCore::Pasteboard::documentFragment):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150166 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/ClipboardIOS.mm
Source/WebCore/platform/ios/PasteboardIOS.mm

index ae3df88dd4b22f7db7bf5ab0bf2530ecdfa85792..6599841c28af21bfc572c2644fddb902188c38d4 100644 (file)
@@ -1,3 +1,26 @@
+2013-05-15  David Kilzer  <ddkilzer@apple.com>
+
+        BUILD FIX (r150140): Frame::editor() should return a reference for iOS, too
+
+        * platform/ios/ClipboardIOS.mm:
+        (WebCore::ClipboardIOS::ClipboardIOS):
+        (WebCore::ClipboardIOS::hasData):
+        (WebCore::ClipboardIOS::clearData):
+        (WebCore::ClipboardIOS::clearAllData):
+        (WebCore::ClipboardIOS::getData):
+        (WebCore::ClipboardIOS::setData):
+        (WebCore::ClipboardIOS::types):
+        (WebCore::ClipboardIOS::writeRange):
+        * platform/ios/PasteboardIOS.mm:
+        (WebCore::Pasteboard::getStringSelection):
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::writePlainText):
+        (WebCore::Pasteboard::writeImage):
+        (WebCore::Pasteboard::plainText):
+        (WebCore::documentFragmentWithRTF):
+        (WebCore::Pasteboard::documentFragmentForPasteboardItemAtIndex):
+        (WebCore::Pasteboard::documentFragment):
+
 2013-05-15  Anders Carlsson  <andersca@apple.com>
 
         Stop using the factory pattern in FileIconLoaderClient
index 8ddf4c0c778bb5882feea6d06441029d2ba39143..0c9b7138b7ff1aa848a95b1f5d0c38cd9d9fc294 100644 (file)
@@ -60,7 +60,7 @@ ClipboardIOS::ClipboardIOS(ClipboardType clipboardType, ClipboardAccessPolicy po
     : Clipboard(policy, clipboardType)
     , m_frame(frame)
 {
-    m_changeCount = m_frame->editor()->client()->pasteboardChangeCount();
+    m_changeCount = m_frame->editor().client()->pasteboardChangeCount();
 }
 
 ClipboardIOS::~ClipboardIOS()
@@ -69,7 +69,7 @@ ClipboardIOS::~ClipboardIOS()
 
 bool ClipboardIOS::hasData()
 {
-    return m_frame->editor()->client()->getPasteboardItemsCount() != 0;
+    return m_frame->editor().client()->getPasteboardItemsCount() != 0;
 }
 
 static String utiTypeFromCocoaType(NSString* type)
@@ -138,7 +138,7 @@ void ClipboardIOS::clearData(const String& type)
     if (RetainPtr<NSString> cocoaType = cocoaTypeFromHTMLClipboardType(type)) {
         RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
         [representations.get() setValue:0 forKey:cocoaType.get()];
-        m_frame->editor()->client()->writeDataToPasteboard(representations.get());
+        m_frame->editor().client()->writeDataToPasteboard(representations.get());
     }
 }
 
@@ -148,7 +148,7 @@ void ClipboardIOS::clearAllData()
         return;
 
     RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
-    m_frame->editor()->client()->writeDataToPasteboard(representations.get());
+    m_frame->editor().client()->writeDataToPasteboard(representations.get());
 }
 
 String ClipboardIOS::getData(const String& type) const
@@ -160,7 +160,7 @@ String ClipboardIOS::getData(const String& type) const
     NSString *cocoaValue = nil;
 
     // Grab the value off the pasteboard corresponding to the cocoaType.
-    RetainPtr<NSArray> pasteboardItem = m_frame->editor()->client()->readDataFromPasteboard(cocoaType.get(), 0);
+    RetainPtr<NSArray> pasteboardItem = m_frame->editor().client()->readDataFromPasteboard(cocoaType.get(), 0);
 
     if ([pasteboardItem.get() count] == 0)
         return String();
@@ -195,7 +195,7 @@ String ClipboardIOS::getData(const String& type) const
 
     // Enforce changeCount ourselves for security.  We check after reading instead of before to be
     // sure it doesn't change between our testing the change count and accessing the data.
-    if (cocoaValue && m_changeCount == m_frame->editor()->client()->pasteboardChangeCount())
+    if (cocoaValue && m_changeCount == m_frame->editor().client()->pasteboardChangeCount())
         return cocoaValue;
 
     return String();
@@ -214,7 +214,7 @@ bool ClipboardIOS::setData(const String& type, const String& data)
     if ([cocoaType.get() isEqualToString:(NSString*)kUTTypeURL]) {
         RetainPtr<NSURL> url = adoptNS([[NSURL alloc] initWithString:cocoaData]);
         [representations.get() setValue:url.get() forKey:(NSString*)kUTTypeURL];
-        m_frame->editor()->client()->writeDataToPasteboard(representations.get());
+        m_frame->editor().client()->writeDataToPasteboard(representations.get());
         return true;
     }
 
@@ -222,7 +222,7 @@ bool ClipboardIOS::setData(const String& type, const String& data)
         // Everything else we know of goes on the pboard as the original string
         // we received as parameter.
         [representations.get() setValue:cocoaData forKey:cocoaType.get()];
-        m_frame->editor()->client()->writeDataToPasteboard(representations.get());
+        m_frame->editor().client()->writeDataToPasteboard(representations.get());
         return true;
     }
 
@@ -238,7 +238,7 @@ ListHashSet<String> ClipboardIOS::types() const
 
     // Enforce changeCount ourselves for security.  We check after reading instead of before to be
     // sure it doesn't change between our testing the change count and accessing the data.
-    if (m_changeCount != m_frame->editor()->client()->pasteboardChangeCount())
+    if (m_changeCount != m_frame->editor().client()->pasteboardChangeCount())
         return ListHashSet<String>();
 
     ListHashSet<String> result;
@@ -260,7 +260,7 @@ void ClipboardIOS::writeRange(Range* range, Frame* frame)
 {
     ASSERT(range);
     ASSERT(frame);
-    Pasteboard::generalPasteboard()->writeSelection(range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame);
+    Pasteboard::generalPasteboard()->writeSelection(range, frame->editor().smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame);
 }
 
 void ClipboardIOS::writePlainText(const String& text)
index 6f6d24c53fe70ac96c7c4e6767d8fab2a6106002..b09cc4f603669f0ccc54768520e82a1efcfbdc3e 100644 (file)
@@ -116,7 +116,7 @@ void Pasteboard::clear()
 
 String Pasteboard::getStringSelection(Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
 {
-    String text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor()->selectedTextForClipboard() : frame->editor()->selectedText();
+    String text = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText();
     text.replace(noBreakSpace, ' ');
     return text;
 }
@@ -135,7 +135,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool /*canSmartCopyOrDelet
     if (enclosingAnchor && comparePositions(firstPositionInOrBeforeNode(selectedRange->startPosition().anchorNode()), selectedRange->startPosition()) >= 0)
         selectedRange->setStart(enclosingAnchor, 0, ec);
 
-    frame->editor()->client()->didSetSelectionTypesForPasteboard();
+    frame->editor().client()->didSetSelectionTypesForPasteboard();
 
     RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
 
@@ -161,7 +161,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool /*canSmartCopyOrDelet
     // Put plain string on the pasteboard.
     [representations.get() setValue:getStringSelection(frame, shouldSerializeSelectedTextForClipboard) forKey:(NSString *)kUTTypeText];
 
-    frame->editor()->client()->writeDataToPasteboard(representations.get());
+    frame->editor().client()->writeDataToPasteboard(representations.get());
 }
 
 void Pasteboard::writePlainText(const String& text, Frame *frame)
@@ -170,7 +170,7 @@ void Pasteboard::writePlainText(const String& text, Frame *frame)
 
     RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
     [representations.get() setValue:text forKey:(NSString *)kUTTypeText];
-    frame->editor()->client()->writeDataToPasteboard(representations.get());
+    frame->editor().client()->writeDataToPasteboard(representations.get());
 }
 
 void Pasteboard::writeImage(Node* node, Frame* frame)
@@ -200,7 +200,7 @@ void Pasteboard::writeImage(Node* node, Frame* frame)
         [dictionary.get() setObject:imageData.get() forKey:(NSString *)uti.get()];
         [dictionary.get() setObject:(NSString *)node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(static_cast<HTMLElement*>(node)->getAttribute("src"))) forKey:(NSString *)kUTTypeURL];
     }
-    frame->editor()->client()->writeDataToPasteboard(dictionary.get());
+    frame->editor().client()->writeDataToPasteboard(dictionary.get());
 }
 
 void Pasteboard::writePlainText(const String&, SmartReplaceOption)
@@ -218,7 +218,7 @@ bool Pasteboard::canSmartReplace()
 
 String Pasteboard::plainText(Frame* frame)
 {
-    RetainPtr<NSArray> pasteboardItem = frame->editor()->client()->readDataFromPasteboard((NSString *)kUTTypeText, 0);
+    RetainPtr<NSArray> pasteboardItem = frame->editor().client()->readDataFromPasteboard((NSString *)kUTTypeText, 0);
 
     if ([pasteboardItem.get() count] == 0)
         return String();
@@ -300,7 +300,7 @@ static PassRefPtr<DocumentFragment> documentFragmentWithRTF(Frame* frame, NSStri
         frame->page()->setDefersLoading(true);
 
     Vector<RefPtr<ArchiveResource> > resources;
-    RefPtr<DocumentFragment> fragment = frame->editor()->client()->documentFragmentFromAttributedString(string.get(), resources);
+    RefPtr<DocumentFragment> fragment = frame->editor().client()->documentFragmentFromAttributedString(string.get(), resources);
 
     size_t size = resources.size();
     if (size) {
@@ -317,20 +317,20 @@ static PassRefPtr<DocumentFragment> documentFragmentWithRTF(Frame* frame, NSStri
 
 PassRefPtr<DocumentFragment> Pasteboard::documentFragmentForPasteboardItemAtIndex(Frame* frame, int index, bool allowPlainText, bool& chosePlainText)
 {
-    RefPtr<DocumentFragment> fragment = frame->editor()->client()->documentFragmentFromDelegate(index);
+    RefPtr<DocumentFragment> fragment = frame->editor().client()->documentFragmentFromDelegate(index);
     if (fragment)
         return fragment.release();
 
     // First try to ask the client about the supported types. It will return null if the client
     // has no selection.
-    NSArray *supportedTypes = frame->editor()->client()->supportedPasteboardTypesForCurrentSelection();
+    NSArray *supportedTypes = frame->editor().client()->supportedPasteboardTypesForCurrentSelection();
     if (!supportedTypes)
         supportedTypes = supportedPasteboardTypes();
     int numberOfTypes = [supportedTypes count];
 
     for (int i = 0; i < numberOfTypes; i++) {
         NSString *type = [supportedTypes objectAtIndex:i];
-        RetainPtr<NSArray> pasteboardItem = frame->editor()->client()->readDataFromPasteboard(type, index);
+        RetainPtr<NSArray> pasteboardItem = frame->editor().client()->readDataFromPasteboard(type, index);
 
         if ([pasteboardItem.get() count] == 0)
             continue;
@@ -380,7 +380,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragmentForPasteboardItemAtInde
             }
             NSURL *url = (NSURL *)value;
 
-            if (!frame->editor()->client()->hasRichlyEditableSelection()) {
+            if (!frame->editor().client()->hasRichlyEditableSelection()) {
                 fragment = createFragmentFromText(frame->selection()->toNormalizedRange().get(), [url absoluteString]);
                 if (fragment)
                     return fragment.release();
@@ -427,7 +427,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
     if (!frame)
         return 0;
 
-    int numberOfItems = frame->editor()->client()->getPasteboardItemsCount();
+    int numberOfItems = frame->editor().client()->getPasteboardItemsCount();
 
     if (!numberOfItems)
         return 0;