Bug 1169879 - Use only the critical displayport when computing image visibility. r=tn

This commit is contained in:
Seth Fowler 2015-05-29 22:33:37 -07:00
parent f265a24409
commit 7257d4441a
3 changed files with 20 additions and 1 deletions

View File

@ -1065,6 +1065,13 @@ nsLayoutUtils::GetDisplayPort(nsIContent* aContent, nsRect *aResult)
return GetDisplayPortImpl(aContent, aResult, 1.0f);
}
/* static */ bool
nsLayoutUtils::GetDisplayPortForVisibilityTesting(nsIContent* aContent,
nsRect* aResult)
{
return GetDisplayPortImpl(aContent, aResult, 1.0f);
}
bool
nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent,
nsIPresShell* aPresShell,

View File

@ -165,6 +165,16 @@ public:
*/
static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult = nullptr);
/**
* @return the display port for the given element which should be used for
* visibility testing purposes.
*
* If low-precision buffers are enabled, this is the critical display port;
* otherwise, it's the same display port returned by GetDisplayPort().
*/
static bool GetDisplayPortForVisibilityTesting(nsIContent* aContent,
nsRect* aResult = nullptr);
enum class RepaintMode : uint8_t {
Repaint,
DoNotRepaint

View File

@ -5940,7 +5940,9 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect)
nsIScrollableFrame* scrollFrame = do_QueryFrame(aFrame);
if (scrollFrame) {
nsRect displayPort;
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(aFrame->GetContent(), &displayPort);
bool usingDisplayport =
nsLayoutUtils::GetDisplayPortForVisibilityTesting(aFrame->GetContent(),
&displayPort);
if (usingDisplayport) {
rect = displayPort;
} else {