зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
8f186cdbd5
Коммит
c72fb8dce5
|
@ -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 {
|
||||
|
|
|
@ -88,6 +88,9 @@ CSS_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported")
|
|||
|
||||
CSS_PSEUDO_CLASS(mozHasHandlerRef, ":-moz-has-handlerref")
|
||||
|
||||
// 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")
|
||||
|
|
|
@ -1256,6 +1256,10 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
else if (nsCSSPseudoClasses::mozReadWrite == pseudoClass->mAtom) {
|
||||
stateToCheck = NS_EVENT_STATE_MOZ_READWRITE;
|
||||
}
|
||||
else if (nsCSSPseudoClasses::mozIsHTML == pseudoClass->mAtom) {
|
||||
result = data.mIsHTMLContent &&
|
||||
data.mContent->GetNameSpaceID() == kNameSpaceID_None;
|
||||
}
|
||||
else {
|
||||
NS_ERROR("CSS parser parsed a pseudo-class that we do not handle");
|
||||
result = PR_FALSE; // unknown pseudo class
|
||||
|
|
|
@ -90,28 +90,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
|
||||
|
@ -352,8 +331,7 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(void)
|
|||
mLinkRule(nsnull),
|
||||
mVisitedRule(nsnull),
|
||||
mActiveRule(nsnull),
|
||||
mDocumentColorRule(nsnull),
|
||||
mTableFormRule(nsnull)
|
||||
mDocumentColorRule(nsnull)
|
||||
{
|
||||
mMappedAttrTable.ops = nsnull;
|
||||
}
|
||||
|
@ -385,11 +363,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;
|
||||
}
|
||||
|
||||
|
@ -401,7 +374,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);
|
||||
|
@ -498,25 +470,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 = content->GetOwnerDoc();
|
||||
nsIContent* parent = content->GetParent();
|
||||
if (!content->GetChildCount() && // form is empty
|
||||
doc && !doc->IsCaseSensitive() && // document is not XHTML
|
||||
parent && parent->IsNodeOfType(nsINode::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
|
||||
|
@ -707,7 +660,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);
|
||||
|
|
|
@ -125,23 +125,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 {
|
||||
|
@ -214,7 +197,6 @@ private:
|
|||
HTMLColorRule* mVisitedRule;
|
||||
HTMLColorRule* mActiveRule;
|
||||
HTMLColorRule* mDocumentColorRule;
|
||||
TableFormRule* mTableFormRule;
|
||||
TableTbodyRule* mTableTbodyRule;
|
||||
TableRowRule* mTableRowRule;
|
||||
TableColgroupRule* mTableColgroupRule;
|
||||
|
|
Загрузка…
Ссылка в новой задаче