1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00
Commit Graph

72 Commits

Author SHA1 Message Date
Moonchild 2f20100059 Issue #3011 - Part 1: Add As{Text|Html}Editor() and AsEditorBase()
This adds helper functions to get specific types of content editors (if
possible) through the nsIEditor interface, as opposed to doing manual
casting and the ad hoc `GetHTMLEditor()` function.

Helper functions are spread out over multiple headers due to the
circular dependency issues that would be triggered otherwise.
2026-03-25 07:18:47 +08:00
Andy b11affbdf3 Issue #2106 - Clean-up: Un-prefix -moz-user-select in Comments 2025-07-08 10:01:21 +08:00
Andy 1a5b3dcae6 Issue #2106 - Follow-up: Additional Un-prefixing 2025-07-08 10:00:02 +08:00
Andy 4cc014cb6b Unprefix -moz-read-write / -moz-read-only 2025-07-04 22:27:22 +08:00
Moonchild c3f1c0cdba Issue #2721 - Remove nsILinkHandler.
This interface inly has a single implementation behind it, which is also
only used in 2 places after the previous commit. That's a lot of
additional complexity and compiler indirection for no good reason.
This change removes the interface and uses direct nsDocShell::Cast calls
instead of going through the interface in the few places left now that
we no longer build on a presentation context for links.
2025-06-17 09:25:00 +08:00
Moonchild 37de431ac0 Issue #2721 - Create special case exception for <A>.Click() outside of DOM
This removes the requirement for there to be a non-null PresShell to
dispatch `Click()` events on `<A>` elements (only), since the exception
to the rule has propagated to the spec.

With these changes it should now be possible do create an anchor and
`Click()` on it from JS without actually first attaching it to the DOM
of the presented document, as abused by scripted downloads in pages
(instead of using the A attribute to custom-name downloads).
2025-06-17 09:24:44 +08:00
Moonchild 139e7a7ac6 Issue #2678 - Remove NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED
This no longer does anything at this point, except add indirection.
2025-01-20 21:12:18 +08:00
FranklinDM f0116f51db Issue #2488 - Part 6: Define and declare CSSStyleSheet cast functions directly in StyleSheet
This renames AsGecko calls to AsConcrete and removes the header containing leftover Stylo macros.
2024-04-02 22:52:28 +08:00
FranklinDM 4d7bdedade Issue #2488 - Part 2: Remove the DeclarationBlock class and use Declaration directly 2024-04-02 22:47:20 +08:00
FranklinDM a93a7bed47 Issue #2112 - Part 5: Remove Servo from forwarding code used by magic pointer classes 2024-04-02 22:41:34 +08:00
FranklinDM 656ee639c5 Issue #2112 - Part 1: Remove Stylo tests 2024-04-02 22:29:48 +08:00
Moonchild b1c57e3b53 Issue #2388 - Part 3: Update tests 2024-01-18 12:01:51 +08:00
Moonchild dc253ce953 Issue #2362 - Fix click handling according to the spec.
This removes some hackery surrounding preventing content clicks, and in
general handles auxclick as it should, firing that event on secondary
buttons (wheel/right on default setup for right-handed mouse).
2023-12-06 14:50:08 +08:00
FranklinDM 010db07bf3 Issue #2135 - Bug 1066965: Make contentEditable and spellchecking to work in Shadow DOM 2023-03-06 16:16:21 +08:00
FranklinDM b2c77e5eda Issue #2135 - Bug 1356496: Don't use nsIDOM* in ConfirmSelectionInBody 2023-03-06 16:15:53 +08:00
Job Bautista cc6b0f11e7 Issue #2107 - Clean up caret when destroying editor.
Editor changes caret visibility during drag and drop. But when destroying
editor, we don't restore caret state. So we should restore it when destroying
editor.

