зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374761 part 1. Properly restyle the viewport and its child anonymous box when we do a restyle. r=heycam
The child anon box may be an nsHTMLScrollFrame, a nsRootBoxFrame, or a nsSimplePageSequenceFrame. nsHTMLScrollFrame already knows how to deal with its anonymous box kids, nsRootBoxFrame doesn't have any, and the next changeset will deal with anon box kids of nsSimplePageSequenceFrame. MozReview-Commit-ID: 2ZV061EhRmc --HG-- extra : rebase_source : 43084315454284fc6d7353ccdb20137611b2ee46
This commit is contained in:
Родитель
4bc8228f27
Коммит
7a8cb34ac0
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/ViewportFrame.h"
|
||||
#include "mozilla/dom/ChildIterator.h"
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
@ -432,6 +433,15 @@ ServoRestyleManager::ProcessPostTraversal(Element* aElement,
|
|||
UpdateFramePseudoElementStyles(styleFrame, *aStyleSet, aChangeList);
|
||||
}
|
||||
|
||||
if (!aElement->GetParent()) {
|
||||
// This is the root. Update styles on the viewport as needed.
|
||||
ViewportFrame* viewport =
|
||||
do_QueryFrame(mPresContext->PresShell()->GetRootFrame());
|
||||
if (viewport) {
|
||||
viewport->UpdateStyle(*aStyleSet, aChangeList);
|
||||
}
|
||||
}
|
||||
|
||||
// Some changes to animations don't affect the computed style and yet still
|
||||
// require the layer to be updated. For example, pausing an animation via
|
||||
// the Web Animations API won't affect an element's style but still
|
||||
|
|
|
@ -2761,6 +2761,8 @@ nsCSSFrameConstructor::ConstructRootFrame()
|
|||
// What would that break?
|
||||
viewportFrame->Init(nullptr, nullptr, nullptr);
|
||||
|
||||
viewportFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
|
||||
|
||||
// Bind the viewport frame to the root view
|
||||
nsView* rootView = mPresShell->GetViewManager()->GetRootView();
|
||||
viewportFrame->SetView(rootView);
|
||||
|
|
|
@ -415,6 +415,35 @@ ViewportFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
|
|||
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
|
||||
}
|
||||
|
||||
void
|
||||
ViewportFrame::UpdateStyle(ServoStyleSet& aStyleSet,
|
||||
nsStyleChangeList& aChangeList)
|
||||
{
|
||||
nsStyleContext* oldContext = StyleContext();
|
||||
nsIAtom* pseudo = oldContext->GetPseudo();
|
||||
RefPtr<nsStyleContext> newContext =
|
||||
aStyleSet.ResolveInheritingAnonymousBoxStyle(pseudo, nullptr);
|
||||
|
||||
// We're special because we have a null GetContent(), so don't call things
|
||||
// like UpdateStyleOfOwnedChildFrame that try to append changes for the
|
||||
// content to the change list. Nor do we computed a changehint, since we have
|
||||
// no way to apply it anyway.
|
||||
newContext->EnsureSameStructsCached(oldContext);
|
||||
|
||||
MOZ_ASSERT(!GetNextContinuation(), "Viewport has continuations?");
|
||||
SetStyleContext(newContext);
|
||||
|
||||
UpdateStyleOfOwnedAnonBoxes(aStyleSet, aChangeList, nsChangeHint_Empty);
|
||||
}
|
||||
|
||||
void
|
||||
ViewportFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult)
|
||||
{
|
||||
if (mFrames.NotEmpty()) {
|
||||
aResult.AppendElement(mFrames.FirstChild());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
nsresult
|
||||
ViewportFrame::GetFrameName(nsAString& aResult) const
|
||||
|
|
|
@ -72,6 +72,17 @@ public:
|
|||
*/
|
||||
nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
|
||||
|
||||
/**
|
||||
* Update our style (and recursively the styles of any anonymous boxes we
|
||||
* might own)
|
||||
*/
|
||||
void UpdateStyle(ServoStyleSet& aStyleSet, nsStyleChangeList& aChangeList);
|
||||
|
||||
/**
|
||||
* Return our single anonymous box child.
|
||||
*/
|
||||
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
|
|
@ -10208,7 +10208,8 @@ nsIFrame::UpdateStyleOfChildAnonBox(nsIFrame* aChildFrame,
|
|||
{
|
||||
MOZ_ASSERT(aChildFrame->GetParent() == this,
|
||||
"This should only be used for children!");
|
||||
MOZ_ASSERT(aChildFrame->GetContent() == GetContent(),
|
||||
MOZ_ASSERT((!GetContent() && IsViewportFrame()) ||
|
||||
aChildFrame->GetContent() == GetContent(),
|
||||
"What content node is it a frame for?");
|
||||
MOZ_ASSERT(!aChildFrame->GetPrevContinuation(),
|
||||
"Only first continuations should end up here");
|
||||
|
|
Загрузка…
Ссылка в новой задаче