Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2852)

Unified Diff: chrome/browser/resources/print_preview/previewarea/preview_area.js

Issue 601083004: Enable a11y audit for chrome://print and fix failing tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ChromeOS timeout Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/previewarea/preview_area.js
diff --git a/chrome/browser/resources/print_preview/previewarea/preview_area.js b/chrome/browser/resources/print_preview/previewarea/preview_area.js
index 85578a383dfe8fa344883b867d75d60cc899a112..adfdafd7d8c410df6c0b14e5cfe3c1eff81da4b3 100644
--- a/chrome/browser/resources/print_preview/previewarea/preview_area.js
+++ b/chrome/browser/resources/print_preview/previewarea/preview_area.js
@@ -199,7 +199,10 @@ cr.define('print_preview', function() {
OPEN_SYSTEM_DIALOG_BUTTON: 'preview-area-open-system-dialog-button',
OPEN_SYSTEM_DIALOG_BUTTON_THROBBER:
'preview-area-open-system-dialog-button-throbber',
- OVERLAY: 'preview-area-overlay-layer'
+ OVERLAY: 'preview-area-overlay-layer',
+ OVERLAYED: 'preview-area-overlayed',
+ MARGIN_CONTROL: 'margin-control',
+ PREVIEW_AREA: 'preview-area-plugin-wrapper'
};
/**
@@ -504,20 +507,39 @@ cr.define('print_preview', function() {
PreviewArea.MessageIdClassMap_[messageId])[0];
setIsVisible(messageEl, true);
- // Show overlay.
- this.overlayEl_.classList.remove(PreviewArea.Classes_.INVISIBLE);
+ this.setOverlayVisible_(true);
},
/**
- * Hides the message overlay.
+ * Set the visibility of the message overlay.
+ * @param {boolean} visible Whether to make the overlay visible or not
* @private
*/
- hideOverlay_: function() {
- this.overlayEl_.classList.add(PreviewArea.Classes_.INVISIBLE);
- // Disable jumping animation to conserve cycles.
- var jumpingDotsEl = this.getElement().querySelector(
- '.preview-area-loading-message-jumping-dots');
- jumpingDotsEl.classList.remove('jumping-dots');
+ setOverlayVisible_: function(visible) {
+ this.overlayEl_.classList.toggle(
+ PreviewArea.Classes_.INVISIBLE,
+ !visible);
+
+ // Hide/show all controls that will overlap when the overlay is visible.
+ var marginControls = this.getElement().getElementsByClassName(
+ PreviewArea.Classes_.MARGIN_CONTROL);
+ for (var i = 0; i < marginControls.length; ++i) {
+ marginControls[i].classList.toggle(PreviewArea.Classes_.OVERLAYED,
+ visible);
+ }
+ var previewAreaControls = this.getElement().getElementsByClassName(
+ PreviewArea.Classes_.PREVIEW_AREA);
+ for (var i = 0; i < previewAreaControls.length; ++i) {
+ previewAreaControls[i].classList.toggle(PreviewArea.Classes_.OVERLAYED,
+ visible);
+ }
+
+ if (!visible) {
+ // Disable jumping animation to conserve cycles.
+ var jumpingDotsEl = this.getElement().querySelector(
+ '.preview-area-loading-message-jumping-dots');
+ jumpingDotsEl.classList.remove('jumping-dots');
+ }
},
/**
@@ -714,7 +736,7 @@ cr.define('print_preview', function() {
this.plugin_.fitToHeight();
}
}
- this.hideOverlay_();
+ this.setOverlayVisible_(false);
this.isPluginReloaded_ = true;
this.dispatchPreviewGenerationDoneIfReady_();
},

Powered by Google App Engine
This is Rietveld 408576698