Skip to content

Commit

Permalink
✨ Keep the highlighted text color consistent with Android Chrome. (am…
Browse files Browse the repository at this point in the history
  • Loading branch information
yunabe authored and Noran Azmy committed Mar 22, 2019
1 parent 1df4ec4 commit 3b2f75e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions extensions/amp-viewer-integration/0.1/highlight-handler.js
Expand Up @@ -203,9 +203,11 @@ export class HighlightHandler {

for (let i = 0; i < this.highlightedNodes_.length; i++) {
const n = this.highlightedNodes_[i];
// The background color is same as Android Chrome text finding.
// https://cs.chromium.org/chromium/src/chrome/android/java/res/values/colors.xml?l=158&rcl=8b461e376e824c72fec1d6d91cd6633ba344dd55&q=ff9632
setStyles(n, {
backgroundColor: '#fc9741',
color: '#333',
backgroundColor: '#ff9632',
color: '#000',
});
}

Expand Down
Expand Up @@ -142,10 +142,10 @@ describes.realWin('HighlightHandler', {
{state: 'auto_scroll'});

expect(root.innerHTML).to.equal(
'<div>text in <span style="background-color: rgb(252, 151, 65); ' +
'color: rgb(51, 51, 51);">amp</span> doc</div><div>' +
'<span style="background-color: rgb(252, 151, 65); color: ' +
'rgb(51, 51, 51);">highlight</span>ed text</div>');
'<div>text in <span style="background-color: rgb(255, 150, 50); ' +
'color: rgb(0, 0, 0);">amp</span> doc</div><div>' +
'<span style="background-color: rgb(255, 150, 50); color: ' +
'rgb(0, 0, 0);">highlight</span>ed text</div>');

const viewerOrigin = 'http://localhost:9876';
const port = new WindowPortEmulator(
Expand Down

0 comments on commit 3b2f75e

Please sign in to comment.