Bug 261081. Support official 'pre-wrap' value for CSS 'white-space' since we already support it well as '-moz-pre-wrap'. r+sr=dbaron,a=schrep
This commit is contained in:
parent
50d79f4b2e
commit
aae6e2b7da
|
@ -340,7 +340,7 @@ nsresult nsCopySupport::IsPlainTextContext(nsISelection *aSel, nsIDocument *aDoc
|
|||
nsCOMPtr<nsIDOMElement> bodyElem = do_QueryInterface(selContent);
|
||||
nsAutoString wsVal;
|
||||
rv = bodyElem->GetAttribute(NS_LITERAL_STRING("style"), wsVal);
|
||||
if (NS_SUCCEEDED(rv) && (kNotFound != wsVal.Find(NS_LITERAL_STRING("-moz-pre-wrap"))))
|
||||
if (NS_SUCCEEDED(rv) && (kNotFound != wsVal.Find(NS_LITERAL_STRING("pre-wrap"))))
|
||||
{
|
||||
*aIsPlainTextContext = PR_TRUE;
|
||||
break;
|
||||
|
|
|
@ -1149,7 +1149,7 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
|||
nsCOMPtr<nsIDOMElement> bodyElem = do_QueryInterface(selContent);
|
||||
nsAutoString wsVal;
|
||||
rv = bodyElem->GetAttribute(NS_LITERAL_STRING("style"), wsVal);
|
||||
if (NS_SUCCEEDED(rv) && (kNotFound != wsVal.Find(NS_LITERAL_STRING("-moz-pre-wrap"))))
|
||||
if (NS_SUCCEEDED(rv) && (kNotFound != wsVal.Find(NS_LITERAL_STRING("pre-wrap"))))
|
||||
{
|
||||
mIsTextWidget = PR_TRUE;
|
||||
break;
|
||||
|
|
|
@ -677,7 +677,7 @@ nsPlainTextSerializer::DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag)
|
|||
if(NS_SUCCEEDED(GetAttributeValue(aNode, nsHTMLAtoms::style, style)) &&
|
||||
(kNotFound != (whitespace = style.Find("white-space:")))) {
|
||||
|
||||
if (kNotFound != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) {
|
||||
if (kNotFound != style.Find("pre-wrap", PR_TRUE, whitespace)) {
|
||||
#ifdef DEBUG_preformatted
|
||||
printf("Set mPreFormatted based on style moz-pre-wrap\n");
|
||||
#endif
|
||||
|
|
|
@ -150,7 +150,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (aData->mTextData->mWhiteSpace.GetUnit() == eCSSUnit_Null) {
|
||||
// wrap: empty
|
||||
if (aAttributes->GetAttr(nsHTMLAtoms::wrap))
|
||||
aData->mTextData->mWhiteSpace.SetIntValue(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, eCSSUnit_Enumerated);
|
||||
aData->mTextData->mWhiteSpace.SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated);
|
||||
|
||||
// width: int (html4 attribute == nav4 cols)
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::width);
|
||||
|
@ -162,7 +162,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
// Force wrap property on since we want to wrap at a width
|
||||
// boundary not just a newline.
|
||||
aData->mTextData->mWhiteSpace.SetIntValue(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, eCSSUnit_Enumerated);
|
||||
aData->mTextData->mWhiteSpace.SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4434,8 +4434,7 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
|
|||
|
||||
const nsStyleText* styleText = frame->GetStyleText();
|
||||
|
||||
*aResult = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
|
||||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
|
||||
*aResult = styleText->WhiteSpaceIsSignificant();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1002,12 +1002,12 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn)
|
|||
// and now we're ready to set the new whitespace/wrapping style.
|
||||
if (aWrapColumn > 0 && !mWrapToWindow) // Wrap to a fixed column
|
||||
{
|
||||
styleValue.AppendLiteral("white-space: -moz-pre-wrap; width: ");
|
||||
styleValue.AppendLiteral("white-space: pre-wrap; width: ");
|
||||
styleValue.AppendInt(aWrapColumn);
|
||||
styleValue.AppendLiteral("ch;");
|
||||
}
|
||||
else if (mWrapToWindow || aWrapColumn == 0)
|
||||
styleValue.AppendLiteral("white-space: -moz-pre-wrap;");
|
||||
styleValue.AppendLiteral("white-space: pre-wrap;");
|
||||
else
|
||||
styleValue.AppendLiteral("white-space: pre;");
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
#define NS_STYLE_WHITESPACE_NORMAL 0
|
||||
#define NS_STYLE_WHITESPACE_PRE 1
|
||||
#define NS_STYLE_WHITESPACE_NOWRAP 2
|
||||
#define NS_STYLE_WHITESPACE_MOZ_PRE_WRAP 3
|
||||
#define NS_STYLE_WHITESPACE_PRE_WRAP 3
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_UNICODE_BIDI_NORMAL 0
|
||||
|
|
|
@ -1927,8 +1927,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
rc->GetFontMetrics(*getter_AddRefs(fm));
|
||||
|
||||
PRBool preMode = (mStyleText->mWhiteSpace == NS_STYLE_WHITESPACE_PRE) ||
|
||||
(mStyleText->mWhiteSpace == NS_STYLE_WHITESPACE_MOZ_PRE_WRAP);
|
||||
PRBool preMode = mStyleText->WhiteSpaceIsSignificant();
|
||||
|
||||
// See if the span is an empty continuation. It's an empty continuation iff:
|
||||
// - it has a prev-in-flow
|
||||
|
|
|
@ -631,7 +631,7 @@ public:
|
|||
mNumJustifiableCharacterReceivingExtraJot = 0;
|
||||
mExtraSpacePerJustifiableCharacter = 0;
|
||||
mPreformatted = (NS_STYLE_WHITESPACE_PRE == mText->mWhiteSpace) ||
|
||||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == mText->mWhiteSpace);
|
||||
(NS_STYLE_WHITESPACE_PRE_WRAP == mText->mWhiteSpace);
|
||||
|
||||
mJustifying = (NS_STYLE_TEXT_ALIGN_JUSTIFY == mText->mTextAlign) &&
|
||||
!mPreformatted;
|
||||
|
@ -5907,7 +5907,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
PRBool wrapping = (NS_STYLE_WHITESPACE_NORMAL == ts.mText->mWhiteSpace) ||
|
||||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == ts.mText->mWhiteSpace);
|
||||
(NS_STYLE_WHITESPACE_PRE_WRAP == ts.mText->mWhiteSpace);
|
||||
|
||||
// Set whitespace skip flag
|
||||
PRBool skipWhitespace = PR_FALSE;
|
||||
|
@ -6179,7 +6179,7 @@ nsTextFrame::TrimTrailingWhiteSpace(nsPresContext* aPresContext,
|
|||
const nsStyleText* textStyle = GetStyleText();
|
||||
if (mContentLength &&
|
||||
(NS_STYLE_WHITESPACE_PRE != textStyle->mWhiteSpace) &&
|
||||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP != textStyle->mWhiteSpace)) {
|
||||
(NS_STYLE_WHITESPACE_PRE_WRAP != textStyle->mWhiteSpace)) {
|
||||
|
||||
// Get the text fragments that make up our content
|
||||
nsCOMPtr<nsITextContent> tc = do_QueryInterface(mContent);
|
||||
|
|
|
@ -260,7 +260,7 @@ nsTextTransformer::Init(nsIFrame* aFrame,
|
|||
if (NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) {
|
||||
mMode = ePreformatted;
|
||||
}
|
||||
else if (NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace) {
|
||||
else if (NS_STYLE_WHITESPACE_PRE_WRAP == styleText->mWhiteSpace) {
|
||||
mMode = ePreWrap;
|
||||
}
|
||||
mTextTransform = styleText->mTextTransform;
|
||||
|
@ -1569,7 +1569,7 @@ struct SelfTestData {
|
|||
static PRUint8 preModeValue[NUM_MODES] = {
|
||||
NS_STYLE_WHITESPACE_NORMAL,
|
||||
NS_STYLE_WHITESPACE_PRE,
|
||||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP
|
||||
NS_STYLE_WHITESPACE_PRE_WRAP
|
||||
};
|
||||
|
||||
static PRUnichar test1text[] = {
|
||||
|
@ -1812,7 +1812,7 @@ nsTextTransformer::Init2(const nsTextFragment* aFrag,
|
|||
if (NS_STYLE_WHITESPACE_PRE == aWhiteSpace) {
|
||||
mMode = ePreformatted;
|
||||
}
|
||||
else if (NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == aWhiteSpace) {
|
||||
else if (NS_STYLE_WHITESPACE_PRE_WRAP == aWhiteSpace) {
|
||||
mMode = ePreWrap;
|
||||
}
|
||||
mTextTransform = aTextTransform;
|
||||
|
|
|
@ -108,8 +108,7 @@ inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
|
|||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
if (frame) {
|
||||
const nsStyleText* text = frame->GetStyleText();
|
||||
*aReturn = text->mWhiteSpace != NS_STYLE_WHITESPACE_PRE &&
|
||||
text->mWhiteSpace != NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
|
||||
*aReturn = !text->WhiteSpaceIsSignificant();
|
||||
}
|
||||
else {
|
||||
// empty inter-tag text node without frame, e.g., in between <table>\n<tr>
|
||||
|
|
|
@ -355,6 +355,7 @@ CSS_KEY(physical, physical)
|
|||
CSS_KEY(pointer, pointer)
|
||||
CSS_KEY(portrait, portrait)
|
||||
CSS_KEY(pre, pre)
|
||||
CSS_KEY(pre-wrap, pre_wrap)
|
||||
CSS_KEY(progress, progress)
|
||||
CSS_KEY(pt, pt)
|
||||
CSS_KEY(px, px)
|
||||
|
|
|
@ -928,7 +928,8 @@ const PRInt32 nsCSSProps::kVolumeKTable[] = {
|
|||
const PRInt32 nsCSSProps::kWhitespaceKTable[] = {
|
||||
eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE,
|
||||
eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP,
|
||||
eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP,
|
||||
eCSSKeyword_pre_wrap, NS_STYLE_WHITESPACE_PRE_WRAP,
|
||||
eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_PRE_WRAP,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -740,7 +740,7 @@ struct nsStyleText : public nsStyleStruct {
|
|||
|
||||
PRBool WhiteSpaceIsSignificant() const {
|
||||
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE ||
|
||||
mWhiteSpace == NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
|
||||
mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue