Handle hypothetical fragments

This commit is contained in:
Permutator 2017-01-13 11:00:15 -08:00
parent 686d2f8509
commit 74e34d69f0
No known key found for this signature in database
GPG key ID: 62D7A8D792C3B058

View file

@ -548,6 +548,20 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
"Skipped at least one level in the flow tree!"); "Skipped at least one level in the flow tree!");
} }
if fragment.is_hypothetical() {
// We're not interested in hypothetical fragments. The
// corresponding block will show up later if this fragment
// corresponds to the node we're looking for.
if self.node_offset_box.is_none() {
// If this is the only fragment in the flow, we need to
// do this to avoid failing the above assertion.
self.parent_nodes.push(None);
}
return;
}
if fragment.node == self.node_address { if fragment.node == self.node_address {
// Found the fragment in the flow tree that matches the // Found the fragment in the flow tree that matches the
// DOM node being looked for. // DOM node being looked for.
@ -596,10 +610,6 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
if node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) { if node.flags.contains(LAST_FRAGMENT_OF_ELEMENT) {
self.has_processed_node = true; self.has_processed_node = true;
} }
// 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.
} else if self.node_offset_box.is_none() { } else if self.node_offset_box.is_none() {
// TODO(gw): Is there a less fragile way of checking whether this // TODO(gw): Is there a less fragile way of checking whether this
// fragment is the body element, rather than just checking that // fragment is the body element, rather than just checking that