[geary/bug/728002-webkit2: 121/140] Calculate ClientWebView to include HTML element margins.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/bug/728002-webkit2: 121/140] Calculate ClientWebView to include HTML element margins.
- Date: Tue, 31 Jan 2017 23:08:43 +0000 (UTC)
commit 5ff2d9b908d7abdccecb86bcc3dfc20ee9fa35fc
Author: Michael James Gratton <mike vee net>
Date: Fri Jan 27 02:09:23 2017 +1100
Calculate ClientWebView to include HTML element margins.
* ui/client-web-view.js (PageState::getPreferredHeight): Compute and use
top and bottom when determining the height value.
* ui/conversation-web-view.css: Remove onerous style defaults now we
can deal with HTML elements with margins.
ui/client-web-view.js | 12 +++++++++++-
ui/conversation-web-view.css | 29 +++++------------------------
2 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/ui/client-web-view.js b/ui/client-web-view.js
index 4c11d39..57f0b53 100644
--- a/ui/client-web-view.js
+++ b/ui/client-web-view.js
@@ -53,7 +53,17 @@ PageState.prototype = {
}, true);
},
getPreferredHeight: function() {
- return window.document.documentElement.offsetHeight;
+ let html = window.document.documentElement;
+ let height = html.offsetHeight;
+ let computed = window.getComputedStyle(html);
+ let top = computed.getPropertyValue('margin-top');
+ let bot = computed.getPropertyValue('margin-bottom');
+
+ return (
+ height
+ + parseInt(top.substring(0, top.length - 2))
+ + parseInt(bot.substring(0, bot.length - 2))
+ );
},
loaded: function() {
this.isLoaded = true;
diff --git a/ui/conversation-web-view.css b/ui/conversation-web-view.css
index e3385e3..d1cf1fd 100644
--- a/ui/conversation-web-view.css
+++ b/ui/conversation-web-view.css
@@ -7,33 +7,15 @@
*/
* {
- transition: height 0.25s;
-}
-
-html {
- /* Trigger CSS 2.1 ยง 10.6.7 to get a shrink-wrapped height. */
- position: absolute !important;
- top: 0 !important;
- left: 0 !important;
- bottom: auto !important;
- width: 100% !important;
- height: auto !important;
-
- /* Lock down the box enough so we don't get an incrementally
- expanding web view */
- box-sizing: border-box !important;
- margin: 0 !important;
- border: 0 !important;
- padding: 0;
-
- /* Never show scroll bars */
- overflow: hidden;
+ transition: height 0.25s !important;
}
body {
- margin: 0;
+ margin: 12px;
border: 0;
- padding: 12px;
+ padding: 0;
+
+ /* XXX for plain text only? */
overflow-wrap: break-word !important;
}
@@ -61,7 +43,6 @@ blockquote {
padding: 0 8px;
}
-
pre {
white-space: pre-wrap;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]