summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/documentwidget.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 6ec76c0a..e9753fec 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -327,14 +327,18 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) {
327 rect.pos.x = mid_Rect(bounds).x - rect.size.x / 2; 327 rect.pos.x = mid_Rect(bounds).x - rect.size.x / 2;
328 rect.pos.y = top_Rect(bounds); 328 rect.pos.y = top_Rect(bounds);
329 rect.size.y = height_Rect(bounds) - margin; 329 rect.size.y = height_Rect(bounds) - margin;
330 if (!hasSiteBanner_GmDocument(d->doc)) { 330 const iGmRun *banner = siteBanner_GmDocument(d->doc);
331 if (!banner) {
331 rect.pos.y += margin; 332 rect.pos.y += margin;
332 rect.size.y -= margin; 333 rect.size.y -= margin;
333 } 334 }
334 const iInt2 docSize = size_GmDocument(d->doc); 335 const iInt2 docSize = size_GmDocument(d->doc);
335 if (docSize.y < rect.size.y) { 336 if (docSize.y < rect.size.y) {
336 /* Center vertically if short. */ 337 /* Center vertically if short. There is one empty paragraph line's worth of margin
337 int offset = (rect.size.y - docSize.y) / 2; 338 between the banner and the page contents. */
339 const int bannerHeight = banner ? height_Rect(banner->visBounds) : 0;
340 int offset = iMax(0, (rect.size.y + margin - docSize.y - bannerHeight -
341 lineHeight_Text(paragraph_FontId)) / 2);
338 rect.pos.y += offset; 342 rect.pos.y += offset;
339 rect.size.y = docSize.y; 343 rect.size.y = docSize.y;
340 } 344 }