diff --git a/mozilla/content/shared/public/nsCSSAnonBoxList.h b/mozilla/content/shared/public/nsCSSAnonBoxList.h index 78ddcc8d0f9..b8acd69d8c9 100644 --- a/mozilla/content/shared/public/nsCSSAnonBoxList.h +++ b/mozilla/content/shared/public/nsCSSAnonBoxList.h @@ -66,7 +66,6 @@ CSS_ANON_BOX(fieldsetContent, ":-moz-fieldset-content") CSS_ANON_BOX(framesetBlank, ":-moz-frameset-blank") CSS_ANON_BOX(radio, ":-moz-radio") CSS_ANON_BOX(check, ":-moz-checkbox") -CSS_ANON_BOX(mozSingleLineTextControlFrame, ":-moz-singleline-textcontrol-frame") CSS_ANON_BOX(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame") CSS_ANON_BOX(dummyOption, ":-moz-dummy-option") diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 16ff7134622..5784d214576 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1586,26 +1586,6 @@ nsTextControlFrame::InitEditor() return NS_OK; } -// XXXldb I'm not sure if we really want the 'text-decoration: inherit', -// but it's needed to make 'text-decoration' "work" on text inputs. -#define DIV_STRING \ - "-moz-user-focus: none;" \ - "border: 0px !important;" \ - "padding: 0px;" \ - "margin: 0px;" \ - "text-decoration: inherit;" \ - "" - -#define DIV_STRING_SINGLELINE \ - "-moz-user-focus: none;" \ - "white-space : nowrap;" \ - "overflow: auto;" \ - "border: 0px !important;" \ - "padding: 0px;" \ - "margin: 0px;" \ - "text-decoration: inherit;" \ - "" - NS_IMETHODIMP nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, nsISupportsArray& aChildList) @@ -1672,17 +1652,22 @@ nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // Set the neccessary style attributes on the text control. - if (IsSingleLineTextControl()) - rv = divContent->SetAttr(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertASCIItoUCS2(DIV_STRING_SINGLELINE), PR_FALSE); - else { - nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING); + rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::kClass, + NS_LITERAL_STRING("anonymous-div"), PR_FALSE); + + if (!IsSingleLineTextControl()) { + // We can't just inherit the overflow because setting visible overflow will + // crash when the number of lines exceeds the height of the textarea and + // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_HIDDEN) + // doesn't paint the caret for some reason. const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp->mOverflow == NS_STYLE_OVERFLOW_SCROLL) - divStr += NS_LITERAL_STRING("overflow:scroll;"); - else if (disp->mOverflow == NS_STYLE_OVERFLOW_HIDDEN) - divStr += NS_LITERAL_STRING("overflow:-moz-scrollbars-none;"); - else divStr += NS_LITERAL_STRING("overflow:auto;"); - rv = divContent->SetAttr(kNameSpaceID_None,nsHTMLAtoms::style, divStr, PR_FALSE); + if (disp->mOverflow != NS_STYLE_OVERFLOW_AUTO && // this is the default + disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + disp->mOverflow != NS_STYLE_OVERFLOW_HIDDEN) { + rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, + NS_LITERAL_STRING("overflow: inherit;"), + PR_FALSE); + } } if (NS_FAILED(rv)) diff --git a/mozilla/layout/forms/resources/content/xbl-forms.css b/mozilla/layout/forms/resources/content/xbl-forms.css index 0c5d4693f9a..7905aec45e2 100644 --- a/mozilla/layout/forms/resources/content/xbl-forms.css +++ b/mozilla/layout/forms/resources/content/xbl-forms.css @@ -207,6 +207,10 @@ input { padding: 1px 0 1px 0; } +input > .anonymous-div { + white-space : nowrap; +} + textarea { background-color: -moz-Field; border: 2px inset ThreeDFace; @@ -225,11 +229,16 @@ textarea > scrollbar { cursor: default; } -*|*::-moz-singleline-textcontrol-frame { - overflow: -moz-hidden-unscrollable; - white-space: nowrap; - background-color: inherit; - text-align: inherit; +textarea > .anonymous-div, +input > .anonymous-div { + -moz-user-focus: none; + overflow: auto; + border: 0px !important; + padding: 0px; + margin: 0px; + /* XXXldb I'm not sure if we really want the 'text-decoration: inherit', + but it's needed to make 'text-decoration' "work" on text inputs. */ + text-decoration: inherit; } input[disabled], diff --git a/mozilla/layout/html/document/src/forms.css b/mozilla/layout/html/document/src/forms.css index d238d92e019..f189589ce2a 100644 --- a/mozilla/layout/html/document/src/forms.css +++ b/mozilla/layout/html/document/src/forms.css @@ -98,6 +98,10 @@ input { text-indent: 0; } +input > .anonymous-div { + white-space : nowrap; +} + textarea { margin: 1px 0 1px 0; border: 2px inset ThreeDFace; @@ -120,11 +124,16 @@ textarea > scrollbar { cursor: default; } -*|*::-moz-singleline-textcontrol-frame { - overflow: -moz-hidden-unscrollable; - white-space: nowrap; - background-color: inherit; - text-align: inherit; +textarea > .anonymous-div, +input > .anonymous-div { + -moz-user-focus: none; + overflow: auto; + border: 0px !important; + padding: 0px; + margin: 0px; + /* XXXldb I'm not sure if we really want the 'text-decoration: inherit', + but it's needed to make 'text-decoration' "work" on text inputs. */ + text-decoration: inherit; } select { diff --git a/mozilla/layout/html/forms/resources/content/xbl-forms.css b/mozilla/layout/html/forms/resources/content/xbl-forms.css index 0c5d4693f9a..7905aec45e2 100644 --- a/mozilla/layout/html/forms/resources/content/xbl-forms.css +++ b/mozilla/layout/html/forms/resources/content/xbl-forms.css @@ -207,6 +207,10 @@ input { padding: 1px 0 1px 0; } +input > .anonymous-div { + white-space : nowrap; +} + textarea { background-color: -moz-Field; border: 2px inset ThreeDFace; @@ -225,11 +229,16 @@ textarea > scrollbar { cursor: default; } -*|*::-moz-singleline-textcontrol-frame { - overflow: -moz-hidden-unscrollable; - white-space: nowrap; - background-color: inherit; - text-align: inherit; +textarea > .anonymous-div, +input > .anonymous-div { + -moz-user-focus: none; + overflow: auto; + border: 0px !important; + padding: 0px; + margin: 0px; + /* XXXldb I'm not sure if we really want the 'text-decoration: inherit', + but it's needed to make 'text-decoration' "work" on text inputs. */ + text-decoration: inherit; } input[disabled], diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 16ff7134622..5784d214576 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -1586,26 +1586,6 @@ nsTextControlFrame::InitEditor() return NS_OK; } -// XXXldb I'm not sure if we really want the 'text-decoration: inherit', -// but it's needed to make 'text-decoration' "work" on text inputs. -#define DIV_STRING \ - "-moz-user-focus: none;" \ - "border: 0px !important;" \ - "padding: 0px;" \ - "margin: 0px;" \ - "text-decoration: inherit;" \ - "" - -#define DIV_STRING_SINGLELINE \ - "-moz-user-focus: none;" \ - "white-space : nowrap;" \ - "overflow: auto;" \ - "border: 0px !important;" \ - "padding: 0px;" \ - "margin: 0px;" \ - "text-decoration: inherit;" \ - "" - NS_IMETHODIMP nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, nsISupportsArray& aChildList) @@ -1672,17 +1652,22 @@ nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // Set the neccessary style attributes on the text control. - if (IsSingleLineTextControl()) - rv = divContent->SetAttr(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertASCIItoUCS2(DIV_STRING_SINGLELINE), PR_FALSE); - else { - nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING); + rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::kClass, + NS_LITERAL_STRING("anonymous-div"), PR_FALSE); + + if (!IsSingleLineTextControl()) { + // We can't just inherit the overflow because setting visible overflow will + // crash when the number of lines exceeds the height of the textarea and + // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_HIDDEN) + // doesn't paint the caret for some reason. const nsStyleDisplay* disp = GetStyleDisplay(); - if (disp->mOverflow == NS_STYLE_OVERFLOW_SCROLL) - divStr += NS_LITERAL_STRING("overflow:scroll;"); - else if (disp->mOverflow == NS_STYLE_OVERFLOW_HIDDEN) - divStr += NS_LITERAL_STRING("overflow:-moz-scrollbars-none;"); - else divStr += NS_LITERAL_STRING("overflow:auto;"); - rv = divContent->SetAttr(kNameSpaceID_None,nsHTMLAtoms::style, divStr, PR_FALSE); + if (disp->mOverflow != NS_STYLE_OVERFLOW_AUTO && // this is the default + disp->mOverflow != NS_STYLE_OVERFLOW_VISIBLE && + disp->mOverflow != NS_STYLE_OVERFLOW_HIDDEN) { + rv = divContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, + NS_LITERAL_STRING("overflow: inherit;"), + PR_FALSE); + } } if (NS_FAILED(rv)) diff --git a/mozilla/layout/style/forms.css b/mozilla/layout/style/forms.css index d238d92e019..f189589ce2a 100644 --- a/mozilla/layout/style/forms.css +++ b/mozilla/layout/style/forms.css @@ -98,6 +98,10 @@ input { text-indent: 0; } +input > .anonymous-div { + white-space : nowrap; +} + textarea { margin: 1px 0 1px 0; border: 2px inset ThreeDFace; @@ -120,11 +124,16 @@ textarea > scrollbar { cursor: default; } -*|*::-moz-singleline-textcontrol-frame { - overflow: -moz-hidden-unscrollable; - white-space: nowrap; - background-color: inherit; - text-align: inherit; +textarea > .anonymous-div, +input > .anonymous-div { + -moz-user-focus: none; + overflow: auto; + border: 0px !important; + padding: 0px; + margin: 0px; + /* XXXldb I'm not sure if we really want the 'text-decoration: inherit', + but it's needed to make 'text-decoration' "work" on text inputs. */ + text-decoration: inherit; } select { diff --git a/mozilla/layout/style/nsCSSAnonBoxList.h b/mozilla/layout/style/nsCSSAnonBoxList.h index 78ddcc8d0f9..b8acd69d8c9 100644 --- a/mozilla/layout/style/nsCSSAnonBoxList.h +++ b/mozilla/layout/style/nsCSSAnonBoxList.h @@ -66,7 +66,6 @@ CSS_ANON_BOX(fieldsetContent, ":-moz-fieldset-content") CSS_ANON_BOX(framesetBlank, ":-moz-frameset-blank") CSS_ANON_BOX(radio, ":-moz-radio") CSS_ANON_BOX(check, ":-moz-checkbox") -CSS_ANON_BOX(mozSingleLineTextControlFrame, ":-moz-singleline-textcontrol-frame") CSS_ANON_BOX(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame") CSS_ANON_BOX(dummyOption, ":-moz-dummy-option")