Bug 253564 implemented word wrap for plain text documents, but it shouldn't have applied these changes to framed documents. For example, load the following URL in Fx21 and Fx22: data:text/html,<iframe src="http://people.mozilla.com/~jwein/longlines.txt">
Besides backing out bug 253564, I'm not sure what else can be done here. I've looked and there doesn't appear to be a way within nsHtml5TreeBuilderCppSupplement.h or nsHtml5StreamParser.cpp to see if the document being loaded is within a frame.
Boris, do you know of anything that can be done here?
Well, one option is to always have the parser output an alternate stylesheet and then have the document switch to the relevant stylesheet set based on whether it's in a subframe and whether the pref is set....
Given the fact that bug 253564 would be a simple backout as Plan B, let's track
It should be noted that this will may have the effect of applying the stylesheet after layout.
No, I meant that the document would switch in the C++ code for plaintext documents, so we can make sure it happens before layout...
In particular, we can switch to the right stylesheet set _before_ we've seen the <link>, iirc, so can do it in StartDocumentLoad.
I also removed the duplication within our codebase that checked if the content-type was plain text.
Comment on attachment 726831 [details] [diff] [review] Patch v2 > + static bool IsPlainText(const nsAString& aContentType); IsPlainTextType? And perhaps document that it returns whether we render the type as plaintext? That said, if all callers have an nsACString, why not make this method take that and avoid extra conversions? >+ nsAString* titleCopy = new nsString(title); >+ if (titleCopy) >+ SetSelectedStyleSheetSet(*titleCopy); Just: SetSelectedStyleSheetSet(title); should work. Also, why not put this code in nsHTMLDocument::StartDocumentLoad, where we already have plainText boolean? r=me with those bits fixed. Thanks!
Attachment #726831 - Flags: review?(bzbarsky) → review+
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.