Auto merge of #14990 - asajeffrey:script-remove-browsing-context-reflow, r=emilio

Remove reflow status from browsing context.

<!-- Please describe your changes on the following line: -->

This PR removes the reflow status from each browsing context. Previously, we were only using it to avoid reflowing on traversal, which is rare enough it doesn't seem worth the complexity.

This is a first step towards #14843.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because reflows aren't visible from script

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14990)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-12 13:22:59 -08:00 committed by GitHub
commit cad78b9c6f
2 changed files with 1 additions and 20 deletions

View file

@ -33,9 +33,6 @@ use std::cell::Cell;
pub struct BrowsingContext {
reflector: Reflector,
/// Indicates if reflow is required when reloading.
needs_reflow: Cell<bool>,
/// Has this browsing context been discarded?
discarded: Cell<bool>,
@ -47,7 +44,6 @@ impl BrowsingContext {
pub fn new_inherited(frame_element: Option<&Element>) -> BrowsingContext {
BrowsingContext {
reflector: Reflector::new(),
needs_reflow: Cell::new(true),
discarded: Cell::new(false),
frame_element: frame_element.map(JS::from_ref),
}
@ -95,12 +91,6 @@ impl BrowsingContext {
assert!(!window_proxy.get().is_null());
window_proxy.get()
}
pub fn set_reflow_status(&self, status: bool) -> bool {
let old = self.needs_reflow.get();
self.needs_reflow.set(status);
old
}
}
#[allow(unsafe_code)]

View file

@ -1371,12 +1371,7 @@ impl ScriptThread {
fn handle_thaw_msg(&self, id: PipelineId) {
let document = self.documents.borrow().find_document(id);
if let Some(document) = document {
if let Some(context) = document.browsing_context() {
let needed_reflow = context.set_reflow_status(false);
if needed_reflow {
self.rebuild_and_force_reflow(&document, ReflowReason::CachedPageNeededReflow);
}
}
self.rebuild_and_force_reflow(&document, ReflowReason::CachedPageNeededReflow);
document.window().thaw();
document.fully_activate();
return;
@ -1451,7 +1446,6 @@ impl ScriptThread {
let window = self.documents.borrow().find_window(id)
.expect("ScriptThread: received a resize msg for a pipeline not in this script thread. This is a bug.");
window.set_window_size(new_size);
window.browsing_context().set_reflow_status(true);
}
/// We have gotten a window.close from script, which we pass on to the compositor.
@ -2188,9 +2182,6 @@ impl ScriptThread {
let window = window_from_node(&*document);
window.reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::FirstLoad);
// No more reflow required
window.browsing_context().set_reflow_status(false);
// https://html.spec.whatwg.org/multipage/#the-end steps 3-4.
document.process_deferred_scripts();
}