Title: [154575] trunk/Source
Revision
154575
Author
[email protected]
Date
2013-08-25 03:15:43 -0700 (Sun, 25 Aug 2013)

Log Message

Source/WebCore: No need for documentTypeString function in Frame
https://bugs.webkit.org/show_bug.cgi?id=120262

Reviewed by Andreas Kling.

* WebCore.exp.in: Removed export of Frame::documentTypeString.

* editing/markup.cpp:
(WebCore::documentTypeString): Added. Replaces the old Frame member function.
Makes more sense to have this here since it is both called by and calls code
in this file; somehow this function was left behind.
(WebCore::createFullMarkup): Changed to call the new function.
* editing/markup.h: Added documentTypeString function. Has to be exported
because LegacyWebArchive uses it; might be worth fixing that later.
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create): Changed to call the new function.
(WebCore::LegacyWebArchive::createFromSelection): Ditto.

* page/Frame.cpp: Removed Frame::documentTypeString.
* page/Frame.h: Ditto.

Source/WebKit/mac: Frame should not have a documentTypeString member function
https://bugs.webkit.org/show_bug.cgi?id=120262

Reviewed by Andreas Kling.

* WebView/WebFrame.mm: Removed _stringWithDocumentTypeStringAndMarkupString:
internal method, which was not used anywhere in WebKit. Internal methods are
only for use within WebKit, as opposed to public and private methods that can
be used outside.
* WebView/WebFrameInternal.h: Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154574 => 154575)


--- trunk/Source/WebCore/ChangeLog	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/ChangeLog	2013-08-25 10:15:43 UTC (rev 154575)
@@ -1,5 +1,28 @@
 2013-08-25  Darin Adler  <[email protected]>
 
+        No need for documentTypeString function in Frame
+        https://bugs.webkit.org/show_bug.cgi?id=120262
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.exp.in: Removed export of Frame::documentTypeString.
+
+        * editing/markup.cpp:
+        (WebCore::documentTypeString): Added. Replaces the old Frame member function.
+        Makes more sense to have this here since it is both called by and calls code
+        in this file; somehow this function was left behind.
+        (WebCore::createFullMarkup): Changed to call the new function.
+        * editing/markup.h: Added documentTypeString function. Has to be exported
+        because LegacyWebArchive uses it; might be worth fixing that later.
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create): Changed to call the new function.
+        (WebCore::LegacyWebArchive::createFromSelection): Ditto.
+
+        * page/Frame.cpp: Removed Frame::documentTypeString.
+        * page/Frame.h: Ditto.
+
+2013-08-25  Darin Adler  <[email protected]>
+
         Clipboard is in DOM directory, but ClipboardMac is in platform directory
         https://bugs.webkit.org/show_bug.cgi?id=120267
 

Modified: trunk/Source/WebCore/WebCore.exp.in (154574 => 154575)


--- trunk/Source/WebCore/WebCore.exp.in	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-08-25 10:15:43 UTC (rev 154575)
@@ -1586,7 +1586,6 @@
 __ZNK7WebCore5Frame15contentRendererEv
 __ZNK7WebCore5Frame15layerTreeAsTextEj
 __ZNK7WebCore5Frame16frameScaleFactorEv
-__ZNK7WebCore5Frame18documentTypeStringEv
 __ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv
 __ZNK7WebCore5Frame31displayStringModifiedByEncodingERKN3WTF6StringE
 __ZNK7WebCore5Range11startOffsetERi

Modified: trunk/Source/WebCore/editing/markup.cpp (154574 => 154575)


--- trunk/Source/WebCore/editing/markup.cpp	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/editing/markup.cpp	2013-08-25 10:15:43 UTC (rev 154575)
@@ -36,10 +36,8 @@
 #include "CSSValueKeywords.h"
 #include "ChildListMutationScope.h"
 #include "ContextFeatures.h"
-#if ENABLE(DELETION_UI)
-#include "DeleteButtonController.h"
-#endif
 #include "DocumentFragment.h"
