зеркало из https://github.com/mozilla/gecko-dev.git
Bug 82711 - Support CSS white-space property on textareas. r=bz
This commit is contained in:
Родитель
59a309404b
Коммит
f9006a4784
|
@ -37,6 +37,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsPresState.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsTextEditorState.h"
|
||||
#include "nsIController.h"
|
||||
|
@ -407,6 +408,18 @@ void
|
|||
HTMLTextAreaElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
|
||||
// wrap=off
|
||||
nsCSSValue* whiteSpace = aData->ValueForWhiteSpace();
|
||||
if (whiteSpace->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::wrap);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
value->Equals(nsGkAtoms::OFF, eIgnoreCase)) {
|
||||
whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE, eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
@ -431,7 +444,13 @@ HTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
|||
NS_IMETHODIMP_(bool)
|
||||
HTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] {
|
||||
{ &nsGkAtoms::wrap },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sDivAlignAttributeMap,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" wrap="off">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: pre">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" wrap="off" style="white-space: normal">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: normal">
|
||||
0 1 2 3 4 5 6 7 8 9 This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -5,6 +5,9 @@ include toblob-todataurl/reftest.list
|
|||
skip-if(B2G) == 41464-1a.html 41464-1-ref.html
|
||||
skip-if(B2G) == 41464-1b.html 41464-1-ref.html
|
||||
== 52019-1.html 52019-1-ref.html
|
||||
== 82711-1.html 82711-1-ref.html
|
||||
== 82711-2.html 82711-2-ref.html
|
||||
!= 82711-1-ref.html 82711-2-ref.html
|
||||
!= 468263-1a.html about:blank
|
||||
!= 468263-1b.html about:blank
|
||||
!= 468263-1c.html about:blank
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: normal">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: normal">
|
||||
0 1 2 3 4 5 6 7 8 9 This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: nowrap">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: nowrap">
|
||||
0 1 2 3 4 5 6 7 8 9 This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: pre-line">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<textarea rows="10" cols="25" style="white-space: pre-wrap">
|
||||
0 1 2 3
|
||||
4 5
|
||||
|
||||
6 7 8
|
||||
9
|
||||
|
||||
|
||||
This is a long line that could wrap.
|
||||
</textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -82,6 +82,12 @@ skip-if(B2G) == 28811-2a.html 28811-2-ref.html
|
|||
== 68061-2.xml 68061-2-ref.xml
|
||||
== 76331-1.html 76331-1-ref.html
|
||||
== 81947-1.html 81947-ref.html
|
||||
== 82711-1.html 82711-1-ref.html
|
||||
== 82711-2.html 82711-2-ref.html
|
||||
== 82711-3.html 82711-3-ref.html
|
||||
!= 82711-1-ref.html 82711-2-ref.html
|
||||
!= 82711-1-ref.html 82711-3-ref.html
|
||||
!= 82711-2-ref.html 82711-3-ref.html
|
||||
== 84400-1.html 84400-1-ref.html
|
||||
== 84400-2.html 84400-2-ref.html
|
||||
== 97777-1.html 97777-1-ref.html
|
||||
|
|
|
@ -114,6 +114,7 @@ textarea {
|
|||
text-indent: 0;
|
||||
-moz-user-select: text;
|
||||
text-shadow: none;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
overflow-clip-box: content-box;
|
||||
}
|
||||
|
@ -126,7 +127,6 @@ textarea > .anonymous-div,
|
|||
input > .anonymous-div,
|
||||
input::-moz-placeholder,
|
||||
textarea::-moz-placeholder {
|
||||
white-space: pre;
|
||||
overflow: auto;
|
||||
border: 0px !important;
|
||||
padding: inherit !important;
|
||||
|
@ -141,7 +141,11 @@ textarea::-moz-placeholder {
|
|||
overflow-clip-box: inherit;
|
||||
}
|
||||
|
||||
textarea > .anonymous-div.wrap,
|
||||
input > .anonymous-div,
|
||||
input::-moz-placeholder {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
input > .anonymous-div.wrap {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче