Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: safari/ext/popup.js

Issue 5635941347622912: Resize popover on Safari only when the size of its content doesn't change anymore (Closed)
Patch Set: Created Feb. 26, 2014, 6:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/ext/popup.js
===================================================================
--- a/safari/ext/popup.js
+++ b/safari/ext/popup.js
@@ -4,13 +4,21 @@
// of its content, like when the ad counter is expanded/collapsed. So we add
// event listeners to do so.
var mayResize = true;
+ var resizingScheduled = false;
var updateSize = function()
{
- if (mayResize)
+ if (mayResize && !resizingScheduled)
{
- safari.self.width = document.body.offsetWidth;
- safari.self.height = document.body.offsetHeight;
+ setTimeout(function()
+ {
+ safari.self.width = document.body.offsetWidth;
+ safari.self.height = document.body.offsetHeight;
+
+ resizingScheduled = false;
+ }, 0);
+
+ resizingScheduled = true;
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld