diff options
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 4af3dd72..3bd9f059 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -220,13 +220,12 @@ enum iDocumentWidgetFlag { | |||
220 | movingSelectMarkEnd_DocumentWidgetFlag = iBit(11), | 220 | movingSelectMarkEnd_DocumentWidgetFlag = iBit(11), |
221 | otherRootByDefault_DocumentWidgetFlag = iBit(12), /* links open to other root by default */ | 221 | otherRootByDefault_DocumentWidgetFlag = iBit(12), /* links open to other root by default */ |
222 | urlChanged_DocumentWidgetFlag = iBit(13), | 222 | urlChanged_DocumentWidgetFlag = iBit(13), |
223 | openedFromSidebar_DocumentWidgetFlag = iBit(14), | 223 | drawDownloadCounter_DocumentWidgetFlag = iBit(14), |
224 | drawDownloadCounter_DocumentWidgetFlag = iBit(15), | 224 | fromCache_DocumentWidgetFlag = iBit(15), /* don't write anything to cache */ |
225 | fromCache_DocumentWidgetFlag = iBit(16), /* don't write anything to cache */ | 225 | animationPlaceholder_DocumentWidgetFlag = iBit(16), /* avoid slow operations */ |
226 | animationPlaceholder_DocumentWidgetFlag = iBit(17), /* avoid slow operations */ | 226 | invalidationPending_DocumentWidgetFlag = iBit(17), /* invalidate as soon as convenient */ |
227 | invalidationPending_DocumentWidgetFlag = iBit(18), /* invalidate as soon as convenient */ | 227 | leftWheelSwipe_DocumentWidgetFlag = iBit(18), /* swipe state flags are used on desktop */ |
228 | leftWheelSwipe_DocumentWidgetFlag = iBit(19), /* swipe state flags are used on desktop */ | 228 | rightWheelSwipe_DocumentWidgetFlag = iBit(19), |
229 | rightWheelSwipe_DocumentWidgetFlag = iBit(20), | ||
230 | eitherWheelSwipe_DocumentWidgetFlag = leftWheelSwipe_DocumentWidgetFlag | | 229 | eitherWheelSwipe_DocumentWidgetFlag = leftWheelSwipe_DocumentWidgetFlag | |
231 | rightWheelSwipe_DocumentWidgetFlag, | 230 | rightWheelSwipe_DocumentWidgetFlag, |
232 | }; | 231 | }; |
@@ -2144,9 +2143,7 @@ static void documentWasChanged_DocumentWidget_(iDocumentWidget *d) { | |||
2144 | } | 2143 | } |
2145 | showOrHidePinningIndicator_DocumentWidget_(d); | 2144 | showOrHidePinningIndicator_DocumentWidget_(d); |
2146 | if (~d->flags & fromCache_DocumentWidgetFlag) { | 2145 | if (~d->flags & fromCache_DocumentWidgetFlag) { |
2147 | setCachedDocument_History(d->mod.history, | 2146 | setCachedDocument_History(d->mod.history, d->view.doc /* keeps a ref */); |
2148 | d->view.doc, /* keeps a ref */ | ||
2149 | (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); | ||
2150 | } | 2147 | } |
2151 | } | 2148 | } |
2152 | 2149 | ||
@@ -2905,14 +2902,11 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n | |||
2905 | static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) { | 2902 | static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) { |
2906 | const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history); | 2903 | const iRecentUrl *recent = constMostRecentUrl_History(d->mod.history); |
2907 | if (recent && recent->cachedResponse && equalCase_String(&recent->url, d->mod.url)) { | 2904 | if (recent && recent->cachedResponse && equalCase_String(&recent->url, d->mod.url)) { |
2908 | iChangeFlags(d->flags, | ||
2909 | openedFromSidebar_DocumentWidgetFlag, | ||
2910 | recent->flags.openedFromSidebar); | ||
2911 | updateFromCachedResponse_DocumentWidget_( | 2905 | updateFromCachedResponse_DocumentWidget_( |
2912 | d, recent->normScrollY, recent->cachedResponse, recent->cachedDoc); | 2906 | d, recent->normScrollY, recent->cachedResponse, recent->cachedDoc); |
2913 | if (!recent->cachedDoc) { | 2907 | if (!recent->cachedDoc) { |
2914 | /* We have a cached copy now. */ | 2908 | /* We have a cached copy now. */ |
2915 | setCachedDocument_History(d->mod.history, d->view.doc, iFalse); | 2909 | setCachedDocument_History(d->mod.history, d->view.doc); |
2916 | } | 2910 | } |
2917 | return iTrue; | 2911 | return iTrue; |
2918 | } | 2912 | } |
@@ -5617,8 +5611,6 @@ void deserializeState_DocumentWidget(iDocumentWidget *d, iStream *ins) { | |||
5617 | } | 5611 | } |
5618 | 5612 | ||
5619 | void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setUrlFlags) { | 5613 | void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setUrlFlags) { |
5620 | iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, | ||
5621 | (setUrlFlags & openedFromSidebar_DocumentWidgetSetUrlFlag) != 0); | ||
5622 | const iBool allowCache = (setUrlFlags & useCachedContentIfAvailable_DocumentWidgetSetUrlFlag) != 0; | 5614 | const iBool allowCache = (setUrlFlags & useCachedContentIfAvailable_DocumentWidgetSetUrlFlag) != 0; |
5623 | setLinkNumberMode_DocumentWidget_(d, iFalse); | 5615 | setLinkNumberMode_DocumentWidget_(d, iFalse); |
5624 | setUrl_DocumentWidget_(d, urlFragmentStripped_String(url)); | 5616 | setUrl_DocumentWidget_(d, urlFragmentStripped_String(url)); |
@@ -5631,7 +5623,6 @@ void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setU | |||
5631 | 5623 | ||
5632 | void setUrlAndSource_DocumentWidget(iDocumentWidget *d, const iString *url, const iString *mime, | 5624 | void setUrlAndSource_DocumentWidget(iDocumentWidget *d, const iString *url, const iString *mime, |
5633 | const iBlock *source) { | 5625 | const iBlock *source) { |
5634 | d->flags &= ~openedFromSidebar_DocumentWidgetFlag; | ||
5635 | setLinkNumberMode_DocumentWidget_(d, iFalse); | 5626 | setLinkNumberMode_DocumentWidget_(d, iFalse); |
5636 | setUrl_DocumentWidget_(d, url); | 5627 | setUrl_DocumentWidget_(d, url); |
5637 | parseUser_DocumentWidget_(d); | 5628 | parseUser_DocumentWidget_(d); |
@@ -5673,11 +5664,6 @@ void setRedirectCount_DocumentWidget(iDocumentWidget *d, int count) { | |||
5673 | d->redirectCount = count; | 5664 | d->redirectCount = count; |
5674 | } | 5665 | } |
5675 | 5666 | ||
5676 | void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *d, iBool fromSidebar) { | ||
5677 | iChangeFlags(d->flags, openedFromSidebar_DocumentWidgetFlag, fromSidebar); | ||
5678 | // setCachedDocument_History(d->mod.history, d->doc, fromSidebar); | ||
5679 | } | ||
5680 | |||
5681 | iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { | 5667 | iBool isRequestOngoing_DocumentWidget(const iDocumentWidget *d) { |
5682 | return d->request != NULL; | 5668 | return d->request != NULL; |
5683 | } | 5669 | } |