Skip to content
Snippets Groups Projects
  1. May 31, 2023
  2. May 28, 2023
  3. May 24, 2023
  4. May 23, 2023
    • Sean Feng's avatar
      Bug 1817723 - Allow HTMLEditor can receive events when the focus is switched... · df6c9aef
      Sean Feng authored
      Bug 1817723 - Allow HTMLEditor can receive events when the focus is switched between elements in the same shadow tree. r=masayuki
      
      The EditorEventListener for HTMLEditor is registered on document,
      which is problematic because it can't receive events when the focus is
      switched between elements in the same shadow tree due to shadow dom
      encapsulation.
      
      We fix this by moving the EditorEventListener to nsWindowRoot so the
      events can always be received.
      
      Differential Revision: https://phabricator.services.mozilla.com/D178215
      df6c9aef
    • Masayuki Nakano's avatar
      Bug 1833320 - Make `HTMLEditor::HandleInsertParagraphInListItemElement`... · fb4359c2
      Masayuki Nakano authored
      Bug 1833320 - Make `HTMLEditor::HandleInsertParagraphInListItemElement` consider caret position without `WSScanResult` if it reaches a block boundary r=m_kato
      
      When `WSRunScanner::ScanNextVisibleNodeOrBlockBoundary` reaches a block
      boundary, it may return `WSScanResult` without valid position value from
      this path:
      https://searchfox.org/mozilla-central/rev/11a4d97a7b5cdfa133f4bda4525649f651703018/editor/libeditor/WSRunObject.cpp#1777-1782
      
      That happens if the reason is `WSType::CurrentBlockBoundary` or
      `WSType::OtherBlockBoundary` even in usual cases.
      
      If it's `WSType::CurrentBlockBoundary`, `TextFragmentDataAtStartRef().EndRef()`
      may point in a text node in the block, but its `GetEndReasonContent()` returns
      the block.  I'm not sure whether this is intentional result. (I guess t's a
      bug.)
      
      If it's `WSType::OtherBlockBoundary`, `TextFragmentDataAtStartRef().EndRef()`
      may point in the list item, but `GetEndReasonContent()` returns a child block.
      
      Those scan result change needs to understand `TextFragmentData` behavior again,
      but it's difficult as you know. Therefore, this fixes the caller side not to
      use `WSScanResult::Point()` if it meets a block boundary since start of the
      block boundary is a good place to put caret.
      
      Differential Revision: https://phabricator.services.mozilla.com/D178281
      fb4359c2
  5. May 20, 2023
  6. May 19, 2023
  7. May 18, 2023
  8. May 16, 2023
    • Masayuki Nakano's avatar
      Bug 1832710 - Make `EditorBase::DispatchClipboardEventAndUpdateClipboard`... · 859144ba
      Masayuki Nakano authored
      Bug 1832710 - Make `EditorBase::DispatchClipboardEventAndUpdateClipboard` handle `ePasteNoFormatting` event message r=m_kato
      
      Just a mistake, it should treat `ePasteNoFormatting` as an equivalent of `ePaste`.
      
      Differential Revision: https://phabricator.services.mozilla.com/D177988
      859144ba
    • Masayuki Nakano's avatar
      Bug 1828078 - part 2: Stop moving comment nodes when deleting a block/line boundary r=m_kato · 34b8e92a
      Masayuki Nakano authored
      With the preceding patch, comment nodes are also moved at deleting a block/line
      boundary.  However, this causes some WPT failures.  Therefore, this adds an
      option to the related methods.
      
      Note that Chrome removes all comment nodes in moving nodes.  However, I don't
      have the motivation to do that because it requires additional cost and I have
      no idea to improve the compatibility in usual web apps.  So I believe that
      doing it wastes the runtime performance unless we'd get a bug reports by the
      difference.
      
      Therefore, this patch does not update WPTs too.
      
      Differential Revision: https://phabricator.services.mozilla.com/D176767
      34b8e92a
    • Masayuki Nakano's avatar
      Bug 1828078 - part 1: Make `HTMLEditUtils::CanNodeContain` handle comment node r=m_kato · 95e22b6d
      Masayuki Nakano authored
      `HTMLEditUtils::CanNodeContain` does not handle comment nodes and cdata section
      nodes (the latter one is available only in XHTML documents, it's treated as a
      comment node in HTML documents).
      
      When copying HTML from Word on Windows, that contains 2 comment nodes at
      start of pasting body (which does not appear in clipboard viewer, so, Gecko
      creates them somewhere) and that causes `HTMLEditUtils::CanNodeContain` returns
      `false` for any parents.  Therefore,
      `HTMLEditor::InsertNodeIntoProperAncestorWithTransaction` returns error
      and the pasting fails with odd state and unexpectedly split the list item in
      `HTMLWithContextInserter::InsertContents`.  Finally, undoing fails to do some
      of them and causes destroying the editable nodes.
      
      This patch makes `HTMLEditUtils::CanNodeContain` work with comment nodes
      and cdata section nodes (the latter is treated as a comment node since there
      is no "cdata" tag definition of `nsHTMLTag`) and
      `HTMLEditor::InsertNodeIntoProperAncestorWithTransaction` just return
      "not handled" result for some other types of nodes which cannot be inserted
      in any elements.
      
      Note that the result of pasting from Word is different from Chrome's result.
      Chrome does not paste such comment nodes (but inserts comment nodes with
      `insertHTML` command).  For now, I don't want to work on fixing this
      compatibility issue since comment nodes does not cause any known troubles.
      Therefore, this patch does not contain WPT updates.
      
      Differential Revision: https://phabricator.services.mozilla.com/D176766
      95e22b6d
  9. May 10, 2023
  10. May 03, 2023
  11. Apr 25, 2023
  12. Apr 21, 2023
  13. Apr 11, 2023
    • Masayuki Nakano's avatar
      Bug 1807495 - part 1: Make `Document` notify `HTMLEditor` and... · e4a81444
      Masayuki Nakano authored
      Bug 1807495 - part 1: Make `Document` notify `HTMLEditor` and `IMEStateManager` of pseudo focus change when editing state of focused editing host or document is changed r=smaug,m_kato
      
      `IMEStateManager` basically runs at focus change.  However, when `designMode`
      is set to `"off"` or focused editing host becomes non-editable (removing
      `contenteditable` attribute or `contenteditable` attribute is set to `false`),
      IME may be disabled without a focus change.  Therefore, `Document` needs to
      notify `IMEStateManager` of the timing.
      
      Additionally, `nsFocusManager` does not change focus when focused element
      becomes not focusable (bug 1807597).  Therefore, `Document` needs to kick
      `focus` or `blur` event handler of `HTMLEditor` when active editing host
      becomes not editable.
      
      However, if an ancestor of focused element becomes editable, I think that
      `HTMLEditor` does not work well without focus move because it computes
      editing host with current editing state in a lot of places, but `Selection`
      and `nsFocusManager::GetFocusedElement` keeps working with previous focused
      element which is now a editable child of editing host.  Therefore, this patch
      marks them as `todo` in the new tests.
      
      Differential Revision: https://phabricator.services.mozilla.com/D171196
      e4a81444
  14. Apr 05, 2023
    • Emilio Cobos Álvarez's avatar
      Bug 1825825 - Simplify NAC setup. r=smaug · 641fa207
      Emilio Cobos Álvarez authored
      Make all UA widgets also NAC.
      
      Keep the UA widget flag but break at anonymous subtree boundaries, so
      that only nodes inside the UA widget directly (and not NAC from those)
      get the flag.
      
      This is important because two callers depend on this difference:
      
       * The style system, since we still want to match content rules from
         stylesheets in the UA widget. We also match user rules, which is a
         bit sketchy, but that was the previous behavior, will file a
         follow-up for that.
      
       * The reflector code, since we want the scope for UA widgets to not
         include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
         got it wrong.
      
      After this patch, ChromeOnlyAccess is equivalent to
      IsInNativeAnonymousSubtree, so we should probably unify the naming.
      That's left for a follow-up patch because I don't have a strong
      preference.
      
      Differential Revision: https://phabricator.services.mozilla.com/D174310
      641fa207
  15. Mar 22, 2023
  16. Mar 21, 2023
  17. Mar 16, 2023
    • Masayuki Nakano's avatar
      Bug 1820972 - Make `nsBaseDragService::FireDragEventAtSource` update... · e5f02493
      Masayuki Nakano authored
      Bug 1820972 - Make `nsBaseDragService::FireDragEventAtSource` update `mSourceNode` if it's disconnected while `HTMLEditor` deletes selection caused by a drag operation r=edgar
      
      The source node is typically a text node, and it may be editable by
      `contenteditable` or `designMode`.  In that case, the source node may be removed
      during the DnD session even without tricky JS code.  In this case, Blink and
      WebKit updates the source node to dispatch `dragend` to the editing host.
      This behavior does not conform to the standardized DnD behavior, however,
      this is reasonable for editor apps which want to listen to events in editing
      host or window/document for footprint and/or performance reason.  Therefore,
      we should follow their behavior.
      
      Differential Revision: https://phabricator.services.mozilla.com/D172091
      e5f02493
  18. Mar 13, 2023
  19. Mar 10, 2023
Loading