Closed Bug 1307728 Opened 8 years ago Closed 8 years ago

Convert LineReflowStatus to an enum class

Categories

(Core :: Layout: Block and Inline, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: chenpighead, Assigned: chenpighead)

Details

Attachments

(2 files)

      No description provided.
Comment on attachment 8797964 [details]
Bug 1307728 - use LineReflowStatusToString to support debugging.

https://reviewboard.mozilla.org/r/83584/#review82160

There are few extra whitespaces that should be purged. I decided to purge them while converting LineReflowStatus to an enum class since the number is few. Hope this won't cause any pain while reviewing the patch.
Attachment #8797964 - Flags: review?(cam)
Attachment #8797965 - Flags: review?(cam)
Perhaps we should remove the "default:" branch in the switch so we'll
get a warning there if someone adds a new value without updating it?
(In reply to Mats Palmgren (:mats) from comment #4)
> Perhaps we should remove the "default:" branch in the switch so we'll
> get a warning there if someone adds a new value without updating it?

Hi Mats, shouldn't this be caught by the MOZ_ASSERT_UNREACHABLE() outside the switch?
Flags: needinfo?(mats)
An enum class cannot have a value other than defined, so "default:" branch is not needed.  And without the "default:", if some one adds a new value without a correspond switch-case added, compiler could output a warning says something like "enumeration value XXX not handled in switch."
Flags: needinfo?(mats)
(In reply to Ting-Yu Lin [:TYLin] (UTC+8) from comment #6)
> An enum class cannot have a value other than defined, so "default:" branch
> is not needed.  And without the "default:", if some one adds a new value
> without a correspond switch-case added, compiler could output a warning says
> something like "enumeration value XXX not handled in switch."

Sounds great! Mats, TY, thank you for the pointer. :-)

BTW, Mats, since you've already taken a peek at these patches, could you help review them?
Comment on attachment 8797964 [details]
Bug 1307728 - use LineReflowStatusToString to support debugging.

https://reviewboard.mozilla.org/r/83586/#review82464
Attachment #8797964 - Flags: review?(mats) → review+
Comment on attachment 8797965 [details]
Bug 1307728 - convert LineReflowStatus to an enum class.

https://reviewboard.mozilla.org/r/83588/#review82462

::: layout/generic/nsBlockFrame.cpp:3953
(Diff revision 2)
>  
>    aState.mFlags.mIsLineLayoutEmpty = aLineLayout.LineIsEmpty();
>  
>    // We only need to backup if the line isn't going to be reflowed again anyway
>    bool needsBackup = aLineLayout.NeedsBackup() &&
> -    (lineReflowStatus == LINE_REFLOW_STOP || lineReflowStatus == LINE_REFLOW_OK);
> +    (lineReflowStatus == LineReflowStatus::Stop || lineReflowStatus == LineReflowStatus::OK);

This line is a tad long, could you wrap it please?
Attachment #8797965 - Flags: review?(mats) → review+
Comment on attachment 8797965 [details]
Bug 1307728 - convert LineReflowStatus to an enum class.

https://reviewboard.mozilla.org/r/83588/#review82462

> This line is a tad long, could you wrap it please?

Sure, will do. Thank you for the review.
Pushed by jichen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc76dc5df6d9
use LineReflowStatusToString to support debugging. r=mats
https://hg.mozilla.org/integration/autoland/rev/6ffa724dba73
convert LineReflowStatus to an enum class. r=mats
https://hg.mozilla.org/mozilla-central/rev/dc76dc5df6d9
https://hg.mozilla.org/mozilla-central/rev/6ffa724dba73
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: