Identical if and else clauses in nsCaret::GetGeometryForFrame
Categories
(Core :: Layout, defect, P3)
Tracking
()
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 }
Comment 1•2 years ago
|
||
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.
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Set release status flags based on info from the regressing bug 1815729
Assignee | ||
Comment 3•2 years ago
|
||
Ah - yep, got rid of variable shuffle in D169210 by working in logical axis but missed that part.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
Description
•