Closed Bug 1795196 Opened 2 years ago Closed 2 years ago

Remove getters in ReflowInput that return writable references

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(3 files)

+++ This bug was initially created as a clone of Bug #1778178 +++

In this bug, I'm planning to get rid of all these getters that return writable references.

  nscoord& ComputedISize() { return mComputedSize.ISize(mWritingMode); }
  nscoord& ComputedBSize() { return mComputedSize.BSize(mWritingMode); }
  nscoord& ComputedMinISize() { return mComputedMinSize.ISize(mWritingMode); }
  nscoord& ComputedMaxISize() { return mComputedMaxSize.ISize(mWritingMode); }
  nscoord& ComputedMinBSize() { return mComputedMinSize.BSize(mWritingMode); }
  nscoord& ComputedMaxBSize() { return mComputedMaxSize.BSize(mWritingMode); }

https://searchfox.org/mozilla-central/rev/76ccfc801e6b736c844cde3fddeab7a748fc8515/layout/generic/ReflowInput.h#344-349

Users of these two getters should use setters such as SetComputedISize() instead.

Note: for ReflowInput's internal usages, we don't want to call
SetComputedISize/SetComputedBSize because they tweak the resize flags. Also, if
we move the two getters to private section for ReflowInput's internal usage, the
external callers won't be able to call the const version of them because C++
resolves the function calls to the private ones.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ae2be22b628b
Part 1 - Remove ComputedISize() and ComputedBSize() that return writable references. r=emilio
https://hg.mozilla.org/integration/autoland/rev/2f1ca35b216c
Part 2 - Convert ComputedMin{I|B}Size() and ComputedMax{I|B}Size() that return writable references to setters. r=emilio
https://hg.mozilla.org/integration/autoland/rev/72d7c4f11f49
Part 3 - Remove the special case for viewport in SetComputedISize(). r=emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: