Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: Improve scrolling behavior for the root element. #13936

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

layout: Fix incorrect overflow clipping logic for the root flow.

Part of a fix for Google search results.

Closes #13932.
  • Loading branch information
pcwalton committed Oct 27, 2016
commit 53c4845e2109e90df08937bcc62120a5b23688e4
@@ -57,6 +57,7 @@ use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirec
use style_traits::cursor::Cursor;
use table_cell::CollapsedBordersForCell;
use url::Url;
use util::geometry;
use util::opts;

static THREAD_TINT_COLORS: [Color; 8] = [
@@ -1367,7 +1368,10 @@ impl FragmentDisplayListBuilding for Fragment {
.relative_containing_block_mode,
CoordinateSystem::Parent);
let overflow = if scrolls_overflow_area {
Rect::new(Point2D::zero(), base_flow.overflow.scroll.size)
base_flow.overflow
.scroll
.intersection(&Rect::new(Point2D::zero(), geometry::max_rect().size))
.unwrap_or(Rect::zero())
} else {
// First, compute the offset of our border box (including relative positioning)
// from our flow origin, since that is what `BaseFlow::overflow` is relative to.
@@ -928,18 +928,21 @@ impl LayoutThread {

debug!("Done building display list.");

let root_size = {
let root_bounds = {
let root_flow = flow::base(layout_root);
if rw_data.stylist.viewport_constraints().is_some() {
root_flow.position.size.to_physical(root_flow.writing_mode)
root_flow.position.to_physical(root_flow.writing_mode,
Size2D::zero())
} else {
root_flow.overflow.scroll.size
root_flow.overflow.scroll
}
};

let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
root_stacking_context.bounds = origin;
root_stacking_context.overflow = origin;
let root_bounds =
root_bounds.intersection(&Rect::new(Point2D::zero(), max_rect().size))
.unwrap_or(Rect::zero());
root_stacking_context.bounds = root_bounds;
root_stacking_context.overflow = root_bounds;

rw_data.display_list =
Some(Arc::new(DisplayList::new(root_stacking_context,
@@ -0,0 +1,4 @@
<!DOCTYPE html>
This page should not be scrollable.
<div style="position: absolute; top: -1000em;">X</div>

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.