Implement "content: none". Bug 378535, r+sr=dbaron

This commit is contained in:
bzbarsky@mit.edu 2007-04-26 21:43:06 -07:00
parent f7a3d5590c
commit c51b87ebce
7 changed files with 60 additions and 5 deletions

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="div1">PASS1</div>
<div id="div2">PASS2</div>
<div id="div3"></div>
<div id="div4">PASS4</div>
<div id="div5"></div>
<div id="div6">PASS6</div>
<div id="div7">PASS7</div>
<div id="div8">PASS8</div>
<div id="div9">PASS9</div>
<div id="div10">PASS10</div>
<div id="div11"></div>
<div id="div12">PASS12</div>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#div1:before { content: "PASS1"; }
#div2:before { content: "FAIL2"; content: "PASS2" }
#div3:before { content: "FAIL3"; content: normal; }
#div4:before { content: normal; content: "PASS4"; }
#div5:before { content: "FAIL5"; content: none; }
#div6:before { content: "PASS6"; content: none none; }
#div7:before { content: "PASS7"; content: normal none; }
#div8:before { content: "PASS8"; content: none normal; }
#div9:before { content: "PASS9"; content: "FAIL8" none; }
#div10:before { content: "PASS10"; content: no-open-quote none; }
#div11:before { content: "FAIL11"; content: no-open-quote no-close-quote; }
#div12:before { content: "PASS12"; content: none "FAIL12"; }
</style>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
<div id="div4"></div>
<div id="div5"></div>
<div id="div6"></div>
<div id="div7"></div>
<div id="div8"></div>
<div id="div9"></div>
<div id="div10"></div>
<div id="div11"></div>
<div id="div12"></div>
</body>
</html>

View File

@ -222,3 +222,4 @@ fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 372037-1.html 372037-1-ref.html # bug 3
== 374193-1.xhtml about:blank
fails == 376484-1.html 376484-1-ref.html
== 377603-1.html 377603-1-ref.html
== 378535-1.html 378535-1-ref.html

View File

@ -5327,7 +5327,8 @@ PRBool CSSParserImpl::ParseContent(nsresult& aErrorCode)
// XXX Rewrite to make it look more like ParseCursor or ParseCounterData?
nsCSSValue value;
if (ParseVariant(aErrorCode, value,
VARIANT_CONTENT | VARIANT_INHERIT | VARIANT_NORMAL,
VARIANT_CONTENT | VARIANT_INHERIT | VARIANT_NORMAL |
VARIANT_NONE,
nsCSSProps::kContentKTable)) {
nsCSSValueList* listHead = new nsCSSValueList();
nsCSSValueList* list = listHead;
@ -5347,6 +5348,7 @@ PRBool CSSParserImpl::ParseContent(nsresult& aErrorCode)
if (eCSSUnit_Inherit == value.GetUnit() ||
eCSSUnit_Initial == value.GetUnit() ||
eCSSUnit_Normal == value.GetUnit() ||
eCSSUnit_None == value.GetUnit() ||
(eCSSUnit_Enumerated == value.GetUnit() &&
NS_STYLE_CONTENT_ALT_CONTENT == value.GetIntValue())) {
// This only matters the first time through the loop.

View File

@ -3724,14 +3724,15 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
COMPUTE_START_RESET(Content, (), content, parentContent,
Content, contentData)
// content: [string, url, counter, attr, enum]+, normal, inherit
// content: [string, url, counter, attr, enum]+, normal, none, inherit
PRUint32 count;
nsAutoString buffer;
nsCSSValueList* contentValue = contentData.mContent;
if (contentValue) {
if (eCSSUnit_Normal == contentValue->mValue.GetUnit() ||
eCSSUnit_None == contentValue->mValue.GetUnit() ||
eCSSUnit_Initial == contentValue->mValue.GetUnit()) {
// "normal" and "initial" both mean no content
// "normal", "none", and "initial" all mean no content
content->AllocateContents(0);
}
else if (eCSSUnit_Inherit == contentValue->mValue.GetUnit()) {

View File

@ -86,7 +86,6 @@ var gNotAccepted = {
"-moz-column-width": [ "50%" ],
"-moz-user-select": [ "auto" ],
"background-color": [ "rgb(255.0,0.387,3489)" ],
"content": [ "none" ],
"list-style": [ "none disc outside" ],
};

View File

@ -65,7 +65,6 @@ var gNotAccepted = {
"-moz-column-width": [ "50%" ],
"-moz-user-select": [ "auto" ],
"background-color": [ "rgb(255.0,0.387,3489)" ],
"content": [ "none" ],
"list-style": [ "none disc outside" ],
};