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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 57709384..483dc983 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -159,6 +159,7 @@ void init_DocumentWidget(iDocumentWidget *d) {
159 d->isRequestUpdated = iFalse; 159 d->isRequestUpdated = iFalse;
160 d->media = new_ObjectList(); 160 d->media = new_ObjectList();
161 d->doc = new_GmDocument(); 161 d->doc = new_GmDocument();
162 d->initialScrollY = 0;
162 d->scrollY = 0; 163 d->scrollY = 0;
163 d->selecting = iFalse; 164 d->selecting = iFalse;
164 d->selectMark = iNullRange; 165 d->selectMark = iNullRange;
@@ -558,7 +559,7 @@ static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) {
558 const iGmResponse *resp = recent->cachedResponse; 559 const iGmResponse *resp = recent->cachedResponse;
559 d->state = fetching_RequestState; 560 d->state = fetching_RequestState;
560 /* Use the cached response data. */ 561 /* Use the cached response data. */
561 d->scrollY = recent->scrollY; 562 d->scrollY = d->initialScrollY = recent->scrollY;
562 updateTrust_DocumentWidget_(d, resp); 563 updateTrust_DocumentWidget_(d, resp);
563 updateDocument_DocumentWidget_(d, resp); 564 updateDocument_DocumentWidget_(d, resp);
564 d->state = ready_RequestState; 565 d->state = ready_RequestState;
@@ -824,6 +825,11 @@ static void changeTextSize_DocumentWidget_(iDocumentWidget *d, int delta) {
824 postCommandf_App("font.setfactor arg:%d", d->mod.textSizePercent); 825 postCommandf_App("font.setfactor arg:%d", d->mod.textSizePercent);
825} 826}
826 827
828void updateSize_DocumentWidget(iDocumentWidget *d) {
829 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d));
830 updateVisible_DocumentWidget_(d);
831}
832
827static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) { 833static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) {
828 iWidget *w = as_Widget(d); 834 iWidget *w = as_Widget(d);
829 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed")) { 835 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed")) {
@@ -956,6 +962,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
956 return handleMediaCommand_DocumentWidget_(d, cmd); 962 return handleMediaCommand_DocumentWidget_(d, cmd);
957 } 963 }
958 else if (equal_Command(cmd, "document.reload") && document_App() == d) { 964 else if (equal_Command(cmd, "document.reload") && document_App() == d) {
965 d->initialScrollY = d->scrollY;
959 fetch_DocumentWidget_(d); 966 fetch_DocumentWidget_(d);
960 return iTrue; 967 return iTrue;
961 } 968 }