Bug 1240326 - Part 1: Add lazyWidth and lazyHeight properties to frame loaders. r=billm

MozReview-Commit-ID: 6uEcjS10KCW

--HG--
extra : transplant_source : 9%A0I%8Dl%FB%7EQK%8C%E3k%8F%15W%BCA%12p%1D
This commit is contained in:
Kris Maglione 2016-04-07 17:04:57 -07:00
Родитель 86ae6362c9
Коммит 78e77cfa2b
3 изменённых файлов: 46 добавлений и 0 удалений

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

@ -2280,6 +2280,7 @@ nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
ScreenIntSize size = aIFrame->GetSubdocumentSize();
nsIntRect dimensions;
NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), NS_ERROR_FAILURE);
mLazySize = size;
mRemoteBrowser->UpdateDimensions(dimensions, size);
}
return NS_OK;
@ -2310,11 +2311,38 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
}
ScreenIntSize size = aIFrame->GetSubdocumentSize();
mLazySize = size;
baseWindow->SetPositionAndSize(x, y, size.width, size.height, false);
}
}
NS_IMETHODIMP
nsFrameLoader::GetLazyWidth(uint32_t* aLazyWidth)
{
*aLazyWidth = mLazySize.width;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyWidth = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyWidth);
}
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::GetLazyHeight(uint32_t* aLazyHeight)
{
*aLazyHeight = mLazySize.height;
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
if (frame) {
*aLazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(*aLazyHeight);
}
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::GetEventMode(uint32_t* aEventMode)
{

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

@ -375,6 +375,9 @@ private:
// forwards some input events to out-of-process content.
uint32_t mEventMode;
// Holds the last known size of the frame.
mozilla::ScreenIntSize mLazySize;
bool mIsPrerendered : 1;
bool mDepthTooGreat : 1;
bool mIsTopLevelContent : 1;

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

@ -208,6 +208,21 @@ interface nsIFrameLoader : nsISupports
*/
readonly attribute boolean ownerIsWidget;
/**
* The last known width of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
readonly attribute unsigned long lazyWidth;
/**
* The last known height of the frame. Reading this property will not trigger
* a reflow, and therefore may not reflect the current state of things. It
* should only be used in asynchronous APIs where values are not guaranteed
* to be up-to-date when received.
*/
readonly attribute unsigned long lazyHeight;
};
%{C++