diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-09-19 17:47:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 17:47:27 -0400 |
commit | df2adebefdfa3da49f173e480fa1e56450f9bda2 (patch) | |
tree | 1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/textcontrol.rs | |
parent | 2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff) | |
parent | c37a345dc9f4dda6ea29c42f96f6c7201c42cbac (diff) | |
download | servo-df2adebefdfa3da49f173e480fa1e56450f9bda2.tar.gz servo-df2adebefdfa3da49f173e480fa1e56450f9bda2.zip |
Auto merge of #21737 - chansuke:format_script, r=jdm
Format script component
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix part of #21373.
- [x] These changes do not require tests because they format code only.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- 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/21737)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/textcontrol.rs')
-rw-r--r-- | components/script/dom/textcontrol.rs | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/components/script/dom/textcontrol.rs b/components/script/dom/textcontrol.rs index fa6c8d0b604..9abe8d03a69 100644 --- a/components/script/dom/textcontrol.rs +++ b/components/script/dom/textcontrol.rs @@ -30,7 +30,10 @@ pub struct TextControlSelection<'a, E: TextControlElement> { } impl<'a, E: TextControlElement> TextControlSelection<'a, E> { - pub fn new(element: &'a E, textinput: &'a DomRefCell<TextInput<ScriptToConstellationChan>>) -> Self { + pub fn new( + element: &'a E, + textinput: &'a DomRefCell<TextInput<ScriptToConstellationChan>>, + ) -> Self { TextControlSelection { element, textinput } } @@ -123,7 +126,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { Some(self.start()), Some(self.end()), direction.map(|d| SelectionDirection::from(d)), - None + None, ); Ok(()) } @@ -136,7 +139,12 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { } // Step 2 - self.set_range(Some(start), Some(end), direction.map(|d| SelectionDirection::from(d)), None); + self.set_range( + Some(start), + Some(end), + direction.map(|d| SelectionDirection::from(d)), + None, + ); Ok(()) } @@ -146,7 +154,7 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { replacement: DOMString, start: Option<u32>, end: Option<u32>, - selection_mode: SelectionMode + selection_mode: SelectionMode, ) -> ErrorResult { // Step 1 if !self.element.selection_api_applies() { @@ -244,7 +252,12 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { } // Step 14 - self.set_range(Some(selection_start), Some(selection_end), None, Some(original_selection_state)); + self.set_range( + Some(selection_start), + Some(selection_end), + None, + Some(original_selection_state), + ); Ok(()) } @@ -266,10 +279,11 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { start: Option<u32>, end: Option<u32>, direction: Option<SelectionDirection>, - original_selection_state: Option<SelectionState> + original_selection_state: Option<SelectionState>, ) { let mut textinput = self.textinput.borrow_mut(); - let original_selection_state = original_selection_state.unwrap_or_else(|| textinput.selection_state()); + let original_selection_state = + original_selection_state.unwrap_or_else(|| textinput.selection_state()); // Step 1 let start = start.unwrap_or(0); @@ -288,9 +302,12 @@ impl<'a, E: TextControlElement> TextControlSelection<'a, E> { atom!("select"), EventBubbles::Bubbles, EventCancelable::NotCancelable, - &window); + &window, + ); } - self.element.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); + self.element + .upcast::<Node>() + .dirty(NodeDamage::OtherNodeDamage); } } |