-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Expanding divs to improve selection. #6663
Conversation
/cc @speedplane and @mitar for feedback /re #4843 |
b8c8d55
to
1aac073
Compare
1aac073
to
26217a5
Compare
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/a95af6692b3b870/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/a95af6692b3b870/output.txt Total script time: 0.79 mins Published |
Can you explain a bit more about difference to #5545? |
cc @nschloe who is more active on this at the moment. |
Thanks @yurydelendik for the PR! It does improve on the flickering that PDF.js text selection currently suffers from. Also, the background color setting I find that when hovering of a "white" area, the text selection will still jump. |
Especially text selection just outside of text has improved massively. With the current master and the Tracemonkey paper, starting selection just before "Abstract" makes all text above it selected too. With this patch that does not happen anymore and just "Abstract" is selected, which is also what I would expect. If we can make this more efficient (you also mention this in the description/comments) I think this would be a great improvement. |
The white spots on the right are caused by the subscript text on the previous line caused by special characters at the end of the previous line (boxes are on top each other and tab index of top one is less than bottom). The white spot(s) on the left are not present on FF (cause by Chrome returning 0 for |
This does have the side affect of always showing the text cursor no matter where you hover over the page (instead of just over text). |
Shall we wrap span-in-div? But I would recommend that we will turn this mode per demand: on mouse click and/or via preference. ("On mouse click"-expand will solve cursor issue) So far only non-Firefox browsers need this mode. |
👍 Really looking forward to this landing :) |
I played with this a bit, it looks really good, and a whole lot simpler than my approach with crazy quad trees. It even works on rotated text (e.g., http://mpdf1.com/examples/example_RTL.pdf), really impressive! Is there an O(N^2) issue in there (I assume so due to the first item in your TODO)? |
Anything I can do to help getting this PR into shape? |
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option 3. Moving feature functionality from text_layer_builder.js to text_layer.js
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added enhanceOnClick option to textLayerBuilder. True by default.
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added enhanceOnClick option to textLayerBuilder. True by default.
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added enhanceOnClick option to textLayerBuilder. True by default.
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
See #7539 |
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
Proposing a naive div boundary expansion algorithm as alternative solution for #5545. It attempts to expand axis aligned boundary on any div (rotated or not) horizontally then vertically. It's somewhat greedy scanline algorithm, which runs from left to right and extends boundary to maximum possible distance. It's trying to be fair and divides distance equally between neighbors. Some expansion may overlay if boundaries are overlay, but that shall not cause any selection issue (tab order is taking in account). The same process will be repeat from top to bottom, but on already extended boundaries.
TODOs:
This change is