Closed Bug 1625633 Opened 5 years ago Closed 5 years ago

Sort out `WSType`

Categories

(Core :: DOM: Editor, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

It should be hidden in WSRunObject.h and WSRunObject.cpp since it's hard to understand without reading WSRunScanner code.

It means why the WSFragment ends by. I.e., it tells next content type of
the fragment.

Similarly, it indicates the previous content type of the fragment.

Depends on D68673

Surprisingly, each value meaning of WSFragment::mType is different from
WSFragment::mRightType and WSFragment::mLeftType. It uses only 3 bits,
WSType::normalWS, WSType::leadingWS and WSType::trailingWS.
According to the second if block of WSRunScanner::GetRuns(), the latter
2 values mean whether the fragment starts from and/or ends by a hard line.
And also, according to there, normalWS means the run is visible or not.
(However, according to the first if block, Visible::Yes might be set to
for empty fragment too, but I have no better idea of its name.)

Therefore, mType & WSType::leadningWS can call "is start of hard line",
mType & WSType::trailingWS can call "is end of hard line",
mType == WSType::normalWS can call "is visible and not edges of hard line"
and mType & WSType::normalWS can call "is not edges of hard line".

So, 3 bool members can represent all of their status. Therefore, we should
get rid of this odd use case of WSType.

Depends on D68674

Now, WSType is used only by WSRunScanner, WSRunObject and WSScanResult.
We should hide this mysterious enum from other classes for making other
developers easier to understand. Therefore, this patch moves WSType into
WSScanResult and share it with WSRunScanner with making them friends.

Depends on D68675

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/72e16880bb64 part 1: Encapsulate `WSFragment::mRightType` r=m_kato https://hg.mozilla.org/integration/autoland/rev/cadb96d25fbf part 2: Encapsulate `WSFragment::mLeftType` r=m_kato https://hg.mozilla.org/integration/autoland/rev/5a4357636b81 part 3: Get rid of `WSFragment::mType` r=m_kato https://hg.mozilla.org/integration/autoland/rev/774d32b9641e part 4: Move `WSType` into `WSRunScanner` to hide it from `HTMLEditor` r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: