Repository navigation
script/layout: Add support for double/triple click selection extension - #48767
Conversation
bf9f2ee to
b868fc1
Compare
| fn with_independent_formatting_context<T>( | ||
| &self, | ||
| callback: impl FnOnce(&IndependentFormattingContext) -> T, | ||
| ) -> Option<T> { |
There was a problem hiding this comment.
I my version of this I had this signature, with the callback always called exactly once but called with an option parameter. Which one looks more convenient for callers? (Maybe less need for map and flatten?)
| fn with_independent_formatting_context<T>( | |
| &self, | |
| callback: impl FnOnce(&IndependentFormattingContext) -> T, | |
| ) -> Option<T> { | |
| fn with_independent_formatting_context<T>( | |
| &self, | |
| callback: impl FnOnce(Option<&IndependentFormattingContext>) -> T, | |
| ) -> T { |
There was a problem hiding this comment.
Oh, interesting. I've toyed around with this a bit and I think having the callback return an Option serves both to remove the flatten() at the callsites and results in slightly less code.
| callback(&positioned.borrow().context) | ||
| }, | ||
| BlockLevelBox::OutOfFlowFloatBox(float) => callback(&float.contents), | ||
| _ => return None, |
There was a problem hiding this comment.
Instead of a _ catch-all pattern, if all remaining cases are listed explicitly and the enum ever gains a new variant this code will stop compiling until updated explicitly. Maybe a new variant is extremely unlikely to happen though. (When I first write such a match, listing all variants also gives me more confidence I haven’t forgotten something.)
This is a very weak suggestion, up to you which one you like.
There was a problem hiding this comment.
I've gone ahead and done this. I think it makes sense.
mrobinson
left a comment
There was a problem hiding this comment.
Thank you for the review!
b868fc1 to
cd7e102
Compare
Add support for double and triple clicking to select a word and a line in the document. This change also includes the ability to double and triple click and then drag to select by word / line. The dragging feature is not yet implemented for input elements, but will be in a followup. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Simon Sapin <[email protected]>
Signed-off-by: Martin Robinson <[email protected]>
cd7e102 to
a53f903
Compare
|
🔨 Triggering try run (#38361854412) for Linux (WPT) |
|
Test results for linux-wpt from try job (#38361854412): Flaky unexpected result (21)
Stable unexpected results that are known to be intermittent (8)
|
|
✨ Try run (#38361854412) succeeded. |
servo#48767) Add support for double and triple clicking to select a word and a line in the document. This change also includes the ability to double and triple click and then drag to select by word / line. The dragging feature is not yet implemented for input elements, but will be in a followup. Testing: This change adds two Servo-specific WPT style tests as well as causing a few WPT tests to start passing (as well as one to start failing, likely due to an unimplemented feature). --------- Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Simon Sapin <[email protected]>
Add support for double and triple clicking to select a word and a line
in the document. This change also includes the ability to double and
triple click and then drag to select by word / line.
The dragging feature is not yet implemented for input elements, but will
be in a followup.
Testing: This change adds two Servo-specific WPT style tests
as well as causing a few WPT tests to start passing (as well
as one to start failing, likely due to an unimplemented feature).