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

Unified Diff: chrome/browser/resources/vr_shell/vr_shell_ui.js

Issue 2490313002: Remove fixed positioning of HTML UI elements. (Closed)
Patch Set: Address nits. Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/vr_shell/vr_shell_ui.js
diff --git a/chrome/browser/resources/vr_shell/vr_shell_ui.js b/chrome/browser/resources/vr_shell/vr_shell_ui.js
index c00c818200466d6d9aba1e9cba1a5f2d821c6afb..1d363bf4f1a3a2326baa0090b98e60a1de821e9b 100644
--- a/chrome/browser/resources/vr_shell/vr_shell_ui.js
+++ b/chrome/browser/resources/vr_shell/vr_shell_ui.js
@@ -44,21 +44,20 @@ var vrShellUi = (function() {
class DomUiElement {
constructor(domId) {
let domElement = document.querySelector(domId);
- let style = window.getComputedStyle(domElement);
- // Pull copy rectangle from DOM element properties.
- let pixelX = Math.round(domElement.offsetLeft / scaleFactor);
- let pixelY = Math.round(domElement.offsetTop / scaleFactor);
- let pixelWidth = Math.round(
- parseInt(style.getPropertyValue('width')) / scaleFactor);
- let pixelHeight = Math.round(
- parseInt(style.getPropertyValue('height')) / scaleFactor);
+ // Pull copy rectangle from the position of the element.
+ let rect = domElement.getBoundingClientRect();
+ let pixelX = Math.floor(rect.left);
+ let pixelY = Math.floor(rect.top);
+ let pixelWidth = Math.ceil(rect.right) - pixelX;
+ let pixelHeight = Math.ceil(rect.bottom) - pixelY;
let element = new api.UiElement(pixelX, pixelY, pixelWidth, pixelHeight);
element.setSize(scaleFactor * pixelWidth / 1000,
scaleFactor * pixelHeight / 1000);
// Pull additional custom properties from CSS.
+ let style = window.getComputedStyle(domElement);
element.setTranslation(
getStyleFloat(style, '--tranX'),
getStyleFloat(style, '--tranY'),
@@ -252,7 +251,7 @@ var vrShellUi = (function() {
class Omnibox {
constructor(contentQuadId) {
- this.setSecure(false);
+ this.setSecureOrigin(false);
this.domUiElement = new DomUiElement('#omni');
let update = new api.UiElementUpdate();
update.setVisible(false);
@@ -275,10 +274,11 @@ var vrShellUi = (function() {
omnibox.querySelector('#path').innerHTML = path;
}
- setSecure(secure) {
- let image = secure ? 'lock.svg' : 'i_circle.svg';
- let path = '../../../../ui/webui/resources/images/' + image;
- document.querySelector('#connection-security').src = path;
+ setSecureOrigin(secure) {
+ document.querySelector('#omni-secure-icon').style.display =
+ (secure ? 'block' : 'none');
+ document.querySelector('#omni-insecure-icon').style.display =
+ (!secure ? 'block' : 'none');
}
};
@@ -304,6 +304,7 @@ var vrShellUi = (function() {
setSecureOrigin(secure) {
this.secureOriginWarnings.setSecureOrigin(secure);
+ this.omnibox.setSecureOrigin(secure);
}
setReloadUiEnabled(enabled) {
« no previous file with comments | « chrome/browser/resources/vr_shell/vr_shell_ui.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698