mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987320 - Remove unnecessary null checks for do_QueryFrame arguments. r=bz
This commit is contained in:
parent
651c0fd8e0
commit
7ac995a949
@ -394,11 +394,7 @@ HTMLComboboxAccessible::InvalidateChildren()
|
||||
void
|
||||
HTMLComboboxAccessible::CacheChildren()
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
nsIComboboxControlFrame* comboFrame = do_QueryFrame(frame);
|
||||
nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
|
||||
if (!comboFrame)
|
||||
return;
|
||||
|
||||
@ -506,11 +502,7 @@ HTMLComboboxAccessible::GetActionName(uint8_t aIndex, nsAString& aName)
|
||||
if (aIndex != HTMLComboboxAccessible::eAction_Click) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIComboboxControlFrame* comboFrame = do_QueryFrame(frame);
|
||||
nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
|
||||
if (!comboFrame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -602,13 +594,10 @@ nsIFrame*
|
||||
HTMLComboboxListAccessible::GetFrame() const
|
||||
{
|
||||
nsIFrame* frame = HTMLSelectListAccessible::GetFrame();
|
||||
|
||||
if (frame) {
|
||||
nsIComboboxControlFrame* comboBox = do_QueryFrame(frame);
|
||||
if (comboBox) {
|
||||
return comboBox->GetDropDown();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2003,7 +2003,6 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
||||
// When turning clamping on, make sure the current position is clamped.
|
||||
if (aClamp) {
|
||||
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
|
||||
if (frame) {
|
||||
nsSubDocumentFrame* subdocFrame = do_QueryFrame(frame);
|
||||
if (subdocFrame) {
|
||||
nsIFrame* subdocRootFrame = subdocFrame->GetSubdocumentRootFrame();
|
||||
@ -2016,7 +2015,6 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -179,10 +179,7 @@ bool
|
||||
HTMLButtonElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
||||
nsIFrame* formFrame = nullptr;
|
||||
if (formControlFrame) {
|
||||
formFrame = do_QueryFrame(formControlFrame);
|
||||
}
|
||||
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
||||
return IsElementDisabledForEvents(aMessage, formFrame);
|
||||
}
|
||||
|
||||
|
@ -5064,8 +5064,6 @@ HTMLInputElement::SetSelectionRange(int32_t aSelectionStart,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame) {
|
||||
// Default to forward, even if not specified.
|
||||
@ -5086,7 +5084,6 @@ HTMLInputElement::SetSelectionRange(int32_t aSelectionStart,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLInputElement::SetSelectionRange(int32_t aSelectionStart,
|
||||
@ -5350,16 +5347,13 @@ nsresult
|
||||
HTMLInputElement::GetSelectionRange(int32_t* aSelectionStart,
|
||||
int32_t* aSelectionEnd)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame)
|
||||
rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
|
||||
if (textControlFrame) {
|
||||
return textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5381,8 +5375,6 @@ HTMLInputElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame) {
|
||||
nsITextControlFrame::SelectionDirection dir;
|
||||
@ -5391,7 +5383,6 @@ HTMLInputElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& aRv)
|
||||
DirectionToName(dir, aDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
nsTextEditorState* state = GetEditorState();
|
||||
@ -5449,10 +5440,8 @@ HTMLInputElement::GetPhonetic(nsAString& aPhonetic)
|
||||
{
|
||||
aPhonetic.Truncate();
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame)
|
||||
if (textControlFrame) {
|
||||
textControlFrame->GetPhonetic(aPhonetic);
|
||||
}
|
||||
|
||||
|
@ -448,10 +448,7 @@ bool
|
||||
HTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
||||
nsIFrame* formFrame = nullptr;
|
||||
if (formControlFrame) {
|
||||
formFrame = do_QueryFrame(formControlFrame);
|
||||
}
|
||||
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
||||
return IsElementDisabledForEvents(aMessage, formFrame);
|
||||
}
|
||||
|
||||
@ -763,16 +760,13 @@ nsresult
|
||||
HTMLTextAreaElement::GetSelectionRange(int32_t* aSelectionStart,
|
||||
int32_t* aSelectionEnd)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame)
|
||||
rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
|
||||
if (textControlFrame) {
|
||||
return textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -802,8 +796,6 @@ HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& a
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame) {
|
||||
nsITextControlFrame::SelectionDirection dir;
|
||||
@ -812,7 +804,6 @@ HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& a
|
||||
DirectionToName(dir, aDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (mState.IsSelectionCached()) {
|
||||
@ -875,8 +866,6 @@ HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
|
||||
if (formControlFrame) {
|
||||
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
|
||||
if (textControlFrame) {
|
||||
// Default to forward, even if not specified.
|
||||
@ -896,7 +885,6 @@ HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
aError.Throw(rv);
|
||||
|
@ -178,10 +178,6 @@ void
|
||||
TextTrackManager::UpdateCueDisplay()
|
||||
{
|
||||
nsIFrame* frame = mMediaElement->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsVideoFrame* videoFrame = do_QueryFrame(frame);
|
||||
if (!videoFrame) {
|
||||
return;
|
||||
|
@ -805,16 +805,13 @@ SVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
|
||||
void
|
||||
SVGSVGElement::InvalidateTransformNotifyFrame()
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
|
||||
nsISVGSVGFrame* svgframe = do_QueryFrame(GetPrimaryFrame());
|
||||
// might fail this check if we've failed conditional processing
|
||||
if (svgframe) {
|
||||
svgframe->NotifyViewportOrTransformChanged(
|
||||
nsISVGChildFrame::TRANSFORM_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SVGSVGElement::HasPreserveAspectRatio()
|
||||
|
@ -801,7 +801,6 @@ nsScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets(
|
||||
nsIScrollableFrame* target =
|
||||
aESM->ComputeScrollTarget(aTargetFrame, dir->deltaX, dir->deltaY, aEvent,
|
||||
nsEventStateManager::COMPUTE_DEFAULT_ACTION_TARGET);
|
||||
if (target) {
|
||||
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(target);
|
||||
if (scrollbarOwner) {
|
||||
nsIFrame* targetFrame = do_QueryFrame(target);
|
||||
@ -810,7 +809,6 @@ nsScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets()
|
||||
|
@ -1700,12 +1700,10 @@ bool
|
||||
TabChild::RecvNotifyTransformBegin(const ViewID& aViewId)
|
||||
{
|
||||
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
|
||||
if (sf) {
|
||||
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
|
||||
if (scrollbarOwner) {
|
||||
scrollbarOwner->ScrollbarActivityStarted();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1713,12 +1711,10 @@ bool
|
||||
TabChild::RecvNotifyTransformEnd(const ViewID& aViewId)
|
||||
{
|
||||
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
|
||||
if (sf) {
|
||||
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
|
||||
if (scrollbarOwner) {
|
||||
scrollbarOwner->ScrollbarActivityStopped();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1259,9 +1259,6 @@ nsIScrollableFrame*
|
||||
nsLayoutUtils::GetScrollableFrameFor(const nsIFrame *aScrolledFrame)
|
||||
{
|
||||
nsIFrame *frame = aScrolledFrame->GetParent();
|
||||
if (!frame) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIScrollableFrame *sf = do_QueryFrame(frame);
|
||||
return sf;
|
||||
}
|
||||
|
@ -362,12 +362,10 @@ nsPrintEngine::GetSeqFrameAndCountPagesInternal(nsPrintObject* aPO,
|
||||
|
||||
// Finds the SimplePageSequencer frame
|
||||
nsIPageSequenceFrame* seqFrame = aPO->mPresShell->GetPageSequenceFrame();
|
||||
if (seqFrame) {
|
||||
aSeqFrame = do_QueryFrame(seqFrame);
|
||||
} else {
|
||||
aSeqFrame = nullptr;
|
||||
if (!aSeqFrame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (aSeqFrame == nullptr) return NS_ERROR_FAILURE;
|
||||
|
||||
// first count the total number of pages
|
||||
aCount = 0;
|
||||
|
@ -136,12 +136,10 @@ nsSVGSwitchFrame::GetFrameForPoint(const nsPoint &aPoint)
|
||||
"SVG should take this code path");
|
||||
|
||||
nsIFrame *kid = GetActiveChildFrame();
|
||||
if (kid) {
|
||||
nsISVGChildFrame* svgFrame = do_QueryFrame(kid);
|
||||
if (svgFrame) {
|
||||
return svgFrame->GetFrameForPoint(aPoint);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@ -152,12 +150,10 @@ nsSVGSwitchFrame::GetCoveredRegion()
|
||||
nsRect rect;
|
||||
|
||||
nsIFrame *kid = GetActiveChildFrame();
|
||||
if (kid) {
|
||||
nsISVGChildFrame* child = do_QueryFrame(kid);
|
||||
if (child) {
|
||||
rect = child->GetCoveredRegion();
|
||||
}
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
@ -193,7 +189,6 @@ nsSVGSwitchFrame::ReflowSVG()
|
||||
nsOverflowAreas overflowRects;
|
||||
|
||||
nsIFrame *child = GetActiveChildFrame();
|
||||
if (child) {
|
||||
nsISVGChildFrame* svgChild = do_QueryFrame(child);
|
||||
if (svgChild) {
|
||||
NS_ABORT_IF_FALSE(!(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY),
|
||||
@ -205,7 +200,6 @@ nsSVGSwitchFrame::ReflowSVG()
|
||||
// frame list, and we're iterating over that list now anyway.
|
||||
ConsiderChildOverflow(overflowRects, child);
|
||||
}
|
||||
}
|
||||
|
||||
if (isFirstReflow) {
|
||||
// Make sure we have our filter property (if any) before calling
|
||||
@ -227,7 +221,6 @@ nsSVGSwitchFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
nsIFrame* kid = GetActiveChildFrame();
|
||||
if (kid) {
|
||||
nsISVGChildFrame* svgKid = do_QueryFrame(kid);
|
||||
if (svgKid) {
|
||||
nsIContent *content = kid->GetContent();
|
||||
@ -238,7 +231,6 @@ nsSVGSwitchFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||
}
|
||||
return svgKid->GetBBoxContribution(ToMatrix(transform), aFlags);
|
||||
}
|
||||
}
|
||||
return SVGBBox();
|
||||
}
|
||||
|
||||
|
@ -48,17 +48,13 @@ NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
|
||||
nsIFrame *frame = GetFrame(false);
|
||||
|
||||
if (frame) {
|
||||
nsSubDocumentFrame *subDocFrame = do_QueryFrame(frame);
|
||||
nsSubDocumentFrame *subDocFrame = do_QueryFrame(GetFrame(false));
|
||||
if (subDocFrame) {
|
||||
// Ok, the frame for mContent is an nsSubDocumentFrame, it knows how
|
||||
// to reach the docshell, so ask it...
|
||||
|
||||
return subDocFrame->GetDocShell(aResult);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mContent) {
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user