Commit graph

382 commits

Author SHA1 Message Date
Olli Pettay
e8b7bce992 Bug 1799354, replaceChildren should fire DOMNodeRemoved when needed (and not assert about 'Want to fire DOMNodeRemoved event, but it's not safe'), r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D161682
2022-11-16 20:29:53 +00:00
Sean Feng
c6d5b35934 Bug 1741936 - Implement focus delegate algorithm r=emilio
Spec: https://html.spec.whatwg.org/multipage/interaction.html#focus-delegate

Differential Revision: https://phabricator.services.mozilla.com/D153689
2022-10-14 01:20:08 +00:00
Olli Pettay
93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez
6af42b7029 Bug 1771791 - Use regular ComputeIndexOf in ComputeFlatTreeIndexOf if there's no Shadow DOM involved. r=mrobinson
Untested, but seems like it should address the regression.

Differential Revision: https://phabricator.services.mozilla.com/D147865
2022-06-02 09:24:16 +00:00
Martin Robinson
cac491e1fd Bug 1477524 - Update quotes and counters to work trough the flattened tree r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146693
2022-05-26 16:12:46 +00:00
Norisz Fay
28db98ade1 Backed out changeset ce66cc2cbb95 (bug 1477524) for causing build bustages on nsCounterManager.cpp CLOSED TREE 2022-05-26 15:24:40 +03:00
Martin Robinson
786890b5c4 Bug 1477524 - Update quotes and counters to work trough the flattened tree r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146693
2022-05-26 11:15:16 +00:00
Emilio Cobos Álvarez
1ce0975b8e Bug 1761493 - Make Gecko internally consistent wrt what a link is. r=smaug
This is mostly edge-casey, but see bug 1757156 for an example where it's
causing some issues (granted, they could use `href="#"` or something
instead of an empty href).

It feels weird if a link looks like a link (because the CSS definition
of a link matches, which is "has an href") but then mostly doesn't
behave as a link.

We can't navigate anywhere if we don't have a valid URI but maybe JS
handles the relevant events as in bug 1757156.

Use the CSS definition (has href) since that's interoperable across
browsers. This should also make some stuff much faster (since checking
'is link' is now just a bit check instead of a virtual call).

(Awaiting try results, if no tests need adjustments then I need to write
some)

Differential Revision: https://phabricator.services.mozilla.com/D142107
2022-03-30 17:34:31 +00:00
Sylvestre Ledru
98949ee751 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Masayuki Nakano
04af341212 Bug 1753487 - Make nsIContent::GetEditingHost() not assume that itself is an element if there is no parent element r=peterv
If the instance is not an element and is a child of `Document` or something
non-element node, the method calls `this->AsElement()` in non-element instance.

It should check whether it's an element node or not when there is no editable
parent element.

Differential Revision: https://phabricator.services.mozilla.com/D138230
2022-02-10 12:48:14 +00:00
Masayuki Nakano
f2baf0d9ab Bug 1741148 - part 1: Rename nsINode::ComputeIndexOf to ComputeIndexOf_Deprecated r=smaug
It's hard to fix some callers.  Therefore, in this bug, we should fix only
simple cases.  Therefore, we should rename existing API first.

Differential Revision: https://phabricator.services.mozilla.com/D131334
2021-12-09 08:32:30 +00:00
Mike Hommey
8e411675ac Bug 1744877 - Remove --disable-xul. r=Gijs
Building with --disable-xul has been busted since _at least_ bug
1082579, for more than 7 years (I didn't try to track that down
further). It's time to recognize that the option serves no purpose.

Differential Revision: https://phabricator.services.mozilla.com/D133161
2021-12-08 21:37:11 +00:00
Masayuki Nakano
4341d6fb0c Bug 1455514 - part 1: Add accessors and static helper methods to retrieve nsINode or its concrete classes from EventTarget r=smaug
Currently, checking whether an `EventTarget` is `nsINode` (or its concrete
classes) or not requires a QI, but it's expensive and used a lot while we
handle each event.  Therefore, it'd be nicer for creating a virtual method,
`EventTarget::IsNode()` and use it for the check.

If trying to convert `EventTarget` to a concrete class, it may require two
virtual method calls.  I'm not sure whether it's cheaper than a QI, but at
least, it won't depend on the UUID check order of `QueryInterface()` when
multiple interfaces are implemented.

Differential Revision: https://phabricator.services.mozilla.com/D129781
2021-11-02 13:03:43 +00:00
Masayuki Nakano
25a3c48305 Bug 1732845 - Add nsINode::IsInDesignMode() to check whether the node is directly in design mode r=smaug
There are a lot of check of `Document`'s editable state **with** comments. This
means that it's unclear for developers that only `Document` node is editable in
design mode.

Additionally, there are some points which use composed document rather than
uncomposed document even though the raw API uses uncomposed document. Comparing
with the other browsers, checking uncomposed document is compatible behavior,
i.e., nodes in shadow trees are not editable unless `contenteditable`.

Therefore, `nsINode` should have a method to check whether it's in design mode
or not.

Note that it may be called with a node in UA widget.  Therefore, this patch
adds new checks if it's in UA widget subtree or native anonymous subtree,
checking whether it's in design mode with its host.

Differential Revision: https://phabricator.services.mozilla.com/D126764
2021-10-12 03:14:43 +00:00
Emilio Cobos Álvarez
8d7ad39477 Bug 1730022 - Improve debuggability of nsIContent. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D125192
2021-09-10 16:39:15 +00:00
Sean Feng
2aa145db40 Bug 1705141 - Implement imperative slotting API r=smaug,emilio
Differential Revision: https://phabricator.services.mozilla.com/D119444
2021-07-20 18:06:25 +00:00
Simon Giesecke
4803e61816 Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 17:56:46 +00:00
Csoregi Natalia
f54ee076ae Backed out 13 changesets (bug 708901, bug 1184468) for causing build bustage on GeckoViewHistory.cpp. CLOSED TREE
Backed out changeset b1e4c01e63b8 (bug 708901)
Backed out changeset 37b52cce83c0 (bug 708901)
Backed out changeset eee75f33f060 (bug 708901)
Backed out changeset 479bf64c7986 (bug 708901)
Backed out changeset 15a8fb94d15d (bug 708901)
Backed out changeset be31ccd9a61d (bug 708901)
Backed out changeset fc54f4eaedd5 (bug 708901)
Backed out changeset 03c3a56c3d13 (bug 708901)
Backed out changeset 73f11d3c1298 (bug 708901)
Backed out changeset aed22fd80893 (bug 708901)
Backed out changeset 74d8249fbe7e (bug 708901)
Backed out changeset acb725eb3c1d (bug 1184468)
Backed out changeset 70f3ea6efec4 (bug 1184468)
2021-03-24 19:26:20 +02:00
Simon Giesecke
82e566bfca Bug 708901 - Migrate to nsTHashSet in dom/base. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108593
2021-03-24 16:58:58 +00:00
Simon Giesecke
91fdeec18c Bug 1695162 - Migrate from custom hashtable iteration to range-based for in accessible, dom/animation, dom/base, dom/localstorage, gfx/thebes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D106895
2021-03-12 16:14:58 +00:00
Alexandru Michis
c691800cb0 Backed out changeset fd03162e726d (bug 1695162) for causing bustages in Document.cpp
CLOSED TREE
2021-03-12 17:10:02 +02:00
Simon Giesecke
2fb6095f16 Bug 1695162 - Migrate from custom hashtable iteration to range-based for in accessible, dom/animation, dom/base, dom/localstorage, gfx/thebes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D106895
2021-03-12 14:54:08 +00:00
Tooru Fujisawa
e84c1c58f7 Bug 1690274 - Part 3: Use mozilla::BitBloomFilter instead of mozilla::CountingBloomFilter. r=sg
BitBloomFilter takes 1/8 spaces than CountingBloomFilter,
and all consumers don't need CountingBloomFilter::remove.

Differential Revision: https://phabricator.services.mozilla.com/D104691
2021-02-16 22:07:06 +00:00
Tooru Fujisawa
b1044551e9 Bug 1690274 - Part 1: Rename mozilla::BloomFilter to mozilla::CountingBloomFilter. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D104689
2021-02-16 22:07:05 +00:00
Masayuki Nakano
d27602eee6 Bug 1683226 - part 1: Make IMEState::Enabled an enum class r=m_kato,geckoview-reviewers
Before deleting `IMEState::Enabled::PLUGIN`, let's make it an enum class
for making the change safer.  Almost all of this change is done by
"replace" of VSCode.

Differential Revision: https://phabricator.services.mozilla.com/D100100
2020-12-21 05:52:03 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
longsonr
875f5e88ac Bug 1259861 - Move everything else into the mozilla namespace in layout/svg r=dholbert
Also: adjust include paths to be consistent for usages of various SVG headers,
and remove unused SVG includes (mostly for "utils" classes),
and drop stray "ns" from already-renamed SVG classes in various code comments.

Differential Revision: https://phabricator.services.mozilla.com/D83140
2020-07-11 02:20:20 +00:00
Emilio Cobos Álvarez
b9c1bf761c Bug 312971 - Unprefix -moz-read-write / -moz-read-only. r=edgar
And remove some duplicated tests from WPT.

Differential Revision: https://phabricator.services.mozilla.com/D75231
2020-05-14 16:46:08 +00:00
Kris Maglione
c5353a7809 Bug 1630691: Part 1 - Get rid of most of the remaining mozbrowser API. r=nika,mtigley,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D71226
2020-04-29 19:29:06 +00:00
Andi-Bogdan Postelnicu
38afb32dc5 Bug 1626555 - Make dom/base buildable outside of unified-build environment. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D69183
2020-04-29 09:02:05 +00:00
Mirko Brodesser
c477d38a70 Bug 1623858: part 2) Declare nsIContent::HasIndependentSelection const. r=smaug
Depends on D67599

Differential Revision: https://phabricator.services.mozilla.com/D67600

--HG--
extra : moz-landing-system : lando
2020-03-20 13:23:00 +00:00
Sean Feng
053f3e648d Bug 1377999 - Make nsIContent to declare a final DeleteCycleCollectable r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63263

--HG--
extra : moz-landing-system : lando
2020-03-17 14:53:00 +00:00
Simon Giesecke
d94419173b Bug 1613985 - Use default for equivalent-to-default constructors/destructors in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63102

--HG--
extra : moz-landing-system : lando
2020-02-21 10:41:47 +00:00
Masayuki Nakano
1110bedb45 Bug 1613830 - Add nsINode::GetAsElementOrParentElement() r=smaug
This patch assumes that only element node can have content node.  I.e., we
won't hit the following `MOZ_ASSERT`:

```
Element* element = nullptr;
nsIContent* content = aContent;
while (content) {
  if (content->IsElement()) {
    element = content->AsElement();
    break;
  }
  content = content->GetParent();
}
MOZ_ASSERT(!content || content == element || content->GetParent() == element);
```

Differential Revision: https://phabricator.services.mozilla.com/D63308

--HG--
extra : moz-landing-system : lando
2020-02-21 02:47:05 +00:00
Emilio Cobos Álvarez
69c87f6cb2 Bug 1613349 - Rename nsINode::DeleteProperty to RemoveProperty. r=smaug
And the related methods as well.

Differential Revision: https://phabricator.services.mozilla.com/D61768

--HG--
extra : moz-landing-system : lando
2020-02-06 16:06:49 +00:00
Christoph Walcher
9d0708ddd2 Bug 1607702 - Extract nsuri displaynames to nsNameSpaceManager r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D59274

--HG--
extra : moz-landing-system : lando
2020-01-10 18:45:12 +00:00
Christoph Walcher
855264d3a5 Bug 1596476 - Remove nsuri_xbl static atom r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D53333

--HG--
extra : moz-landing-system : lando
2020-01-08 04:44:33 +00:00
Emma Malysz
dcd4934531 Bug 1596478, remove references to kNameSpaceID_XBL except for instance in nsNameSpaceManager.cpp r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D58872

--HG--
extra : moz-landing-system : lando
2020-01-07 21:51:27 +00:00
Gabriele Svelto
ace6d1063f Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-06 09:24:56 +00:00
Dorel Luca
a381d5c96d Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto
bc9290f767 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442

--HG--
extra : moz-landing-system : lando
2019-12-04 15:01:19 +00:00
Boris Zbarsky
e9cfb6db8e Bug 1596458 part 2. Fix the innerHTML setter for shadow DOM cases in XML to supply the right context. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D53077

--HG--
extra : moz-landing-system : lando
2019-11-15 12:45:40 +00:00
Emilio Cobos Álvarez
7e683e7615 Bug 1596209 - Remove nsIContent::GetBindingParent. r=smaug
It's unused after all the previous patches.

Differential Revision: https://phabricator.services.mozilla.com/D53217

--HG--
extra : moz-landing-system : lando
2019-11-15 18:19:37 +00:00
Sebastian Hengst
9ad1a69782 Backed out changeset 0478d1bf6e32 (bug 1596209) on request from emilio. CLOSED TREE
--HG--
extra : rebase_source : 3c14fff8de93d231125ec8714aae98e51fbf6aeb
extra : amend_source : 5f1791c11b41593330cc8c94bdf67e1a0cf11fb1
2019-11-15 19:11:06 +01:00
Emilio Cobos Álvarez
5b84f966ac Bug 1596209 - Remove nsIContent::GetBindingParent. r=smaug
It's unused after all the previous patches.

Differential Revision: https://phabricator.services.mozilla.com/D53217

--HG--
extra : moz-landing-system : lando
2019-11-15 16:46:29 +00:00
Emilio Cobos Álvarez
ebc571fca6 Bug 1596768 - Remove GetBindingParent() usage in GetEventTargetParent. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D53197

--HG--
extra : moz-landing-system : lando
2019-11-15 17:00:14 +00:00
Emilio Cobos Álvarez
c5d9f3067b Bug 1596768 - Remove GetBindingParent usage in nsIContent::FindFirstNonChromeOnlyAccessContent. r=smaug
This one is a bit subtle, but not too much.

Depends on D53193

Differential Revision: https://phabricator.services.mozilla.com/D53194

--HG--
extra : moz-landing-system : lando
2019-11-15 15:41:07 +00:00
Emilio Cobos Álvarez
f36874d798 Bug 1596445 - Add some supporting code to nsINode to deal with NAC and shadow DOM separately. r=bzbarsky
We'll use these to remove GetBindingParent.

Differential Revision: https://phabricator.services.mozilla.com/D53029

--HG--
extra : moz-landing-system : lando
2019-11-15 15:10:45 +00:00
Emilio Cobos Álvarez
9bd8bd3152 Bug 1596391 - Remove Get/SetXBLInsertionPoint. r=smaug
They're dead.

Depends on D52992

Differential Revision: https://phabricator.services.mozilla.com/D52993

--HG--
extra : moz-landing-system : lando
2019-11-14 12:56:44 +00:00