Changeset 47383 in webkit


Ignore:
Timestamp:
Aug 17, 2009 1:21:11 PM (15 years ago)
Author:
mitz@apple.com
Message:

REGRESSION (r47255): MediaWiki's (including Wikipedia) navigation pane
appears below the main content
https://bugs.webkit.org/show_bug.cgi?id=28350

Reviewed by Darin Adler.

A particular version of the MediaWiki software detects WebKit through
user agent sniffing and imports a style sheet called KHTMLFixes.css,
which contains a single rule that was meant to work around some KHTML
bug, but currently has the sole effect of causing the float containing
the main article content to extend all the way to the left and thus push
down the left navigation pane.

  • css/CSSImportRule.cpp:

(WebCore::CSSImportRule::setCSSStyleSheet): If site specific hacks are
enabled, check if the imported style sheet is the MediaWiki
KHTMLFixes.css. If so, remove the offending rule.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47379 r47383  
     12009-08-17  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        REGRESSION (r47255): MediaWiki's (including Wikipedia) navigation pane
     6        appears below the main content
     7        https://bugs.webkit.org/show_bug.cgi?id=28350
     8
     9        A particular version of the MediaWiki software detects WebKit through
     10        user agent sniffing and imports a style sheet called KHTMLFixes.css,
     11        which contains a single rule that was meant to work around some KHTML
     12        bug, but currently has the sole effect of causing the float containing
     13        the main article content to extend all the way to the left and thus push
     14        down the left navigation pane.
     15
     16        * css/CSSImportRule.cpp:
     17        (WebCore::CSSImportRule::setCSSStyleSheet): If site specific hacks are
     18        enabled, check if the imported style sheet is the MediaWiki
     19        KHTMLFixes.css. If so, remove the offending rule.
     20
    1212009-08-17  Brent Fulgham  <bfulgham@webkit.org>
    222
  • trunk/WebCore/css/CSSImportRule.cpp

    r39441 r47383  
    22 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
    33 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
    4  * Copyright (C) 2002, 2005, 2006, 2008 Apple Inc. All rights reserved.
     4 * Copyright (C) 2002, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2727#include "Document.h"
    2828#include "MediaList.h"
     29#include "Settings.h"
     30#include <wtf/StdLibExtras.h>
    2931
    3032namespace WebCore {
     
    6163    CSSStyleSheet* parent = parentStyleSheet();
    6264    bool strict = !parent || parent->useStrictParsing();
    63     m_styleSheet->parseString(sheet->sheetText(strict), strict);
     65    String sheetText = sheet->sheetText(strict);
     66    m_styleSheet->parseString(sheetText, strict);
     67
     68    if (strict && parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks()) {
     69        // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
     70        DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css"));
     71        DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n"));
     72        if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) {
     73            ASSERT(m_styleSheet->length() == 1);
     74            ExceptionCode ec;
     75            m_styleSheet->deleteRule(0, ec);
     76        }
     77    }
     78
    6479    m_loading = false;
    6580
Note: See TracChangeset for help on using the changeset viewer.