Changeset 29336 in webkit


Ignore:
Timestamp:
Jan 9, 2008 1:23:16 AM (16 years ago)
Author:
eric@webkit.org
Message:

Reworked by Eric, Reviewed by Hyatt.

Tests: fast/selectors/lang-inheritance.html

fast/selectors/lang-inheritance2.html
fast/selectors/lang-vs-xml-lang.html
fast/selectors/lang-vs-xml-lang-xhtml.xhtml

  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::canShareStyleWithElement): Do not share style between elements with different LANG-attribute. (WebCore::CSSStyleSelector::checkOneSelector): Change :lang() to recursively check the LANG attribute for all the elements parents and the content-language of the document.
  • dom/Document.cpp: (WebCore::Document::processHttpEquiv): Parse MIME Content-Language
  • dom/Document.h: (WebCore::Document::contentLanguage): (WebCore::Document::setContentLanguage):
Location:
trunk
Files:
16 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r29328 r29336  
     12007-10-01  Allan Sandfeld Jensen  <sandfeld@kde.org>
     2
     3        Updated by Eric, Reviewed by Hyatt.
     4
     5        - tests and updates for http://bugs.webkit.org/show_bug.cgi?id=9454
     6
     7        * fast/selectors/lang-inheritance-expected.checksum: Added.
     8        * fast/selectors/lang-inheritance-expected.png: Added.
     9        * fast/selectors/lang-inheritance-expected.txt: Added.
     10        * fast/selectors/lang-inheritance.html: Added.
     11        * fast/selectors/lang-inheritance2-expected.checksum: Added.
     12        * fast/selectors/lang-inheritance2-expected.png: Added.
     13        * fast/selectors/lang-inheritance2-expected.txt: Added.
     14        * fast/selectors/lang-inheritance2.html: Added.
     15        * fast/selectors/lang-vs-xml-lang-expected.checksum: Added.
     16        * fast/selectors/lang-vs-xml-lang-expected.png: Added.
     17        * fast/selectors/lang-vs-xml-lang-expected.txt: Added.
     18        * fast/selectors/lang-vs-xml-lang-xhtml-expected.checksum: Added.
     19        * fast/selectors/lang-vs-xml-lang-xhtml-expected.png: Added.
     20        * fast/selectors/lang-vs-xml-lang-xhtml-expected.txt: Added.
     21        * fast/selectors/lang-vs-xml-lang-xhtml.xhtml: Added.
     22        * fast/selectors/lang-vs-xml-lang.html: Added.
     23        * svg/W3C-SVG-1.1/styling-css-05-b-expected.checksum:
     24        * svg/W3C-SVG-1.1/styling-css-05-b-expected.png:
     25        * svg/W3C-SVG-1.1/styling-css-05-b-expected.txt:
     26
    1272008-01-08  Antti Koivisto  <antti@apple.com>
    228
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/styling-css-05-b-expected.checksum

    r27850 r29336  
    1 72e22879400385c3ca2962d3706197f9
     12439426c6c0a37d87c613d6ee03905f5
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/styling-css-05-b-expected.txt

    r26599 r29336  
    33layer at (0,0) size 480x360
    44  RenderSVGRoot {svg} at (0.50,0.50) size 479x359
    5     RenderSVGContainer {g} at (128,72) size 224x136
    6       RenderSVGContainer {g} at (128,72) size 224x136
     5    RenderSVGContainer {g} at (127,72) size 226x136
     6      RenderSVGContainer {g} at (127,72) size 226x136
    77        RenderSVGText {text} at (147,100) size 186x36 contains 1 chunk(s)
    88          RenderSVGInlineText {#text} at (0,-28) size 186x36
    99            chunk 1 (middle anchor) text run 1 at (147.00,100.00) startOffset 0 endOffset 13 width 186.00: "Good morning!"
    10         RenderSVGText {text} at (128,200) size 224x36 contains 1 chunk(s)
    11           RenderSVGInlineText {#text} at (0,-28) size 86x36
    12             chunk 1 (middle anchor) text run 1 at (128.00,200.00) startOffset 0 endOffset 6 width 86.00: "Bonne "
    13           RenderSVGTSpan {tspan} at (0,0) size 128x36
    14             RenderSVGInlineText {#text} at (86,-28) size 128x36
    15               chunk 1 (middle anchor) text run 2 at (214.00,200.00) startOffset 0 endOffset 10 width 128.00: "avant-midi"
    16           RenderSVGInlineText {#text} at (214,-28) size 10x36
    17             chunk 1 (middle anchor) text run 3 at (342.00,200.00) startOffset 0 endOffset 1 width 10.00: "!"
     10        RenderSVGText {text} at (127,200) size 226x36 contains 1 chunk(s)
     11          RenderSVGInlineText {#text} at (0,-28) size 87x36
     12            chunk 1 (middle anchor) text run 1 at (127.50,200.00) startOffset 0 endOffset 6 width 86.00: "Bonne "
     13          RenderSVGTSpan {tspan} at (0,0) size 130x36
     14            RenderSVGInlineText {#text} at (86,-28) size 130x36
     15              chunk 1 (middle anchor) text run 2 at (213.50,200.00) startOffset 0 endOffset 10 width 129.00: "avant-midi"
     16          RenderSVGInlineText {#text} at (215,-28) size 11x36
     17            chunk 1 (middle anchor) text run 3 at (342.50,200.00) startOffset 0 endOffset 1 width 10.00: "!"
    1818    RenderSVGText {text} at (10,340) size 264x46 contains 1 chunk(s)
    1919      RenderSVGInlineText {#text} at (0,-36) size 264x46
  • trunk/WebCore/ChangeLog

    r29335 r29336  
     12007-10-01  Allan Sandfeld Jensen  <sandfeld@kde.org>
     2
     3        Reworked by Eric, Reviewed by Hyatt.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=9454
     6        Add support for :lang inheritance and xml:lang support.
     7
     8        Tests: fast/selectors/lang-inheritance.html
     9               fast/selectors/lang-inheritance2.html
     10               fast/selectors/lang-vs-xml-lang.html
     11               fast/selectors/lang-vs-xml-lang-xhtml.xhtml
     12
     13        * css/CSSStyleSelector.cpp:
     14        (WebCore::CSSStyleSelector::canShareStyleWithElement): Do not share style between elements with
     15        different LANG-attribute.
     16        (WebCore::CSSStyleSelector::checkOneSelector): Change :lang() to recursively check the LANG attribute
     17        for all the elements parents and the content-language of the document.
     18        * dom/Document.cpp:
     19        (WebCore::Document::processHttpEquiv): Parse MIME Content-Language
     20        * dom/Document.h:
     21        (WebCore::Document::contentLanguage):
     22        (WebCore::Document::setContentLanguage):
     23
    1242008-01-08  Timothy Hatcher  <timothy@apple.com>
    225
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r29320 r29336  
    55 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
     7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    2829#include "CSSCursorImageValue.h"
    2930#include "CSSFontFace.h"
     31#include "CSSFontFaceRule.h"
    3032#include "CSSFontFaceSource.h"
    31 #include "CSSFontFaceRule.h"
    3233#include "CSSImageValue.h"
    3334#include "CSSImportRule.h"
     
    6364#include "StyleSheetList.h"
    6465#include "UserAgentStyleSheets.h"
     66#include "XMLNames.h"
    6567#include "loader.h"
    6668
     
    761763            (s != s->document()->getCSSTarget() && m_element != m_element->document()->getCSSTarget()) &&
    762764            (s->getAttribute(typeAttr) == m_element->getAttribute(typeAttr)) &&
     765            (s->getAttribute(XMLNames::langAttr) == m_element->getAttribute(XMLNames::langAttr)) &&
     766            (s->getAttribute(langAttr) == m_element->getAttribute(langAttr)) &&
    763767            (s->getAttribute(readonlyAttr) == m_element->getAttribute(readonlyAttr))) {
    764768            bool isControl = s->isControl();
     
    16971701                break;
    16981702            case CSSSelector::PseudoLang: {
    1699                 const AtomicString& value = e->getAttribute(langAttr);
     1703                Node* n = e;
     1704                AtomicString value;
     1705                // The language property is inherited, so we iterate over the parents
     1706                // to find the first language.
     1707                while (n && value.isEmpty()) {
     1708                    if (n->isElementNode()) {
     1709                        // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
     1710                        value = static_cast<Element*>(n)->getAttribute(XMLNames::langAttr);
     1711                        if (value.isEmpty())
     1712                            value = static_cast<Element*>(n)->getAttribute(langAttr);
     1713                    } else if (n->isDocumentNode())
     1714                        // checking the MIME content-language
     1715                        value = static_cast<Document*>(n)->contentLanguage();
     1716
     1717                    n = n->parent();
     1718                }
    17001719                if (value.isEmpty() || !value.startsWith(sel->m_argument, false))
    17011720                    break;
  • trunk/WebCore/dom/Document.cpp

    r29291 r29336  
    18371837        if (isHTMLDocument())
    18381838            static_cast<HTMLDocument*>(this)->setCookie(content);
    1839     }
     1839    } else if (equalIgnoringCase(equiv, "content-language"))
     1840        setContentLanguage(content);
    18401841}
    18411842
  • trunk/WebCore/dom/Document.h

    r29291 r29336  
    198198    void setCharset(const String&);
    199199
     200    String contentLanguage() const { return m_contentLanguage; }
     201    void setContentLanguage(const String& lang) { m_contentLanguage = lang; }
     202
    200203    String xmlEncoding() const { return m_xmlEncoding; }
    201204    String xmlVersion() const { return m_xmlVersion; }
     
    809812    bool m_xmlStandalone;
    810813
     814    String m_contentLanguage;
     815
    811816public:
    812817    bool inPageCache();
Note: See TracChangeset for help on using the changeset viewer.