Changeset 56182 in webkit


Ignore:
Timestamp:
Mar 18, 2010 12:50:47 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=36281

Reviewed by Simon Fraser.

Make sure an exception is raised if an @import rule is inserted in the wrong place.

Also make sure (so that this particular test case passes) that rgba(0, 0, 0, 0) is dumped
as transparent by getComputedStyle, since it most commonly occurs in background-color and
that default makes more sense than dumping rgba values.

Added fast/css/invalid-import-insertion.html

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::createColor):

  • css/CSSStyleSheet.cpp:

(WebCore::CSSStyleSheet::insertRule):

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/http/tests/mime/standard-mode-does-not-load-stylesheet-with-text-plain-and-css-extension-expected.txt

    r42330 r56182  
    1 This test passes if we do NOT apply the stylesheet (which turns the background color red.) The background color is: rgba(0, 0, 0, 0).
     1This test passes if we do NOT apply the stylesheet (which turns the background color red.) The background color is: transparent.
  • trunk/LayoutTests/http/tests/mime/standard-mode-does-not-load-stylesheet-with-text-plain-expected.txt

    r42330 r56182  
    1 This test passes if we do NOT apply the stylesheet (which turns the background color red.) The background color is: rgba(0, 0, 0, 0).
     1This test passes if we do NOT apply the stylesheet (which turns the background color red.) The background color is: transparent.
  • trunk/LayoutTests/http/tests/security/cross-origin-css-expected.txt

    r52784 r56182  
    11LINK Cross-origin, HTML, valid: rgb(255, 255, 0)
    2 LINK + IMPORT Cross-origin, HTML, invalid: rgba(0, 0, 0, 0)
     2LINK + IMPORT Cross-origin, HTML, invalid: transparent
    33LINK Cross-origin, CSS, invalid: rgb(255, 255, 0)
    44LINK Same-origin, HTML, invalid: rgb(255, 255, 0)
  • trunk/LayoutTests/http/tests/security/cross-origin-css-in-xml-expected.txt

    r52784 r56182  
    1 XML CSS Same-origin, HTML, valid: rgba(0, 0, 0, 0)
     1XML CSS Same-origin, HTML, valid: transparent
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r55576 r56182  
    33rect: style.getPropertyValue(background-clip) : border-box
    44rect: style.getPropertyCSSValue(background-clip) : [object CSSPrimitiveValue]
    5 rect: style.getPropertyValue(background-color) : rgba(0, 0, 0, 0)
     5rect: style.getPropertyValue(background-color) : transparent
    66rect: style.getPropertyCSSValue(background-color) : [object CSSPrimitiveValue]
    77rect: style.getPropertyValue(background-image) : none
     
    419419g: style.getPropertyValue(background-clip) : border-box
    420420g: style.getPropertyCSSValue(background-clip) : [object CSSPrimitiveValue]
    421 g: style.getPropertyValue(background-color) : rgba(0, 0, 0, 0)
     421g: style.getPropertyValue(background-color) : transparent
    422422g: style.getPropertyCSSValue(background-color) : [object CSSPrimitiveValue]
    423423g: style.getPropertyValue(background-image) : none
  • trunk/WebCore/ChangeLog

    r56180 r56182  
     12010-03-18  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=36281
     6
     7        Make sure an exception is raised if an @import rule is inserted in the wrong place.
     8       
     9        Also make sure (so that this particular test case passes) that rgba(0, 0, 0, 0) is dumped
     10        as transparent by getComputedStyle, since it most commonly occurs in background-color and
     11        that default makes more sense than dumping rgba values.
     12
     13        Added fast/css/invalid-import-insertion.html
     14
     15        * css/CSSPrimitiveValue.cpp:
     16        (WebCore::CSSPrimitiveValue::createColor):
     17        * css/CSSStyleSheet.cpp:
     18        (WebCore::CSSStyleSheet::insertRule):
     19
    1202010-03-18  Luiz Agostini  <luiz.agostini@openbossa.org>
    221
  • trunk/WebCore/css/CSSPrimitiveValue.cpp

    r55914 r56182  
    6969    // These are the empty and deleted values of the hash table.
    7070    if (rgbValue == Color::transparent) {
    71         static CSSPrimitiveValue* colorTransparent = new CSSPrimitiveValue(Color::transparent);
     71        static CSSPrimitiveValue* colorTransparent = new CSSPrimitiveValue(CSSValueTransparent);
    7272        return colorTransparent;
    7373    }
  • trunk/WebCore/css/CSSStyleSheet.cpp

    r53607 r56182  
    9797    }
    9898
    99     // ###
    100     // HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an
    101     //@import rule is inserted after a standard rule set or other at-rule.
     99    // Throw a HIERARCHY_REQUEST_ERR exception if the rule cannot be inserted at the specified index.  The best
     100    // example of this is an @import rule inserted after regular rules.
     101    if (index > 0) {
     102        if (r->isImportRule()) {
     103            // Check all the rules that come before this one to make sure they are only @charset and @import rules.
     104            for (unsigned i = 0; i < index; ++i) {
     105                if (!item(i)->isCharsetRule() && !item(i)->isImportRule()) {
     106                    ec = HIERARCHY_REQUEST_ERR;
     107                    return 0;
     108                }
     109            }
     110        } else if (r->isCharsetRule()) {
     111            // The @charset rule has to come first and there can be only one.
     112            ec = HIERARCHY_REQUEST_ERR;
     113            return 0;
     114        }
     115    }
     116
    102117    insert(index, r.release());
    103118   
Note: See TracChangeset for help on using the changeset viewer.