diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 30 | ||||
-rw-r--r-- | src/ui/documentwidget.h | 2 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 1 |
3 files changed, 8 insertions, 25 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 | } |
diff --git a/src/ui/documentwidget.h b/src/ui/documentwidget.h index 1405f19d..1bee8351 100644 --- a/src/ui/documentwidget.h +++ b/src/ui/documentwidget.h | |||
@@ -50,7 +50,6 @@ int documentWidth_DocumentWidget (const iDocumentWidget *); | |||
50 | 50 | ||
51 | enum iDocumentWidgetSetUrlFlags { | 51 | enum iDocumentWidgetSetUrlFlags { |
52 | useCachedContentIfAvailable_DocumentWidgetSetUrlFlag = iBit(1), | 52 | useCachedContentIfAvailable_DocumentWidgetSetUrlFlag = iBit(1), |
53 | openedFromSidebar_DocumentWidgetSetUrlFlag = iBit(2), | ||
54 | }; | 53 | }; |
55 | 54 | ||
56 | void setOrigin_DocumentWidget (iDocumentWidget *, const iDocumentWidget *other); | 55 | void setOrigin_DocumentWidget (iDocumentWidget *, const iDocumentWidget *other); |
@@ -60,7 +59,6 @@ void setUrlAndSource_DocumentWidget (iDocumentWidget *, const iString *url, | |||
60 | void setInitialScroll_DocumentWidget (iDocumentWidget *, float normScrollY); /* set after content received */ | 59 | void setInitialScroll_DocumentWidget (iDocumentWidget *, float normScrollY); /* set after content received */ |
61 | void setRedirectCount_DocumentWidget (iDocumentWidget *, int count); | 60 | void setRedirectCount_DocumentWidget (iDocumentWidget *, int count); |
62 | void setSource_DocumentWidget (iDocumentWidget *, const iString *sourceText); | 61 | void setSource_DocumentWidget (iDocumentWidget *, const iString *sourceText); |
63 | void setOpenedFromSidebar_DocumentWidget(iDocumentWidget *, iBool fromSidebar); | ||
64 | 62 | ||
65 | void takeRequest_DocumentWidget (iDocumentWidget *, iGmRequest *finishedRequest); /* ownership given */ | 63 | void takeRequest_DocumentWidget (iDocumentWidget *, iGmRequest *finishedRequest); /* ownership given */ |
66 | 64 | ||
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 4b4968a3..fe8ec939 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -965,7 +965,6 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, iSidebarItem *item, si | |||
965 | const iGmHeading *head = constAt_Array(headings_GmDocument(doc), item->id); | 965 | const iGmHeading *head = constAt_Array(headings_GmDocument(doc), item->id); |
966 | postCommandf_App("document.goto loc:%p", head->text.start); | 966 | postCommandf_App("document.goto loc:%p", head->text.start); |
967 | dismissPortraitPhoneSidebars_Root(as_Widget(d)->root); | 967 | dismissPortraitPhoneSidebars_Root(as_Widget(d)->root); |
968 | setOpenedFromSidebar_DocumentWidget(document_App(), iTrue); | ||
969 | } | 968 | } |
970 | break; | 969 | break; |
971 | } | 970 | } |