Changeset 48818 in webkit


Ignore:
Timestamp:
Sep 28, 2009, 9:34:53 AM (16 years ago)
Author:
mitz@apple.com
Message:

Extend the MediaWiki/KHTMLFixes.css workaround to cover older MediaWiki versions
https://bugs.webkit.org/show_bug.cgi?id=29792

Reviewed by Darin Adler.

  • html/HTMLLinkElement.cpp:

(WebCore::HTMLLinkElement::setCSSStyleSheet): If site specific hacks are
enabled, check if the linked style sheet is one of two versions of the
MediaWiki KHTMLFixes.css. If so, remove the offending rule.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r48817 r48818  
     12009-09-28  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Extend the MediaWiki/KHTMLFixes.css workaround to cover older MediaWiki versions
     6        https://bugs.webkit.org/show_bug.cgi?id=29792
     7
     8        * html/HTMLLinkElement.cpp:
     9        (WebCore::HTMLLinkElement::setCSSStyleSheet): If site specific hacks are
     10        enabled, check if the linked style sheet is one of two versions of the
     11        MediaWiki KHTMLFixes.css. If so, remove the offending rule.
     12
    1132009-09-28  Dimitri Glazkov  <dglazkov@chromium.org>
    214
  • trunk/WebCore/html/HTMLLinkElement.cpp

    r45947 r48818  
    253253        enforceMIMEType = false;
    254254
    255     m_sheet->parseString(sheet->sheetText(enforceMIMEType), strictParsing);
     255    String sheetText = sheet->sheetText(enforceMIMEType);
     256    m_sheet->parseString(sheetText, strictParsing);
     257
     258    if (strictParsing && document()->settings() && document()->settings()->needsSiteSpecificQuirks()) {
     259        // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
     260        DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css"));
     261        DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n"));
     262        // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKHTMLFixesStyleSheet,
     263        // while the other lacks the second trailing newline.
     264        if (url.endsWith(slashKHTMLFixesDotCss) && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText)
     265                && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1) {
     266            ASSERT(m_sheet->length() == 1);
     267            ExceptionCode ec;
     268            m_sheet->deleteRule(0, ec);
     269        }
     270    }
     271
    256272    m_sheet->setTitle(title());
    257273
Note: See TracChangeset for help on using the changeset viewer.