summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 17111ed0..75da67a1 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -342,6 +342,7 @@ void init_DocumentWidget(iDocumentWidget *d) {
342 d->media = new_ObjectList(); 342 d->media = new_ObjectList();
343 d->doc = new_GmDocument(); 343 d->doc = new_GmDocument();
344 d->banner = new_Banner(); 344 d->banner = new_Banner();
345 setOwner_Banner(d->banner, d);
345 d->redirectCount = 0; 346 d->redirectCount = 0;
346 d->ordinalBase = 0; 347 d->ordinalBase = 0;
347 d->initNormScrollY = 0; 348 d->initNormScrollY = 0;
@@ -540,25 +541,10 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) {
540 if (docSize.y < rect.size.y) { 541 if (docSize.y < rect.size.y) {
541 /* Center vertically if short. There is one empty paragraph line's worth of margin 542 /* Center vertically if short. There is one empty paragraph line's worth of margin
542 between the banner and the page contents. */ 543 between the banner and the page contents. */
543// const int bannerHeight = 0; //banner ? height_Rect(banner->visBounds) : 0;
544#if 0
545 int offset = iMax(0, (rect.size.y + margin - size_GmDocument(d->doc).y
546 //- lineHeight_Text(paragraph_FontId)
547 ) / 2 - height_Banner(d->banner)
548 //-
549 //documentTopPad_DocumentWidget_(d)
550 );
551#endif
552 int offset = iMax(0, height_Rect(bounds) / 2 544 int offset = iMax(0, height_Rect(bounds) / 2
553// - (isEmpty_Banner(d->banner) ? lineHeight_Text(paragraph_FontId) / 2 : 0)
554 - documentTopPad_DocumentWidget_(d) 545 - documentTopPad_DocumentWidget_(d)
555// + lineHeight_Text(paragraph_FontId) / 2
556// - isEmpty_Banner(d->banner) ?
557 - height_Banner(d->banner) 546 - height_Banner(d->banner)
558 - size_GmDocument(d->doc).y / 2 547 - size_GmDocument(d->doc).y / 2);
559 );
560 //(//documentTopPad_DocumentWidget_(d) +
561 //size_GmDocument(d->doc).y) / 2);
562 rect.pos.y = top_Rect(bounds) + offset; 548 rect.pos.y = top_Rect(bounds) + offset;
563 rect.size.y = docSize.y; 549 rect.size.y = docSize.y;
564 wasCentered = iTrue; 550 wasCentered = iTrue;
@@ -594,9 +580,6 @@ static iInt2 documentPos_DocumentWidget_(const iDocumentWidget *d, iInt2 pos) {
594} 580}
595 581
596static iRangei visibleRange_DocumentWidget_(const iDocumentWidget *d) { 582static iRangei visibleRange_DocumentWidget_(const iDocumentWidget *d) {
597// const int margin = -documentTopPad_DocumentWidget_(d) +
598// d->pageMargin * gap_UI;
599 //const int top = -viewPos_DocumentWidget_(d) - margin;
600 int top = pos_SmoothScroll(&d->scrollY) - height_Banner(d->banner) - documentTopPad_DocumentWidget_(d); 583 int top = pos_SmoothScroll(&d->scrollY) - height_Banner(d->banner) - documentTopPad_DocumentWidget_(d);
601 if (isEmpty_Banner(d->banner)) { 584 if (isEmpty_Banner(d->banner)) {
602 /* Top padding is not collapsed. */ 585 /* Top padding is not collapsed. */
@@ -3939,6 +3922,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
3939 if (processMediaEvents_DocumentWidget_(d, ev)) { 3922 if (processMediaEvents_DocumentWidget_(d, ev)) {
3940 return iTrue; 3923 return iTrue;
3941 } 3924 }
3925 if (processEvent_Banner(d->banner, ev)) {
3926 return iTrue;
3927 }
3942 /* The left mouse button. */ 3928 /* The left mouse button. */
3943 switch (processEvent_Click(&d->click, ev)) { 3929 switch (processEvent_Click(&d->click, ev)) {
3944 case started_ClickResult: 3930 case started_ClickResult:
@@ -4191,21 +4177,6 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
4191 d->selectMark = iNullRange; 4177 d->selectMark = iNullRange;
4192 refresh_Widget(w); 4178 refresh_Widget(w);
4193 } 4179 }
4194#if 0
4195 /* Clicking on the top/side banner navigates to site root. */
4196 const iRect banRect = siteBannerRect_DocumentWidget_(d);
4197 if (contains_Rect(banRect, pos_Click(&d->click))) {
4198 /* Clicking on a warning? */
4199 if (bannerType_DocumentWidget_(d) == certificateWarning_GmDocumentBanner &&
4200 pos_Click(&d->click).y - top_Rect(banRect) >
4201 lineHeight_Text(banner_FontId) * 2) {
4202 postCommand_Widget(d, "document.info");
4203 }
4204 else {
4205 postCommand_Widget(d, "navigate.root");
4206 }
4207 }
4208#endif
4209 } 4180 }
4210 return iTrue; 4181 return iTrue;
4211 case aborted_ClickResult: 4182 case aborted_ClickResult: