hexo-theme-linen 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -224,9 +224,12 @@
224
224
  var showTransition =
225
225
  !window.$lazyload || window.$lazyload.showTransition !== false;
226
226
  var clearPlaceholder = function clearPlaceholder() {
227
+ // Keep the placeholder underneath by default to prevent blank frames or flashes
228
+ // caused by asynchronous GPU decoding and rasterization delays.
227
229
  var keepPlaceholder =
228
230
  element.getAttribute("data-hdr-active") === "true" ||
229
- (window.$lazyload && window.$lazyload.keepPlaceholder === true);
231
+ !window.$lazyload ||
232
+ window.$lazyload.keepPlaceholder !== false;
230
233
  if (!keepPlaceholder) {
231
234
  element.children[0].classList.add("loaded");
232
235
  }
@@ -247,6 +250,18 @@
247
250
  return;
248
251
  }
249
252
  revealedSource = source;
253
+
254
+ // If the resource finishes loading while off-screen, skip the opacity
255
+ // transition to prevent deferred animations and visual flashes when
256
+ // the element scrolls into the viewport.
257
+ var rect = element.getBoundingClientRect();
258
+ var inViewport =
259
+ rect.bottom > 0 &&
260
+ rect.top < (window.innerHeight || document.documentElement.clientHeight);
261
+ if (!inViewport) {
262
+ resourceElement.style.transition = "none";
263
+ }
264
+
250
265
  // The inline opacity is already 0 and the inline transition is set
251
266
  // before insertion, so the next frame can reveal without forcing a
252
267
  // synchronous layout for every image.