Co-authored-by: Makoto Kato <m_kato@ga2.so-net.ne.jp>
2023-02-20 11:11:02 +08:00
Moonchild 1392f5f223 Issue #2019 - Do not dispatch keypress event for non-printable keys.
This will prevent the keypress DOM event from firing on keypresses
that do not produce printable keys (e.g. editing nav keys) in content.
This should not affect any chrome events that are in use.
Event dispatch can be re-enabled if necessary with the added pref.
2022-10-27 08:57:42 +08:00
Moonchild 5dfded811d Issue #80 - reinstated unified building for some large chunks of our code.
This should reduce compile complexity saving time and reducing linker stress.
2022-09-07 10:36:23 +08:00
Moonchild 0cd673d720 Issue #1656 - Part 6: Clean up the build files 2020-09-25 22:04:23 +08:00
Moonchild 30df895eb2 Issue #1656 - Part 3: Nuke more vim config lines in the tree.
Another S&R run with some smarter matching.
2020-09-25 22:04:17 +08:00
Moonchild 8c395520d9 Issue #1656 - Part 1: Nuke most vim config lines in the tree.
Since these are just interpreted comments, there's 0 impact on actual code.
This removes all lines that match /* vim: set(.*)tw=80: */ with S&R -- there are
a few others scattered around which will be removed manually in a second part.
2020-09-25 22:04:12 +08:00
Gaming4JC 5703454329 Issue #1621 - Part 4: Check whether node can be splited.
At first, HTMLEditor::GetActiveEditingHost might return null in this situation, we should check whether nullptr is returned. At second, SplitNodeDeep returns error since curent is design mode and selection node has no parent. So we should check error.

Ref: Bug 1350772
2020-08-06 10:23:48 +08:00
Gaming4JC ec1301a85d Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version.

Ref: Bug 1324996
2020-08-06 10:23:45 +08:00
Gaming4JC b6b2792a35 Issue #1621 - Part 2: Implement nsIAtom version of SetAttribute/RemoveAttribute/CloneAttirubte.
Add nsIAtom version of the following.
 - CloneAttribute
 - RemoveAttribute
 - RemoveAttributeOrEquivalent
 - SetAttribute
 - SetAttributeOrEquivalent

Ref: Bug 1324996
2020-08-06 10:23:43 +08:00
Gaming4JC 5260565a09 Issue #1621 - Part 1: CSSEditUtils should use atom for CSS property if possible.
There is a lot of string compare when using CSS property name. We should use nsGkAtoms instead.

Ref: Bug 1323138
2020-08-06 10:23:41 +08:00
Gaming4JC a1a1d76e6f Bug 1318570 - Clean up GetTextNode into TextEditRules.
EditorBase parameter of GetTextNode is unnecessary because it uses static method only. Also, we should return nsINode to reduce QI.

Resolves #1617
2020-08-01 07:12:40 +08:00
Gaming4JC 1a100c40d7 Bug 1316302 - Part 4: Refine HTMLEditRules::TryToJoinBlocks() and HTMLEditRules::MoveNodeSmart() with early return style for making scope of EditActionResult variable smaller
For now, let's make the scope of EditActionResult variable in them smaller without big change.

Tag #1563
2020-06-20 06:44:51 +08:00
Gaming4JC 4731db5173 Bug 1316302 - Part 3: Create EditActionResult class for making the methods which return nsresult, handled and canceled with out params
In a lot of places, edit action handlers and their helper methods return nsresult and aHandled and aCanceled with out params. However, the out params cause the code complicated since:

* it's not unclear if the method will overwrite aHandled and aCanceled value.
* callers need to create temporary variable event if some of them are not necessary.

This patch rewrites the helper methods of HTMLEditRules::WillDeleteSelection() with it.

Tag #1563
2020-06-20 06:44:49 +08:00
Gaming4JC 2afdd9f0ba Bug 1316302 - Part 2: WillDeleteSelection() should retry to handle it when selection is collapsed and JoinBlocks() doesn't handle nor cancel the action
When selection is collapsed and JoinBlocks() doesn't handle nor cancel the action, WillDeleteSelection() should move selection to the start/end of leftmost/rightmost editable leaf node and retry to handle the action again.

For avoiding infinite loop, it checks if selected node is changed actually before calling itself again.

Tag #1563
2020-06-20 06:44:47 +08:00
Gaming4JC bdd709df2b Bug 1316302 - Part 1: Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.

This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.

Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.

