Closed Bug 1819203 Opened 2 years ago Closed 2 years ago

Identical if and else clauses in nsCaret::GetGeometryForFrame

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox110 --- unaffected
firefox111 --- unaffected
firefox112 --- fixed

People

(Reporter: jesup, Assigned: dshin)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: coverity, regression)

Attachments

(1 file)

coverity:


*** CID 1521542: Incorrect expression (IDENTICAL_BRANCHES)
/layout/base/nsCaret.cpp: 289 in nsCaret::GetGeometryForFrame(nsIFrame *, int, int *)()
283 // already, which reverses the desired caret placement behavior.
284 // Note that the following condition is equivalent to:
285 // if ( (!textRun->IsSidewaysLeft() && textRunDirIsReverseOfFrame) ||
286 // (textRun->IsSidewaysLeft() && !textRunDirIsReverseOfFrame) )
287 if (textRunDirIsReverseOfFrame != textRun->IsSidewaysLeft()) {
288 int dir = wm.IsBidiLTR() ? -1 : 1;

CID 1521542:  Incorrect expression  (IDENTICAL_BRANCHES)
The same code is executed regardless of whether "vertical" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?

289 if (vertical) {
290 inlineOffset = dir * caretMetrics.mCaretWidth;
291 } else {
292 inlineOffset = dir * caretMetrics.mCaretWidth;
293 }
294 }

Seems like the code is correct because vertical is accounted below, so we probably just want to remove the condition, but ni?ing David to confirm.

Flags: needinfo?(dshin)
Keywords: regression
Regressed by: 1815729
Severity: -- → S3
Priority: -- → P3

Set release status flags based on info from the regressing bug 1815729

Ah - yep, got rid of variable shuffle in D169210 by working in logical axis but missed that part.

Flags: needinfo?(dshin)
Assignee: nobody → dshin
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b4175f1f21b4 Remove identical if block introduced in D169210. r=emilio
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: