Skip to content

Commit

Permalink
revert workaround to non-polymer version, but keep as typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Sep 7, 2016
1 parent 1bef2e3 commit acdf838
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/cca/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script src='../bower/webcomponentsjs/webcomponents.min.js'></script>

<script src='scripts/context.static.js'></script>
<script src='scripts/workarounds.js'></script>

<!-- The vulcanized code will be loaded asynchronously by context.static.js -->
<!-- <link rel='import' href='polymer/vulcanized.html'> -->
Expand Down Expand Up @@ -44,9 +45,8 @@
</head>

<body unresolved touch-action='auto'>
<!-- uproxy-root and uproxy-workarounds will be loaded after polymer is loaded (see src/cca/app/scripts/context.ts) -->
<!-- uproxy-root will be appended here after polymer is loaded (see src/cca/app/scripts/context.ts) -->
<!-- <uproxy-root></uproxy-root> -->
<!-- <uproxy-workarounds></uproxy-workarounds> -->
</body>

</html>
1 change: 0 additions & 1 deletion src/cca/app/polymer/browser-elements.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!doctype html>
<!-- Imports for all Chrome-specific Polymer elements. This ensures that the elements will be vulcanized along with the generic UI Polymer elements. -->

<link rel='import' href='workarounds.html'>
6 changes: 0 additions & 6 deletions src/cca/app/polymer/workarounds.html

This file was deleted.

36 changes: 0 additions & 36 deletions src/cca/app/polymer/workarounds.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/cca/app/scripts/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ chrome.runtime.getBackgroundPage((bgPage) => {
// an <iframe> in this page to represent the background page.
var root = document.createElement('uproxy-root');
document.body.appendChild(root);
// Also add our <uproxy-workarounds> Polymer element defined in
// ../polymer/workarounds.{html,js}
var workarounds = document.createElement('uproxy-workarounds');
document.body.appendChild(workarounds);
};
link.onerror = function(e) {
console.log('Error while loading polymer/vulcanized.html:', e);
Expand Down
34 changes: 34 additions & 0 deletions src/cca/app/scripts/workarounds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// CCA-specific workarounds.

(function () {
// Force a repaint every 300 ms.
// Extremely hacky workaround for https://crbug.com/612836

let sendResize = true;

setInterval(function () {
if (sendResize) {
window.dispatchEvent(new Event('resize'));
} else {
console.debug('suppressed resize event');
}
}, 300);

// Workaround for janky inviteUserPanel transition,
// which is caused by the workaround above.
// https://github.com/uProxy/uproxy/issues/2659
document.addEventListener('uproxy-root-ready', function () {
// The 'uproxy-root-ready' event is dispatched in the `ready()` method of
// the uproxy root object instantiated in src/generic_ui/polymer/root.ts.
console.debug('got uproxy-root-ready');
let inviteButton = document.querySelector('uproxy-root /deep/ #inviteButton');
if (!inviteButton) {
console.error('#inviteButton missing:', inviteButton);
return;
}
inviteButton.addEventListener('tap', function () {
sendResize = false;
setTimeout(function () { sendResize = true; }, 2000);
});
});
})();
2 changes: 1 addition & 1 deletion src/generic_ui/polymer/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Polymer({
this.$.browserElementContainer.appendChild(browserCustomElement);
}
this.setDirectionality();
// Logic that depends on the uproxy-root element being loaded
// Logic that depends on the uproxy-root element being ready
// (as in src/cca/app/polymer/workarounds.ts)
// can be scheduled appropriately by listening for this event:
document.dispatchEvent(new Event('uproxy-root-ready'));
Expand Down

0 comments on commit acdf838

Please sign in to comment.