Commit 07426889 authored by rbpotter's avatar rbpotter Committed by Commit Bot

PDF Viewer: Highlight download button when menu is open, match bookmarks

The download button should be highlighted when the action menu is open,
similar to the highlight on the bookmarks icon when the bookmarks menu
is open.

Also changing the menu to be light when the PDFViewerUpdate feature
flag is not enabled, for the same reason (matching the bookmarks menu).

Bug: 1113519
Change-Id: I86dc1b7a569688532a2bbce1b8b639e79932d325
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340447
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796144}
parent fb9e7a13
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
ui/webui/resources/cr_elements/shared_vars_css.html. Unfortunately there ui/webui/resources/cr_elements/shared_vars_css.html. Unfortunately there
seems to be no great way to share styles with the seems to be no great way to share styles with the
"prefers-color-scheme: dark" @media query selector. */ "prefers-color-scheme: dark" @media query selector. */
cr-action-menu[force-dark-mode] { :host-context([pdf-viewer-update-enabled]) cr-action-menu {
--cr-menu-background-color: var(--google-grey-900); --cr-menu-background-color: var(--google-grey-900);
--cr-menu-shadow: rgba(0, 0, 0, .3) 0 1px 2px 0, --cr-menu-shadow: rgba(0, 0, 0, .3) 0 1px 2px 0,
rgba(0, 0, 0, .15) 0 3px 6px 2px; rgba(0, 0, 0, .15) 0 3px 6px 2px;
......
...@@ -3,12 +3,17 @@ ...@@ -3,12 +3,17 @@
position: fixed; position: fixed;
top: 48px; top: 48px;
} }
:host([menu-open_]) #download {
background-color: var(--active-button-bg);
border-radius: 50%;
}
</style> </style>
<cr-icon-button id="download" iron-icon="cr:file-download" <cr-icon-button id="download" iron-icon="cr:file-download"
on-click="onDownloadClick_" aria-label$="$i18n{tooltipDownload}" on-click="onDownloadClick_" aria-label$="$i18n{tooltipDownload}"
aria-haspopup$="[[downloadHasPopup_]]" aria-haspopup$="[[downloadHasPopup_]]"
title="$i18n{tooltipDownload}"></cr-icon-button> title="$i18n{tooltipDownload}"></cr-icon-button>
<cr-action-menu id="menu" force-dark-mode> <cr-action-menu id="menu" on-close="onMenuClose_">
<button class="dropdown-item" on-click="onDownloadEditedClick_"> <button class="dropdown-item" on-click="onDownloadEditedClick_">
$i18n{downloadEdited} $i18n{downloadEdited}
</button> </button>
......
...@@ -40,6 +40,13 @@ export class ViewerDownloadControlsElement extends PolymerElement { ...@@ -40,6 +40,13 @@ export class ViewerDownloadControlsElement extends PolymerElement {
computed: 'computeDownloadHasPopup_(' + computed: 'computeDownloadHasPopup_(' +
'pdfFormSaveEnabled, hasEdits, hasEnteredAnnotationMode)', 'pdfFormSaveEnabled, hasEdits, hasEnteredAnnotationMode)',
}, },
/** @private */
menuOpen_: {
type: Boolean,
reflectToAttribute: true,
value: false,
},
}; };
} }
...@@ -69,13 +76,18 @@ export class ViewerDownloadControlsElement extends PolymerElement { ...@@ -69,13 +76,18 @@ export class ViewerDownloadControlsElement extends PolymerElement {
/** @return {boolean} */ /** @return {boolean} */
isMenuOpen() { isMenuOpen() {
return this.getDownloadMenu_().open; return this.menuOpen_;
} }
closeMenu() { closeMenu() {
this.getDownloadMenu_().close(); this.getDownloadMenu_().close();
} }
/** @private */
onMenuClose_() {
this.menuOpen_ = false;
}
/** /**
* @return {boolean} * @return {boolean}
* @private * @private
...@@ -105,6 +117,7 @@ export class ViewerDownloadControlsElement extends PolymerElement { ...@@ -105,6 +117,7 @@ export class ViewerDownloadControlsElement extends PolymerElement {
/** @private */ /** @private */
showDownloadMenu_() { showDownloadMenu_() {
this.menuOpen_ = true;
this.getDownloadMenu_().showAt(this.$.download, { this.getDownloadMenu_().showAt(this.$.download, {
anchorAlignmentX: AnchorAlignment.CENTER, anchorAlignmentX: AnchorAlignment.CENTER,
}); });
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<if expr="chromeos"> <if expr="chromeos">
:host([annotation-mode]) #annotate { :host([annotation-mode]) #annotate {
background-color: rgba(255, 255, 255, 0.24); background-color: var(--active-button-bg);
border-radius: 50%; border-radius: 50%;
} }
</if> </if>
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
<paper-progress id="progress" value="[[loadProgress]]" hidden="[[!loading_]]"> <paper-progress id="progress" value="[[loadProgress]]" hidden="[[!loading_]]">
</paper-progress> </paper-progress>
<cr-action-menu force-dark-mode> <cr-action-menu>
<button id="single-page-view-button" <button id="single-page-view-button"
class="dropdown-item" on-click="onSinglePageViewClick_" class="dropdown-item" on-click="onSinglePageViewClick_"
role="radio" role="radio"
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
} }
:host([annotation-mode]) #annotate { :host([annotation-mode]) #annotate {
background-color: rgba(255, 255, 255, 0.24); background-color: var(--active-button-bg);
border-radius: 50%; border-radius: 50%;
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
} }
:host([dropdown-open]) #button { :host([dropdown-open]) #button {
background-color: rgba(255, 255, 255, 0.24); background-color: var(--active-button-bg);
} }
h1 { h1 {
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
--pdf-toolbar-text-color: rgb(241, 241, 241); --pdf-toolbar-text-color: rgb(241, 241, 241);
} }
viewer-pdf-toolbar,
viewer-pdf-toolbar-new {
--active-button-bg: rgba(255, 255, 255, 0.24);
}
#content-focus-rectangle { #content-focus-rectangle {
border: 2px solid var(--google-grey-600); border: 2px solid var(--google-grey-600);
border-radius: 2px; border-radius: 2px;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment