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

Unified Diff: safari/ext/popup.js

Issue 5183241912844288: Issue 380 - Fixed width of bubble in Safari with long translated texts (Closed)
Patch Set: Addressed comments Created April 30, 2014, 3:37 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 | « popup.html ('k') | skin/popup.css » ('j') | 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
@@ -12,7 +12,7 @@
{
setTimeout(function()
{
- safari.self.width = document.body.offsetWidth;
+ safari.self.width = document.body.scrollWidth;
safari.self.height = document.body.offsetHeight;
resizingScheduled = false;
@@ -38,6 +38,16 @@
document.addEventListener("DOMSubtreeModified", updateSize);
});
+ // when using "white-space: nowrap", the overflown text overlaps the padding
+ // and neither clientWidth nor scrollWidth, we rely on when adjusting the size
+ // of the popover, inlcudes the overlapped area. So we have to use additional
+ // placeholders, in order to preserve padding. Since the dimensions of the
+ // popover are automatically correctly adjusted on Chrome, those placeholders
+ // would add extra empty space and therefore must only be rendered on Safari.
+ var style = document.createElement("style");
+ style.textContent = ".safari-inline-block { display: inline-block; }";
+ document.head.appendChild(style);
+
// Safari will load the popover once, and then show it everytime the icon is
// clicked. While Chrome loads it everytime you click the icon. So in order to
« no previous file with comments | « popup.html ('k') | skin/popup.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld