diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js index a8f99c4668..058b4e578c 100644 --- a/data/webkit/e-web-view.js +++ b/data/webkit/e-web-view.js @@ -772,6 +772,38 @@ Evo.EnsureMainDocumentInitialized = function() Evo.initializeAndPostContentLoaded(null); } +Evo.mailDisplayUpdateIFramesHeightRecursive = function(doc) +{ + if (!doc) + return; + + var ii, iframes; + + iframes = doc.getElementsByTagName("iframe"); + + /* Update from bottom to top */ + for (ii = 0; ii < iframes.length; ii++) { + Evo.mailDisplayUpdateIFramesHeightRecursive(iframes[ii].contentDocument); + } + + if (!doc.body || !doc.defaultView || !doc.defaultView.frameElement) + return; + + if (doc.defaultView.frameElement.height == doc.body.scrollHeight) + doc.defaultView.frameElement.height = 10; + doc.defaultView.frameElement.height = doc.body.scrollHeight + 2 + (doc.body.scrollWidth > doc.body.clientWidth ? 20 : 0); +} + +Evo.MailDisplayUpdateIFramesHeight = function() +{ + var scrolly = document.defaultView ? document.defaultView.scrollY : -1; + + Evo.mailDisplayUpdateIFramesHeightRecursive(document); + + if (scrolly != -1 && document.defaultView.scrollY != scrolly) + document.defaultView.scrollTo(0, scrolly); +} + if (this instanceof Window && this.document) { this.document.onload = function() { Evo.initializeAndPostContentLoaded(this); }; @@ -857,9 +889,8 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() local_width -= 2; /* 1 + 1 frame borders */ } else if (!iframes.length) { /* Message main body */ - local_width -= 8; /* 8 + 8 margins of body without iframes */ - if (level > 1) - local_width -= 8; + local_width -= level * 20; /* 10 + 10 margins of body without iframes */ + local_width -= 4; Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", "body", "width: " + local_width + "px;"); Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", ".part-container", "width: " + local_width + "px;"); @@ -869,7 +900,7 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", "body", "width: " + local_width + "px;"); - local_width -= 2; /* 1 + 1 frame borders */ + local_width -= 4; /* 2 + 2 frame borders */ Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", ".part-container-nostyle iframe", "width: " + local_width + "px;"); @@ -881,19 +912,15 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", ".part-container iframe", "width: " + (local_width - 10) + "px;"); } else { - local_width -= 20; /* 10 + 10 margins of body with iframes */ - local_width -= 8; /* attachment margin */ - local_width -= 2; /* 1 + 1 frame borders */ + local_width -= (level - 1) * 20; /* 10 + 10 margins of body with iframes */ + local_width -= 4; /* 2 + 2 frame borders */ + local_width -= 10; /* attachment margin */ - /* We need to subtract another 10 pixels from the iframe width to - * have the iframe's borders on the correct place. We can't subtract - * it from local_width as we don't want to propagate this change - * further. */ Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", ".part-container-nostyle iframe", - "width: " + (local_width - 10) + "px;"); + "width: " + local_width + "px;"); Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", "body > .part-container-nostyle iframe", - "width: " + (local_width - 10) + "px;"); + "width: " + local_width + "px;"); } /* Add rules to every sub document */ @@ -904,7 +931,7 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() var tmp_local_width = local_width; if (level == 0) { - tmp_local_width -= 8; /* attachment's margin */ + tmp_local_width -= 10; /* attachment's margin */ Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", ".attachment-wrapper iframe:not([src*=\"__formatas=\"])", "width: " + tmp_local_width + "px;"); @@ -913,7 +940,7 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() "width: " + tmp_local_width + "px;"); Evo.addRuleIntoStyleSheetDocument(doc, "-e-mail-formatter-style-sheet", "body > .part-container-nostyle iframe", - "width: " + local_width + "px;"); + "width: " + tmp_local_width + "px;"); } this.set_iframe_and_body_width (iframes[ii].contentDocument, tmp_local_width, original_width, level + 1); @@ -926,6 +953,7 @@ Evo.mailDisplayResizeContentToPreviewWidth = function() width -= 20; /* 10 + 10 margins of body */ traversar.set_iframe_and_body_width(document, width, width, 0); + window.webkit.messageHandlers.scheduleIFramesHeightUpdate.postMessage(0); } Evo.mailDisplayUpdateMagicSpacebarState = function() @@ -1294,6 +1322,8 @@ Evo.MailDisplayShowAttachment = function(element_id, show) window.webkit.messageHandlers.contentLoaded.postMessage(iframe_id); Evo.mailDisplayUpdateMagicSpacebarState(); } + } else if (elem.ownerDocument.defaultView.frameElement) { + window.webkit.messageHandlers.scheduleIFramesHeightUpdate.postMessage(0); } } diff --git a/data/webkit/webview.css b/data/webkit/webview.css index 905e148aa3..257c25b42d 100644 --- a/data/webkit/webview.css +++ b/data/webkit/webview.css @@ -12,8 +12,8 @@ img { } body { - /* Use margin so that children can safely use width=100% */ - margin: 5px 10px 5px 10px; + /* Use padding so that children can safely use width=100% */ + padding: 8px; } body, div, p, td { @@ -39,21 +39,21 @@ img#__evo-contact-photo { img.navigable { cursor: pointer; - margin-right: 4px; + padding-right: 4px; } .attachments { background: #FFF; border: 1px solid silver; - margin: 10px 10px 10px 10px; + padding: 10px 10px 10px 10px; border-left: 0; border-right: 0; border-bottom: 0; } .attachment { - margin-left: 8px; - margin-right: 0px; + padding-left: 8px; + padding-right: 0px; } .attachment td { @@ -67,21 +67,21 @@ iframe:not([id$=".itip"]) { .part-container { height: 100%; - margin-top: 2px; - margin-bottom: 2px; + padding: 0px; } .part-container-nostyle iframe { - margin-right: 10px; + margin: 0px; + padding-right: 0px; } .part-container-inner-margin { - margin: 8px; + padding: 0px; } object { /* GtkWidgets */ - margin-top: 2px; - margin-bottom: 2px; + padding-top: 2px; + padding-bottom: 2px; } .__evo-highlight { @@ -176,7 +176,7 @@ th.rtl { /***** PRINTING *******/ .printing-header { - margin-bottom: 20px; + padding-bottom: 20px; } .printing-header h1, @@ -196,7 +196,7 @@ th.rtl { /******* ITIP *********/ .itip.icon { float: left; - margin-right: 5px; + padding-right: 5px; } .itip.content { @@ -205,7 +205,7 @@ th.rtl { } .itip.description { - margin: 5px; + padding: 5px; } .itip tr { @@ -229,7 +229,7 @@ th.rtl { } #table_row_buttons img { - margin-right: 5px; + padding-right: 5px; vertical-align: middle; } diff --git a/src/em-format/e-mail-formatter-text-plain.c b/src/em-format/e-mail-formatter-text-plain.c index 7c6befda6b..3858bcdb3d 100644 --- a/src/em-format/e-mail-formatter-text-plain.c +++ b/src/em-format/e-mail-formatter-text-plain.c @@ -111,7 +111,7 @@ emfe_text_plain_format (EMailFormatterExtension *extension, string = "