Commit 7588a257 authored by Henri Sivonen's avatar Henri Sivonen
Browse files

Bug 1724243 - Make text/plain and MediaDocuments use the Standards Mode. r=smaug,emilio

parent 83e68e81
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -112,7 +112,9 @@ const char* const MediaDocument::sFormatNames[4] = {
};

MediaDocument::MediaDocument()
    : nsHTMLDocument(), mDidInitialDocumentSetup(false) {}
    : nsHTMLDocument(), mDidInitialDocumentSetup(false) {
  mCompatMode = eCompatibility_FullStandards;
}
MediaDocument::~MediaDocument() = default;

nsresult MediaDocument::Init() {
+1 −1
Original line number Diff line number Diff line
<meta charset=utf-8><pre>ää
<!DOCTYPE html><meta charset=utf-8><pre>ää
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=369370
            // Give the image document time to respond
            SimpleTest.executeSoon(function() {
              is(img.height, 600, "image height");
              var bodyHeight = kidDoc.body.scrollHeight;
              var bodyHeight = kidDoc.documentElement.scrollHeight;
              var imgRect = img.getBoundingClientRect();
              is(imgRect.top, bodyHeight - imgRect.bottom, "Image is vertically centered");
              test7();
+2 −10
Original line number Diff line number Diff line
@@ -25,14 +25,6 @@ body {
  }
}

@media print {
  /* We must declare the image as a block element. If we stay as
  an inline element, our parent LineBox will be inline too and
  ignore the available height during reflow.
  This is bad during printing, it means tall image frames won't know
  the size of the paper and cannot break into continuations along
  multiple pages. */
img {
  display: block;
}
}
+12 −7
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,

    private boolean quirks = false;

    private boolean isSrcdocDocument = false;
    private boolean forceNoQuirks = false;

    // [NOCPP[

@@ -4064,7 +4064,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
            String systemIdentifier)
            throws SAXException {

        if (isSrcdocDocument) {
        if (forceNoQuirks) {
            // Srcdoc documents are always rendered in standards mode.
            quirks = false;
            if (documentModeHandler != null) {
@@ -5807,8 +5807,13 @@ public abstract class TreeBuilder<T> implements TokenHandler,
        this.scriptingEnabled = scriptingEnabled;
    }

    public void setForceNoQuirks(boolean forceNoQuirks) {
        this.forceNoQuirks = forceNoQuirks;
    }

    // Redundant method retained because previously public.
    public void setIsSrcdocDocument(boolean isSrcdocDocument) {
        this.isSrcdocDocument = isSrcdocDocument;
        this.setForceNoQuirks(isSrcdocDocument);
    }

    // [NOCPP[
@@ -6304,13 +6309,13 @@ public abstract class TreeBuilder<T> implements TokenHandler,
    }

    private void errAlmostStandardsDoctype() throws SAXException {
        if (!isSrcdocDocument) {
        if (!forceNoQuirks) {
            err("Almost standards mode doctype. Expected \u201C<!DOCTYPE html>\u201D.");
        }
    }

    private void errQuirkyDoctype() throws SAXException {
        if (!isSrcdocDocument) {
        if (!forceNoQuirks) {
            err("Quirky doctype. Expected \u201C<!DOCTYPE html>\u201D.");
        }
    }
@@ -6347,7 +6352,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
    }

    private void errStartTagWithoutDoctype() throws SAXException {
        if (!isSrcdocDocument) {
        if (!forceNoQuirks) {
            err("Start tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
        }
    }
@@ -6424,7 +6429,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
    }

    private void errEndTagSeenWithoutDoctype() throws SAXException {
        if (!isSrcdocDocument) {
        if (!forceNoQuirks) {
            err("End tag seen without seeing a doctype first. Expected \u201C<!DOCTYPE html>\u201D.");
        }
    }
Loading