Tag #1563
2020-06-20 06:44:45 +08:00
Matt A. Tobin db72493615 Bug 1426494 - Share more code between nsIDocument and ShadowRoot
Tag #1375
2020-06-20 06:43:47 +08:00
wolfbeast d2ec4693eb Issue #1564 - Fix debug build dependencies 2020-05-30 07:13:05 +08:00
Moonchild 08bf05f6f1 Issue #80 - De-unify editor/txmgr and editor/txtsvc 2020-05-23 06:52:31 +08:00
Moonchild 7e3c172ffb Issue #80 - De-unify editor/libeditor 2020-05-23 06:52:28 +08:00
Moonchild 32db6ce7bf Issue #80 - De-unify editor/composer 2020-05-23 06:52:25 +08:00
Moonchild d62f0a0dd2 Issue #1517 - Remove dom.event.highrestimestamp.enabled pref
This resolves #1517
2020-05-09 06:55:11 +08:00
Matt A. Tobin a6f048fc42 Bug 1360154 - nsIPlaintextEditor might have to have hasText property for UpdateOverlayTextVisibility
* DocumentIsBody should return bool, not nsresult
* Add fast path to check whether valus is emtpy

Tag #1375
2020-04-18 07:06:55 +08:00
Matt A. Tobin a7ba34c672 Bug 1418002 - Remove HTMLContentElement
Tag #1375
2020-04-18 07:05:35 +08:00
Matt A. Tobin 592c34bc79 Bug 1402941 - Add HTMLSlotElement
Tag #1375
2020-04-18 07:05:10 +08:00
Matt A. Tobin 5917636e83 Bug 1396584 - Remove support for multiple ShadowRoots
Tag #1375
2020-04-18 07:05:03 +08:00
Matt A. Tobin a665a8796a Bug 1400777 - Slim down nsElementTable.h
* Remove eHTMLTags
* De-expose HTML group constants[]
* De-expose gHTMLElements[]
* Split nsHTMLElement
* Clean up nsElementTable.{cpp,h}
* Fixup for eHTMLTag removal in Parser

Tag #1375
2020-04-18 07:05:00 +08:00
Matt A. Tobin 9928baf912 Issue #1375 - Stop largely using the parser service
This is based on Bug 1395828

* Add nsHTMLElement::IsBlock()
* Rename nsHTMLTags methods
* Remove AssertParserServiceIsCorrect()
* Remove most uses of nsIParserService/nsParserService
2020-04-18 07:04:57 +08:00
Matt A. Tobin 6ce9cc2a25 Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
2020-04-18 07:04:38 +08:00
Matt A. Tobin 4e14355697 Bug 1372829 - Part 2: mozilla::EditorBase should cache raw pointer of nsISelectionController and nsIDocument with nsWeakPtr
Tag #1375
2020-04-18 07:04:22 +08:00
Matt A. Tobin 5d444ef68a Bug 1332353 - Make it clearer when a stylesheet is really owned by its mDocument
Tag #1375
2020-04-18 07:04:19 +08:00
Matt A. Tobin db34da8e01 Bug 1372829 - Part 1: Make mozilla::PlaceholderTransaction inherit mozilla::SupportsWeakPtr instead of nsSupportsWeakReference
Tag #1375
2020-04-18 07:04:14 +08:00
Matt A. Tobin 8e7852efa2 Bug 1371170 - Add non-virtual EditorBase::GetSelectionController
Tag #1375
2020-04-18 07:04:10 +08:00
Matt A. Tobin 32e4ad01e3 Bug 1337698 - Use UniquePtr instead of nsAutoPtr in editor
* PlaceholderTransaction should use UniquePtr
* HTMLEditor should use UniquePtr
* TypeInState should use UniquePtr

Tag #1375
2020-04-18 07:04:07 +08:00
Matt A. Tobin 9d8343e19c Bug 1367683 - Optimize initializing nsRange
Tag #1375
2020-04-18 07:04:01 +08:00
Matt A. Tobin 9220996e92 Bug 1348851 - Use new block when better selection isn't found.
Tag #1375
2020-04-18 07:03:58 +08:00