Add nsPresContext::EnsureSafeToHandOutCSSRules. (Bug 536379) r=bzbarsky

This commit is contained in:
L. David Baron 2009-12-31 10:56:33 -05:00
parent 305a488187
commit 005c3d8297
2 changed files with 25 additions and 0 deletions

View File

@ -1973,6 +1973,25 @@ nsPresContext::UserFontSetUpdated()
PostRebuildAllStyleDataEvent(NS_STYLE_HINT_REFLOW);
}
PRBool
nsPresContext::EnsureSafeToHandOutCSSRules()
{
nsCSSStyleSheet::EnsureUniqueInnerResult res =
mShell->StyleSet()->EnsureUniqueInnerOnCSSSheets();
if (res == nsCSSStyleSheet::eUniqueInner_AlreadyUnique) {
// Nothing to do.
return PR_TRUE;
}
if (res == nsCSSStyleSheet::eUniqueInner_CloneFailed) {
return PR_FALSE;
}
NS_ABORT_IF_FALSE(res == nsCSSStyleSheet::eUniqueInner_ClonedInner,
"unexpected result");
RebuildAllStyleData(nsChangeHint(0));
return PR_TRUE;
}
void
nsPresContext::FireDOMPaintEvent()
{

View File

@ -824,6 +824,12 @@ public:
// user font set is changed and fonts become unavailable).
void UserFontSetUpdated();
// Ensure that it is safe to hand out CSS rules outside the layout
// engine by ensuring that all CSS style sheets have unique inners
// and, if necessary, synchronously rebuilding all style data.
// Returns true on success and false on failure (not safe).
PRBool EnsureSafeToHandOutCSSRules();
PRBool MayHavePaintEventListener();
void NotifyInvalidation(const nsRect& aRect, PRUint32 aFlags);
void FireDOMPaintEvent();