mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Bug 1290335: Hoist frame-construction logic in RestyleManager to static members in RestyleManagerBase. r=heycam
MozReview-Commit-ID: BqywJXZ0CYU
This commit is contained in:
parent
6973c87a4e
commit
95abaaa872
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,10 @@ namespace dom {
|
||||
class RestyleManager final : public RestyleManagerBase
|
||||
{
|
||||
public:
|
||||
typedef RestyleManagerBase base_type;
|
||||
|
||||
friend class RestyleTracker;
|
||||
friend class ElementRestyler;
|
||||
|
||||
explicit RestyleManager(nsPresContext* aPresContext);
|
||||
|
||||
@ -137,19 +140,16 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* DEBUG ONLY method to verify integrity of style tree versus frame tree
|
||||
*/
|
||||
void DebugVerifyStyleTree(nsIFrame* aFrame);
|
||||
#endif
|
||||
|
||||
// Note: It's the caller's responsibility to make sure to wrap a
|
||||
// ProcessRestyledFrames call in a view update batch and a script blocker.
|
||||
// This function does not call ProcessAttachedQueue() on the binding manager.
|
||||
// If the caller wants that to happen synchronously, it needs to handle that
|
||||
// itself.
|
||||
nsresult ProcessRestyledFrames(nsStyleChangeList& aRestyleArray);
|
||||
nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
|
||||
return base_type::ProcessRestyledFrames(aChangeList,
|
||||
*PresContext(),
|
||||
mOverflowChangedTracker);
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to start CSS transitions on elements that are being
|
||||
@ -493,11 +493,6 @@ private:
|
||||
// Recursively add all the given frame and all children to the tracker.
|
||||
void AddSubtreeToOverflowTracker(nsIFrame* aFrame);
|
||||
|
||||
// Returns true if this function managed to successfully move a frame, and
|
||||
// false if it could not process the position change, and a reflow should
|
||||
// be performed instead.
|
||||
bool RecomputePosition(nsIFrame* aFrame);
|
||||
|
||||
bool ShouldStartRebuildAllFor(RestyleTracker& aRestyleTracker) {
|
||||
// When we process our primary restyle tracker and we have a pending
|
||||
// rebuild-all, we need to process it.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,11 @@
|
||||
|
||||
#include "nsChangeHint.h"
|
||||
|
||||
class nsStyleChangeList;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class OverflowChangedTracker;
|
||||
class ServoRestyleManager;
|
||||
class RestyleManager;
|
||||
|
||||
@ -44,6 +47,13 @@ public:
|
||||
|
||||
static nsCString RestyleHintToString(nsRestyleHint aHint);
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* DEBUG ONLY method to verify integrity of style tree versus frame tree
|
||||
*/
|
||||
static void DebugVerifyStyleTree(nsIFrame* aFrame);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void ContentStateChangedInternal(Element* aElement,
|
||||
EventStates aStateMask,
|
||||
@ -92,6 +102,22 @@ private:
|
||||
uint32_t mHoverGeneration;
|
||||
// True if we're already waiting for a refresh notification.
|
||||
bool mObservingRefreshDriver;
|
||||
|
||||
/**
|
||||
* These are protected static methods that help with the frame construction
|
||||
* bits of the restyle managers.
|
||||
*/
|
||||
protected:
|
||||
static nsIFrame*
|
||||
GetNearestAncestorFrame(nsIContent* aContent);
|
||||
|
||||
static nsIFrame*
|
||||
GetNextBlockInInlineSibling(FramePropertyTable* aPropTable, nsIFrame* aFrame);
|
||||
|
||||
static nsresult
|
||||
ProcessRestyledFrames(nsStyleChangeList& aChangeList,
|
||||
nsPresContext& aPresContext,
|
||||
OverflowChangedTracker& aOverflowChangedTracker);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -25,6 +25,7 @@ class nsAttrValue;
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsStyleChangeList;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -137,6 +138,8 @@ public:
|
||||
inline uint64_t GetRestyleGeneration() const;
|
||||
inline uint32_t GetHoverGeneration() const;
|
||||
inline void SetObservingRefreshDriver(bool aObserving);
|
||||
inline nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList);
|
||||
inline void FlushOverflowChangedTracker();
|
||||
|
||||
private:
|
||||
// Stores a pointer to an RestyleManager or a ServoRestyleManager. The least
|
||||
|
@ -74,6 +74,18 @@ RestyleManagerHandle::Ptr::ProcessPendingRestyles()
|
||||
FORWARD(ProcessPendingRestyles, ());
|
||||
}
|
||||
|
||||
nsresult
|
||||
RestyleManagerHandle::Ptr::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
{
|
||||
FORWARD(ProcessRestyledFrames, (aChangeList));
|
||||
}
|
||||
|
||||
void
|
||||
RestyleManagerHandle::Ptr::FlushOverflowChangedTracker()
|
||||
{
|
||||
FORWARD(FlushOverflowChangedTracker, ());
|
||||
}
|
||||
|
||||
void
|
||||
RestyleManagerHandle::Ptr::RestyleForInsertOrChange(dom::Element* aContainer,
|
||||
nsIContent* aChild)
|
||||
|
@ -311,4 +311,18 @@ ServoRestyleManager::SnapshotForElement(Element* aElement)
|
||||
return mModifiedElements.LookupOrAdd(aElement, aElement);
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoRestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
||||
{
|
||||
MOZ_CRASH("stylo: ServoRestyleManager::ProcessRestyledFrames not implemented "
|
||||
"for Servo-backed style system");
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::FlushOverflowChangedTracker()
|
||||
{
|
||||
MOZ_CRASH("stylo: ServoRestyleManager::FlushOverflowChangedTracker "
|
||||
"not implemented for Servo-backed style system");
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -25,6 +25,7 @@ class nsAttrValue;
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsStyleChangeList;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -69,6 +70,8 @@ public:
|
||||
const nsAttrValue* aOldValue) {}
|
||||
|
||||
nsresult ReparentStyleContext(nsIFrame* aFrame);
|
||||
nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList);
|
||||
void FlushOverflowChangedTracker();
|
||||
|
||||
bool HasPendingRestyles() { return !mModifiedElements.IsEmpty(); }
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define nsCSSFrameConstructor_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/RestyleManagerBase.h"
|
||||
#include "mozilla/RestyleManagerHandle.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
@ -53,6 +54,7 @@ public:
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
||||
friend class mozilla::RestyleManager;
|
||||
friend class mozilla::RestyleManagerBase;
|
||||
|
||||
nsCSSFrameConstructor(nsIDocument* aDocument, nsIPresShell* aPresShell);
|
||||
~nsCSSFrameConstructor(void) {
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "gfxUtils.h"
|
||||
#include "gfxGradientCache.h"
|
||||
#include "nsInlineFrame.h"
|
||||
#include "nsRubyTextContainerFrame.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -2912,12 +2912,8 @@ PresShell::RecreateFramesFor(nsIContent* aContent)
|
||||
// Mark ourselves as not safe to flush while we're doing frame construction.
|
||||
++mChangeNestCount;
|
||||
RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
|
||||
if (restyleManager->IsServo()) {
|
||||
MOZ_CRASH("stylo: PresShell::RecreateFramesFor not implemented for Servo-"
|
||||
"backed style system");
|
||||
}
|
||||
nsresult rv = restyleManager->AsGecko()->ProcessRestyledFrames(changeList);
|
||||
restyleManager->AsGecko()->FlushOverflowChangedTracker();
|
||||
nsresult rv = restyleManager->ProcessRestyledFrames(changeList);
|
||||
restyleManager->FlushOverflowChangedTracker();
|
||||
--mChangeNestCount;
|
||||
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user