Skip to content

Commit

Permalink
Merge pull request #328 from hzbhzb/main
Browse files Browse the repository at this point in the history
fix: setting lazy loading for an image didn't work.
  • Loading branch information
andycall committed May 8, 2023
2 parents e30edbb + 89bc04c commit 2eb23c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bridge/core/dart_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ webf::DartMethodPointer::DartMethodPointer(const uint64_t* dart_methods, int32_t
create_binding_object = reinterpret_cast<CreateBindingObject>(dart_methods[i++]);

#if ENABLE_PROFILE
dartMethodPointer->getPerformanceEntries = reinterpret_cast<GetPerformanceEntries>(dart_methods[i++]);
getPerformanceEntries = reinterpret_cast<GetPerformanceEntries>(dart_methods[i++]);
#else
i++;
#endif
Expand All @@ -33,4 +33,4 @@ webf::DartMethodPointer::DartMethodPointer(const uint64_t* dart_methods, int32_t

assert_m(i == dart_methods_length, "Dart native methods count is not equal with C++ side method registrations.");
}
} // namespace webf
} // namespace webf
4 changes: 2 additions & 2 deletions webf/lib/src/html/img.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ class ImageElement extends Element {
if (entry.isIntersecting) {
// Once appear remove the listener
_removeIntersectionChangeListener();
_isInLazyRendering = false;
await _decode();
_loadImage();
_listenToStream();
_isInLazyRendering = false;
}
}

Expand Down Expand Up @@ -402,7 +402,7 @@ class ImageElement extends Element {
// If imageElement has property size or width/height property on [renderStyle],
// The image will be encoded into a small size for better rasterization performance.
Future<void> _decode({bool updateImageProvider = false}) async {
if (_isImageEncoding) return;
if (_isImageEncoding || _isInLazyLoading) return;
Completer completer = Completer();

// Make sure all style and properties are ready before decode begins.
Expand Down

0 comments on commit 2eb23c5

Please sign in to comment.