mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
Bug 1504924 - Avoid nsIFrame::IsSelected() call in nsDisplayText::CanApplyOpacity() r=mats
Differential Revision: https://phabricator.services.mozilla.com/D12750 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a59d3605be
commit
da20c7650e
@ -4986,11 +4986,11 @@ public:
|
|||||||
|
|
||||||
bool CanApplyOpacity() const final
|
bool CanApplyOpacity() const final
|
||||||
{
|
{
|
||||||
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
if (IsSelected()) {
|
||||||
if (f->IsSelected()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
|
||||||
const nsStyleText* textStyle = f->StyleText();
|
const nsStyleText* textStyle = f->StyleText();
|
||||||
if (textStyle->mTextShadow) {
|
if (textStyle->mTextShadow) {
|
||||||
return false;
|
return false;
|
||||||
@ -6983,12 +6983,12 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PropertyProvider provider(this, iter, nsTextFrame::eInflated);
|
PropertyProvider provider(this, iter, nsTextFrame::eInflated);
|
||||||
if (aItem.mIsFrameSelected.isNothing()) {
|
|
||||||
aItem.mIsFrameSelected.emplace(IsSelected());
|
const bool isSelected = aItem.IsSelected();
|
||||||
}
|
|
||||||
// Trim trailing whitespace, unless we're painting a selection highlight,
|
// Trim trailing whitespace, unless we're painting a selection highlight,
|
||||||
// which should include trailing spaces if present (bug 1146754).
|
// which should include trailing spaces if present (bug 1146754).
|
||||||
provider.InitializeForDisplay(!aItem.mIsFrameSelected.value());
|
provider.InitializeForDisplay(!isSelected);
|
||||||
|
|
||||||
const bool reversed = mTextRun->IsInlineReversed();
|
const bool reversed = mTextRun->IsInlineReversed();
|
||||||
const bool verticalRun = mTextRun->IsVertical();
|
const bool verticalRun = mTextRun->IsVertical();
|
||||||
@ -7032,7 +7032,7 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
|
|||||||
textPaintStyle.SetResolveColors(!aParams.callbacks);
|
textPaintStyle.SetResolveColors(!aParams.callbacks);
|
||||||
|
|
||||||
// Fork off to the (slower) paint-with-selection path if necessary.
|
// Fork off to the (slower) paint-with-selection path if necessary.
|
||||||
if (aItem.mIsFrameSelected.value() &&
|
if (isSelected &&
|
||||||
(aParams.IsPaintBGColor() || ShouldDrawSelection(this->GetParent()))) {
|
(aParams.IsPaintBGColor() || ShouldDrawSelection(this->GetParent()))) {
|
||||||
MOZ_ASSERT(aOpacity == 1.0f, "We don't support opacity with selections!");
|
MOZ_ASSERT(aOpacity == 1.0f, "We don't support opacity with selections!");
|
||||||
gfxSkipCharsIterator tmp(provider.GetStart());
|
gfxSkipCharsIterator tmp(provider.GetStart());
|
||||||
|
@ -7767,6 +7767,15 @@ public:
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsSelected() const
|
||||||
|
{
|
||||||
|
if (mIsFrameSelected.isNothing()) {
|
||||||
|
mIsFrameSelected.emplace(mFrame->IsSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
return mIsFrameSelected.value();
|
||||||
|
}
|
||||||
|
|
||||||
// Lengths measured from the visual inline start and end sides
|
// Lengths measured from the visual inline start and end sides
|
||||||
// (i.e. left and right respectively in horizontal writing modes,
|
// (i.e. left and right respectively in horizontal writing modes,
|
||||||
// regardless of bidi directionality; top and bottom in vertical modes).
|
// regardless of bidi directionality; top and bottom in vertical modes).
|
||||||
|
Loading…
Reference in New Issue
Block a user