From c2c4cce304da59a208e62e33862418fb46593e36 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 14 Apr 2004 02:05:52 +0000 Subject: [PATCH] Make sure to apply our styles to our anonymous content no matter what the page's style language is. Bug 234761, r=sicking, sr=jst git-svn-id: svn://10.0.0.236/trunk@154840 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsGenericHTMLElement.cpp | 13 ++++++++----- mozilla/layout/forms/nsTextControlFrame.cpp | 3 +++ .../layout/html/forms/src/nsTextControlFrame.cpp | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index feba14e6814..c3275750a3f 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -2618,11 +2618,14 @@ nsGenericHTMLElement::ParseStyleAttribute(nsIContent* aContent, if (doc) { PRBool isCSS = PR_TRUE; // assume CSS until proven otherwise - nsAutoString styleType; - doc->GetHeaderData(nsHTMLAtoms::headerContentStyleType, styleType); - if (!styleType.IsEmpty()) { - static const char textCssStr[] = "text/css"; - isCSS = (styleType.EqualsIgnoreCase(textCssStr, sizeof(textCssStr) - 1)); + if (!aContent->IsNativeAnonymous()) { // native anonymous content + // always assumes CSS + nsAutoString styleType; + doc->GetHeaderData(nsHTMLAtoms::headerContentStyleType, styleType); + if (!styleType.IsEmpty()) { + static const char textCssStr[] = "text/css"; + isCSS = (styleType.EqualsIgnoreCase(textCssStr, sizeof(textCssStr) - 1)); + } } if (isCSS) { diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 5c7e644cc06..e132eee442c 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1675,6 +1675,9 @@ nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, if (!divContent) return NS_ERROR_FAILURE; + // Set the div native anonymous, so CSS will be its style language + // no matter what. + divContent->SetNativeAnonymous(PR_TRUE); // Set the neccessary style attributes on the text control. diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 5c7e644cc06..e132eee442c 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -1675,6 +1675,9 @@ nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, if (!divContent) return NS_ERROR_FAILURE; + // Set the div native anonymous, so CSS will be its style language + // no matter what. + divContent->SetNativeAnonymous(PR_TRUE); // Set the neccessary style attributes on the text control.