mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #10623 - pcwalton:reddit-float-fix, r=mbrubeck
layout: Reset values appropriately for floats flowing out of blocks with nonzero inline margins. These two commits correctly position the hamburger menu icons on http://reddit.com/r/rust. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10623) <!-- Reviewable:end -->
This commit is contained in:
commit
fcb1352e97
5 changed files with 94 additions and 10 deletions
|
@ -1020,8 +1020,12 @@ impl BlockFlow {
|
|||
self.base.position.size.block = cur_b;
|
||||
}
|
||||
|
||||
// Store the current set of floats in the flow so that flows that come later in the
|
||||
// Translate the current set of floats back into the parent coordinate system in the
|
||||
// inline direction, and store them in the flow so that flows that come later in the
|
||||
// document can access them.
|
||||
floats.translate(LogicalSize::new(writing_mode,
|
||||
self.fragment.inline_start_offset(),
|
||||
Au(0)));
|
||||
self.base.floats = floats.clone();
|
||||
self.adjust_fragments_for_collapsed_margins_if_root(layout_context);
|
||||
} else {
|
||||
|
|
|
@ -470,17 +470,22 @@ impl SpeculatedFloatPlacement {
|
|||
let block_flow = flow.as_block();
|
||||
if block_flow.formatting_context_type() != FormattingContextType::None {
|
||||
*self = block_flow.base.speculated_float_placement_in;
|
||||
}
|
||||
|
||||
if self.left > Au(0) || self.right > Au(0) {
|
||||
let speculated_inline_content_edge_offsets =
|
||||
block_flow.fragment.guess_inline_content_edge_offsets();
|
||||
if self.left > Au(0) && speculated_inline_content_edge_offsets.start > Au(0) {
|
||||
self.left = self.left + speculated_inline_content_edge_offsets.start
|
||||
}
|
||||
if self.right > Au(0) && speculated_inline_content_edge_offsets.end > Au(0) {
|
||||
self.right = self.right + speculated_inline_content_edge_offsets.end
|
||||
}
|
||||
if self.left > Au(0) || self.right > Au(0) {
|
||||
let speculated_inline_content_edge_offsets =
|
||||
block_flow.fragment.guess_inline_content_edge_offsets();
|
||||
if self.left > Au(0) && speculated_inline_content_edge_offsets.start > Au(0) {
|
||||
self.left = self.left + speculated_inline_content_edge_offsets.start
|
||||
}
|
||||
if self.right > Au(0) && speculated_inline_content_edge_offsets.end > Au(0) {
|
||||
self.right = self.right + speculated_inline_content_edge_offsets.end
|
||||
}
|
||||
}
|
||||
|
||||
if block_flow.formatting_context_type() == FormattingContextType::None {
|
||||
self.left = max(self.left, block_flow.base.speculated_float_placement_in.left);
|
||||
self.right = max(self.right, block_flow.base.speculated_float_placement_in.right);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1608,6 +1608,18 @@
|
|||
"url": "/_mozilla/css/floated_table_with_margin_a.html"
|
||||
}
|
||||
],
|
||||
"css/floats_inline_margins_a.html": [
|
||||
{
|
||||
"path": "css/floats_inline_margins_a.html",
|
||||
"references": [
|
||||
[
|
||||
"/_mozilla/css/floats_inline_margins_ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/_mozilla/css/floats_inline_margins_a.html"
|
||||
}
|
||||
],
|
||||
"css/floats_margin_collapse_a.html": [
|
||||
{
|
||||
"path": "css/floats_margin_collapse_a.html",
|
||||
|
@ -8336,6 +8348,18 @@
|
|||
"url": "/_mozilla/css/floated_table_with_margin_a.html"
|
||||
}
|
||||
],
|
||||
"css/floats_inline_margins_a.html": [
|
||||
{
|
||||
"path": "css/floats_inline_margins_a.html",
|
||||
"references": [
|
||||
[
|
||||
"/_mozilla/css/floats_inline_margins_ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/_mozilla/css/floats_inline_margins_a.html"
|
||||
}
|
||||
],
|
||||
"css/floats_margin_collapse_a.html": [
|
||||
{
|
||||
"path": "css/floats_margin_collapse_a.html",
|
||||
|
|
27
tests/wpt/mozilla/tests/css/floats_inline_margins_a.html
Normal file
27
tests/wpt/mozilla/tests/css/floats_inline_margins_a.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="match" href="floats_inline_margins_ref.html">
|
||||
<style>
|
||||
html, body, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div {
|
||||
background-color: gold;
|
||||
float: left;
|
||||
height: 27px;
|
||||
width: 27px;
|
||||
}
|
||||
#first {
|
||||
margin-left: 27px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
<p id=first>submitted</p>
|
||||
<p>x</p>
|
||||
</body>
|
||||
</html>
|
||||
|
24
tests/wpt/mozilla/tests/css/floats_inline_margins_ref.html
Normal file
24
tests/wpt/mozilla/tests/css/floats_inline_margins_ref.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<style>
|
||||
html, body, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div {
|
||||
background-color: gold;
|
||||
float: left;
|
||||
height: 27px;
|
||||
width: 27px;
|
||||
border-bottom: solid white 27px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
<p id=first>submitted</p>
|
||||
<p>x</p>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue