-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Reorganise display list builder #20031
Conversation
Heads up! This PR modifies the following files:
|
r? @mbrubeck Now the gfx/display_list types are basically the same as the WebRender diplay items and could be replaced quite easily. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks! Some thoughts/comments below, which you can optionally address before landing.
|
||
// Returns the text index within a node for the point of interest. | ||
pub fn text_index(&self, node: OpaqueNode, point_in_item: Point2D<Au>) -> Option<usize> { | ||
if let Some(item) = self.inner.get(&node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion: You could use ?
instead of if let ... else
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Did not know it landed.
// Guard against duplicate nodes. | ||
if self.inner.insert(node, item).is_some() { | ||
debug!( | ||
"TODO(#20020): Text indexing for {:?} is broken because of multiple text runs.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... using a HashMap<OpaqueNode, IndexableTextItem>
might make it harder to fix #20020. In the current code, all the data is in the display list, but the loop incorrectly stops at the first display item for the node. It seems like we could fix #20020 by continuing to search until we find the text run that actually contains the given advance. With the hash map, we don't even store all the text runs.
This doesn't need to be fixed right now, but what is the long-term plan? Maybe the values in the HashMap will change to something like SmallVec<[IndexableTextItem; 1]>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this also impacts #19754 which adds new code that queries for the text runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#19754 has been approved. If it merges successfully before this PR, you'll need to resolve some conflicts by changing its code that searches the display list for text items. I think this changes should be fairly straightforward, but I apoologize for the extra churn! |
There's a |
updated. But I guess #19754 will be merged first. |
@bors-servo try |
Reorganise display list builder Description in the individual commits. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20031) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
Failures:
@mbrubeck I think this is good now. |
@mbrubeck ping |
☔ The latest upstream changes (presumably #20034) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Looks good, thanks! r=mbrubeck
It was unused.
Add an IndexableText structure for text queries. Instead of linear search for a node this now uses a HashMap. Remove the now irrelevant fields from TextDisplayItem.
Webrender solved the issue with servo/webrender#1189.
Store multiple indexable text items for a node.
Rebased. |
@bors-servo r+ |
📌 Commit 23fcd3a has been approved by |
Reorganise display list builder Description in the individual commits. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20031) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Description in the individual commits.
This change is