mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Expose Quirks Mode information in the style shared context r=emilio
This commit is contained in:
parent
9d2b98e6f8
commit
d024787188
9 changed files with 58 additions and 25 deletions
|
@ -91,7 +91,6 @@ use encoding::EncodingRef;
|
|||
use encoding::all::UTF_8;
|
||||
use euclid::point::Point2D;
|
||||
use gfx_traits::ScrollRootId;
|
||||
use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks, QuirksMode};
|
||||
use html5ever_atoms::{LocalName, QualName};
|
||||
use hyper::header::{Header, SetCookie};
|
||||
use hyper_serde::Serde;
|
||||
|
@ -129,7 +128,7 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use style::attr::AttrValue;
|
||||
use style::context::ReflowGoal;
|
||||
use style::context::{QuirksMode, ReflowGoal};
|
||||
use style::restyle_hints::RestyleHint;
|
||||
use style::selector_parser::{RestyleDamage, Snapshot};
|
||||
use style::str::{split_html_space_chars, str_join};
|
||||
|
@ -490,7 +489,7 @@ impl Document {
|
|||
pub fn set_quirks_mode(&self, mode: QuirksMode) {
|
||||
self.quirks_mode.set(mode);
|
||||
|
||||
if mode == Quirks {
|
||||
if mode == QuirksMode::Quirks {
|
||||
self.window.layout_chan().send(Msg::SetQuirksMode).unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -1777,6 +1776,7 @@ pub trait LayoutDocumentHelpers {
|
|||
unsafe fn drain_pending_restyles(&self) -> Vec<(LayoutJS<Element>, PendingRestyle)>;
|
||||
unsafe fn needs_paint_from_layout(&self);
|
||||
unsafe fn will_paint(&self);
|
||||
unsafe fn quirks_mode(&self) -> QuirksMode;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -1803,6 +1803,11 @@ impl LayoutDocumentHelpers for LayoutJS<Document> {
|
|||
unsafe fn will_paint(&self) {
|
||||
(*self.unsafe_get()).needs_paint.set(false)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn quirks_mode(&self) -> QuirksMode {
|
||||
(*self.unsafe_get()).quirks_mode()
|
||||
}
|
||||
}
|
||||
|
||||
/// https://url.spec.whatwg.org/#network-scheme
|
||||
|
@ -1860,7 +1865,7 @@ impl Document {
|
|||
last_modified: last_modified,
|
||||
url: DOMRefCell::new(url),
|
||||
// https://dom.spec.whatwg.org/#concept-document-quirks
|
||||
quirks_mode: Cell::new(NoQuirks),
|
||||
quirks_mode: Cell::new(QuirksMode::NoQuirks),
|
||||
// https://dom.spec.whatwg.org/#concept-document-encoding
|
||||
encoding: Cell::new(UTF_8),
|
||||
is_html_document: is_html_document == IsHTMLDocument::HTMLDocument,
|
||||
|
@ -2303,8 +2308,8 @@ impl DocumentMethods for Document {
|
|||
// https://dom.spec.whatwg.org/#dom-document-compatmode
|
||||
fn CompatMode(&self) -> DOMString {
|
||||
DOMString::from(match self.quirks_mode.get() {
|
||||
LimitedQuirks | NoQuirks => "CSS1Compat",
|
||||
Quirks => "BackCompat",
|
||||
QuirksMode::LimitedQuirks | QuirksMode::NoQuirks => "CSS1Compat",
|
||||
QuirksMode::Quirks => "BackCompat",
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue