Bug 1623858: part 16) Annotate `nsFrameSelection::HandleTableSelection` with `[[nodiscard]]`. r=hsivonen

Depends on D68575

Differential Revision: https://phabricator.services.mozilla.com/D68576

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2020-03-30 08:35:36 +00:00
Родитель 4c2e63fddc
Коммит e7cdb1cf10
3 изменённых файлов: 17 добавлений и 8 удалений

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

@ -4989,8 +4989,11 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
AutoWeakFrame weakThis = this;
if (NS_SUCCEEDED(result) && parentContent) {
frameselection->HandleTableSelection(parentContent, contentOffset, target,
mouseEvent);
result = frameselection->HandleTableSelection(parentContent, contentOffset,
target, mouseEvent);
if (NS_WARN_IF(NS_FAILED(result))) {
return result;
}
} else {
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mouseEvent, this);
frameselection->HandleDrag(this, pt);

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

@ -1395,8 +1395,11 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus,
// Start selecting in the cell we were in before
nsINode* parent = ParentOffset(mTableSelection.mCellParent, &offset);
if (parent) {
HandleTableSelection(parent, offset, TableSelectionMode::Cell,
&event);
const nsresult result = HandleTableSelection(
parent, offset, TableSelectionMode::Cell, &event);
if (NS_WARN_IF(NS_FAILED(result))) {
return result;
}
}
// Find the parent of this new cell and extend selection to it
@ -1408,8 +1411,11 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus,
if (parent) {
mTableSelection.mCellParent = cellparent;
// Continue selection into next cell
HandleTableSelection(parent, offset, TableSelectionMode::Cell,
&event);
const nsresult result = HandleTableSelection(
parent, offset, TableSelectionMode::Cell, &event);
if (NS_WARN_IF(NS_FAILED(result))) {
return result;
}
}
} else {
// XXXX Problem: Shift+click in browser is appending text selection to

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

@ -284,7 +284,7 @@ class nsFrameSelection final {
* and what keys are pressed
*/
// TODO: replace with `MOZ_CAN_RUN_SCRIPT`.
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
[[nodiscard]] MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
HandleTableSelection(nsINode* aParentContent, int32_t aContentOffset,
mozilla::TableSelectionMode aTarget,
mozilla::WidgetMouseEvent* aMouseEvent);
@ -817,7 +817,7 @@ class nsFrameSelection final {
// (according to GetFirstCellNodeInRange).
nsRange* GetNextCellRange(const mozilla::dom::Selection& aNormalSelection);
MOZ_CAN_RUN_SCRIPT nsresult
[[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
HandleSelection(nsINode* aParentContent, int32_t aContentOffset,
mozilla::TableSelectionMode aTarget,
mozilla::WidgetMouseEvent* aMouseEvent, bool aDragState,