Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scroll performance #202

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions chrome/content/feedview.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ FeedView.prototype = {
_scrolling: null,
// Autoselect timeout ID for clearTimeout
_scrollSelectionTimeout: null,
// Partially delay processing a scroll event to the next animationFrame
_scrollAnimationFrame: null,

// Indicates if a filter paramater is fixed and cannot be toggled by the user.
_fixedUnread: false,
Expand Down Expand Up @@ -418,11 +420,6 @@ FeedView.prototype = {
case 'scroll':
this._autoMarkRead();

if (this.window.pageYOffset > 0)
getElement('feed-view-header').setAttribute('border', true);
else
getElement('feed-view-header').removeAttribute('border');

if (this._suppressSelectionOnNextScroll) {
this._suppressSelectionOnNextScroll = false;
}
Expand All @@ -434,13 +431,26 @@ FeedView.prototype = {
this._scrollSelectionTimeout = setTimeout(callback, 50);
}

if (!this.enoughEntriesPreloaded(MIN_LOADED_WINDOW_HEIGHTS))
if (!this._loading && !this._allEntriesLoaded
&& !this.enoughEntriesPreloaded(MIN_LOADED_WINDOW_HEIGHTS))
this._fillWindow(WINDOW_HEIGHTS_LOAD)
.catch(this._ignoreRefresh);

if (this._scrollAnimationFrame === null) {
this._scrollAnimationFrame = requestAnimationFrame(() => {
if (this.window.pageYOffset > 0)
getElement('feed-view-header').setAttribute('border', true);
else
getElement('feed-view-header').removeAttribute('border');

this._scrollAnimationFrame = null;
});
}
break;

case 'resize':
if (!this.enoughEntriesPreloaded(MIN_LOADED_WINDOW_HEIGHTS))
if (!this._loading && !this._allEntriesLoaded
&& !this.enoughEntriesPreloaded(MIN_LOADED_WINDOW_HEIGHTS))
this._fillWindow(WINDOW_HEIGHTS_LOAD)
.catch(this._ignoreRefresh);
break;
Expand Down
44 changes: 23 additions & 21 deletions defaults/data/feedview.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,32 @@ <h1 class="headline-title"></h1>
<div class="collapse-button" command="collapse"></div>

<div class="full-container-inner">
<header class="header">
<a class="title-link" command="open"></a>
<div class="full-container-inner-border">
<header class="header">
<a class="title-link" command="open"></a>

<div class="controls">
<div class="button bookmark-button" command="star"></div>
<div class="button mark-read-button" command="switchRead"></div>
<div class="button delete-button" command="delete"></div>
<div class="button restore-button" command="restore"></div>
</div>
</header>
<div class="controls">
<div class="button bookmark-button" command="star"></div>
<div class="button mark-read-button" command="switchRead"></div>
<div class="button delete-button" command="delete"></div>
<div class="button restore-button" command="restore"></div>
</div>
</header>

<header class="subheader">
<div class="subheader-left">
<h2 class="feed-name"></h2>
<h2 class="tags"></h2>
</div>
<div class="subheader-right">
<h2 class="authors"></h2>
<time class="date" pubdate></time>
<div class="updated-label"></div>
</div>
</header>
<header class="subheader">
<div class="subheader-left">
<h2 class="feed-name"></h2>
<h2 class="tags"></h2>
</div>
<div class="subheader-right">
<h2 class="authors"></h2>
<time class="date" pubdate></time>
<div class="updated-label"></div>
</div>
</header>

<div class="content"></article>
<div class="content"></div>
</div>
</div>
</div>
</article>
Expand Down
14 changes: 10 additions & 4 deletions defaults/data/full-view.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ article.full {
flex-direction: column;
align-self: stretch;
border: 1px solid #abbfc9;
padding-left: 1px;
background: linear-gradient(to bottom, rgba(229, 244, 255, 1), rgba(229, 244, 255, 0) 35px);
background-clip: padding-box;
}

.full-container-inner-border {
border-left: 1px solid rgba(0,0,0,0);
}

article.selected > .full-container > .full-container-inner {
border-left: 2px solid #3e8fb7;
padding-left: 0;
border-left-color: #3e8fb7;
}

article.selected > .full-container > .full-container-inner > .full-container-inner-border {
border-left-color: #3e8fb7;
}

article.read > .full-container > .full-container-inner {
Expand Down Expand Up @@ -120,4 +126,4 @@ body:not(.multiple-feeds) .feed-name {

article:not(.updated) .updated-label {
display: none;
}
}