Fix bug 349695 by taking a different approach to setting display:none on HTML
forms inside tables; this approach overrides author styles. r+sr=dbaron, a=dveditz git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_0_BRANCH@208501 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -252,6 +252,13 @@ th {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
tr > form:-moz-is-html, tbody > form:-moz-is-html,
|
||||
thead > form:-moz-is-html, tfoot > form:-moz-is-html,
|
||||
table > form:-moz-is-html {
|
||||
/* Important: don't show these forms in HTML */
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* inlines */
|
||||
|
||||
q:before {
|
||||
|
||||
@@ -76,6 +76,9 @@ CSS_PSEUDO_CLASS(lastChild, ":last-child")
|
||||
CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node")
|
||||
CSS_PSEUDO_CLASS(onlyChild, ":only-child")
|
||||
|
||||
// Match nodes that are HTML but not XHTML
|
||||
CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html")
|
||||
|
||||
// CSS 3 UI
|
||||
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
|
||||
CSS_PSEUDO_CLASS(required, ":required")
|
||||
|
||||
@@ -3158,6 +3158,12 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||
else if (nsCSSPseudoClasses::mozReadWrite == pseudoClass->mAtom) {
|
||||
result = STATE_CHECK(NS_EVENT_STATE_MOZ_READWRITE);
|
||||
}
|
||||
else if (nsCSSPseudoClasses::mozIsHTML == pseudoClass->mAtom) {
|
||||
result =
|
||||
(data.mIsHTMLContent &&
|
||||
data.mContent->GetNameSpaceID() == kNameSpaceID_None) ? localTrue :
|
||||
localFalse;
|
||||
}
|
||||
else {
|
||||
NS_ERROR("CSS parser parsed a pseudo-class that we do not handle");
|
||||
result = PR_FALSE; // unknown pseudo class
|
||||
|
||||
@@ -85,28 +85,7 @@ nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, PRInt32 aIndent) const
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::TableFormRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::TableFormRule::MapRuleInfoInto(nsRuleData* aRuleData)
|
||||
{
|
||||
if (aRuleData->mSID == eStyleStruct_Display &&
|
||||
aRuleData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null) {
|
||||
nsCSSValue none(NS_STYLE_DISPLAY_NONE, eCSSUnit_Enumerated);
|
||||
aRuleData->mDisplayData->mDisplay = none;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
nsHTMLStyleSheet::TableFormRule::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -347,8 +326,7 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(void)
|
||||
mLinkRule(nsnull),
|
||||
mVisitedRule(nsnull),
|
||||
mActiveRule(nsnull),
|
||||
mDocumentColorRule(nsnull),
|
||||
mTableFormRule(nsnull)
|
||||
mDocumentColorRule(nsnull)
|
||||
{
|
||||
mMappedAttrTable.ops = nsnull;
|
||||
}
|
||||
@@ -380,11 +358,6 @@ nsHTMLStyleSheet::Init()
|
||||
if (!mTableTHRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableTHRule);
|
||||
|
||||
mTableFormRule = new TableFormRule();
|
||||
if (!mTableFormRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mTableFormRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -396,7 +369,6 @@ nsHTMLStyleSheet::~nsHTMLStyleSheet()
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
NS_IF_RELEASE(mTableFormRule);
|
||||
NS_IF_RELEASE(mTableTbodyRule);
|
||||
NS_IF_RELEASE(mTableRowRule);
|
||||
NS_IF_RELEASE(mTableColgroupRule);
|
||||
@@ -494,26 +466,6 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
|
||||
ruleWalker->Forward(mDocumentColorRule);
|
||||
}
|
||||
}
|
||||
else if (tag == nsHTMLAtoms::form) {
|
||||
// suppress in html documents empty forms inside tables,
|
||||
// they have been used as a hack
|
||||
// to avoid the form top and bottom margin
|
||||
nsIDocument* doc = styledContent->GetOwnerDoc();
|
||||
nsIContent* parent = styledContent->GetParent();
|
||||
if (!styledContent->GetChildCount() && // form is empty
|
||||
doc && !doc->IsCaseSensitive() && // document is not XHTML
|
||||
parent && parent->IsContentOfType(nsIContent::eHTML)) {
|
||||
// parent is HTML
|
||||
nsIAtom* parentTag = parent->Tag();
|
||||
if ((nsHTMLAtoms::table == parentTag) ||
|
||||
(nsHTMLAtoms::tr == parentTag) ||
|
||||
(nsHTMLAtoms::tbody == parentTag) ||
|
||||
(nsHTMLAtoms::thead == parentTag) ||
|
||||
(nsHTMLAtoms::tfoot == parentTag)) {
|
||||
ruleWalker->Forward(mTableFormRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end html element
|
||||
|
||||
// just get the style rules from the content
|
||||
@@ -704,7 +656,6 @@ nsHTMLStyleSheet::Reset(nsIURI* aURL)
|
||||
NS_IF_RELEASE(mVisitedRule);
|
||||
NS_IF_RELEASE(mActiveRule);
|
||||
NS_IF_RELEASE(mDocumentColorRule);
|
||||
NS_IF_RELEASE(mTableFormRule);
|
||||
|
||||
if (mMappedAttrTable.ops) {
|
||||
PL_DHashTableFinish(&mMappedAttrTable);
|
||||
|
||||
@@ -119,23 +119,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// this rule supresses forms inside table tags in html
|
||||
class TableFormRule;
|
||||
friend class TableFormRule;
|
||||
class TableFormRule: public nsIStyleRule {
|
||||
public:
|
||||
TableFormRule() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIStyleRule interface
|
||||
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
class GenericTableRule;
|
||||
friend class GenericTableRule;
|
||||
class GenericTableRule: public nsIStyleRule {
|
||||
@@ -208,7 +191,6 @@ private:
|
||||
HTMLColorRule* mVisitedRule;
|
||||
HTMLColorRule* mActiveRule;
|
||||
HTMLColorRule* mDocumentColorRule;
|
||||
TableFormRule* mTableFormRule;
|
||||
TableTbodyRule* mTableTbodyRule;
|
||||
TableRowRule* mTableRowRule;
|
||||
TableColgroupRule* mTableColgroupRule;
|
||||
|
||||
Reference in New Issue
Block a user