/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/****************************************************************************** * Is*PropertyAvailable() methods which check if the property is available * (valid) with the event message.
******************************************************************************/
nsQueryContentEventResult::nsQueryContentEventResult(
mozilla::WidgetQueryContentEvent&& aEvent)
: mEventMessage(aEvent.mMessage),
mSucceeded(aEvent.Succeeded()),
mReversed(false) { if (mSucceeded) {
mOffsetAndData = std::move(aEvent.mReply->mOffsetAndData);
mTentativeCaretOffset = std::move(aEvent.mReply->mTentativeCaretOffset);
mRect = std::move(aEvent.mReply->mRect);
mRectArray = std::move(aEvent.mReply->mRectArray);
mReversed = aEvent.mReply->mReversed;
} // Mark as result that is longer used.
aEvent.mReply.reset();
}
NS_IMETHODIMP
nsQueryContentEventResult::GetOffset(uint32_t* aOffset) { if (NS_WARN_IF(!mSucceeded)) { return NS_ERROR_NOT_AVAILABLE;
}
if (NS_WARN_IF(!IsOffsetPropertyAvailable(mEventMessage))) { return NS_ERROR_NOT_AVAILABLE;
}
// With some event message, both offset and notFound properties are available. // In that case, offset value may mean "not found". If so, this method // shouldn't return mOffset as the result because it's a special value for // "not found". if (IsNotFoundPropertyAvailable(mEventMessage)) { bool notFound;
nsresult rv = GetNotFound(¬Found); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; // Just an unexpected case...
} // As said above, if mOffset means "not found", offset property shouldn't // return its value without any errors. if (NS_WARN_IF(notFound)) { return NS_ERROR_NOT_AVAILABLE;
}
}
// Convert the top widget related coordinates to the given widget's.
LayoutDeviceIntPoint offset =
aWidget->WidgetToScreenOffset() - topWidget->WidgetToScreenOffset();
mRect.MoveBy(-offset); for (size_t i = 0; i < mRectArray.Length(); i++) {
mRectArray[i].MoveBy(-offset);
}
}
¤ Dauer der Verarbeitung: 0.30 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.