Skip to content

Highlight selected text in input fields - #10176

Merged
bors-servo merged 2 commits into
servo:masterfrom
mbrubeck:selection-range
Mar 26, 2016
Merged

bors-servo merged 2 commits into
servo:masterfrom
mbrubeck:selection-range

Conversation

@mbrubeck

Copy link
Copy Markdown
Contributor

Fixes #9993. This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

r? @pcwalton


This change is Reviewable

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify layout and script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 24, 2016
@jdm

jdm commented Mar 24, 2016

Copy link
Copy Markdown
Member

You'll need ./mach cargo-update -p script.

@mbrubeck

Copy link
Copy Markdown
Contributor Author

You'll need ./mach cargo-update -p script.

Done.

Comment thread components/layout/fragment.rs Outdated

/// Is this fragment selected?
pub selected: 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.

Can we move this down to after requires_line_break_afterward_if_wrapping_on_newlines? (Or, even better, combine those two into a bitflags!?)

Fragment memory usage tends to have an outsized effect on Servo's performance, since they do get moved around a lot (more than they should, but fixing this will be a good bit of work).

@pcwalton

Copy link
Copy Markdown
Contributor

Is there a way we can reftest this, perhaps by programmatically selecting text in JavaScript (the selection APIs work, right?) and then comparing that against something with a solid background? To avoid failing that test once we have user-stylable ::selection, we could just add a CSS rule to set the color of the selection to the same color that Servo chooses now, allowing Servo of today to harmlessly ignore that rule.

@mbrubeck

Copy link
Copy Markdown
Contributor Author

Can we move this down to after requires_line_break_afterward_if_wrapping_on_newlines? (Or, even better, combine those two into a bitflags!?)

Done.

Is there a way we can reftest this, perhaps by programmatically selecting text in JavaScript (the selection APIs work, right?) and then comparing that against something with a solid background?

Added a reftest. r? @pcwalton

Fixes servo#9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
@pcwalton

Copy link
Copy Markdown
Contributor

@bors-servo: r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 08caf74 has been approved by pcwalton

@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 Mar 25, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 08caf74 with merge f125478...

bors-servo pushed a commit that referenced this pull request Mar 25, 2016
Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10176)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 26, 2016
@mbrubeck

Copy link
Copy Markdown
Contributor Author

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 08caf74 with merge bed91b3...

bors-servo pushed a commit that referenced this pull request Mar 26, 2016
Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10176)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 26, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor

@bors-servo
bors-servo merged commit 08caf74 into servo:master Mar 26, 2016
bors-servo pushed a commit that referenced this pull request Mar 28, 2016
Make selection blue instead of orange

PR #10176 add a background color for selected text. It uses a builtin color until `::selection` is supported. ~~Orange makes sense for Linux. Let's make it blue for windows and mac.~~ See #10231 (comment)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10231)
<!-- Reviewable:end -->
@mbrubeck
mbrubeck deleted the selection-range branch May 11, 2016 03:48
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…lrouget:selectionColor); r=mbrubeck

PR servo/servo#10176 add a background color for selected text. It uses a builtin color until `::selection` is supported. ~~Orange makes sense for Linux. Let's make it blue for windows and mac.~~ See servo/servo#10231 (comment)

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

UltraBlame original commit: 95ef72f1a6e7ee93eb4d6cc096da8fbf6a52d90a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…lrouget:selectionColor); r=mbrubeck

PR servo/servo#10176 add a background color for selected text. It uses a builtin color until `::selection` is supported. ~~Orange makes sense for Linux. Let's make it blue for windows and mac.~~ See servo/servo#10231 (comment)

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

UltraBlame original commit: 95ef72f1a6e7ee93eb4d6cc096da8fbf6a52d90a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…lrouget:selectionColor); r=mbrubeck

PR servo/servo#10176 add a background color for selected text. It uses a builtin color until `::selection` is supported. ~~Orange makes sense for Linux. Let's make it blue for windows and mac.~~ See servo/servo#10231 (comment)

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

UltraBlame original commit: 95ef72f1a6e7ee93eb4d6cc096da8fbf6a52d90a
romen pushed a commit to QUBIP/mozilla-central that referenced this pull request Mar 25, 2025
…lrouget:selectionColor); r=mbrubeck

PR servo/servo#10176 add a background color for selected text. It uses a builtin color until `::selection` is supported. ~~Orange makes sense for Linux. Let's make it blue for windows and mac.~~ See servo/servo#10231 (comment)

Source-Repo: https://github.com/servo/servo
Source-Revision: cf4fa0a9f463f9bdfc5daef7f6bf9d6e1d151aa6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants