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
Merged
+364
−74
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
014ad76
Added assertion to process_offset_parent_query
Permutatrix 0a5218d
Fixed ParentOffsetBorderBoxIterator's keeping track of parents
Permutatrix 6623583
offsetParent queries now basically work on inline nodes.
Permutatrix 18793af
Don't crash when offset parent querying an element not in the document
Permutatrix a61a263
Added tests/wpt/web-platform-tests/cssom-view/offsetPropertiesInline.…
Permutatrix 6a76525
Replaced trivial pattern matching with is_none() and is_some()
Permutatrix fa0cb7c
Assert self.node_offset_box is None if fragment.node == self.node_add…
Permutatrix 699fc4b
Use InlineFragmentNodeFlags in ParentOffsetBorderBoxIterator
Permutatrix 923ecba
Updated expectations for passing tests
Permutatrix db5da15
Updated expectations for failing tests that were passing erroneously
Permutatrix 4825169
Split 123-character line
Permutatrix defa7d9
Actually, node_position probably won't be needed later.
Permutatrix b75dcc0
Made assertions more helpful
Permutatrix 5be1879
"above the root node" -> "below the root node"
Permutatrix 290ebab
Moved and adjusted offset_properties_inline test
Permutatrix 5ef7a0a
Don't store the offset parent's dimensions
Permutatrix 686d2f8
Don't use rposition() and unwrap() to find parent info
Permutatrix 74e34d6
Handle hypothetical fragments
Permutatrix cb0d43a
Broke up some comment lines that were a bit too long
Permutatrix af633b2
Use parent padding box, not border box
Permutatrix 2cd5384
Don't take measurements from non-primary fragments
Permutatrix 400a267
/css-text-3_dev/html/word-break-normal-zh-000.htm fails on Mac
Permutatrix File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Don't crash when offset parent querying an element not in the document
- Loading branch information
Permutatrix
committed
Jan 13, 2017
Permutatrix
Permutator
commit 18793af44de90e6e91890dee1249838b3bda8677
Verified
This commit was signed with a verified signature.
GPG key ID: 62D7A8D792C3B058
Learn about signing commits
| @@ -845,12 +845,11 @@ pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root | ||
| -> OffsetParentResponse { | ||
| let mut iterator = ParentOffsetBorderBoxIterator::new(requested_node.opaque()); | ||
| sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator); | ||
| // If we didn't find the node, something went wrong. Unwrap it. | ||
| let node_offset_box = iterator.node_offset_box.unwrap(); | ||
|
|
||
| let node_offset_box = iterator.node_offset_box; | ||
| let parent_info_index = iterator.parent_nodes.iter().rposition(|info| info.is_some()); | ||
| match parent_info_index { | ||
| Some(parent_info_index) => { | ||
| match (node_offset_box, parent_info_index) { | ||
| (Some(node_offset_box), Some(parent_info_index)) => { | ||
| let parent = iterator.parent_nodes[parent_info_index].as_ref().unwrap(); | ||
| let origin = node_offset_box.offset - parent.border_box.origin; | ||
Permutatrix
Author
Contributor
|
||
| let size = node_offset_box.rectangle.size; | ||
| @@ -859,7 +858,7 @@ pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root | ||
| rect: Rect::new(origin, size), | ||
| } | ||
| } | ||
| None => { | ||
| _ => { | ||
| OffsetParentResponse::empty() | ||
| } | ||
| } | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
According to https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsettop
offsetTop the result of subtracting the y-coordinate of the top padding edge of the first CSS layout box associated with the offsetParent of the element from the y-coordinate of the top border edge of the first CSS layout box associated with the element,
So you may need to subtract the border of the offsetParent first?