Changeset 83252 in webkit


Ignore:
Timestamp:
Apr 7, 2011 9:59:33 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-07 Magnus Danielsson <public@fuzzac.com>

Reviewed by Darin Fisher.

[chromium] WebPageSerializerImpl doesn't serialize sub-frames correctly
https://bugs.webkit.org/show_bug.cgi?id=53897

When serializing a web page using 'save page as', sub-frames and resources gets
saved in a sub-directory. However, frame elements didn't get updated to reference
these saved sub-frames, but were still referencing the original url. So when opening
a saved web page, any sub-frames would get pulled in from the original url rather than
what was saved.

In addition to this, sub-frames in the sub-directory erroneously had the name of the
sub-directory prepended to the path of resources located in the same sub-directory.

  • src/WebPageSerializerImpl.cpp: (WebKit::WebPageSerializerImpl::openTagToStrne: Fixed resource paths in sub-frames. Also made sure sub-frames are referenced correctly from parent frame. (WebKit::WebPageSerializerImpl::endTagToString): Removed constness from argument. (WebKit::WebPageSerializerImpl::buildContentForNode): Ditto.
  • src/WebPageSerializerImpl.h:
Location:
trunk/Source/WebKit/chromium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r83249 r83252  
     12011-04-07  Magnus Danielsson  <public@fuzzac.com>
     2
     3        Reviewed by Darin Fisher.
     4
     5        [chromium] WebPageSerializerImpl doesn't serialize sub-frames correctly
     6        https://bugs.webkit.org/show_bug.cgi?id=53897
     7
     8        When serializing a web page using 'save page as', sub-frames and resources gets
     9        saved in a sub-directory. However, frame elements didn't get updated to reference
     10        these saved sub-frames, but were still referencing the original url. So when opening
     11        a saved web page, any sub-frames would get pulled in from the original url rather than
     12        what was saved.
     13
     14        In addition to this, sub-frames in the sub-directory erroneously had the name of the
     15        sub-directory prepended to the path of resources located in the same sub-directory.
     16
     17        * src/WebPageSerializerImpl.cpp:
     18        (WebKit::WebPageSerializerImpl::openTagToStrne: Fixed resource paths in sub-frames.
     19        Also made sure sub-frames are referenced correctly from parent frame.
     20        (WebKit::WebPageSerializerImpl::endTagToString): Removed constness from argument.
     21        (WebKit::WebPageSerializerImpl::buildContentForNode): Ditto.
     22        * src/WebPageSerializerImpl.h:
     23
    1242011-04-07  Nat Duca  <nduca@chromium.org>
    225
  • trunk/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp

    r79123 r83252  
    296296}
    297297
    298 void WebPageSerializerImpl::openTagToString(const Element* element,
     298void WebPageSerializerImpl::openTagToString(Element* element,
    299299                                            SerializeDomParam* param)
    300300{
     
    329329                    else {
    330330                        // Get the absolute link
    331                         String completeURL = param->document->completeURL(attrValue);
     331                        WebFrameImpl* subFrame = WebFrameImpl::fromFrameOwnerElement(element);
     332                        String completeURL = subFrame ? subFrame->frame()->document()->url() :
     333                                                        param->document->completeURL(attrValue);
    332334                        // Check whether we have local files for those link.
    333335                        if (m_localLinks.contains(completeURL)) {
    334                             if (!m_localDirectoryName.isEmpty())
    335                                 result += "./" + m_localDirectoryName + "/";
     336                            if (!param->directoryName.isEmpty())
     337                                result += "./" + param->directoryName + "/";
    336338                            result += m_localLinks.get(completeURL);
    337339                        } else
     
    361363
    362364// Serialize end tag of an specified element.
    363 void WebPageSerializerImpl::endTagToString(const Element* element,
     365void WebPageSerializerImpl::endTagToString(Element* element,
    364366                                           SerializeDomParam* param)
    365367{
     
    398400}
    399401
    400 void WebPageSerializerImpl::buildContentForNode(const Node* node,
     402void WebPageSerializerImpl::buildContentForNode(Node* node,
    401403                                                SerializeDomParam* param)
    402404{
     
    404406    case Node::ELEMENT_NODE:
    405407        // Process open tag of element.
    406         openTagToString(static_cast<const Element*>(node), param);
     408        openTagToString(static_cast<Element*>(node), param);
    407409        // Walk through the children nodes and process it.
    408         for (const Node *child = node->firstChild(); child; child = child->nextSibling())
     410        for (Node *child = node->firstChild(); child; child = child->nextSibling())
    409411            buildContentForNode(child, param);
    410412        // Process end tag of element.
    411         endTagToString(static_cast<const Element*>(node), param);
     413        endTagToString(static_cast<Element*>(node), param);
    412414        break;
    413415    case Node::TEXT_NODE:
  • trunk/Source/WebKit/chromium/src/WebPageSerializerImpl.h

    r69675 r83252  
    175175                              FlushOption);
    176176    // Serialize open tag of an specified element.
    177     void openTagToString(const WebCore::Element* element,
     177    void openTagToString(WebCore::Element*,
    178178                         SerializeDomParam* param);
    179179    // Serialize end tag of an specified element.
    180     void endTagToString(const WebCore::Element* element,
     180    void endTagToString(WebCore::Element*,
    181181                        SerializeDomParam* param);
    182182    // Build content for a specified node
    183     void buildContentForNode(const WebCore::Node* node,
     183    void buildContentForNode(WebCore::Node*,
    184184                             SerializeDomParam* param);
    185185};
Note: See TracChangeset for help on using the changeset viewer.