Skip to content

Text selection API conformance - #19544

Merged
bors-servo merged 6 commits into
servo:masterfrom
jonleighton:issue-19171-5
Jan 26, 2018
Merged

bors-servo merged 6 commits into
servo:masterfrom
jonleighton:issue-19171-5

Conversation

@jonleighton

@jonleighton jonleighton commented Dec 11, 2017 •

Copy link
Copy Markdown
Contributor

This is my next batch of changes for issue #19171. All the tests in tests/wpt/metadata/html/semantics/forms/textfieldselection/ are now passing (and also some tests outside of there).

I've made detailed notes about the changes in each commit message.

r? @KiChjang


This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/htmltextareaelement.rs, components/script/dom/textcontrol.rs, components/script/dom/webidls/HTMLInputElement.webidl, components/script/dom/webidls/HTMLTextAreaElement.webidl, components/script/dom/htmlinputelement.rs and 2 more
  • @fitzgen: components/script/dom/htmltextareaelement.rs, components/script/dom/textcontrol.rs, components/script/dom/webidls/HTMLInputElement.webidl, components/script/dom/webidls/HTMLTextAreaElement.webidl, components/script/dom/htmlinputelement.rs and 2 more
  • @KiChjang: components/script/dom/htmltextareaelement.rs, components/script/dom/textcontrol.rs, components/script/dom/webidls/HTMLInputElement.webidl, components/script/dom/webidls/HTMLTextAreaElement.webidl, components/script/dom/htmlinputelement.rs and 2 more

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 11, 2017
@jonleighton jonleighton changed the title This is my next batch of changes for issue #19171. All the tests in tests/wpt/metadata/html/semantics/forms/textfieldselection/ are now passing (and also some tests outside of there). Text selection API conformance Dec 11, 2017

@KiChjang KiChjang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a full review, just commenting on things that jumped out at me when I skimmed through the changes.

true
}

_ => false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use exhaustive matching here? It is useful when a new enum variant is added to input type, and we need to look for places where the InputType enum is referenced.


// https://html.spec.whatwg.org/multipage/#dom-textarea/input-select
fn Select(&self) {
self.dom_select();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite surprised by this change when I initially looked at it, since nowhere in this file is dom_select being defined.

That goes back to my comments about making the TextControl trait -- I think that TextInput can instead hold all the text selection API methods, without going through the trait indirection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting to review this.

I can see where you are coming from, but personally I think that to try to put this code in TextInput would muddy the concerns of TextInput. At the moment it doesn't have any DOM node-related code - it is basically a wrapper around a string, providing some extra state about the selection and so on. This makes it easy to unit test and keeps its implementation focused. To put the selection API code inside TextInput would require passing in DOM nodes somehow.

As I say, I agree that there is some indirection here, I guess I just don't think it's that big a deal (easy to find the dom_select method using grep, ctags, etc...) It's also just how traits work - when you implement e.g. the Iterator trait, you get a whole load of extra methods which aren't defined in the same file, and that's the point of it.

There is potentially another option, though, which is to have a TextControl object rather than trait (maybe the name could be improved too). So HTMLInputElement and HTMLTextAreaElement would each do something like (in their constructor):

self.text_control = TextControl::new(&self.upcast::<Node>(), self.textinput)

(Actually, we'd probably need to pass in more things than this... but you get the idea.)

And then this method would become:

fn Select(&self) {
    self.text_control.dom_select();
}

Either way, since I'm not changing the existing architecture in this PR, could we perhaps move this discussion elsewhere, to an issue or something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very least, we'll need to make the code look less magical. I don't agree that "the ease of grepping for dom_select" is a good reason to not surprise future maintainers of the code, since even if I do find the definition in text_control.rs, it's not exactly apparent that both HTMLInputElement and HTMLTextAreaElement implement the TextControl trait, until you search both htmlinputelement.rs and htmltextareaelement.rs for its implementation.

Encapsulating a TextInput inside of a TextControl struct sounds fine to me, however. In other words, instead of having HTMLInputElement or HTMLTextAreaElement both contain a TextInput field, have a TextControl as a member field, inside of which contains a TextInput.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Respectfully, I'm feeling quite frustrated that you're asking me to change this as a precondition of getting my code merged.

I had thought that the architectural question we're talking about had already been decided in #19272 (where you chose to defer the review to @jdm). I've now submitted this quite substantial PR and the only real feedback I've received after waiting several days is to ask me to make an architectural change which is unrelated to the actual PR, other than that it relates to the same area of the code.

I can understand your perspective, and I place a lot of value on easy to follow code too. I don't think either of us is "right", we just have a difference of opinion about the trade-offs of each choice. I'm willing to revisit the code that you're concerned about, but I'd prefer to do so in a separate PR, since this PR doesn't change the existing architecture. (And I think we should also involve @jdm in any such change since he reviewed #19272.)

@KiChjang KiChjang Dec 15, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry if my intentions were not clear! I did not mean that you need to make architectural changes in my previous comment. My simple wish is to keep the implementation details of dom_select within htmlinputelement.rs and htmltextareaelement.rs. A workable solution here is to not have a default implementation on the trait, and have it implemented on both htmlinputelement.rs and htmltextareaelement.rs.

Also, the architectural design is not already decided (refer to @jdm's comment here). We have to keep in mind that the spec can change at any time, and reducing the burden for future maintainers when reading the code and making changes to it (keeping in mind that they may not be Rust experts!) would make their lives easier. However, for the purpose of this PR, I concede that this is out of scope.

I really appreciate the work that you've done so far, and I understand it could be frustrating when a code review requires you to make huge architectural changes. In the future, may I invite you to #servo at irc.mozilla.org to discuss implementation plans, before any huge changes are made?

@KiChjang KiChjang Dec 15, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea would be to just leave a comment here explaining that this is implemented by default on the TextControl trait.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A workable solution here is to not have a default implementation on the trait, and have it implemented on both htmlinputelement.rs and htmltextareaelement.rs.

Not sure if I've misunderstood, but if you mean to duplicate the ~110 lines of code which implement dom_select() and set_dom_range_text() in TextControl, this seems like much more of a maintainability problem to me than a bit of indirection.

I'm fine with your other suggestion of adding a comment, though, so I've done that. I'm also willing to revisit the architecture of TextControl separately, as I already said.

In the future, may I invite you to #servo at irc.mozilla.org to discuss implementation plans, before any huge changes are made?

I've been in the IRC room a bit, but I don't really understand what you'd prefer I'd done differently here? Do you mean that you'd prefer I'd discussed the #19272 changes in IRC before submitting a PR?

@jonleighton

Copy link
Copy Markdown
Contributor Author

@KiChjang I believe I've addressed everything you've currently commented on, would you mind having another look at this please? (Or let me know if I should ask somebody else?)

@jdm jdm assigned jdm and unassigned KiChjang Jan 12, 2018

@KiChjang KiChjang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! I've been stuck with reviewing the 2nd and the 2nd last commit forever, and as such I believe it's better to hand this review off to @nox, and perhaps @mbrubeck can also look at the 2nd commit.

Comment thread components/script/dom/textcontrol.rs Outdated
},

SelectionMode::Preserve => {
// Step 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is substep 1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you recommend labelling this? "Substep 1"? "Step 13 -> preserve -> 1"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there are two ways to go about this, we can do Substep 1 or Step 13.1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go with the former; the latter seems ambiguous if other branches also had sub-steps.

Comment thread components/script/dom/textcontrol.rs Outdated
fn textinput(&self) -> &DomRefCell<TextInput<ScriptToConstellationChan>>;
fn selection_api_applies(&self) -> bool;
fn has_selectable_text(&self) -> bool;
fn dirty_value_flag(&self) -> &Cell<bool>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a &Cell here looks like an implementation detail, rather than a generalized API. I would expect this to return a bool, and have another method that sets the dirty value flag.

@KiChjang

Copy link
Copy Markdown
Contributor

r? @nox and @mbrubeck (2nd commit)

@highfive highfive assigned nox and unassigned jdm Jan 14, 2018

@mbrubeck mbrubeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ for the second commit. Looks great!

@nox

nox commented Jan 18, 2018

Copy link
Copy Markdown
Contributor

@KiChjang @mbrubeck reviewed the second commit, please approve your review and r=you if everything is ok.

@nox nox assigned KiChjang and unassigned nox Jan 18, 2018
@jonleighton

Copy link
Copy Markdown
Contributor Author

@nox FWIW I think @KiChjang was requesting that @mbrubeck review the 2nd commit only, and that you review the rest.

@KiChjang

Copy link
Copy Markdown
Contributor

@nox Sorry, I did mean to hand the PR over to you for review. Perhaps instead of the entire PR, you can look at the last 2 commits? r? @nox

@highfive highfive assigned nox and unassigned KiChjang Jan 20, 2018
@jonleighton

Copy link
Copy Markdown
Contributor Author

@KiChjang maybe we could just merge this? Seems like @nox is busy, and if there are no glaring problems with the code, surely having some implementation of this API is an improvement on having no implementation?

@nox

nox commented Jan 26, 2018

Copy link
Copy Markdown
Contributor

Great job with the last 2 commits! I think that can be merged as is.

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b76ec35 has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 26, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b76ec35 with merge 462ac0d...

Per the spec, selectionStart and selectionEnd should return the same
values regardless of the selectionDirection. (That is, selectionStart is
always less than or equal to selectionEnd; the direction then implies
which of selectionStart or selectionEnd is the cursor position.)

There was no explicit WPT test for this, so I added one.

This bug was initially quite hard to wrap my head around, and I think
part of the problem is the code in TextInput. Therefore, in the process
of fixing it I have refactored the implementation of TextInput:

* Rename selection_begin to selection_origin. This value doesn't
  necessarily correspond directly to the selectionStart DOM value - in
  the case of a backward selection, it corresponds to selectionEnd.
  I feel that "origin" doesn't imply a specific ordering as strongly as
  "begin" (or "start" for that matter) does.

* In various other cases where "begin" is used as a synonym for "start",
  just use "start" for consistency.

* Implement selection_start() and selection_end() methods (and their
  _offset() variants) which directly correspond to their DOM
  equivalents.

* Rename other related methods to make them less wordy and more
  consistent / intention-revealing.

* Add assertions to assert_ok_selection() to ensure that our assumptions
  about the ordering of selection_origin and edit_point are met. This
  then revealed a bug in adjust_selection_for_horizontal_change() where
  the value of selection_direction was not maintained correctly (causing
  a unit test failure when the new assertion failed).
The implementation of adjust_horizontal_to_limit() is written with UI in
mind. As such, when there's a selection and we "adjust horizontal", the
selection will be cleared and the cursor will and up at the start/end of
the previous selection. This is what happens when you have a selection
and you press an arrow key on your keyboard, but it isn't the behaviour
we want when programmatically changing the value.

Instead, we need to first clear the selection, and then move the cursor
to the end. (We also need to reset the selection direction when clearing
the selection.)
Spec: https://html.spec.whatwg.org/multipage/#dom-textarea/input-setrangetext

In order to do this, we need to define the SelectionMode enum in WebIDL:
https://html.spec.whatwg.org/multipage/#selectionmode

Since the enum is used by HTMLTextAreaElement and HTMLInputElement, it
doesn't seem to make sense to define it in the WebIDL file for one or
other of those.

However, we also can't create a stand-alone SelectionMode.webidl file,
because the current binding-generation code won't generate a "pub mod
SelectionMode;" line in mod.rs unless SelectionMode.webidl contains
either an interface or a namespace. (This logic happens in
components/script/dom/bindings/codegen/Configuration.py:35, in the
Configuration.__init__ method.)

I thought about changing the binding-generation code, but that seems
difficult. So I settled for placing the enum inside
HTMLFormElement.webidl, as that seems like a "neutral" location. We
could equally settle for putting it under HTMLTextAreaElement or
HTMLInputElement, it probably doesn't really matter.

The setRangeText algorithm set the "dirty value flag" on the
input/textarea. I made some clean-ups related to this:

1. HTMLTextAreaElement called its dirty value flag "value_changed"; I
   changed this to "value_dirty" to be consistent with the spec.

2. HTMLInputElement had a "value_changed" field and also a "value_dirty"
   field, which were each used in slightly different places (and
   sometimes in both places). I consolidated these into a single
   "value_dirty" field, which was necessary in order to make some of the
   tests pass.

TextControl::set_dom_range_text replaces part of the existing textinput
content with the replacement string (steps 9-10 of the algorithm). My
implementation changes the textinput's selection and then replaces the
selection. A downside of this approach is that we lose the original
selection state from before the call to setRangeText. Therefore, we have
to save the state into the original_selection_state variable so that we
can later pass it into TextControl::set_selection_range. This allows
TextControl::set_selection_range to correctly decide whether or not to
fire the select event.

An alternative approach would be to implement a method on TextInput
which allows a subtring of the content to be mutated, without touching
the current selection state. However, any such method would potentially
put the TextInput into an inconsistent state where the edit_point and/or
selection_origin is a TextPoint which doesn't exist in the content. It
would be up to the caller to subsequently make sure that the TextInput
gets put back into a valid state (which would actually happen, when
TextControl::set_selection_range is called).

I think TextInput's public API should not make it possible to put it
into an invalid state, as that would be a potential source of bugs.
That's why I didn't take this approach. (TextInput's public API does
currently make it possible to create an invalid state, but I'd like to
submit a follow-up patch to lock this down.)
Spec: https://html.spec.whatwg.org/multipage/input.html#input-type-change

In short, this resets the selection to the start of the field when the
type has changed from one which doesn't support the selection API to one
that does.

I couldn't see an existing WPT test covering this.
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jan 26, 2018
@jonleighton

Copy link
Copy Markdown
Contributor Author

@nox should be good to go now. (FWIW I had to add --no-pause-after-test to the test-wpt command; the file in question runs thousands of tests and it seemed to struggle with rendering all the output to the page...)

@nox

nox commented Jan 26, 2018

Copy link
Copy Markdown
Contributor

@bors-servo r+

Thanks again!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit a8b64ac has been approved by nox

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 26, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit a8b64ac with merge c2dfece...

bors-servo pushed a commit that referenced this pull request Jan 26, 2018
Text selection API conformance

This is my next batch of changes for issue #19171. All the tests in tests/wpt/metadata/html/semantics/forms/textfieldselection/ are now passing (and also some tests outside of there).

I've made detailed notes about the changes in each commit message.

r? @KiChjang

<!-- 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/19544)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ 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
Approved by: nox
Pushing c2dfece to master...

@bors-servo
bors-servo merged commit a8b64ac into servo:master Jan 26, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 26, 2018
jonleighton added a commit to jonleighton/servo that referenced this pull request Jan 30, 2018
The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.
jonleighton added a commit to jonleighton/servo that referenced this pull request Jan 30, 2018
The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.
jdm pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 31, 2018
Per the spec, selectionStart and selectionEnd should return the same
values regardless of the selectionDirection. (That is, selectionStart is
always less than or equal to selectionEnd; the direction then implies
which of selectionStart or selectionEnd is the cursor position.)

There was no explicit WPT test for this, so I added one.

This bug was initially quite hard to wrap my head around, and I think
part of the problem is the code in TextInput. Therefore, in the process
of fixing it I have refactored the implementation of TextInput:

* Rename selection_begin to selection_origin. This value doesn't
  necessarily correspond directly to the selectionStart DOM value - in
  the case of a backward selection, it corresponds to selectionEnd.
  I feel that "origin" doesn't imply a specific ordering as strongly as
  "begin" (or "start" for that matter) does.

* In various other cases where "begin" is used as a synonym for "start",
  just use "start" for consistency.

* Implement selection_start() and selection_end() methods (and their
  _offset() variants) which directly correspond to their DOM
  equivalents.

* Rename other related methods to make them less wordy and more
  consistent / intention-revealing.

* Add assertions to assert_ok_selection() to ensure that our assumptions
  about the ordering of selection_origin and edit_point are met. This
  then revealed a bug in adjust_selection_for_horizontal_change() where
  the value of selection_direction was not maintained correctly (causing
  a unit test failure when the new assertion failed).

Upstreamed from servo/servo#19544 [ci skip]
jdm pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 31, 2018
Spec: https://html.spec.whatwg.org/multipage/input.html#input-type-change

In short, this resets the selection to the start of the field when the
type has changed from one which doesn't support the selection API to one
that does.

I couldn't see an existing WPT test covering this.

Upstreamed from servo/servo#19544 [ci skip]
bors-servo pushed a commit that referenced this pull request Jan 31, 2018
Refactor implementation of TextControl

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? @jdm and @KiChjang

<!-- 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/19909)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 31, 2018
…nleighton:refactor-textcontrol); r=jdm

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo/servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? @jdm and @KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: ff54a58694af43fc549baa6c64bf6ebc5c37385f

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 308bb6755c90c07004c00e5cefacfaa4fa1f6ade
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
…nleighton:refactor-textcontrol); r=jdm

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo/servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? jdm and KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: ff54a58694af43fc549baa6c64bf6ebc5c37385f

UltraBlame original commit: bc60fea496d5e9f1eb059881b14e197dabc7bc59
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…nleighton:refactor-textcontrol); r=jdm

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo/servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? jdm and KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: ff54a58694af43fc549baa6c64bf6ebc5c37385f

UltraBlame original commit: bc60fea496d5e9f1eb059881b14e197dabc7bc59
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
…nleighton:refactor-textcontrol); r=jdm

The intention here is to make the flow more explicit. I.e. rather than
calling `self.dom_select()` and relying on the programmer to
know/realise that this method is provided by a trait, we call
`self.selection().dom_select()` and the programmer can inspect the
definition of `self.selection()` to follow the code.

This came out of a discussion with KiChjang here:

servo/servo#19544 (comment)

Note that I tried to make "selection" be a member field of
HTML{Input,TextArea}Element but it opened up a whole can of worms with
lifetimes, so it seemed simpler to not do that since it is not
essential for this code to work.

r? jdm and KiChjang

Source-Repo: https://github.com/servo/servo
Source-Revision: ff54a58694af43fc549baa6c64bf6ebc5c37385f

UltraBlame original commit: bc60fea496d5e9f1eb059881b14e197dabc7bc59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants