kooloveme / thtmlviewer

Automatically exported from code.google.com/p/thtmlviewer
Other
0 stars 0 forks source link

OnBitmapRequest's Result seems to be discarded #296

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which steps will reproduce the problem?
1. Display some simple Webpage containing an image
2. Use OnBitmapRequest to supply the image to the Component

What is the expected output? What do you see instead?
Expected: the image get's shown in the component
Instead: an "Empty Image"-Icon is shown

Which version of the product are you using? Which compiler version are you
using? On which operating system?
Version HtmlViewer114-r418, Lazarus 1.0.8 on Win 7 x64.

The Problem seems to be sitting in HtmlSubs-Unit, providing it's not the 
excpected behaviour. Following Lines 8154, the code is:
      else if Assigned(GetBitmap) or Assigned(GetImage) then
      begin
        GetTheBitmap;
        GetTheStream;
      end     

GetTheBitmap successfully loads the image, GetTheStream doesn't (OnImageRequest 
is not set - the function then defaults to LoadImageFromFile, which also fails 
of course and returns nil).

Fix (HtmlSubs.pas, Line 8154):
      else if Assigned(GetBitmap) or Assigned(GetImage) then
      begin
        GetTheBitmap;
        if not Assigned(Result) then GetTheStream;
      end
      else
        Result := LoadImageFromFile(TheOwner.HtmlExpandFilename(BMName), Transparent, AMask);  

Original issue reported on code.google.com by googleco...@21347.de on 20 Aug 2013 at 8:47

GoogleCodeExporter commented 9 years ago
Thanks for spotting this issue.

It is not intended behaviour.

Original comment by OrphanCat on 2 Sep 2013 at 6:18

GoogleCodeExporter commented 9 years ago
r434 fixes this issue.

Original comment by OrphanCat on 2 Sep 2013 at 6:55