Hi,
After loading a web page, I want to get preferred dimension and resize
window to fit it for getting a snapshot of web page.
I do this to get preferred dimension:
// ... Get some variables.
nsresult rv = presShell->ResizeReflow(prefWidth,
NS_UNCONSTRAINEDSIZE);
NS_ENSURE_SUCCESS(rv, false);
PRInt32 width, height;
nsRect shellArea = presContext->GetVisibleArea();
NS_ENSURE_TRUE(shellArea.width != NS_UNCONSTRAINEDSIZE &&
shellArea.height !=
NS_UNCONSTRAINEDSIZE,
false);
width = presContext->AppUnitsToDevPixels(shellArea.width);
height = presContext->AppUnitsToDevPixels(shellArea.height);
preferredWidth = width + 1;
preferredHeight = height;
This works great but I found it will cause the snapshot of
google.com.tw with scrollbar.
Look like this:
http://mercurius.f-snet.com/google-1.png
I try to resize window width to 1024, but it will become:
http://mercurius.f-snet.com/google-2.png
It still has scrollbar.
I found that after I call presShell->ResizeReflow(prefWidth,
NS_UNCONSTRAINEDSIZE);
That scrollbar will appear even I resize the window.
How can I get preferred dimension without such sub effect?
Thank you very much.
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding