Bug 1509903 part 1 - Make nsTextFrame::IsFrameSelected() 'final' and inline nsIFrame::IsSelected() to de-virtualize the IsFrameSelected() call in some cases. r=emilio

In particular, in nsCharClipDisplayItem::IsSelected() we know that
the frame must be a nsTextFrame (or nsContinuingTextFrame) which
means nsTextFrame::IsFrameSelected() can be called directly now.
This commit is contained in:
Mats Palmgren 2018-11-29 00:17:25 +01:00
Родитель 0196497399
Коммит 7cdfa1649e
5 изменённых файлов: 19 добавлений и 17 удалений

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

@ -11030,13 +11030,6 @@ nsIFrame::CreateOwnLayerIfNeeded(nsDisplayListBuilder* aBuilder,
}
}
bool
nsIFrame::IsSelected() const
{
return (GetContent() && GetContent()->IsSelectionDescendant()) ?
IsFrameSelected() : false;
}
bool
nsIFrame::IsStackingContext(EffectSet* aEffectSet,
const nsStyleDisplay* aStyleDisplay,

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

@ -3232,7 +3232,10 @@ public:
/**
* @returns true if this frame is selected.
*/
bool IsSelected() const;
bool IsSelected() const {
return (GetContent() && GetContent()->IsSelectionDescendant()) ?
IsFrameSelected() : false;
}
/**
* called to discover where this frame, or a parent frame has user-select style

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

@ -704,7 +704,7 @@ protected:
* Return true if the frame is part of a Selection.
* Helper method to implement the public IsSelected() API.
*/
bool IsFrameSelected() const override;
bool IsFrameSelected() const final;
mozilla::UniquePtr<SelectionDetails> GetSelectionDetails();

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

@ -90,6 +90,7 @@
#include "nsSVGMaskFrame.h"
#include "nsTableCellFrame.h"
#include "nsTableColFrame.h"
#include "nsTextFrame.h"
#include "nsSliderFrame.h"
#include "ClientLayerManager.h"
#include "mozilla/layers/StackingContextHelper.h"
@ -9604,6 +9605,18 @@ nsCharClipDisplayItem::ComputeInvalidationRegion(
}
}
bool
nsCharClipDisplayItem::IsSelected() const
{
if (mIsFrameSelected.isNothing()) {
MOZ_ASSERT((nsTextFrame*)do_QueryFrame(mFrame));
auto* f = static_cast<nsTextFrame*>(mFrame);
mIsFrameSelected.emplace(f->IsSelected());
}
return mIsFrameSelected.value();
}
nsDisplayEffectsBase::nsDisplayEffectsBase(
nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,

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

@ -7798,14 +7798,7 @@ public:
: nullptr;
}
bool IsSelected() const
{
if (mIsFrameSelected.isNothing()) {
mIsFrameSelected.emplace(mFrame->IsSelected());
}
return mIsFrameSelected.value();
}
bool IsSelected() const;
// Lengths measured from the visual inline start and end sides
// (i.e. left and right respectively in horizontal writing modes,