diff --git a/chrome/browser/resources/md_bookmarks/command_manager.html b/chrome/browser/resources/md_bookmarks/command_manager.html index 13b59a667824f5..ad0e2f13856a9d 100644 --- a/chrome/browser/resources/md_bookmarks/command_manager.html +++ b/chrome/browser/resources/md_bookmarks/command_manager.html @@ -29,7 +29,7 @@ } diff --git a/chrome/browser/resources/md_history/history_list.html b/chrome/browser/resources/md_history/history_list.html index ed46d9fcda9311..e1497095672f90 100644 --- a/chrome/browser/resources/md_history/history_list.html +++ b/chrome/browser/resources/md_history/history_list.html @@ -74,7 +74,7 @@ diff --git a/chrome/browser/resources/md_history/synced_device_manager.html b/chrome/browser/resources/md_history/synced_device_manager.html index 7b10c59e6cbd3c..cf99f6e8d27de3 100644 --- a/chrome/browser/resources/md_history/synced_device_manager.html +++ b/chrome/browser/resources/md_history/synced_device_manager.html @@ -88,7 +88,7 @@ diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html index 8ddeeba9e3e5d4..870f10dd87bb5f 100644 --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.html @@ -37,7 +37,7 @@ title="$i18n{moreActions}" on-keydown="ignoreEnterKey_"> - + - + diff --git a/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html b/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html index 66450a90e92b65..35babb87473f4a 100644 --- a/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html +++ b/chrome/browser/resources/settings/internet_page/internet_known_networks_page.html @@ -84,7 +84,7 @@ - + - + diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html index 31087c02f59079..3e95b3ef7a358c 100644 --- a/chrome/browser/resources/settings/languages_page/languages_page.html +++ b/chrome/browser/resources/settings/languages_page/languages_page.html @@ -45,15 +45,15 @@ margin-top: 4px; } - dialog[is='cr-action-menu'].complex .dropdown-item { + cr-action-menu.complex .dropdown-item { min-height: 36px; } - dialog[is='cr-action-menu']:not(.complex) hr { + cr-action-menu:not(.complex) hr { display: none; } - dialog[is='cr-action-menu'].complex hr { + cr-action-menu.complex hr { /* Override user-agent border and margin. */ border: none; /* TODO(michaelpg): Update to whatever variable is used for the darker, @@ -266,7 +266,7 @@ diff --git a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html index 284c9571d0b486..a89df417f6fb0c 100644 --- a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html +++ b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.html @@ -31,7 +31,7 @@ diff --git a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.js b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.js index dd6ac50a0458dc..756fdd9ee81e4d 100644 --- a/chrome/browser/resources/settings/on_startup_page/startup_url_entry.js +++ b/chrome/browser/resources/settings/on_startup_page/startup_url_entry.js @@ -43,7 +43,7 @@ Polymer({ /** @private */ onRemoveTap_: function() { - this.$$('dialog[is=cr-action-menu]').close(); + this.$$('cr-action-menu').close(); settings.StartupUrlsPageBrowserProxyImpl.getInstance().removeStartupPage( this.model.modelIndex); }, @@ -54,7 +54,7 @@ Polymer({ */ onEditTap_: function(e) { e.preventDefault(); - this.$$('dialog[is=cr-action-menu]').close(); + this.$$('cr-action-menu').close(); this.fire(settings.EDIT_STARTUP_URL_EVENT, { model: this.model, anchor: this.$$('#dots'), diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html index 73f241e1686634..4490ec43d4aea5 100644 --- a/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html +++ b/chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html @@ -126,12 +126,12 @@

$i18n{addresses}

$i18n{noAddressesFound} - + - + diff --git a/ui/webui/resources/cr_components/certificate_manager/certificate_subentry.js b/ui/webui/resources/cr_components/certificate_manager/certificate_subentry.js index f2bc22e51fcb6e..8467bd7c15fa19 100644 --- a/ui/webui/resources/cr_components/certificate_manager/certificate_subentry.js +++ b/ui/webui/resources/cr_components/certificate_manager/certificate_subentry.js @@ -139,7 +139,7 @@ Polymer({ /** @private */ closePopupMenu_: function() { - this.$$('dialog[is=cr-action-menu]').close(); + this.$$('cr-action-menu').close(); }, /** @private */ diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.html b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.html index 70acc097ff29ab..ef6cca6b2f36d3 100644 --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.html +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.html @@ -8,16 +8,18 @@ diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js index 31613726bccb34..3da580b9cb583f 100644 --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js @@ -117,7 +117,6 @@ function getDefaultShowConfig() { Polymer({ is: 'cr-action-menu', - extends: 'dialog', /** * The element which the action menu will be anchored to. Also the element @@ -157,6 +156,11 @@ Polymer({ type: Boolean, value: false, }, + + open: { + type: Boolean, + value: false, + }, }, listeners: { @@ -170,6 +174,14 @@ Polymer({ this.removeListeners_(); }, + /** + * Exposing internal elements for tests. + * @return {!HTMLDialogElement} + */ + getDialog: function() { + return this.$.dialog; + }, + /** @private */ removeListeners_: function() { window.removeEventListener('resize', this.boundClose_); @@ -214,10 +226,10 @@ Polymer({ if (nextOption) { if (!this.hasMousemoveListener_) { this.hasMousemoveListener_ = true; - listenOnce(this, 'mousemove', function(e) { + listenOnce(this, 'mousemove', e => { this.onMouseover_(e); this.hasMousemoveListener_ = false; - }.bind(this)); + }); } nextOption.focus(); } @@ -243,7 +255,7 @@ Polymer({ } while (this != target); // The user moved the mouse off the options. Reset focus to the dialog. - this.focus(); + this.$.dialog.focus(); }, /** @@ -278,11 +290,11 @@ Polymer({ return nextOption; }, - /** @override */ close: function() { // Removing 'resize' and 'popstate' listeners when dialog is closed. this.removeListeners_(); - HTMLDialogElement.prototype.close.call(this); + this.$.dialog.close(); + this.open = false; if (this.anchorElement_) { cr.ui.focusWithoutInk(assert(this.anchorElement_)); this.anchorElement_ = null; @@ -353,7 +365,8 @@ Polymer({ // and so that the dialog is positioned at the top-start corner of the // document. this.resetStyle_(); - this.showModal(); + this.$.dialog.showModal(); + this.open = true; config.top += scrollTop; config.left += scrollLeft; @@ -375,9 +388,9 @@ Polymer({ /** @private */ resetStyle_: function() { - this.style.left = ''; - this.style.right = ''; - this.style.top = '0'; + this.$.dialog.style.left = ''; + this.$.dialog.style.right = ''; + this.$.dialog.style.top = '0'; }, /** @@ -400,20 +413,22 @@ Polymer({ if (rtl) c.anchorAlignmentX *= -1; + const offsetWidth = this.$.dialog.offsetWidth; var menuLeft = getStartPointWithAnchor( - left, right, this.offsetWidth, c.anchorAlignmentX, c.minX, c.maxX); + left, right, offsetWidth, c.anchorAlignmentX, c.minX, c.maxX); if (rtl) { var menuRight = - document.scrollingElement.clientWidth - menuLeft - this.offsetWidth; - this.style.right = menuRight + 'px'; + document.scrollingElement.clientWidth - menuLeft - offsetWidth; + this.$.dialog.style.right = menuRight + 'px'; } else { - this.style.left = menuLeft + 'px'; + this.$.dialog.style.left = menuLeft + 'px'; } var menuTop = getStartPointWithAnchor( - top, bottom, this.offsetHeight, c.anchorAlignmentY, c.minY, c.maxY); - this.style.top = menuTop + 'px'; + top, bottom, this.$.dialog.offsetHeight, c.anchorAlignmentY, c.minY, + c.maxY); + this.$.dialog.style.top = menuTop + 'px'; }, /** @@ -421,7 +436,7 @@ Polymer({ */ addListeners_: function() { this.boundClose_ = this.boundClose_ || function() { - if (this.open) + if (this.$.dialog.open) this.close(); }.bind(this); window.addEventListener('resize', this.boundClose_); @@ -446,7 +461,7 @@ Polymer({ } }); - this.resizeObserver_.observe(this); + this.resizeObserver_.observe(this.$.dialog); } }, });