зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1623858: part 7) Rename and simplify `nsFrame::DisplaySelection`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D67807 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d7badaf4fb
Коммит
1a8fa110c7
|
@ -2299,13 +2299,12 @@ static nsIFrame* GetActiveSelectionFrame(nsPresContext* aPresContext,
|
|||
return aFrame;
|
||||
}
|
||||
|
||||
int16_t nsFrame::DisplaySelection(nsPresContext* aPresContext,
|
||||
bool isOkToTurnOn) {
|
||||
int16_t nsFrame::DetermineDisplaySelection() {
|
||||
int16_t selType = nsISelectionController::SELECTION_OFF;
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsresult result =
|
||||
GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
GetSelectionController(PresContext(), getter_AddRefs(selCon));
|
||||
if (NS_SUCCEEDED(result) && selCon) {
|
||||
result = selCon->GetDisplaySelection(&selType);
|
||||
if (NS_SUCCEEDED(result) &&
|
||||
|
@ -2313,13 +2312,8 @@ int16_t nsFrame::DisplaySelection(nsPresContext* aPresContext,
|
|||
// Check whether style allows selection.
|
||||
if (!IsSelectable(nullptr)) {
|
||||
selType = nsISelectionController::SELECTION_OFF;
|
||||
isOkToTurnOn = false;
|
||||
}
|
||||
}
|
||||
if (isOkToTurnOn && (selType == nsISelectionController::SELECTION_OFF)) {
|
||||
selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
|
||||
selType = nsISelectionController::SELECTION_ON;
|
||||
}
|
||||
}
|
||||
return selType;
|
||||
}
|
||||
|
@ -4788,8 +4782,9 @@ nsresult nsFrame::SelectByTypeAtPoint(nsPresContext* aPresContext,
|
|||
NS_ENSURE_ARG_POINTER(aPresContext);
|
||||
|
||||
// No point in selecting if selection is turned off
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF)
|
||||
if (DetermineDisplaySelection() == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ContentOffsets offsets = GetContentOffsetsFromPoint(aPoint, SKIP_HIDDEN);
|
||||
if (!offsets.content) return NS_ERROR_FAILURE;
|
||||
|
@ -4817,7 +4812,7 @@ nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
|
|||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
|
||||
if (nsEventStatus_eConsumeNoDefault == *aEventStatus ||
|
||||
DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
DetermineDisplaySelection() == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4933,9 +4928,9 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
|
|||
// XXX Do we really need to exclude non-selectable content here?
|
||||
// GetContentOffsetsFromPoint can handle it just fine, although some
|
||||
// other stuff might not like it.
|
||||
// NOTE: DisplaySelection() returns SELECTION_OFF for non-selectable frames.
|
||||
if (DisplaySelection(aPresContext) ==
|
||||
nsISelectionController::SELECTION_OFF) {
|
||||
// NOTE: DetermineDisplaySelection() returns SELECTION_OFF for
|
||||
// non-selectable frames.
|
||||
if (DetermineDisplaySelection() == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -5064,7 +5059,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
PresShell::ReleaseCapturingContent();
|
||||
|
||||
bool selectionOff =
|
||||
(DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF);
|
||||
(DetermineDisplaySelection() == nsISelectionController::SELECTION_OFF);
|
||||
|
||||
RefPtr<nsFrameSelection> frameselection;
|
||||
ContentOffsets offsets;
|
||||
|
@ -5098,8 +5093,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
|
|||
// Note, this may cause the current nsFrame object to be deleted, bug 336592.
|
||||
RefPtr<nsFrameSelection> frameSelection;
|
||||
if (activeFrame != this &&
|
||||
static_cast<nsFrame*>(activeFrame)
|
||||
->DisplaySelection(activeFrame->PresContext()) !=
|
||||
static_cast<nsFrame*>(activeFrame)->DetermineDisplaySelection() !=
|
||||
nsISelectionController::SELECTION_OFF) {
|
||||
frameSelection = activeFrame->GetFrameSelection();
|
||||
}
|
||||
|
|
|
@ -585,8 +585,10 @@ class nsFrame : public nsBox {
|
|||
nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
|
||||
uint16_t aContentType = nsISelectionDisplay::DISPLAY_FRAMES);
|
||||
|
||||
int16_t DisplaySelection(nsPresContext* aPresContext,
|
||||
bool isOkToTurnOn = false);
|
||||
/**
|
||||
* @return see nsISelectionController.idl's `getDisplaySelection`.
|
||||
*/
|
||||
int16_t DetermineDisplaySelection();
|
||||
|
||||
// Style post processing hook
|
||||
void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
||||
|
|
|
@ -267,7 +267,7 @@ void nsTableCellFrame::DecorateForSelection(DrawTarget* aDrawTarget,
|
|||
NS_ASSERTION(IsSelected(), "Should only be called for selected cells");
|
||||
int16_t displaySelection;
|
||||
nsPresContext* presContext = PresContext();
|
||||
displaySelection = DisplaySelection(presContext);
|
||||
displaySelection = DetermineDisplaySelection();
|
||||
if (displaySelection) {
|
||||
RefPtr<nsFrameSelection> frameSelection =
|
||||
presContext->PresShell()->FrameSelection();
|
||||
|
|
Загрузка…
Ссылка в новой задаче