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
Родитель 29ba8d4eb1
Коммит 900c174944
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

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

Просмотреть файл

@ -165,6 +165,16 @@ public:
*/ */
static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult = nullptr); 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 { enum class RepaintMode : uint8_t {
Repaint, Repaint,
DoNotRepaint DoNotRepaint

Просмотреть файл

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