зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305957 part 13 - Highlight scroll anchor when 'layout.scroll-anchoring.highlight' is enabled. r=mattwoodrow
This commit adds a debug pref that will highlight the frames that are marked as anchor nodes. This is helpful to debug anchor selection. Differential Revision: https://phabricator.services.mozilla.com/D13276 --HG-- extra : rebase_source : 61109b3d967f0e4f8e5a260a71fecc01ebf22c73 extra : histedit_source : d2275fdb4edc3d7f6b006c8c7ab24fca1223998d
This commit is contained in:
Родитель
99d438a584
Коммит
e54839acce
|
@ -63,6 +63,14 @@ static void SetAnchorFlags(const nsIFrame* aScrolledFrame,
|
|||
}
|
||||
MOZ_ASSERT(frame,
|
||||
"The anchor node should be a descendant of the scroll frame");
|
||||
// If needed, invalidate the frame so that we start/stop highlighting the
|
||||
// anchor
|
||||
if (StaticPrefs::layout_css_scroll_anchoring_highlight()) {
|
||||
for (nsIFrame* frame = aAnchorNode->FirstContinuation(); !!frame;
|
||||
frame = frame->GetNextContinuation()) {
|
||||
frame->InvalidateFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
|
@ -3517,6 +3518,17 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
|||
// Animations may change the stacking context state.
|
||||
!(child->MayHaveTransformAnimation() || child->MayHaveOpacityAnimation());
|
||||
|
||||
if (StaticPrefs::layout_css_scroll_anchoring_highlight()) {
|
||||
if (child->FirstContinuation()->IsScrollAnchor()) {
|
||||
nsRect bounds = child->GetContentRectRelativeToSelf() +
|
||||
aBuilder->ToReferenceFrame(child);
|
||||
nsDisplaySolidColor* color = MakeDisplayItem<nsDisplaySolidColor>(
|
||||
aBuilder, child, bounds, NS_RGBA(255, 0, 255, 64));
|
||||
color->SetOverrideZIndex(INT32_MAX);
|
||||
aLists.PositionedDescendants()->AppendToTop(color);
|
||||
}
|
||||
}
|
||||
|
||||
if (doingShortcut) {
|
||||
BuildDisplayListForSimpleChild(aBuilder, child, aLists);
|
||||
return;
|
||||
|
|
|
@ -896,6 +896,12 @@ VARCACHE_PREF(
|
|||
)
|
||||
#undef PREF_VALUE
|
||||
|
||||
VARCACHE_PREF(
|
||||
"layout.css.scroll-anchoring.highlight",
|
||||
layout_css_scroll_anchoring_highlight,
|
||||
bool, false
|
||||
)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// JavaScript prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче