Hi there,
(well, I'm not quite sure if this is the right mailing list, but
probably you can help me out anyway).
In my embedding-mozilla app, I'm resizing the images in a web page using
imgl* interfaces (at modules/libpr0n/src/imgContainer.cpp) instead of
setting the style attribute directly in the DOM tree (the former much
faster, btw). Following is a quoted code used for that:
(...) // zooming according to the current "text scale"
DOMWindow->GetTextZoom(&curr_zoom);
(...) // getting a nodelist within all images
(...) resizing each one
for (bla ; bla ; bla) {
nsCOMPtr<nsIDOMNode> node;
nodeList->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIDOMHTMLImageElement> img;
img = do_QueryInterface(node);
nsCOMPtr<imgIContainer> imgContainer;
nsCOMPtr<nsIImageLoadingContent> imageLoader =
do_QueryInterface(img);
if (imageLoader) {
nsCOMPtr<imgIRequest> imgRequest;
nsresult rv =
imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
getter_AddRefs(imgRequest));
if (!imgRequest) {
printf ("Resizing fails :(. It can't get
imgRequest obj\n");
return ;
}
rv = imgRequest->GetImage(getter_AddRefs(imgContainer));
if (imgContainer) {
imgContainer->GetHeight(&height);
imgContainer->GetWidth(&width);
width = (PRInt32) ( width * relative_scale);
height = (PRInt32) ( height * relative_scale);
} else printf ("Resizing fails :(. It can't get
imgContainer obj\n");
} else printf ("Resizing troubles. It won't work.\n !");
// THIS COULD BE THE PROBLEM ... The image size is changed but
not its DOM value :s
img->SetHeight(height);
img->SetWidth(width);
} // end loop
Ok, I do get them resized at the first time, but if I try resizing again
the same web page, when I try to get the new sizes of each images ( to
apply the resizing scale) I've noticed they have the same value as
before the first resize (just their visual have changed). It seems like
the setHeight and setWidth do not set the value properly). Am I missing
something ?
Antonio Gomes
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout