Make implied universal selectors be equivalent to ns|* where ns is the default namespace, and make appropriate changes to our CSS files. This brings us into conformance with the CSS3 selectors draft and improves performance by reducing the number of universally hashed selectors. Most of this patch is by attinasi. (35847, 83482) Also make first-node/last-node rules in quirks.css non-universal to improve performance. (83839) r=rbs sr=waterson a=asa b=35847

This commit is contained in:
dbaron%fas.harvard.edu 2001-06-09 01:32:19 +00:00
parent 08fd630ec6
commit b659af71e9
14 changed files with 203 additions and 67 deletions

View File

@ -1745,6 +1745,22 @@ void CSSParserImpl::ParseTypeOrUniversalSelector(PRInt32& aDataMask,
return;
}
}
else {
// no tag or namespace: implied universal selector
// set namespace to unknown since it is not specified
aSelector.SetNameSpace(kNameSpaceID_Unknown); // wildcard
if (mNameSpace) { // look for default namespace
nsINameSpace* defaultNameSpace = nsnull;
mNameSpace->FindNameSpace(nsnull, defaultNameSpace);
if (defaultNameSpace) {
PRInt32 defaultID;
defaultNameSpace->GetNameSpaceID(defaultID);
aSelector.SetNameSpace(defaultID);
NS_RELEASE(defaultNameSpace);
}
}
}
aParsingStatus = SELECTOR_PARSING_ENDED_OK;
if (aIsNegated) {
// restore last token read in case of a negated type selector

View File

@ -26,7 +26,7 @@
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
:fieldset-content {
*|*:fieldset-content {
display: block;
}
@ -87,7 +87,7 @@ textarea {
-moz-binding: url("resource:///res/builtin/platformHTMLBindings.xml#textAreas");
}
:-moz-singleline-textcontrol-frame {
*|*:-moz-singleline-textcontrol-frame {
overflow: hidden;
white-space: nowrap;
background-color: inherit;
@ -141,7 +141,7 @@ select:-moz-dummy-option {
content: "XX"; /* demo 8, edge case test 1 */
}
:-moz-display-comboboxcontrol-frame {
*|*:-moz-display-comboboxcontrol-frame {
overflow: hidden;
white-space: nowrap;
background-color: inherit;
@ -187,7 +187,7 @@ optgroup:before {
content: attr(label);
}
:-moz-dropdown-list {
*|*:-moz-dropdown-list {
background-color: inherit;
border: 1px outset black;
border-top-style: none;
@ -304,7 +304,7 @@ input[type="radio"]:hover:active {
background-color: ThreeDHighlight;
}
:-moz-radio {
*|*:-moz-radio {
background-color: -moz-FieldText;
width: 4px;
height: 4px;
@ -331,7 +331,7 @@ input[type="submit"] {
-moz-binding: none;
}
:button-content {
*|*:button-content {
display: block;
text-align: center;
}

View File

@ -130,7 +130,7 @@ plaintext, xmp, pre {
/* tables */
table, :table {
table, *|*:table {
display: table;
border-spacing: 2px;
border-collapse: separate;
@ -148,7 +148,7 @@ table[align="right"] {
text-align: start;
}
:table-outer {
*|*:table-outer {
display: table;
margin: 0;
border: none;
@ -178,15 +178,15 @@ tr {
vertical-align: inherit;
}
:table-row {
*|*:table-row {
display: table-row;
}
col, :table-column {
col, *|*:table-column {
display: table-column;
}
colgroup, :table-column-group {
colgroup, *|*:table-column-group {
display: table-column-group;
}
@ -205,7 +205,7 @@ tfoot {
vertical-align: middle;
}
:table-row-group {
*|*:table-row-group {
display: table-row-group;
}
@ -223,7 +223,7 @@ th {
padding: 1px;
}
:table-cell {
*|*:table-cell {
display: table-cell;
padding: 1px;
}
@ -295,7 +295,7 @@ abbr[title], acronym[title] {
/* lists */
:-moz-list-bullet {
*|*:-moz-list-bullet {
display: inline;
vertical-align: baseline;
margin-right: 8px;
@ -364,7 +364,7 @@ hr {
margin: 0 auto 0 auto;
}
:-moz-any-link img, img[usemap], object[usemap] {
*|*:-moz-any-link img, img[usemap], object[usemap] {
border: 2px solid;
cursor: pointer;
}
@ -401,34 +401,34 @@ noframes {
/* focusable content */
/* links */
:-moz-any-link {
*|*:-moz-any-link {
cursor: pointer;
-moz-user-focus: normal;
}
:-moz-any-link:active {
*|*:-moz-any-link:active {
color: red;
}
:-moz-any-link:focus {
*|*:-moz-any-link:focus {
-moz-outline: 1px dotted WindowText;
}
/* hidden elements */
area, base, basefont, head, meta, script, style, title,
noembed, noscript, param, :-moz-comment, :-moz-pi {
noembed, noscript, param, *|*:-moz-comment, *|*:-moz-pi {
display: none;
}
/* magic */
:viewport, :viewport-scroll, :canvas {
*|*:viewport, *|*:viewport-scroll, *|*:canvas {
display: block;
background-color: inherit;
}
:scrolled-content {
*|*:scrolled-content {
/* e.g., text inputs, select boxes */
background: inherit;
padding: inherit;
@ -436,22 +436,22 @@ noembed, noscript, param, :-moz-comment, :-moz-pi {
-moz-xul-box-orient: inherit;
}
:wrapped-frame {
*|*:wrapped-frame {
display: inherit;
}
:placeholder-frame {
*|*:placeholder-frame {
display: inline;
width: 0;
height: 0;
}
:-moz-page, :-moz-page-sequence {
*|*:-moz-page, *|*:-moz-page-sequence {
display: block;
background: transparent;
}
:-moz-anonymous-positioned-block {
*|*:-moz-anonymous-positioned-block {
display: block;
position: relative;
top: inherit;

View File

@ -90,11 +90,56 @@ td, th, tr, thead, tbody, tfoot {
/* Quirk: collapse top margin of BODY and TD and bottom margin of TD */
body > :first-node, td > :first-node {
/*
* While it may seem simpler to use :first-node and :last-node without
* tags, it's slower, since we have to do the :first-node or :last-node
* check on every single element in the document. If we list all the
* element names for which the UA stylesheet specifies a margin, the
* selectors will be hashed in the RuleHash and things will be much more
* efficient.
*/
body > form:first-node, td > form:first-node,
body > p:first-node, td > p:first-node,
body > dl:first-node, td > dl:first-node,
body > multicol:first-node, td > multicol:first-node,
body > blockquote:first-node, td > blockquote:first-node,
body > h1:first-node, td > h1:first-node,
body > h2:first-node, td > h2:first-node,
body > h3:first-node, td > h3:first-node,
body > h4:first-node, td > h4:first-node,
body > h5:first-node, td > h5:first-node,
body > h6:first-node, td > h6:first-node,
body > listing:first-node, td > listing:first-node,
body > plaintext:first-node, td > plaintext:first-node,
body > xmp:first-node, td > xmp:first-node,
body > pre:first-node, td > pre:first-node,
body > ul:first-node, td > ul:first-node,
body > menu:first-node, td > menu:first-node,
body > dir:first-node, td > dir:first-node,
body > ol:first-node, td > ol:first-node {
margin-top: 0;
}
td > :last-node {
td > form:last-node,
td > p:last-node,
td > dl:last-node,
td > multicol:last-node,
td > blockquote:last-node,
td > h1:last-node,
td > h2:last-node,
td > h3:last-node,
td > h4:last-node,
td > h5:last-node,
td > h6:last-node,
td > listing:last-node,
td > plaintext:last-node,
td > xmp:last-node,
td > pre:last-node,
td > ul:last-node,
td > menu:last-node,
td > dir:last-node,
td > ol:last-node {
margin-bottom: 0;
}
@ -210,6 +255,11 @@ img[align=right] {
margin-left: 3px;
}
/*
* XXX This is a potential performance problem. This should not be
* using an attribute!
*/
/* Quirk: Make sure that the residual style tags' size info.
* does not take precedence over heading tags' size. (b=77352)
* Note: This special attribute is set only for a residual

View File

@ -26,7 +26,7 @@
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
:fieldset-content {
*|*:fieldset-content {
display: block;
}
@ -87,7 +87,7 @@ textarea {
-moz-binding: url("resource:///res/builtin/platformHTMLBindings.xml#textAreas");
}
:-moz-singleline-textcontrol-frame {
*|*:-moz-singleline-textcontrol-frame {
overflow: hidden;
white-space: nowrap;
background-color: inherit;
@ -141,7 +141,7 @@ select:-moz-dummy-option {
content: "XX"; /* demo 8, edge case test 1 */
}
:-moz-display-comboboxcontrol-frame {
*|*:-moz-display-comboboxcontrol-frame {
overflow: hidden;
white-space: nowrap;
background-color: inherit;
@ -187,7 +187,7 @@ optgroup:before {
content: attr(label);
}
:-moz-dropdown-list {
*|*:-moz-dropdown-list {
background-color: inherit;
border: 1px outset black;
border-top-style: none;
@ -304,7 +304,7 @@ input[type="radio"]:hover:active {
background-color: ThreeDHighlight;
}
:-moz-radio {
*|*:-moz-radio {
background-color: -moz-FieldText;
width: 4px;
height: 4px;
@ -331,7 +331,7 @@ input[type="submit"] {
-moz-binding: none;
}
:button-content {
*|*:button-content {
display: block;
text-align: center;
}

View File

@ -130,7 +130,7 @@ plaintext, xmp, pre {
/* tables */
table, :table {
table, *|*:table {
display: table;
border-spacing: 2px;
border-collapse: separate;
@ -148,7 +148,7 @@ table[align="right"] {
text-align: start;
}
:table-outer {
*|*:table-outer {
display: table;
margin: 0;
border: none;
@ -178,15 +178,15 @@ tr {
vertical-align: inherit;
}
:table-row {
*|*:table-row {
display: table-row;
}
col, :table-column {
col, *|*:table-column {
display: table-column;
}
colgroup, :table-column-group {
colgroup, *|*:table-column-group {
display: table-column-group;
}
@ -205,7 +205,7 @@ tfoot {
vertical-align: middle;
}
:table-row-group {
*|*:table-row-group {
display: table-row-group;
}
@ -223,7 +223,7 @@ th {
padding: 1px;
}
:table-cell {
*|*:table-cell {
display: table-cell;
padding: 1px;
}
@ -295,7 +295,7 @@ abbr[title], acronym[title] {
/* lists */
:-moz-list-bullet {
*|*:-moz-list-bullet {
display: inline;
vertical-align: baseline;
margin-right: 8px;
@ -364,7 +364,7 @@ hr {
margin: 0 auto 0 auto;
}
:-moz-any-link img, img[usemap], object[usemap] {
*|*:-moz-any-link img, img[usemap], object[usemap] {
border: 2px solid;
cursor: pointer;
}
@ -401,34 +401,34 @@ noframes {
/* focusable content */
/* links */
:-moz-any-link {
*|*:-moz-any-link {
cursor: pointer;
-moz-user-focus: normal;
}
:-moz-any-link:active {
*|*:-moz-any-link:active {
color: red;
}
:-moz-any-link:focus {
*|*:-moz-any-link:focus {
-moz-outline: 1px dotted WindowText;
}
/* hidden elements */
area, base, basefont, head, meta, script, style, title,
noembed, noscript, param, :-moz-comment, :-moz-pi {
noembed, noscript, param, *|*:-moz-comment, *|*:-moz-pi {
display: none;
}
/* magic */
:viewport, :viewport-scroll, :canvas {
*|*:viewport, *|*:viewport-scroll, *|*:canvas {
display: block;
background-color: inherit;
}
:scrolled-content {
*|*:scrolled-content {
/* e.g., text inputs, select boxes */
background: inherit;
padding: inherit;
@ -436,22 +436,22 @@ noembed, noscript, param, :-moz-comment, :-moz-pi {
-moz-xul-box-orient: inherit;
}
:wrapped-frame {
*|*:wrapped-frame {
display: inherit;
}
:placeholder-frame {
*|*:placeholder-frame {
display: inline;
width: 0;
height: 0;
}
:-moz-page, :-moz-page-sequence {
*|*:-moz-page, *|*:-moz-page-sequence {
display: block;
background: transparent;
}
:-moz-anonymous-positioned-block {
*|*:-moz-anonymous-positioned-block {
display: block;
position: relative;
top: inherit;

View File

@ -1745,6 +1745,22 @@ void CSSParserImpl::ParseTypeOrUniversalSelector(PRInt32& aDataMask,
return;
}
}
else {
// no tag or namespace: implied universal selector
// set namespace to unknown since it is not specified
aSelector.SetNameSpace(kNameSpaceID_Unknown); // wildcard
if (mNameSpace) { // look for default namespace
nsINameSpace* defaultNameSpace = nsnull;
mNameSpace->FindNameSpace(nsnull, defaultNameSpace);
if (defaultNameSpace) {
PRInt32 defaultID;
defaultNameSpace->GetNameSpaceID(defaultID);
aSelector.SetNameSpace(defaultID);
NS_RELEASE(defaultNameSpace);
}
}
}
aParsingStatus = SELECTOR_PARSING_ENDED_OK;
if (aIsNegated) {
// restore last token read in case of a negated type selector

View File

@ -90,11 +90,56 @@ td, th, tr, thead, tbody, tfoot {
/* Quirk: collapse top margin of BODY and TD and bottom margin of TD */
body > :first-node, td > :first-node {
/*
* While it may seem simpler to use :first-node and :last-node without
* tags, it's slower, since we have to do the :first-node or :last-node
* check on every single element in the document. If we list all the
* element names for which the UA stylesheet specifies a margin, the
* selectors will be hashed in the RuleHash and things will be much more
* efficient.
*/
body > form:first-node, td > form:first-node,
body > p:first-node, td > p:first-node,
body > dl:first-node, td > dl:first-node,
body > multicol:first-node, td > multicol:first-node,
body > blockquote:first-node, td > blockquote:first-node,
body > h1:first-node, td > h1:first-node,
body > h2:first-node, td > h2:first-node,
body > h3:first-node, td > h3:first-node,
body > h4:first-node, td > h4:first-node,
body > h5:first-node, td > h5:first-node,
body > h6:first-node, td > h6:first-node,
body > listing:first-node, td > listing:first-node,
body > plaintext:first-node, td > plaintext:first-node,
body > xmp:first-node, td > xmp:first-node,
body > pre:first-node, td > pre:first-node,
body > ul:first-node, td > ul:first-node,
body > menu:first-node, td > menu:first-node,
body > dir:first-node, td > dir:first-node,
body > ol:first-node, td > ol:first-node {
margin-top: 0;
}
td > :last-node {
td > form:last-node,
td > p:last-node,
td > dl:last-node,
td > multicol:last-node,
td > blockquote:last-node,
td > h1:last-node,
td > h2:last-node,
td > h3:last-node,
td > h4:last-node,
td > h5:last-node,
td > h6:last-node,
td > listing:last-node,
td > plaintext:last-node,
td > xmp:last-node,
td > pre:last-node,
td > ul:last-node,
td > menu:last-node,
td > dir:last-node,
td > ol:last-node {
margin-bottom: 0;
}
@ -210,6 +255,11 @@ img[align=right] {
margin-left: 3px;
}
/*
* XXX This is a potential performance problem. This should not be
* using an attribute!
*/
/* Quirk: Make sure that the residual style tags' size info.
* does not take precedence over heading tags' size. (b=77352)
* Note: This special attribute is set only for a residual

View File

@ -1,4 +1,5 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to HTML */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
/* ::::: autocomplete ::::: */
@ -7,7 +8,7 @@ textbox[type="autocomplete"]
cursor : default !important;
}
.textbox-input
html|*.textbox-input
{
cursor : text;
}

View File

@ -1,5 +1,5 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to HTML */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for XUL elements */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
/** generic text fields (in dialogs)
**/
@ -56,7 +56,7 @@
}
/* internal text widget */
.textbox-input, .textbox-textarea
html|*.textbox-input, html|*.textbox-textarea
{
border : none !important;
margin : 0px;

View File

@ -1,5 +1,5 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to HTML */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for XUL elements */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
/** generic text fields (in dialogs)
**/
@ -35,7 +35,7 @@
}
/* internal text widget */
.textbox-input, .textbox-textarea
html|*.textbox-input, html|*.textbox-textarea
{
border : none !important;
margin : 0px;
@ -70,7 +70,7 @@
margin : 0px !important;
}
.textbox-inline-edit > .textbox-internal-box > .textbox-input
.textbox-inline-edit > .textbox-internal-box > html|*.textbox-input
{
border : none !important;
padding : 0px !important;

View File

@ -26,6 +26,7 @@
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
/* ::::: autocomplete ::::: */
@ -33,7 +34,7 @@ textbox[type="autocomplete"] {
cursor: default !important;
}
.textbox-input {
html|*.textbox-input {
cursor: text;
margin: 0px;
border: none;

View File

@ -28,6 +28,7 @@
@import url("chrome://global/content/autocomplete.css");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
/* ::::: textbox ::::: */
@ -59,8 +60,8 @@ textbox[readonly="true"][focused="true"] > .textarea-internal-box {
border: 1px solid #5D616E;
}
.textbox-input,
.textbox-textarea {
html|*.textbox-input,
html|*.textbox-textarea {
margin: 0px !important;
border: none !important;
padding: 0px !important;

View File

@ -1,3 +1,4 @@
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
box[type="location-field"]
@ -17,7 +18,7 @@ menulist[editable="true"]
}
/* XXX factor me */
.textbox-input
html|*.textbox-input
{
-moz-user-focus : normal;
}