Bug 1265591 patch 2 - Rename nsIPresShell::ReconstructStyleData to RestyleForCSSRuleChanges. r?heycam
MozReview-Commit-ID: BU3X0fBEKE3
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -2651,17 +2651,17 @@ nsHTMLDocument::TearingDownEditor(nsIEdi
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
agentSheets.RemoveElement(cache->ContentEditableSheet());
if (oldState == eDesignMode)
agentSheets.RemoveElement(cache->DesignModeSheet());
presShell->SetAgentStyleSheets(agentSheets);
- presShell->ReconstructStyleData();
+ presShell->RestyleForCSSRuleChanges();
}
}
nsresult
nsHTMLDocument::TurnEditingOff()
{
NS_ASSERTION(mEditingState != eOff, "Editing is already off.");
@@ -2815,17 +2815,17 @@ nsHTMLDocument::EditingStateChanged()
// designMode is being turned off (contentEditable is still on).
agentSheets.RemoveElement(cache->DesignModeSheet());
updateState = true;
}
rv = presShell->SetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
- presShell->ReconstructStyleData();
+ presShell->RestyleForCSSRuleChanges();
// Adjust focused element with new style but blur event shouldn't be fired
// until mEditingState is modified with newState.
nsAutoScriptBlocker scriptBlocker;
if (designMode) {
nsCOMPtr<nsPIDOMWindowOuter> focusedWindow;
nsIContent* focusedContent =
nsFocusManager::GetFocusedDescendant(window, false,
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -2872,17 +2872,17 @@ nsHTMLEditor::AddOverrideStyleSheet(cons
// Synchronous loads should ALWAYS return completed
NS_ENSURE_TRUE(sheet, NS_ERROR_NULL_POINTER);
// Add the override style sheet
// (This checks if already exists)
ps->AddOverrideStyleSheet(sheet);
- ps->ReconstructStyleData();
+ ps->RestyleForCSSRuleChanges();
// Save as the last-loaded sheet
mLastOverrideStyleSheetURL = aURL;
//Add URL and style sheet to our lists
return AddNewStyleSheetToList(aURL, sheet);
}
@@ -2917,17 +2917,17 @@ nsHTMLEditor::RemoveOverrideStyleSheet(c
NS_ENSURE_TRUE(sheet, NS_OK); /// Don't fail if sheet not found
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIPresShell> ps = GetPresShell();
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
ps->RemoveOverrideStyleSheet(sheet);
- ps->ReconstructStyleData();
+ ps->RestyleForCSSRuleChanges();
// Remove it from our internal list
return rv;
}
NS_IMETHODIMP
nsHTMLEditor::EnableStyleSheet(const nsAString &aURL, bool aEnable)
{
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -362,17 +362,17 @@ public:
* all style data for a given pres shell without necessarily reconstructing
* all of the frames. This will not reconstruct style synchronously; if
* you need to do that, call FlushPendingNotifications to flush out style
* reresolves.
* // XXXbz why do we have this on the interface anyway? The only consumer
* is calling AddOverrideStyleSheet/RemoveOverrideStyleSheet, and I think
* those should just handle reconstructing style data...
*/
- void ReconstructStyleData();
+ void RestyleForCSSRuleChanges();
/**
* Update the style set somehow to take into account changed prefs which
* affect document styling.
*/
virtual void UpdatePreferenceStyles() = 0;
/**
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1345,17 +1345,17 @@ PresShell::MakeZombie()
CancelAllPendingReflows();
}
void
nsIPresShell::SetAuthorStyleDisabled(bool aStyleDisabled)
{
if (aStyleDisabled != mStyleSet->GetAuthorStyleDisabled()) {
mStyleSet->SetAuthorStyleDisabled(aStyleDisabled);
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(mDocument,
"author-style-disabled-changed",
nullptr);
}
@@ -1454,33 +1454,33 @@ PresShell::AddUserSheet(nsISupports* aSh
// Now iterate backwards, so that the order of userSheets will be the same as
// the order of sheets from it in the style set.
for (StyleSheetHandle sheet : Reversed(userSheets)) {
mStyleSet->PrependStyleSheet(SheetType::User, sheet);
}
mStyleSet->EndUpdate();
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
}
void
PresShell::AddAgentSheet(nsISupports* aSheet)
{
// Make sure this does what nsDocumentViewer::CreateStyleSet does
// wrt ordering.
// XXXheycam This needs to work with ServoStyleSheets too.
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
if (!sheet) {
NS_ERROR("stylo: AddAgentSheet needs to support ServoStyleSheets");
return;
}
mStyleSet->AppendStyleSheet(SheetType::Agent, sheet);
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
}
void
PresShell::AddAuthorSheet(nsISupports* aSheet)
{
// XXXheycam This needs to work with ServoStyleSheets too.
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
if (!sheet) {
@@ -1493,30 +1493,30 @@ PresShell::AddAuthorSheet(nsISupports* a
StyleSheetHandle firstAuthorSheet =
mDocument->GetFirstAdditionalAuthorSheet();
if (firstAuthorSheet) {
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet, firstAuthorSheet);
} else {
mStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
}
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
}
void
PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet)
{
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
if (!sheet) {
NS_ERROR("stylo: RemoveSheet needs to support ServoStyleSheets");
return;
}
mStyleSet->RemoveStyleSheet(aType, sheet);
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
}
NS_IMETHODIMP
PresShell::SetDisplaySelection(int16_t aToggle)
{
mSelection->SetDisplaySelection(aToggle);
return NS_OK;
}
@@ -2400,17 +2400,17 @@ PresShell::EndUpdate(nsIDocument *aDocum
#ifdef DEBUG
NS_PRECONDITION(0 != mUpdateCount, "too many EndUpdate's");
--mUpdateCount;
#endif
if (aUpdateType & UPDATE_STYLE) {
mStyleSet->EndUpdate();
if (mStylesHaveChanged || !mChangedScopeStyleRoots.IsEmpty())
- ReconstructStyleData();
+ RestyleForCSSRuleChanges();
}
mFrameConstructor->EndUpdate();
}
void
PresShell::RestoreRootScrollPosition()
{
@@ -4430,17 +4430,17 @@ PresShell::ReconstructFrames(void)
nsresult rv = mFrameConstructor->ReconstructDocElementHierarchy();
VERIFY_STYLE_TREE;
mFrameConstructor->EndUpdate();
return rv;
}
void
-nsIPresShell::ReconstructStyleData()
+nsIPresShell::RestyleForCSSRuleChanges()
{
AutoTArray<RefPtr<mozilla::dom::Element>,1> scopeRoots;
mChangedScopeStyleRoots.SwapElements(scopeRoots);
if (mStylesHaveChanged) {
// If we need to restyle everything, no need to restyle individual
// scoped style roots.
scopeRoots.Clear();
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -3214,17 +3214,17 @@ nsCSSRuleProcessor::ClearRuleCascades()
// record their invalidity so we can assert if we try to use them.
if (!mMustGatherDocumentRules) {
mDocumentRulesAndCacheKeyValid = false;
}
#endif
// We rely on our caller (perhaps indirectly) to do something that
// will rebuild style data and the user font set (either
- // nsIPresShell::ReconstructStyleData or
+ // nsIPresShell::RestyleForCSSRuleChanges or
// nsPresContext::RebuildAllStyleData).
RuleCascadeData *data = mRuleCascades;
mRuleCascades = nullptr;
while (data) {
RuleCascadeData *next = data->mNext;
delete data;
data = next;
}