diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-02-13 13:57:35 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-02-13 12:32:26 +0100 |
| commit | 19ac43503568ebc7fe4721f84292a11bbf7c2c2c (patch) | |
| tree | 4feaa078c614476ed0a4165da6eab5a1a1ca39bb /src/browsertab.cpp | |
| parent | 496ea48de41e6c637c9fb3582216dbd9d8ee55c7 (diff) | |
Adds per-style pref for text width
Diffstat (limited to 'src/browsertab.cpp')
| -rw-r--r-- | src/browsertab.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp index 1455ea8..dfcf517 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -730,6 +730,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime) this->ui->text_browser->setDocument(document.get()); this->current_document = std::move(document); + this->current_style = std::move(doc_style); this->updatePageMargins(); this->needs_rerender = false; @@ -1315,11 +1316,13 @@ void BrowserTab::setUiDensity(UIDensity density) void BrowserTab::updatePageMargins() { - if (!this->current_document) return; + if (!this->current_document || !this->current_style.text_width_enabled) + return; QTextFrame *root = this->current_document->rootFrame(); QTextFrameFormat fmt = root->frameFormat(); - int margin = std::max((this->width() - 900) / 2, 30); + int margin = std::max((this->width() - this->current_style.text_width) / 2, + this->current_style.margin); fmt.setLeftMargin(margin); fmt.setRightMargin(margin); root->setFrameFormat(fmt); |
