Bug 1781034 - Remove layout debugger's visual debugging. r=layout-reviewers,dshin

Differential Revision: https://phabricator.services.mozilla.com/D152628
This commit is contained in:
Emilio Cobos Álvarez 2022-07-26 14:08:56 +00:00
Родитель f0b9ca55d6
Коммит 81b3b99519
12 изменённых файлов: 1 добавлений и 206 удалений

Просмотреть файл

@ -2231,12 +2231,6 @@ void PresShell::NotifyDestroyingFrame(nsIFrame* aFrame) {
mCurrentEventFrame = nullptr;
}
#ifdef DEBUG
if (aFrame == mDrawEventTargetFrame) {
mDrawEventTargetFrame = nullptr;
}
#endif
for (unsigned int i = 0; i < mCurrentEventFrameStack.Length(); i++) {
if (aFrame == mCurrentEventFrameStack.ElementAt(i)) {
// One of our stack frames was deleted. Get its content so that when we
@ -7112,9 +7106,6 @@ nsresult PresShell::EventHandler::HandleEventUsingCoordinates(
nsresult rv = eventHandler.HandleEventWithCurrentEventInfo(
aGUIEvent, aEventStatus, true,
MOZ_KnownLive(eventTargetData.mOverrideClickTarget));
#ifdef DEBUG
eventTargetData.mPresShell->ShowEventTargetDebug();
#endif
return rv;
}
@ -7911,11 +7902,6 @@ nsresult PresShell::EventHandler::HandleEventAtFocusedContent(
nsresult rv =
HandleEventWithCurrentEventInfo(aGUIEvent, aEventStatus, true, nullptr);
#ifdef DEBUG
mPresShell->ShowEventTargetDebug();
#endif
return rv;
}
@ -8017,10 +8003,6 @@ nsresult PresShell::EventHandler::HandleEventWithFrameForPresShell(
HandleEventWithCurrentEventInfo(aGUIEvent, aEventStatus, true, nullptr);
}
#ifdef DEBUG
mPresShell->ShowEventTargetDebug();
#endif
return rv;
}
@ -8052,19 +8034,6 @@ Document* PresShell::GetPrimaryContentDocument() {
return childDocShell->GetExtantDocument();
}
#ifdef DEBUG
void PresShell::ShowEventTargetDebug() {
if (nsIFrame::GetShowEventTargetFrameBorder() && GetCurrentEventFrame()) {
if (mDrawEventTargetFrame) {
mDrawEventTargetFrame->InvalidateFrame();
}
mDrawEventTargetFrame = mCurrentEventFrame;
mDrawEventTargetFrame->InvalidateFrame();
}
}
#endif
nsresult PresShell::EventHandler::HandleEventWithTarget(
WidgetEvent* aEvent, nsIFrame* aNewEventFrame, nsIContent* aNewEventContent,
nsEventStatus* aEventStatus, bool aIsHandlingNativeEvent,

Просмотреть файл

@ -1731,10 +1731,6 @@ class PresShell final : public nsStubDocumentObserver,
*/
void NotifyDestroyingFrame(nsIFrame* aFrame);
#ifdef DEBUG
nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; }
#endif
bool GetZoomableByAPZ() const;
private:
@ -2833,14 +2829,11 @@ class PresShell final : public nsStubDocumentObserver,
MOZ_CAN_RUN_SCRIPT_BOUNDARY bool VerifyIncrementalReflow();
MOZ_CAN_RUN_SCRIPT_BOUNDARY void DoVerifyReflow();
void VerifyHasDirtyRootAncestor(nsIFrame* aFrame);
void ShowEventTargetDebug();
bool mInVerifyReflow = false;
// The reflow root under which we're currently reflowing. Null when
// not in reflow.
nsIFrame* mCurrentReflowRoot = nullptr;
nsIFrame* mDrawEventTargetFrame = nullptr;
#endif // #ifdef DEBUG
// Send, and reset, the current per tick telemetry. This includes:

Просмотреть файл

@ -303,21 +303,6 @@ std::ostream& operator<<(std::ostream& aStream, const nsReflowStatus& aStatus) {
}
#ifdef DEBUG
static bool gShowFrameBorders = false;
void nsIFrame::ShowFrameBorders(bool aEnable) { gShowFrameBorders = aEnable; }
bool nsIFrame::GetShowFrameBorders() { return gShowFrameBorders; }
static bool gShowEventTargetFrameBorder = false;
void nsIFrame::ShowEventTargetFrameBorder(bool aEnable) {
gShowEventTargetFrameBorder = aEnable;
}
bool nsIFrame::GetShowEventTargetFrameBorder() {
return gShowEventTargetFrameBorder;
}
/**
* Note: the log module is created during library initialization which
@ -2762,45 +2747,6 @@ nsSize nsIFrame::OverflowClipMargin(PhysicalAxes aClipAxes) const {
return result;
}
#ifdef DEBUG
static void PaintDebugBorder(nsIFrame* aFrame, DrawTarget* aDrawTarget,
const nsRect& aDirtyRect, nsPoint aPt) {
nsRect r(aPt, aFrame->GetSize());
int32_t appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
sRGBColor blueOrRed(aFrame->HasView() ? sRGBColor(0.f, 0.f, 1.f, 1.f)
: sRGBColor(1.f, 0.f, 0.f, 1.f));
aDrawTarget->StrokeRect(NSRectToRect(r, appUnitsPerDevPixel),
ColorPattern(ToDeviceColor(blueOrRed)));
}
static void PaintEventTargetBorder(nsIFrame* aFrame, DrawTarget* aDrawTarget,
const nsRect& aDirtyRect, nsPoint aPt) {
nsRect r(aPt, aFrame->GetSize());
int32_t appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
ColorPattern purple(ToDeviceColor(sRGBColor(.5f, 0.f, .5f, 1.f)));
aDrawTarget->StrokeRect(NSRectToRect(r, appUnitsPerDevPixel), purple);
}
static void DisplayDebugBorders(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
const nsDisplayListSet& aLists) {
// Draw a border around the child
// REVIEW: From nsContainerFrame::PaintChild
if (nsIFrame::GetShowFrameBorders() && !aFrame->GetRect().IsEmpty()) {
aLists.Outlines()->AppendNewToTop<nsDisplayGeneric>(
aBuilder, aFrame, PaintDebugBorder, "DebugBorder",
DisplayItemType::TYPE_DEBUG_BORDER);
}
// Draw a border around the current event target
if (nsIFrame::GetShowEventTargetFrameBorder() &&
aFrame->PresShell()->GetDrawEventTargetFrame() == aFrame) {
aLists.Outlines()->AppendNewToTop<nsDisplayGeneric>(
aBuilder, aFrame, PaintEventTargetBorder, "EventTargetBorder",
DisplayItemType::TYPE_EVENT_TARGET_BORDER);
}
}
#endif
/**
* Returns whether a display item that gets created with the builder's current
* state will have a scrolled clip, i.e. a clip that is scrolled by a scroll
@ -3494,10 +3440,6 @@ void nsIFrame::BuildDisplayListForStackingContext(
nsDisplayList resultList(aBuilder);
set.SerializeWithCorrectZOrder(&resultList, content);
#ifdef DEBUG
DisplayDebugBorders(aBuilder, this, set);
#endif
// Get the ASR to use for the container items that we create here.
const ActiveScrolledRoot* containerItemASR = contASRTracker.GetContainerASR();
@ -3997,9 +3939,6 @@ void nsIFrame::BuildDisplayListForSimpleChild(nsDisplayListBuilder* aBuilder,
aChild->SetBuiltDisplayList(true);
aBuilder->Check();
aBuilder->DisplayCaret(aChild, aLists.Outlines());
#ifdef DEBUG
DisplayDebugBorders(aBuilder, aChild, aLists);
#endif
}
nsIFrame::DisplayChildFlag nsIFrame::DisplayFlagForFlexOrGridItem() const {
@ -4322,9 +4261,6 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
child->BuildDisplayList(aBuilder, aLists);
aBuilder->Check();
aBuilder->DisplayCaret(child, aLists.Outlines());
#ifdef DEBUG
DisplayDebugBorders(aBuilder, child, aLists);
#endif
return;
}
@ -4350,9 +4286,6 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
list.AppendToTop(pseudoStack.Content());
list.AppendToTop(pseudoStack.Outlines());
extraPositionedDescendants.AppendToTop(pseudoStack.PositionedDescendants());
#ifdef DEBUG
DisplayDebugBorders(aBuilder, child, aLists);
#endif
}
buildingForChild.RestoreBuildingInvisibleItemsValue();

Просмотреть файл

@ -5503,14 +5503,6 @@ class nsIFrame : public nsQueryFrame {
static void DisplayReflowShutdown();
static mozilla::LazyLogModule sFrameLogModule;
// Show frame borders when rendering
static void ShowFrameBorders(bool aEnable);
static bool GetShowFrameBorders();
// Show frame border of event target
static void ShowEventTargetFrameBorder(bool aEnable);
static bool GetShowEventTargetFrameBorder();
#endif
};

Просмотреть файл

@ -2294,14 +2294,6 @@ void nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
gIconLoad->RemoveIconObserver(this);
mDisplayingIcon = false;
}
#ifdef DEBUG
if (GetShowFrameBorders() && GetImageMap()) {
aLists.Outlines()->AppendNewToTop<nsDisplayGeneric>(
aBuilder, this, PaintDebugImageMap, "DebugImageMap",
DisplayItemType::TYPE_DEBUG_IMAGE_MAP);
}
#endif
}
}

Просмотреть файл

@ -234,37 +234,11 @@ ComputedStyle* nsPlaceholderFrame::GetLayoutParentStyleForOutOfFlow(
return *aProviderFrame ? (*aProviderFrame)->Style() : nullptr;
}
#ifdef DEBUG
static void PaintDebugPlaceholder(nsIFrame* aFrame, DrawTarget* aDrawTarget,
const nsRect& aDirtyRect, nsPoint aPt) {
ColorPattern cyan(ToDeviceColor(sRGBColor(0.f, 1.f, 1.f, 1.f)));
int32_t appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
nscoord x = nsPresContext::CSSPixelsToAppUnits(-5);
nsRect r(aPt.x + x, aPt.y, nsPresContext::CSSPixelsToAppUnits(13),
nsPresContext::CSSPixelsToAppUnits(3));
aDrawTarget->FillRect(NSRectToRect(r, appUnitsPerDevPixel), cyan);
nscoord y = nsPresContext::CSSPixelsToAppUnits(-10);
r = nsRect(aPt.x, aPt.y + y, nsPresContext::CSSPixelsToAppUnits(3),
nsPresContext::CSSPixelsToAppUnits(10));
aDrawTarget->FillRect(NSRectToRect(r, appUnitsPerDevPixel), cyan);
}
#endif // DEBUG
#if defined(DEBUG) || (defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF))
void nsPlaceholderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
DO_GLOBAL_REFLOW_COUNT_DSP("nsPlaceholderFrame");
# ifdef DEBUG
if (GetShowFrameBorders()) {
aLists.Outlines()->AppendNewToTop<nsDisplayGeneric>(
aBuilder, this, PaintDebugPlaceholder, "DebugPlaceholder",
DisplayItemType::TYPE_DEBUG_PLACEHOLDER);
}
# endif
}
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)

Просмотреть файл

@ -110,9 +110,6 @@ DECLARE_DISPLAY_ITEM_TYPE(XUL_IMAGE, 0)
DECLARE_DISPLAY_ITEM_TYPE(XUL_TEXT_BOX, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(XUL_TREE_BODY, 0)
DECLARE_DISPLAY_ITEM_TYPE(XUL_TREE_COL_SPLITTER_TARGET, TYPE_RENDERS_NO_IMAGES)
#ifdef DEBUG_LAYOUT
DECLARE_DISPLAY_ITEM_TYPE(XUL_DEBUG, TYPE_RENDERS_NO_IMAGES)
#endif
DECLARE_DISPLAY_ITEM_TYPE(MATHML_BAR, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(MATHML_CHAR_FOREGROUND, TYPE_RENDERS_NO_IMAGES)
@ -123,9 +120,4 @@ DECLARE_DISPLAY_ITEM_TYPE(MATHML_SLASH, TYPE_RENDERS_NO_IMAGES)
#ifdef DEBUG
DECLARE_DISPLAY_ITEM_TYPE(MATHML_BOUNDING_METRICS, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(MATHML_CHAR_DEBUG, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(DEBUG_BORDER, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(DEBUG_IMAGE_MAP, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(DEBUG_PLACEHOLDER, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(EVENT_TARGET_BORDER, TYPE_RENDERS_NO_IMAGES)
#endif

Просмотреть файл

@ -13,10 +13,9 @@ interface mozIDOMWindow;
* layout debugging functions to be used from chrome.
*/
[scriptable, uuid(f336d8d3-9721-4ad3-85d0-a7018c0a3383)]
[builtinclass, scriptable, uuid(f336d8d3-9721-4ad3-85d0-a7018c0a3383)]
interface nsILayoutDebuggingTools : nsISupports
{
/*
* Initialize debugger object to act on a docshell.
*/
@ -26,8 +25,6 @@ interface nsILayoutDebuggingTools : nsISupports
void forceRefresh();
/* Toggle various debugging states */
void setVisualDebugging(in boolean enabled);
void setVisualEventDebugging(in boolean enabled);
void setReflowCounts(in boolean enabled);
void setPagedMode(in boolean enabled);

Просмотреть файл

@ -84,24 +84,6 @@ nsLayoutDebuggingTools::Init(mozIDOMWindow* aWin) {
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetVisualDebugging(bool aVisualDebugging) {
#ifdef DEBUG
nsIFrame::ShowFrameBorders(aVisualDebugging);
ForceRefresh();
#endif
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetVisualEventDebugging(bool aVisualEventDebugging) {
#ifdef DEBUG
nsIFrame::ShowEventTargetFrameBorder(aVisualEventDebugging);
ForceRefresh();
#endif
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetReflowCounts(bool aShow) {
NS_ENSURE_TRUE(mDocShell, NS_ERROR_NOT_INITIALIZED);

Просмотреть файл

@ -45,8 +45,6 @@ const COMMANDS = [
class Debugger {
constructor() {
this._flags = new Map();
this._visualDebugging = false;
this._visualEventDebugging = false;
this._pagedMode = false;
this._attached = false;
@ -89,26 +87,6 @@ class Debugger {
}
}
get visualDebugging() {
return this._visualDebugging;
}
set visualDebugging(v) {
v = !!v;
this._visualDebugging = v;
this._sendMessage("setVisualDebugging", v);
}
get visualEventDebugging() {
return this._visualEventDebugging;
}
set visualEventDebugging(v) {
v = !!v;
this._visualEventDebugging = v;
this._sendMessage("setVisualEventDebugging", v);
}
get pagedMode() {
return this._pagedMode;
}

Просмотреть файл

@ -72,9 +72,6 @@
<menu label="&ldb.ToggleMenu.label;"
accesskey="&ldb.ToggleMenu.accesskey;">
<menupopup>
<menuitem type="checkbox" id="menu_visualDebugging" label="&ldb.visualDebugging.label;" accesskey="&ldb.visualDebugging.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_visualEventDebugging" label="&ldb.visualEventDebugging.label;" accesskey="&ldb.visualEventDebugging.accesskey;" oncommand="toggle(this);" />
<menuseparator />
<menuitem type="checkbox" id="menu_paintDumping" label="&ldb.paintDumping.label;" accesskey="&ldb.paintDumping.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_invalidateDumping" label="&ldb.invalidateDumping.label;" accesskey="&ldb.invalidateDumping.accesskey;" oncommand="toggle(this);" />
<menuseparator />

Просмотреть файл

@ -15,10 +15,6 @@
<!ENTITY ldb.ToggleMenu.label "Toggle">
<!ENTITY ldb.ToggleMenu.accesskey "T">
<!ENTITY ldb.visualDebugging.label "Visual Debugging">
<!ENTITY ldb.visualDebugging.accesskey "V">
<!ENTITY ldb.visualEventDebugging.label "Visual Event Debugging">
<!ENTITY ldb.visualEventDebugging.accesskey "E">
<!ENTITY ldb.paintDumping.label "Paint Dumping">
<!ENTITY ldb.paintDumping.accesskey "P">
<!ENTITY ldb.invalidateDumping.label "Invalidate Dumping">