Changeset 54645 in webkit


Ignore:
Timestamp:
Feb 10, 2010 11:32:08 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-02-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Address last round of review comments on r53607
https://bugs.webkit.org/show_bug.cgi?id=33940

Mostly renaming and cleaning up.

  • css/CSSImportRule.cpp: (WebCore::CSSImportRule::insertedIntoParent):
  • css/CSSStyleSheet.h: (WebCore::CSSStyleSheet::create): (WebCore::CSSStyleSheet::createInline):
  • css/StyleBase.cpp: (WebCore::StyleBase::baseURL):
  • css/StyleSheet.cpp: (WebCore::StyleSheet::StyleSheet):
  • css/StyleSheet.h: (WebCore::StyleSheet::href): (WebCore::StyleSheet::setFinalURL): (WebCore::StyleSheet::finalURL):
  • dom/Document.cpp: (WebCore::Document::updateBaseURL):
  • dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet):
  • xml/XSLImportRule.cpp: (WebCore::XSLImportRule::loadSheet):
  • xml/XSLStyleSheet.h: (WebCore::XSLStyleSheet::create): (WebCore::XSLStyleSheet::createInline):
  • xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::XSLStyleSheet): (WebCore::XSLStyleSheet::parseString): (WebCore::XSLStyleSheet::loadChildSheets):
  • xml/XSLStyleSheetQt.cpp: (WebCore::XSLStyleSheet::XSLStyleSheet):
Location:
trunk/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54644 r54645  
     12010-02-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Address last round of review comments on r53607
     6        https://bugs.webkit.org/show_bug.cgi?id=33940
     7
     8        Mostly renaming and cleaning up.
     9
     10        * css/CSSImportRule.cpp:
     11        (WebCore::CSSImportRule::insertedIntoParent):
     12        * css/CSSStyleSheet.h:
     13        (WebCore::CSSStyleSheet::create):
     14        (WebCore::CSSStyleSheet::createInline):
     15        * css/StyleBase.cpp:
     16        (WebCore::StyleBase::baseURL):
     17        * css/StyleSheet.cpp:
     18        (WebCore::StyleSheet::StyleSheet):
     19        * css/StyleSheet.h:
     20        (WebCore::StyleSheet::href):
     21        (WebCore::StyleSheet::setFinalURL):
     22        (WebCore::StyleSheet::finalURL):
     23        * dom/Document.cpp:
     24        (WebCore::Document::updateBaseURL):
     25        * dom/ProcessingInstruction.cpp:
     26        (WebCore::ProcessingInstruction::checkStyleSheet):
     27        * xml/XSLImportRule.cpp:
     28        (WebCore::XSLImportRule::loadSheet):
     29        * xml/XSLStyleSheet.h:
     30        (WebCore::XSLStyleSheet::create):
     31        (WebCore::XSLStyleSheet::createInline):
     32        * xml/XSLStyleSheetLibxslt.cpp:
     33        (WebCore::XSLStyleSheet::XSLStyleSheet):
     34        (WebCore::XSLStyleSheet::parseString):
     35        (WebCore::XSLStyleSheet::loadChildSheets):
     36        * xml/XSLStyleSheetQt.cpp:
     37        (WebCore::XSLStyleSheet::XSLStyleSheet):
     38
    1392010-02-10  Noam Rosenthal  <noam.rosenthal@nokia.com>
    240
  • trunk/WebCore/css/CSSImportRule.cpp

    r53607 r54645  
    118118
    119119    String absHref = m_strHref;
    120     if (!parentSheet->putativeBaseURL().isNull())
     120    if (!parentSheet->finalURL().isNull())
    121121        // use parent styleheet's URL as the base URL
    122         absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
     122        absHref = KURL(parentSheet->finalURL(), m_strHref).string();
    123123
    124124    // Check for a cycle in our import chain.  If we encounter a stylesheet
     
    126126    StyleBase* root = this;
    127127    for (StyleBase* curr = parent(); curr; curr = curr->parent()) {
    128         // FIXME: This is wrong if the putativeBaseURL was updated via document::updateBaseURL.
    129         if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->putativeBaseURL().string())
     128        // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL.
     129        if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->finalURL().string())
    130130            return;
    131131        root = curr;
  • trunk/WebCore/css/CSSStyleSheet.h

    r53607 r54645  
    4545        return adoptRef(new CSSStyleSheet(ownerNode, String(), KURL(), String()));
    4646    }
    47     static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL)
     47    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL)
    4848    {
    49         return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, String()));
     49        return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, String()));
    5050    }
    51     static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset)
     51    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset)
    5252    {
    53         return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, charset));
     53        return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, charset));
    5454    }
    55     static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
     55    static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset)
    5656    {
    57         return adoptRef(new CSSStyleSheet(ownerRule, href, baseURL, charset));
     57        return adoptRef(new CSSStyleSheet(ownerRule, originalURL, finalURL, charset));
    5858    }
    59     static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& baseURL)
     59    static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& finalURL)
    6060    {
    61         return adoptRef(new CSSStyleSheet(ownerNode, baseURL.string(), baseURL, String()));
     61        return adoptRef(new CSSStyleSheet(ownerNode, finalURL.string(), finalURL, String()));
    6262    }
    6363
     
    104104
    105105private:
    106     CSSStyleSheet(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset);
    107     CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset);
    108     CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset);
     106    CSSStyleSheet(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset);
     107    CSSStyleSheet(CSSStyleSheet* parentSheet, const String& originalURL, const KURL& finalURL, const String& charset);
     108    CSSStyleSheet(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset);
    109109
    110110    virtual bool isCSSStyleSheet() const { return true; }
  • trunk/WebCore/css/StyleBase.cpp

    r53607 r54645  
    5757    if (!sheet)
    5858        return KURL();
    59     if (!sheet->putativeBaseURL().isNull())
    60         return sheet->putativeBaseURL();
     59    if (!sheet->finalURL().isNull())
     60        return sheet->finalURL();
    6161    if (sheet->parent())
    6262        return sheet->parent()->baseURL();
  • trunk/WebCore/css/StyleSheet.cpp

    r53607 r54645  
    2525namespace WebCore {
    2626
    27 StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL)
     27StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL)
    2828    : StyleList(parentSheet)
    2929    , m_parentNode(0)
    30     , m_href(href)
    31     , m_baseURL(baseURL)
     30    , m_originalURL(originalURL)
     31    , m_finalURL(finalURL)
    3232    , m_disabled(false)
    3333{
    3434}
    3535
    36 
    37 StyleSheet::StyleSheet(Node* parentNode, const String& href, const KURL& baseURL)
     36StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL)
    3837    : StyleList(0)
    3938    , m_parentNode(parentNode)
    40     , m_href(href)
    41     , m_baseURL(baseURL)
     39    , m_originalURL(originalURL)
     40    , m_finalURL(finalURL)
    4241    , m_disabled(false)
    4342{
    4443}
    4544
    46 StyleSheet::StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL)
     45StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL)
    4746    : StyleList(owner)
    4847    , m_parentNode(0)
    49     , m_href(href)
    50     , m_baseURL(baseURL)
     48    , m_originalURL(originalURL)
     49    , m_finalURL(finalURL)
    5150    , m_disabled(false)
    5251{
  • trunk/WebCore/css/StyleSheet.h

    r53607 r54645  
    4646    // this style sheet. This property probably isn't useful for much except
    4747    // the JavaScript binding (which needs to use this value for security).
    48     const String& href() const { return m_href; }
     48    const String& href() const { return m_originalURL; }
    4949
    50     void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; }
    51 
    52     // Notice that this object inherits a baseURL function from StyleBase that
    53     // crawls the parent() relation looking for a non-0 putativeBaseURL.
    54     const KURL& putativeBaseURL() const { return m_baseURL; }
     50    void setFinalURL(const KURL& finalURL) { m_finalURL = finalURL; }
     51    const KURL& finalURL() const { return m_finalURL; }
    5552
    5653    const String& title() const { return m_strTitle; }
     
    6966
    7067protected:
    71     StyleSheet(Node* ownerNode, const String& href, const KURL& baseURL);
    72     StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL);
    73     StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL);
     68    StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL);
     69    StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& finalURL);
     70    StyleSheet(StyleBase* owner, const String& href, const KURL& finalURL);
    7471
    7572private:
     
    7774
    7875    Node* m_parentNode;
    79     String m_href;
    80     KURL m_baseURL;
     76    String m_originalURL;
     77    KURL m_finalURL;
    8178    String m_strTitle;
    8279    RefPtr<MediaList> m_media;
  • trunk/WebCore/dom/Document.cpp

    r54636 r54645  
    20022002
    20032003    if (m_elemSheet)
    2004         m_elemSheet->setBaseURL(m_baseURL);
     2004        m_elemSheet->setFinalURL(m_baseURL);
    20052005    if (m_mappedElementSheet)
    2006         m_mappedElementSheet->setBaseURL(m_baseURL);
     2006        m_mappedElementSheet->setFinalURL(m_baseURL);
    20072007}
    20082008
  • trunk/WebCore/dom/ProcessingInstruction.cpp

    r53607 r54645  
    140140            // to kick off import/include loads that can hang off some parent sheet.
    141141            if (m_isXSL) {
    142                 KURL baseURL = KURL(ParsedURLString, m_localHref);
    143                 m_sheet = XSLStyleSheet::createEmbedded(this, m_localHref, baseURL);
     142                KURL finalURL(ParsedURLString, m_localHref);
     143                m_sheet = XSLStyleSheet::createInline(this, finalURL);
    144144                m_loading = false;
    145145            }
  • trunk/WebCore/xml/XSLImportRule.cpp

    r53607 r54645  
    8888    String absHref = m_strHref;
    8989    XSLStyleSheet* parentSheet = parentStyleSheet();
    90     if (!parentSheet->putativeBaseURL().isNull())
     90    if (!parentSheet->finalURL().isNull())
    9191        // use parent styleheet's URL as the base URL
    92         absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
     92        absHref = KURL(parentSheet->finalURL(), m_strHref).string();
    9393   
    9494    // Check for a cycle in our import chain.  If we encounter a stylesheet
    9595    // in our parent chain with the same URL, then just bail.
    9696    for (parent = this->parent(); parent; parent = parent->parent()) {
    97         if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->putativeBaseURL().string())
     97        if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->finalURL().string())
    9898            return;
    9999    }
  • trunk/WebCore/xml/XSLStyleSheet.h

    r53607 r54645  
    4444public:
    4545#if !USE(QXMLQUERY)
    46     static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href, const KURL& baseURL)
     46    static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL)
    4747    {
    48         return adoptRef(new XSLStyleSheet(parentImport, href, baseURL));
     48        return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL));
    4949    }
    5050#endif
    51     static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href, const KURL& baseURL)
     51    static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& originalURL, const KURL& finalURL)
    5252    {
    53         return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, false));
     53        return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
    5454    }
    55     static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href, const KURL& baseURL)
     55    static PassRefPtr<XSLStyleSheet> createInline(Node* parentNode, const KURL& finalURL)
    5656    {
    57         return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, true));
     57        return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalURL, true));
    5858    }
    5959
     
    9191
    9292private:
    93     XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded);
     93    XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded);
    9494#if !USE(QXMLQUERY)
    95     XSLStyleSheet(XSLImportRule* parentImport, const String& href, const KURL& baseURL);
     95    XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL);
    9696#endif
    9797
  • trunk/WebCore/xml/XSLStyleSheetLibxslt.cpp

    r53607 r54645  
    5656namespace WebCore {
    5757
    58 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, const KURL& baseURL)
    59     : StyleSheet(parentRule, href, baseURL)
     58XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalURL, const KURL& finalURL)
     59    : StyleSheet(parentRule, originalURL, finalURL)
    6060    , m_ownerDocument(0)
    6161    , m_embedded(false)
     
    6767}
    6868
    69 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL,  bool embedded)
    70     : StyleSheet(parentNode, href, baseURL)
     69XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL,  bool embedded)
     70    : StyleSheet(parentNode, originalURL, finalURL)
    7171    , m_ownerDocument(parentNode->document())
    7272    , m_embedded(embedded)
     
    169169
    170170    m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size,
    171         putativeBaseURL().string().utf8().data(),
     171        finalURL().string().utf8().data(),
    172172        BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
    173173        XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA);
     
    193193        // We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the
    194194        // import/include list.
    195         xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(putativeBaseURL().string().utf8().data()));
     195        xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(finalURL().string().utf8().data()));
    196196        if (!idNode)
    197197            return;
  • trunk/WebCore/xml/XSLStyleSheetQt.cpp

    r53607 r54645  
    3434namespace WebCore {
    3535
    36 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL,  bool embedded)
    37     : StyleSheet(parentNode, href, baseURL)
     36XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL,  bool embedded)
     37    : StyleSheet(parentNode, originalURL, finalURL)
    3838    , m_ownerDocument(parentNode->document())
    3939    , m_embedded(embedded)
Note: See TracChangeset for help on using the changeset viewer.