+#include "DocumentType.h"
 #include "Editor.h"
 #include "ElementTraversal.h"
 #include "ExceptionCode.h"
@@ -64,6 +62,10 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuilder.h>
 
+#if ENABLE(DELETION_UI)
+#include "DeleteButtonController.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -922,24 +924,30 @@
     return fragment.release();
 }
 
+String documentTypeString(const Document& document)
+{
+    DocumentType* documentType = document.doctype();
+    if (!documentType)
+        return String();
+
+    return createMarkup(documentType);
+}
+
 String createFullMarkup(const Node* node)
 {
     if (!node)
         return String();
-        
+
     Document* document = node->document();
     if (!document)
         return String();
-        
-    Frame* frame = document->frame();
-    if (!frame)
-        return String();
 
-    // FIXME: This is never "for interchange". Is that right?    
+    // FIXME: This is never "for interchange". Is that right?
     String markupString = createMarkup(node, IncludeNode, 0);
+
     Node::NodeType nodeType = node->nodeType();
     if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE)
-        markupString = frame->documentTypeString() + markupString;
+        markupString = documentTypeString(*document) + markupString;
 
     return markupString;
 }
@@ -952,17 +960,13 @@
     Node* node = range->startContainer();
     if (!node)
         return String();
-        
+
     Document* document = node->document();
     if (!document)
         return String();
-        
-    Frame* frame = document->frame();
-    if (!frame)
-        return String();
 
-    // FIXME: This is always "for interchange". Is that right? See the previous method.
-    return frame->documentTypeString() + createMarkup(range, 0, AnnotateForInterchange);        
+    // FIXME: This is always "for interchange". Is that right?
+    return documentTypeString(*document) + createMarkup(range, 0, AnnotateForInterchange);
 }
 
 String urlToMarkup(const KURL& url, const String& title)

Modified: trunk/Source/WebCore/editing/markup.h (154574 => 154575)


--- trunk/Source/WebCore/editing/markup.h	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/editing/markup.h	2013-08-25 10:15:43 UTC (rev 154575)
@@ -72,6 +72,8 @@
 
 String urlToMarkup(const KURL&, const String& title);
 
+String documentTypeString(const Document&);
+
 }
 
 #endif // markup_h

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (154574 => 154575)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2013-08-25 10:15:43 UTC (rev 154575)
@@ -445,7 +445,7 @@
     String markupString = createMarkup(node, IncludeNode, &nodeList, DoNotResolveURLs, tagNamesToFilter.get());
     Node::NodeType nodeType = node->nodeType();
     if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE)
-        markupString = frame->documentTypeString() + markupString;
+        markupString = documentTypeString(*document) + markupString;
 
     return create(markupString, frame, nodeList, filter);
 }
@@ -494,7 +494,7 @@
     Vector<Node*> nodeList;
     
     // FIXME: This is always "for interchange". Is that right? See the previous method.
-    String markupString = frame->documentTypeString() + createMarkup(range, &nodeList, AnnotateForInterchange);
+    String markupString = documentTypeString(*document) + createMarkup(range, &nodeList, AnnotateForInterchange);
 
     return create(markupString, frame, nodeList, 0);
 }
@@ -589,14 +589,18 @@
 {
     if (!frame)
         return 0;
-    
+
+    Document* document = frame->document();
+    if (!document)
+        return 0;
+
     RefPtr<Range> selectionRange = frame->selection().toNormalizedRange();
     Vector<Node*> nodeList;
-    String markupString = frame->documentTypeString() + createMarkup(selectionRange.get(), &nodeList, AnnotateForInterchange);
-    
+    String markupString = documentTypeString(*document) + createMarkup(selectionRange.get(), &nodeList, AnnotateForInterchange);
+
     RefPtr<LegacyWebArchive> archive = create(markupString, frame, nodeList, 0);
     
-    if (!frame->document() || !frame->document()->isFrameSet())
+    if (!document->isFrameSet())
         return archive.release();
         
     // Wrap the frameset document in an iframe so it can be pasted into

Modified: trunk/Source/WebCore/page/Frame.cpp (154574 => 154575)


--- trunk/Source/WebCore/page/Frame.cpp	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/page/Frame.cpp	2013-08-25 10:15:43 UTC (rev 154575)
@@ -630,14 +630,6 @@
     m_ownerElement = 0;
 }
 
-String Frame::documentTypeString() const
-{
-    if (DocumentType* doctype = document()->doctype())
-        return createMarkup(doctype);
-
-    return String();
-}
-
 String Frame::displayStringModifiedByEncoding(const String& str) const
 {
     return document() ? document()->displayStringModifiedByEncoding(str) : str;

Modified: trunk/Source/WebCore/page/Frame.h (154574 => 154575)


--- trunk/Source/WebCore/page/Frame.h	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebCore/page/Frame.h	2013-08-25 10:15:43 UTC (rev 154575)
@@ -165,8 +165,6 @@
         int orientation() const { return m_orientation; }
 #endif
 
-        String documentTypeString() const;
-
         String displayStringModifiedByEncoding(const String&) const;
 
         DragImageRef nodeImage(Node*);

Modified: trunk/Source/WebKit/mac/ChangeLog (154574 => 154575)


--- trunk/Source/WebKit/mac/ChangeLog	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-08-25 10:15:43 UTC (rev 154575)
@@ -1,3 +1,16 @@
+2013-08-25  Darin Adler  <[email protected]>
+
+        Frame should not have a documentTypeString member function
+        https://bugs.webkit.org/show_bug.cgi?id=120262
+
+        Reviewed by Andreas Kling.
+
+        * WebView/WebFrame.mm: Removed _stringWithDocumentTypeStringAndMarkupString:
+        internal method, which was not used anywhere in WebKit. Internal methods are
+        only for use within WebKit, as opposed to public and private methods that can
+        be used outside.
+        * WebView/WebFrameInternal.h: Ditto.
+
 2013-08-24  Darin Adler  <[email protected]>
 
         Frame::tree should return a reference instead of a pointer

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (154574 => 154575)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2013-08-25 10:15:43 UTC (rev 154575)
@@ -478,11 +478,6 @@
     return dataSource(_private->coreFrame->loader().documentLoader());
 }
 
-- (NSString *)_stringWithDocumentTypeStringAndMarkupString:(NSString *)markupString
-{
-    return String(_private->coreFrame->documentTypeString() + String(markupString));
-}
-
 - (NSArray *)_nodesFromList:(Vector<Node*> *)nodesVector
 {
     size_t size = nodesVector->size();
@@ -492,17 +487,6 @@
     return nodes;
 }
 
-- (NSString *)_markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes
-{
-    // FIXME: This is always "for interchange". Is that right? See the previous method.
-    Vector<Node*> nodeList;
-    NSString *markupString = createMarkup(core(range), nodes ? &nodeList : 0, AnnotateForInterchange);
-    if (nodes)
-        *nodes = [self _nodesFromList:&nodeList];
-
-    return [self _stringWithDocumentTypeStringAndMarkupString:markupString];
-}
-
 - (NSString *)_selectedString
 {
     return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor().selectedText());

Modified: trunk/Source/WebKit/mac/WebView/WebFrameInternal.h (154574 => 154575)


--- trunk/Source/WebKit/mac/WebView/WebFrameInternal.h	2013-08-25 10:00:37 UTC (rev 154574)
+++ trunk/Source/WebKit/mac/WebView/WebFrameInternal.h	2013-08-25 10:15:43 UTC (rev 154575)
@@ -134,8 +134,6 @@
 - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
 - (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range;
 
-- (NSString *)_markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
-
 - (NSRect)_caretRectAtPosition:(const WebCore::Position&)pos affinity:(NSSelectionAffinity)affinity;
 - (NSRect)_firstRectForDOMRange:(DOMRange *)range;
 - (void)_scrollDOMRangeToVisible:(DOMRange *)range;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to