[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 14:34:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 18741f406fd985ee03ceaf35fba3bf2ee6ab14e5
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 16:40:21 2010 +0000

    2010-10-13  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Darin Fisher.
    
            [Chromium] Clean up SerializeDomParam
            https://bugs.webkit.org/show_bug.cgi?id=47580
    
            This patch just renames a bunch of the members of this struct to be
            more sensible.  No behavior change, well, except for one struct member
            that wasn't initialized.  I didn't trace through this code to see if
            the uninitialized value was used anywhere, but initializing all the
            values seems like a good idea.
    
            * src/WebPageSerializerImpl.cpp:
            (WebKit::WebPageSerializerImpl::SerializeDomParam::SerializeDomParam):
            (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag):
            (WebKit::WebPageSerializerImpl::postActionAfterSerializeOpenTag):
            (WebKit::WebPageSerializerImpl::postActionAfterSerializeEndTag):
            (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
            (WebKit::WebPageSerializerImpl::openTagToString):
            (WebKit::WebPageSerializerImpl::endTagToString):
            (WebKit::WebPageSerializerImpl::buildContentForNode):
            * src/WebPageSerializerImpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69668 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 0f5eb2d..a9919e7 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,27 @@
+2010-10-13  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Clean up SerializeDomParam
+        https://bugs.webkit.org/show_bug.cgi?id=47580
+
+        This patch just renames a bunch of the members of this struct to be
+        more sensible.  No behavior change, well, except for one struct member
+        that wasn't initialized.  I didn't trace through this code to see if
+        the uninitialized value was used anywhere, but initializing all the
+        values seems like a good idea.
+
+        * src/WebPageSerializerImpl.cpp:
+        (WebKit::WebPageSerializerImpl::SerializeDomParam::SerializeDomParam):
+        (WebKit::WebPageSerializerImpl::preActionBeforeSerializeOpenTag):
+        (WebKit::WebPageSerializerImpl::postActionAfterSerializeOpenTag):
+        (WebKit::WebPageSerializerImpl::postActionAfterSerializeEndTag):
+        (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
+        (WebKit::WebPageSerializerImpl::openTagToString):
+        (WebKit::WebPageSerializerImpl::endTagToString):
+        (WebKit::WebPageSerializerImpl::buildContentForNode):
+        * src/WebPageSerializerImpl.h:
+
 2010-10-13  Yury Semikhatsky  <yurys at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebKit/chromium/src/WebPageSerializerImpl.cpp b/WebKit/chromium/src/WebPageSerializerImpl.cpp
index 4b09f0c..ced0821 100644
--- a/WebKit/chromium/src/WebPageSerializerImpl.cpp
+++ b/WebKit/chromium/src/WebPageSerializerImpl.cpp
@@ -105,22 +105,22 @@ namespace WebKit {
 // contegious string is found in the page.
 static const unsigned dataBufferCapacity = 65536;
 
-WebPageSerializerImpl::SerializeDomParam::SerializeDomParam(const KURL& currentFrameURL,
+WebPageSerializerImpl::SerializeDomParam::SerializeDomParam(const KURL& url,
                                                             const TextEncoding& textEncoding,
-                                                            Document* doc,
+                                                            Document* document,
                                                             const String& directoryName)
-    : currentFrameURL(currentFrameURL)
+    : url(url)
     , textEncoding(textEncoding)
-    , doc(doc)
+    , document(document)
     , directoryName(directoryName)
-    , hasDoctype(false)
-    , hasCheckedMeta(false)
+    , isHTMLDocument(document->isHTMLDocument())
+    , haveSeenDocType(false)
+    , haveAddedCharsetDeclaration(false)
     , skipMetaElement(0)
     , isInScriptOrStyleTag(false)
-    , hasDocDeclaration(false)
+    , haveAddedXMLProcessingDirective(false)
+    , haveAddedContentsBeforeEnd(false)
 {
-    // Cache the value since we check it lots of times.
-    isHTMLDocument = doc->isHTMLDocument();
 }
 
 String WebPageSerializerImpl::preActionBeforeSerializeOpenTag(
@@ -148,41 +148,41 @@ String WebPageSerializerImpl::preActionBeforeSerializeOpenTag(
             }
         } else if (element->hasTagName(HTMLNames::htmlTag)) {
             // Check something before processing the open tag of HEAD element.
-            // First we add doc type declaration if original doc has it.
-            if (!param->hasDoctype) {
-                param->hasDoctype = true;
-                result.append(createMarkup(param->doc->doctype()));
+            // First we add doc type declaration if original document has it.
+            if (!param->haveSeenDocType) {
+                param->haveSeenDocType = true;
+                result.append(createMarkup(param->document->doctype()));
             }
 
             // Add MOTW declaration before html tag.
             // See http://msdn2.microsoft.com/en-us/library/ms537628(VS.85).aspx.
-            result.append(WebPageSerializer::generateMarkOfTheWebDeclaration(param->currentFrameURL));
+            result.append(WebPageSerializer::generateMarkOfTheWebDeclaration(param->url));
         } else if (element->hasTagName(HTMLNames::baseTag)) {
             // Comment the BASE tag when serializing dom.
             result.append("<!--");
         }
     } else {
         // Write XML declaration.
-        if (!param->hasDocDeclaration) {
-            param->hasDocDeclaration = true;
+        if (!param->haveAddedXMLProcessingDirective) {
+            param->haveAddedXMLProcessingDirective = true;
             // Get encoding info.
-            String xmlEncoding = param->doc->xmlEncoding();
+            String xmlEncoding = param->document->xmlEncoding();
             if (xmlEncoding.isEmpty())
-                xmlEncoding = param->doc->frame()->loader()->writer()->encoding();
+                xmlEncoding = param->document->frame()->loader()->writer()->encoding();
             if (xmlEncoding.isEmpty())
                 xmlEncoding = UTF8Encoding().name();
             result.append("<?xml version=\"");
-            result.append(param->doc->xmlVersion());
+            result.append(param->document->xmlVersion());
             result.append("\" encoding=\"");
             result.append(xmlEncoding);
-            if (param->doc->xmlStandalone())
+            if (param->document->xmlStandalone())
                 result.append("\" standalone=\"yes");
             result.append("\"?>\n");
         }
-        // Add doc type declaration if original doc has it.
-        if (!param->hasDoctype) {
-            param->hasDoctype = true;
-            result.append(createMarkup(param->doc->doctype()));
+        // Add doc type declaration if original document has it.
+        if (!param->haveSeenDocType) {
+            param->haveSeenDocType = true;
+            result.append(createMarkup(param->document->doctype()));
         }
     }
     return result.toString();
@@ -193,13 +193,13 @@ String WebPageSerializerImpl::postActionAfterSerializeOpenTag(
 {
     StringBuilder result;
 
-    param->hasAddedContentsBeforeEnd = false;
+    param->haveAddedContentsBeforeEnd = false;
     if (!param->isHTMLDocument)
         return result.toString();
     // Check after processing the open tag of HEAD element
-    if (!param->hasCheckedMeta
+    if (!param->haveAddedCharsetDeclaration
         && element->hasTagName(HTMLNames::headTag)) {
-        param->hasCheckedMeta = true;
+        param->haveAddedCharsetDeclaration = true;
         // Check meta element. WebKit only pre-parse the first 512 bytes
         // of the document. If the whole <HEAD> is larger and meta is the
         // end of head part, then this kind of pages aren't decoded correctly
@@ -210,7 +210,7 @@ String WebPageSerializerImpl::postActionAfterSerializeOpenTag(
         result.append(WebPageSerializer::generateMetaCharsetDeclaration(
             String(param->textEncoding.name())));
 
-        param->hasAddedContentsBeforeEnd = true;
+        param->haveAddedContentsBeforeEnd = true;
         // Will search each META which has charset declaration, and skip them all
         // in PreActionBeforeSerializeOpenTag.
     } else if (element->hasTagName(HTMLNames::scriptTag)
@@ -257,7 +257,7 @@ String WebPageSerializerImpl::postActionAfterSerializeEndTag(
         result.append("-->");
         // Append a new base tag declaration.
         result.append(WebPageSerializer::generateBaseTagDeclaration(
-            param->doc->baseTarget()));
+            param->document->baseTarget()));
     }
 
     return result.toString();
@@ -289,7 +289,7 @@ void WebPageSerializerImpl::encodeAndFlushBuffer(
         content.characters(), content.length(), EntitiesForUnencodables);
 
     // Send result to the client.
-    m_client->didSerializeDataForFrame(param->currentFrameURL,
+    m_client->didSerializeDataForFrame(param->url,
                                        WebCString(encodedContent.data(), encodedContent.length()),
                                        status);
 }
@@ -327,7 +327,7 @@ void WebPageSerializerImpl::openTagToString(const Element* element,
                         result += attrValue;
                     else {
                         // Get the absolute link
-                        String completeURL = param->doc->completeURL(attrValue);
+                        String completeURL = param->document->completeURL(attrValue);
                         // Check whether we have local files for those link.
                         if (m_localLinks.contains(completeURL)) {
                             if (!m_localDirectoryName.isEmpty())
@@ -350,7 +350,7 @@ void WebPageSerializerImpl::openTagToString(const Element* element,
     // Do post action for open tag.
     String addedContents = postActionAfterSerializeOpenTag(element, param);
     // Complete the open tag for element when it has child/children.
-    if (element->hasChildNodes() || param->hasAddedContentsBeforeEnd)
+    if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd)
         result += ">";
     // Append the added contents generate in  post action of open tag.
     result += addedContents;
@@ -370,7 +370,7 @@ void WebPageSerializerImpl::endTagToString(const Element* element,
     if (needSkip)
         return;
     // Write end tag when element has child/children.
-    if (element->hasChildNodes() || param->hasAddedContentsBeforeEnd) {
+    if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd) {
         result += "</";
         result += element->nodeName().lower();
         result += ">";
@@ -420,7 +420,7 @@ void WebPageSerializerImpl::buildContentForNode(const Node* node,
         break;
     // Document type node can be in DOM?
     case Node::DOCUMENT_TYPE_NODE:
-        param->hasDoctype = true;
+        param->haveSeenDocType = true;
     default:
         // For other type node, call default action.
         saveHTMLContentToBuffer(createMarkup(node), param);
diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h
index 3c66e3a..fe94b84 100644
--- a/WebKit/chromium/src/WebPageSerializerImpl.h
+++ b/WebKit/chromium/src/WebPageSerializerImpl.h
@@ -116,42 +116,26 @@ private:
     WebEntities m_xmlEntities;
 
     struct SerializeDomParam {
-        // Frame URL of current processing document presented by GURL
-        const WebCore::KURL& currentFrameURL;
-        // Current using text encoding object.
+        const WebCore::KURL& url;
         const WebCore::TextEncoding& textEncoding;
-
-        // Document object of current frame.
-        WebCore::Document* doc;
-        // Local directory name of all local resource files.
+        WebCore::Document* document;
         const WTF::String& directoryName;
-
-        // Flag indicates current doc is html document or not. It's a cache value
-        // of Document.isHTMLDocument().
-        bool isHTMLDocument;
-        // Flag which indicate whether we have met document type declaration.
-        bool hasDoctype;
-        // Flag which indicate whether will process meta issue.
-        bool hasCheckedMeta;
+        bool isHTMLDocument; // document.isHTMLDocument()
+        bool haveSeenDocType;
+        bool haveAddedCharsetDeclaration;
         // This meta element need to be skipped when serializing DOM.
         const WebCore::Element* skipMetaElement;
         // Flag indicates we are in script or style tag.
         bool isInScriptOrStyleTag;
-        // Flag indicates whether we have written xml document declaration.
-        // It is only used in xml document
-        bool hasDocDeclaration;
+        bool haveAddedXMLProcessingDirective;
         // Flag indicates whether we have added additional contents before end tag.
         // This flag will be re-assigned in each call of function
         // PostActionAfterSerializeOpenTag and it could be changed in function
         // PreActionBeforeSerializeEndTag if the function adds new contents into
         // serialization stream.
-        bool hasAddedContentsBeforeEnd;
+        bool haveAddedContentsBeforeEnd;
 
-        // Constructor.
-        SerializeDomParam(const WebCore::KURL& currentFrameURL,
-                          const WebCore::TextEncoding& textEncoding,
-                          WebCore::Document* doc,
-                          const WTF::String& directoryName);
+        SerializeDomParam(const WebCore::KURL&, const WebCore::TextEncoding&, WebCore::Document*, const WTF::String& directoryName);
     };
 
     // Collect all target frames which need to be serialized.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list