Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1363361 - Add ability to dirty root frame from nsIDOMWindowUtils.…
Browse files Browse the repository at this point in the history
… r=dholbert

MozReview-Commit-ID: Jy6PICTkq4l
  • Loading branch information
mikeconley committed Jun 29, 2017
1 parent b8cf996 commit c2d79f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4441,6 +4441,26 @@ nsDOMWindowUtils::GetDirectionFromText(const nsAString& aString, int32_t* aRetva
return NS_OK;
}

NS_IMETHODIMP
nsDOMWindowUtils::EnsureDirtyRootFrame()
{
nsIDocument* doc = GetDocument();
nsIPresShell* presShell = doc ? doc->GetShell() : nullptr;

if (!presShell) {
return NS_ERROR_FAILURE;
}

nsIFrame* frame = presShell->GetRootFrame();
if (!frame) {
return NS_ERROR_FAILURE;
}

presShell->FrameNeedsReflow(frame, nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
return NS_OK;
}

NS_IMETHODIMP
nsDOMWindowUtils::GetIsStyledByServo(bool* aStyledByServo)
{
Expand Down
8 changes: 8 additions & 0 deletions dom/interfaces/base/nsIDOMWindowUtils.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,14 @@ interface nsIDOMWindowUtils : nsISupports {
*/
long getDirectionFromText(in AString aString);

/**
* Calls FrameNeedsReflow on that root frame so that a layout flush
* will be necessary.
*
* This should only be used for testing.
*/
void ensureDirtyRootFrame();

/**
* Whether the current document is styled by Servo's style engine.
*
Expand Down

0 comments on commit c2d79f7

Please sign in to comment.