Closed Bug 1801028 Opened 2 years ago Closed 1 year ago

Make style editor methods which take HTML property and attribute separately take EditorInlineStyle instead

Categories

(Core :: DOM: Editor, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(18 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

I'm now afraid to touch the logic in CSSEditUtils because an user sets HTML property to nullptr and attribute to nsGkAtoms::align.
https://searchfox.org/mozilla-central/rev/d7d2cc647772de15c4c5aa47f74d25d0e379e404/editor/libeditor/HTMLEditorState.cpp#346

For avoiding regressions, I think that we should make all of them take EditorInlineStyle or EditorInlineStyleAndValue to check the relation at the root callers. Then, perhaps, they should be renamed to EditorElementStyle and EditorElementStyleAndValue since only setting attribute works as generic attribute change of any elements.

It does not make sense to make the static method take only EditorInlineStyle.

Depends on D162501

This patch creates a base class of EditorInlineStyle, the name is
EditorElementStyle. It requires only attribute of HTML. However, it's
obviously different from EditorInlineStyle's rule which is mHTMLProperty
cannot be nullptr. Therefore, the methods which can treat only
EditorInlineStyle do not want the data only whose attribute is not nullptr.
For solving this issue at build time, this approach is better than renaming
EditorInlineStyle and make it have the new mode.

Depends on D162513

It can take const Element& instead of nsINode*, then most callers can be
simpler.

Depends on D162516

And also making it and BuildCSSDeclarations return pairs of CSS property and
value with an array makes their callers simpler.

Depends on D162517

No longer blocks: 1801018
Duplicate of this bug: 1801018
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/6123f16df995
part 1: Make `HTMLEditor::IsRemovableParentStyleWithNewSpanElement` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/c53e1725fcd7
part 2: Move `CSSEditUtils::IsCSSInvertible` to `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/43809c02bf7e
part 3: Make `HTMLEditor::GetInlinePropertyBase` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/cec746f53e3f
part 4: Make `HTMLEditor::ClearStyleAt` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/6423b58e19d9
part 5: Make `HTMLEditor::SplitAncestorStyledInlineElementsAtRangeEdges` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/80add9777122
part 6: Make `HTMLEditor::SplitAncestorStyledInlineElementsAt` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e30ed4ad5e7e
part 7: Make `HTMLEditor::SetInlinePropertyOnTextNode` take `EditorInlineStyleAndValue` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/87a1b8d813d2
part 8: Make `HTMLEditor::SetInlinePropertyOnNode` and `HTMLEditor::SetInlinePropertyOnNodeImpl` take `EditorInlineStyleAndValue` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/98fc9276e73c
part 9: Make `HTMLEditor::ElementIsGoodContainerForTheStyle` take `EditorInlineStyleAndValue` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/883bf0a6d10e
part 10: Make `HTMLEditor::RemoveStyleInside` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/9252b81cc71c
part 11: Make `CSSEditUtils::Is(Computed|Specified)CSSEquivalentToHTMLInlineStyleSet` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/d6224033594d
part 12: Make `CSSEditUtils::Have(Specified|Computed)CSSEquivalentStyles` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/4f790bc14ced
part 13: Make `HTMLEditUtils::IsInlineStyleSetByElement` take `EditorInlineStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/b20755464664
part 14: Make `CSSEditUtils::SetCSSEquivalentToHTMLStyle(With|Without)Transaction` take `EditorElementStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/4f07e20564d4
part 15: Make `HTMLEditor::RemoveCSSEquivalentToHTMLStyle(With|Without)Transaction` take `EditorElementStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e59040efaf3b
part 16: Make `CSSEditUtils::GetComputedCSSEquivalentToHTMLInlineStyleSet` take `EditorElementStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/13da38d1f15e
part 17: Make `CSSEditUtils::IsCSSEditableProperty` take `EditorElementStyle` r=m_kato
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/59d691febda1
part 18: Make `CSSEditUtils::GenerateCSSDeclarationsFromHTMLStyle` take `EditorElementStyle` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: