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
Make offset parent queries less buggy. #14839
Changes from 1 commit
014ad76
0a5218d
6623583
18793af
a61a263
6a76525
fa0cb7c
699fc4b
923ecba
db5da15
4825169
defa7d9
b75dcc0
5be1879
290ebab
5ef7a0a
686d2f8
74e34d6
cb0d43a
af633b2
2cd5384
400a267
File filter...
Jump to…
Replaced trivial pattern matching with is_none() and is_some()
- Loading branch information
Verified
| @@ -539,13 +539,11 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator { | ||
| // https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface | ||
| impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator { | ||
| fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) { | ||
| match self.node_offset_box { | ||
| Some(_) => { }, // We've already found the node, so we already have its parent. | ||
| None => { | ||
| // Remove all nodes at this level or higher, as they can't be parents of this node. | ||
| self.parent_nodes.truncate(level as usize); | ||
| assert!(self.parent_nodes.len() == level as usize); | ||
| }, | ||
| if self.node_offset_box.is_none() { | ||
| // We haven't found the node yet, so we're still looking for its parent. | ||
| // Remove all nodes at this level or higher, as they can't be parents of this node. | ||
| self.parent_nodes.truncate(level as usize); | ||
| assert!(self.parent_nodes.len() == level as usize); | ||
|
||
| } | ||
|
|
||
| if fragment.node == self.node_address { | ||
| @@ -581,7 +579,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator { | ||
| // TODO: `position: fixed` on inline elements doesn't seem to work | ||
| // as of Sep 25, 2016, so I don't know how one will check if an | ||
| // inline element has it when it does. | ||
stshine
Contributor
|
||
| } else if let Some(_) = self.node_offset_box { | ||
| } else if self.node_offset_box.is_some() { | ||
| // We've been processing fragments within the node, but now | ||
| // we've found one outside it. That means we're done. | ||
| // Hopefully. | ||
nit: use
assert_eq!, and ideally a helpful assertion message.