Commit graph

30 commits

Author SHA1 Message Date
Serhii Tereshchenko
dbfb7f40da client: Support Dark Mode
Refs #714

Co-authored-by: Niels De Graef <nielsdegraef@gmail.com>
2025-06-09 16:25:30 +03:00
mooff
2ef32d2d2d Implement dark mode using color-scheme CSS property 2025-05-31 13:21:09 +03:00
Cédric Bellegarde
40a2c1aec4 client: Always load email once view is mapped
Remove CSS width workaround.

Fix #283 #1205
2023-08-20 21:41:24 +00:00
Michael Gratton
ec3057daf7 ConversationWebView: Fix plain text emails sometimes being too wide
Using `whitespace: pre-wrap` to format plain text email sometimes
causes additional width to be allocated by the plain text blocks that
then does not get used due to the constraints on the HTML element.
The allocated space remains however and hence an un-needed horizontal
scrollbar appears.

Using `break-spaces` instead seems to help since it allows breaks after
a space character, leading to the additional space not otherwise being
allocated.
2020-10-17 15:08:10 +11:00
Michael Gratton
0e783de5bf ui/conversation-web-view.css: Work around oversized email body height
Sometimes when loading an email body, the viewport for the web view
will be set to 0 (when the web view is hidden or not yet laid out in
the widget hierarchy?). When this happens, since the width of the body
is specified as 100vw, the content width is reduced to the absolute
minimum and hence the content height is stretched right out. Then, when
the web view is displayed, the viewport width increases but the extra
whitespace is never reclaimed (scrollHeight never goes down), so the
height of the web view remains way too large, causing large amounts of
whitespace at the end of the email message (i.e. #283).

To work around this, set a min width for the HTML element so the initial
height of the email body isn't too badly wrong.
2020-10-17 13:55:36 +11:00
Michael Gratton
40f97de745 ui/conversation-web-view.css: Clean up HTML/BODY element lockdowns
Use some more obvious CSS to ensure we can get an accurate idea of the
content height for sizing the web view and that the body fits the
web view's width.
2020-10-17 13:55:36 +11:00
Michael Gratton
dedcb65b10 Specify default HTML colours for composer & conversation viewer
Work around for https://bugs.webkit.org/show_bug.cgi?id=202194

Fixes #573
2019-09-25 20:43:35 +10:00
Rafael Fontenelle
2509c5c4f0 Fix misspellings 2019-05-22 20:47:08 +00:00
Michael Gratton
1e3fbdc69a Use doc element's scrollHeight as ClientWebView's preferred height
This seems to be a bit more accurate than the previous calculation.
Force the doc element's border to zero as well to make using
scrollHeight more reliable.
2018-10-14 11:55:46 +11:00
Alex Henrie
698f61e6e5 Print common headers when printing messages 2018-09-26 18:43:46 -06:00
Michael Gratton
00e7834082 Revert "Merge branch 'print-headers' into 'master'"
This reverts merge request !45
2018-09-23 02:18:24 +00:00
Alex Henrie
2b2c587e6c Print common headers when printing messages 2018-09-22 09:48:51 -06:00
Michael James Gratton
77d33d7346 Don't display quote expander buttons when printing a message.
Fixes Bug 795216.

* ui/conversation-web-view.css: Fix syntax error in CSS, make
  geary-button elements display: none for print.
2018-04-13 16:54:57 +10:00
Michael James Gratton
3da72b2f76 Fix message body quote button styling under WebKitGTK 2.20.
* ui/conversation-web-view.css: Replace bogus ">>" with simple descendent
  selector.
2018-04-11 14:01:54 +10:00
Michael James Gratton
dd3d604b6d Tidy up ConversationWebView's CSS a bit. 2017-02-08 00:31:25 +11:00
Michael James Gratton
fdde9b15a1 Prevent messages from setting a broken body height. Fixes Bug 750075.
* ui/conversation-web-view.css: Require body height to remain set to
  CSS's default value.
2017-02-08 00:30:48 +11:00
Michael James Gratton
7f75a7e944 Fix messages with "html { height: 100%; }" set getting 1px-high views.
Partially reverts commit d4e2b84.

* ui/conversation-web-view.css: Reinstate triggering CSS 2.1 §
  10.6.7. for the HTML element.
2017-02-01 00:41:45 +11:00
Michael James Gratton
5ff2d9b908 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.
2017-02-01 00:41:44 +11:00
Michael James Gratton
8864e2b7a7 Work around rendering quote controller buttons, enable expanding quotes.
* ui/conversation-web-view.js (ConversationPageState): Add
  ::updatePreferredHeight method to waitch for and update the web view's
  preferred height when it changes.
  (ConversationPageState::createControllableQuotes): Create quote
  controllers using the DOM so we can easily attach click handlers to
  it. Attach handlers to toggle the hide class and updated the preferred
  height.

* ui/client-web-view.js (PageState): Add ::getPreferredHeight method, use
  that to determine the preferred height of the page.

* ui/conversation-web-view.css: Import GTK+4 Adwaita button CSS to work
  around WebKitGTK+ Bug 166648. Tweak quote style a bit.
2017-02-01 00:41:43 +11:00
Michael James Gratton
b02059795f Remove some obsolete CSS from conversation-web-view.css. 2017-02-01 00:41:43 +11:00
Michael James Gratton
431ebcb35f Re-implement message HTML cleaning in JS in the web extension for WK2.
* ui/conversation-web-view.js: New script, port old HTML cleaning code in
  vala to Javascript as new subclass of PageState. Instantiate that on
  page load.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Load and add new JS script for conversations.

* src/client/web-process/util-conversation.vala (Util.Conversation):
  Remove migrated and obsolete code.

* ui/client-web-view.js (PageState): Allow on-load behaviour to be
  overridden in subclasses.

* ui/CMakeLists.txt: Include new JS script.

* ui/conversation-web-view.css: Chase CSS class name changes.
2017-02-01 00:41:43 +11:00
Michael James Gratton
1d1229b623 Use CID resources to display images for multipart/mixed messages.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Remove ReplacedImage and related code.
  (ConversationMessage::inline_image_replacer): Don't bother loading,
  scaling, rotating and serialising the images, just add them as CID
  resources.

* src/client/components/client-web-view.vala (ClientWebView): Modify the
  cid_resources map contain memory buffers, not files, and update call
  sites.
2017-02-01 00:41:43 +11:00
Michael James Gratton
e0b956b64d Minor GTK and HTML CSS tweaks. 2016-10-04 10:58:17 +11:00
Michael James Gratton
3d1b208327 Fix lack of padding around GMail blockquotes. 2016-10-04 10:58:17 +11:00
Michael James Gratton
5ea4b0a051 Prefix CSS classes in message HTML to avoid collisions with HTML messages.
* ui/conversation-web-view.css: Prefix the names of base Geary-internal
  elements with "geary_" to reduce the odds of them colliding with class
  names in HTML messages. Chase the name changes in classes that generate
  them.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Use constants for class names and
  WebKit.DOMElement::class_list to add/remove them.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b5e7c27c58 Tidy up collapsible quote container style and behaviour.
* src/client/conversation-viewer/conversation-message.vala:
  (ConversationMessage::create_quote_container): Fix unwanted whitespace
  at the top of quote containers by removing newlines from the inner
  HTML used to construct them.
  (ConversationMessage::unset_controllable_quotes): Replace using
  absolute pxiel value for determining whether a quote should be unhidden
  with a percentage of the parent container.

* ui/conversation-web-view.css: Polish and simplify quote container CSS.
2016-10-04 10:58:17 +11:00
Michael James Gratton
18621a2f7f Remove some unused/uneeded message body CSS. 2016-10-04 10:58:17 +11:00
Michael James Gratton
7581f16320 Substantially rework email HTML sanitising and styling.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::clean_html_markup): Ensure all displayed message
  bodies have at least a HTML element, so that the style in
  conversation-web-view.css has something to work on. Load application
  style when sanitising the HTML rather than when the web view has
  loaded.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Just set user style using WebKit.WebSettings,
  don't try to set application CSS, and remove all associated code.

* ui/conversation-web-view.css: Only trigger CSS 2.1 § 10.6.7 on the HTML
  element, so BODY can be styled as normal by email CSS.
2016-10-04 10:58:17 +11:00
Michael James Gratton
dcc5f42eea Tidy up conversation list style. 2016-10-04 10:58:17 +11:00
Michael James Gratton
3dcf3ce7d6 Convert ConversationWebView HML CSS file to a resource, remove theme dir.
* src/client/application/geary-application.vala
  (GearyApplication::read_theme_file): Renamed to ::read_resource, do the
  lookup on a GResource instead of from the file system.
  (GearyApplication::get_ui_file): Remove unused method.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Chase CSS file rename and load method.

* theming/CMakeLists.txt: Removed, no longer needed.

* theming/message-viewer.css: Moved to ui/conversation-web-view.css.

* ui/CMakeLists.txt: Add conversation-web-view.css resource.

* CMakeLists.txt: Remove theming include.

* src/client/application/geary-application.vala :
2016-10-04 10:58:17 +11:00
Renamed from theming/message-viewer.css (Browse further)