diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-09-29 14:13:32 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-09-29 14:13:32 -0600 |
commit | 0c64e4a2c98cbf5e7b95dbea31c2e6993b70472c (patch) | |
tree | bc20e7f53cf2e3afe578b758baab1234bf3d8b2f /components/script/dom | |
parent | d92e781a87b5a998f06580fa959c3ccb5cf14dcf (diff) | |
parent | 9cf43877f268221f4d7c2eea5a89bffb55709c71 (diff) | |
download | servo-0c64e4a2c98cbf5e7b95dbea31c2e6993b70472c.tar.gz servo-0c64e4a2c98cbf5e7b95dbea31c2e6993b70472c.zip |
Auto merge of #7764 - j3parker:input-caret-only-for-text, r=pcwalton
Only display text carets in text inputs
For #7756
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7764)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 40020a74d14..a07529ebbec 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -143,7 +143,7 @@ pub trait LayoutHTMLInputElementHelpers { #[allow(unsafe_code)] unsafe fn get_size_for_layout(self) -> u32; #[allow(unsafe_code)] - unsafe fn get_insertion_point_for_layout(self) -> TextPoint; + unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint>; } pub trait RawLayoutHTMLInputElementHelpers { @@ -197,8 +197,12 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - unsafe fn get_insertion_point_for_layout(self) -> TextPoint { - (*self.unsafe_get()).textinput.borrow_for_layout().edit_point + unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint> { + match (*self.unsafe_get()).input_type.get() { + InputType::InputText | InputType::InputPassword => + Some((*self.unsafe_get()).textinput.borrow_for_layout().edit_point), + _ => None + } } } |