Граф коммитов

130 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez 47afabb81a Bug 1773070 - While at it use some better names for some bits. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148538
2022-06-07 23:09:53 +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 505c0411c7 Bug 1771713 - Fix content state change notification when a selected option is inserted. r=edgar
This bug was revealed by the patch for bug 1381071, which caused
failures in dom/html/test/test_bug596511.html.

The test was not using the usual style invalidation machinery because it
was in a display: none subtree.

Tweak the test to check both the "raw" state (via matches()) and the
style, which should show invalidation issues more clearly.

Differential Revision: https://phabricator.services.mozilla.com/D147630
2022-05-30 11:06:21 +00:00
Kagami Sascha Rosylight b1653a09c7 Bug 1767996 - Apply readability-make-member-function-const on dom/html r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D145627
2022-05-13 05:35:25 +00:00
Emilio Cobos Álvarez ab3a92e515 Bug 1440506 - Do not destroy dropdowns on reframe. r=dholbert
We switch the open state storage to the element rather than the frame,
to be able to preserve it across reframes.

The code is loosely based on nsHideViewer in nsSubDocument.cpp, but it's
simpler because we don't need to do restoration shenanigans.

Differential Revision: https://phabricator.services.mozilla.com/D138689
2022-02-15 22:00:27 +00:00
Emilio Cobos Álvarez b651bfe99a Bug 1744009 - Simplify combobox <select> code. r=mconley,dholbert
With this patch on its own we get some a11y tests failures, but those
are fixed on a later patch.

Combobox select no longer creates frames for its <options>, nor an
nsListControlFrame. Instead, it computes its right intrinsic size using
the largest size of the options. This is better, because we render the
option text using the select style so if the select and option styles
are mismatched it'd cause changes in the size of the select when text
changes. See the following in a build without the patch, for example:

  <select>
    <option>ABC</option>
    <option style="font-size: 1px">Something long</option>
  </select>

This seems like a rather obscure case, but it's important to get it
right, see bug 1741888.

With this patch we use the same setup in content and parent processes
(this needs bug 1596852 and bug 1744152). This means we can remove a
bunch of the native view and popup code in nsListControlFrame. A couple
browser_* tests are affected by this change and have been tweaked
appropriately (the changes there are trivial).

Not creating an nsListControlFrame for dropdown select means that we
need to move a bunch of the event handling code from nsListControlFrame
to a common place that nsComboboxControlFrame can also use. That place
is HTMLSelectEventListener, and I think the setup is much nicer than
having the code intertwined with nsListControlFrame. It should be
relatively straight-forward to review, mostly moving code from one part
to another.

Another thing that we need to do in HTMLSelectEventListener that we
didn't use to do is listening for DOM mutations on the dropdown. Before,
we were relying on changes like text mutations triggering a reflow of
the listcontrolframe, which also triggered a reflow of the
comboboxcontrolframe, which in turn updated the text of the anonymous
content. Now we need to trigger that reflow manually.

There are some further simplifications that can be done after this
lands (cleanup naming of openInParentProcess and so on, among others),
but I'd rather land this first (after the merge of course) and work on
them separately.

Differential Revision: https://phabricator.services.mozilla.com/D132719
2022-01-17 11:10:05 +00:00
Marian-Vasile Laza 35a88d897e Backed out 2 changesets (bug 1744009) for causing reftest failures on select-3.html.
Backed out changeset 3e44e31d3d12 (bug 1744009)
Backed out changeset 619389788775 (bug 1744009)
2022-01-17 11:14:27 +02:00
Emilio Cobos Álvarez a8d469a8d0 Bug 1744009 - Simplify combobox <select> code. r=mconley,dholbert
With this patch on its own we get some a11y tests failures, but those
are fixed on a later patch.

Combobox select no longer creates frames for its <options>, nor an
nsListControlFrame. Instead, it computes its right intrinsic size using
the largest size of the options. This is better, because we render the
option text using the select style so if the select and option styles
are mismatched it'd cause changes in the size of the select when text
changes. See the following in a build without the patch, for example:

  <select>
    <option>ABC</option>
    <option style="font-size: 1px">Something long</option>
  </select>

This seems like a rather obscure case, but it's important to get it
right, see bug 1741888.

With this patch we use the same setup in content and parent processes
(this needs bug 1596852 and bug 1744152). This means we can remove a
bunch of the native view and popup code in nsListControlFrame. A couple
browser_* tests are affected by this change and have been tweaked
appropriately (the changes there are trivial).

Not creating an nsListControlFrame for dropdown select means that we
need to move a bunch of the event handling code from nsListControlFrame
to a common place that nsComboboxControlFrame can also use. That place
is HTMLSelectEventListener, and I think the setup is much nicer than
having the code intertwined with nsListControlFrame. It should be
relatively straight-forward to review, mostly moving code from one part
to another.

Another thing that we need to do in HTMLSelectEventListener that we
didn't use to do is listening for DOM mutations on the dropdown. Before,
we were relying on changes like text mutations triggering a reflow of
the listcontrolframe, which also triggered a reflow of the
comboboxcontrolframe, which in turn updated the text of the anonymous
content. Now we need to trigger that reflow manually.

There are some further simplifications that can be done after this
lands (cleanup naming of openInParentProcess and so on, among others),
but I'd rather land this first (after the merge of course) and work on
them separately.

Differential Revision: https://phabricator.services.mozilla.com/D132719
2022-01-16 23:31:22 +00:00
Masayuki Nakano 3816ca9546 Bug 1741148 - part 3: Make users of `nsINode::ComputeIndexOf_Deprecated()` use `nsINode::ComputeIndexOf()` if the result is not set to `int32_t` nor return as `int32_t` r=smaug
This patch fixes only the cases if the result of `ComputeIndexOf_Deprecated()`
is used as unsigned integer with implicit or explicit cast.

Differential Revision: https://phabricator.services.mozilla.com/D131336
2021-12-09 11:55:36 +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
Edgar Chen 531ef37175 Bug 1556364 - Part 2-1: Split nsGenericHTMLFormControlElement-only members from nsIConstraintValidation to a separated class; r=smaug
As ElementInternal has it own implmentation.

Differential Revision: https://phabricator.services.mozilla.com/D130259
2021-11-26 11:47:39 +00:00
Marian-Vasile Laza 807599b18f Backed out 5 changesets (bug 1556364) for causing web-platform test failures. CLOSED TREE
Backed out changeset dabffbe71a31 (bug 1556364)
Backed out changeset 76fc30f27c39 (bug 1556364)
Backed out changeset f6f7f949551f (bug 1556364)
Backed out changeset c77ef41d43d4 (bug 1556364)
Backed out changeset 2c8c74e99e47 (bug 1556364)
2021-11-26 05:01:08 +02:00
Edgar Chen ab401654c2 Bug 1556364 - Part 2-1: Split nsGenericHTMLFormControlElement-only members from nsIConstraintValidation to a separated class; r=smaug
As ElementInternal has it own implmentation.

Differential Revision: https://phabricator.services.mozilla.com/D130259
2021-11-25 21:58:04 +00:00
Edgar Chen ad06ef9d0a Bug 1737364 - Part 2: Elements should be barred from constraint validation if it has a datalist element ancestor; r=smaug
Add a new flag, ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR, to indicate that
the element is a HTML datalist element or has a HTML datalist element ancestor.

Per https://html.spec.whatwg.org/multipage/form-elements.html#the-datalist-element:barred-from-constraint-validation

Differential Revision: https://phabricator.services.mozilla.com/D129717
2021-11-03 20:07:43 +00:00
Edgar Chen 36107cfddf Bug 1556363 - Part 1: Check disabled state for submission in a common place; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D129048
2021-10-25 20:43:10 +00:00
Edgar Chen 6c7f4da558 Bug 1556351 - Part 3: Rename nsGenericHTMLFormElementWithState to nsGenericHTMLFormControlElementWithState; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124786
2021-10-04 20:51:26 +00:00
Edgar Chen b946d3b81b Bug 1728537 - Part 2: Move RestoreState out of nsIFormControl; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124180
2021-09-01 16:51:58 +00:00
Edgar Chen 7d1d31d3e9 Bug 1728537 - Part 1: Move SaveState out of nsIFormControl; r=smaug
And make it return void as the return value isn't used at callsites.

Differential Revision: https://phabricator.services.mozilla.com/D124179
2021-09-01 16:51:58 +00:00
Edgar Chen bae585f79e Bug 1728081 - Part 3: Merge nsIForm into HTMLFormElement; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123951
2021-08-30 18:44:51 +00:00
Olli Pettay 93b7f9edff Bug 1725293 - checkValidity() on <select required> returns true when <option value=> is moved in the dom, r=edgar
The new check should be still fast, since accessing selected index is trivial and Item() call is just accessing the element from an
nsTArray.

Differential Revision: https://phabricator.services.mozilla.com/D123371
2021-08-24 08:46:00 +00:00
Edgar Chen af2f2867e6 Bug 1721349 - Move mSubmitter from HTMLFormSubmission to FormData and make it participate in cycle collection; r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D120334
2021-07-21 09:52:20 +00:00
Emilio Cobos Álvarez 2b0eae6061 Bug 1715134 - Make form control type an enum class. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117087
2021-06-08 09:43:59 +00:00
Edgar Chen 1ebbd60592 Bug 1685421 - Part 2: Stop using NS_ERROR_DOM_HIERARCHY_REQUEST_ERR in nsINode; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D113344
2021-06-02 13:43:39 +00:00
Loek ab2f5aa66a Bug 1569314 - Remove IsOptionDisabled check and add relevant test case. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D108005
2021-03-14 01:07:31 +00:00
Sylvestre Ledru 4edd85cc9b Bug 1519636 - Reformat recent changes to the Google coding style r=necko-reviewers,valentin
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D106920
2021-03-02 16:14:46 +00:00
Emilio Cobos Álvarez b0bc0f75a5 Bug 1693969 - Remove <form novalidate> handling from :-moz-ui-{valid,invalid} pseudo-classes. r=smaug
There's no way to know whether the submission will actually be
validated, because formnovalidate on submit buttons is a thing (and even
if all the submit controls had formnovalidate, you could still submit
the form and validate it via form.submit()), so it seems better to make
these pseudo-classes not depend on this.

Differential Revision: https://phabricator.services.mozilla.com/D105968
2021-02-23 11:26:17 +00:00
Sylvestre Ledru fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila 964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru 5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Alex Catarineu 08a431f34e Bug 1581537 - Avoid several browser language leaks r=smaug
Spoof dom/dom.properties, layout/xmlparser.properties,
layout/MediaDocument.properties to en-US if needed.

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

--HG--
extra : moz-landing-system : lando
2019-11-04 16:56:27 +00:00
Mihai Alexandru Michis d19c1272ca Backed out changeset 1d87c269da8a (bug 1581537) for causing bc failures in browser_misused_characters_in_strings.js CLOSED TREE
--HG--
extra : rebase_source : b9f2da6650a4213a4a9284d6dbe7ecfd97761501
extra : amend_source : b7ca833a091419a2de5904eccb2d3ce9d0fcd337
2019-11-04 16:06:37 +02:00
Alex Catarineu ea206b140d Bug 1581537 - Avoid several browser language leaks r=smaug
Spoof dom/dom.properties, layout/xmlparser.properties,
layout/MediaDocument.properties to en-US if needed.

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

--HG--
extra : moz-landing-system : lando
2019-11-04 11:27:59 +00:00
Mirko Brodesser 2f40f072ab Bug 1565584: move `nsIContentUtils::ContentIsDescendantOf` to `nsINode::IsInclusiveDescendantOf`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D37880
2019-07-15 10:02:21 +02:00
Cameron McCormack 0a6fb940c5 Bug 1553705 - Use a cheaper to compute state key for parser inserted form controls. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D32259

--HG--
extra : moz-landing-system : lando
2019-07-01 10:06:16 +00:00
Cameron McCormack 336cad5a55 Bug 1553705 - Make GenerateStateKey() infallible. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D32258

--HG--
extra : moz-landing-system : lando
2019-07-01 07:20:04 +00:00
Narcis Beleuzu cc10ed7ce5 Backed out 2 changesets (bug 1553705) for causing Bug1562142 . CLOSED TREE
Backed out changeset fbb26a04ec1f (bug 1553705)
Backed out changeset dd6e7c0970d5 (bug 1553705)
2019-06-29 02:39:01 +03:00
Cameron McCormack 4d1517b69f Bug 1553705 - Use a cheaper to compute state key for parser inserted form controls. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D32259

--HG--
extra : moz-landing-system : lando
2019-06-26 21:44:11 +00:00
Cameron McCormack 98706be760 Bug 1553705 - Make GenerateStateKey() infallible. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D32258

--HG--
extra : moz-landing-system : lando
2019-06-26 21:44:03 +00:00
Jonathan Kingston a5ba216f93 Bug 1315460 - Removal of keygen element r=keeler,baku,jld,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D22810

--HG--
extra : moz-landing-system : lando
2019-06-13 08:58:07 +00:00
Emilio Cobos Álvarez 6917a38081 Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky
BindContext was going to have way more information at first, but then I realized
that most of the things I wanted to know were basically a flag away using the
parent node.

Still I think it's worth it, now experimenting with BindToTree will only mean
adding a field to a struct that's included from a couple cpp files, instead of a
massive pain.

I also think this is clearer, and doing this highlights quite a few
inconsistencies in our code which I've left untouched, but commented with
FIXMEs.

Steps are:

$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done
$ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#                      nsIContent\* aBindingParent) override#override#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done
$ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done
$ ./mach clang-format

Then manual fixups.

Depends on D32948

Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-31 23:31:52 +02:00
Emilio Cobos Álvarez ff732c2cdf Bug 1555143 - Remove unused aDeep argument from UnbindFromTree. r=bzbarsky
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(bool aDeep = true,#UnbindFromTree(#g' $file; done
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(bool aDeep,#UnbindFromTree(#g' $file; done
$ for file in $(rg UnbindFromTree | cut -d : -f 1 | sort | uniq); do sed -i 's#UnbindFromTree(aDeep,#UnbindFromTree(#g' $file; done
$ ./mach clang-format

And fix the two callers and little use of the aDeep argument (see the "Manual
changes" patch attached to bug).

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

--HG--
extra : moz-landing-system : lando
2019-05-28 22:47:08 +00:00
Peter Van der Beken 61a0d908e5 Bug 1521853 - Remove Throws annotation from some infallible HTMLOptionsCollection/HTMLSelectElement properties. r=qdot
Differential Revision: https://phabricator.services.mozilla.com/D17265

--HG--
extra : moz-landing-system : lando
2019-01-22 19:03:07 +00:00
Emilio Cobos Álvarez d2ed260822 Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug
Summary: Really sorry for the size of the patch. It's mostly automatic
s/nsIDocument/Document/ but I had to fix up in a bunch of places manually to
add the right namespacing and such.

Overall it's not a very interesting patch I think.

nsDocument.cpp turns into Document.cpp, nsIDocument.h into Document.h and
nsIDocumentInlines.h into DocumentInlines.h.

I also changed a bunch of nsCOMPtr usage to RefPtr, but not all of it.

While fixing up some of the bits I also removed some unneeded OwnerDoc() null
checks and such, but I didn't do anything riskier than that.
2019-01-03 17:48:33 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Andrew McCreight 8c3fb70cdf Bug 1499861 - Make HTMLOptionsCollection::mSelect into a strong reference. r=qDot
The cycle collector makes weak references like this obsolete.
2018-11-07 08:38:42 -05:00
Marcos Cáceres dcf8ad3c00 Bug 329509 - allow dispatching event when element is disabled. r=annevk,smaug
Allow untrusted Events and Custom events to be dispatched at disabled form element. This is for interop and some developers have asked for this.

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

--HG--
extra : moz-landing-system : lando
2018-10-31 08:55:33 +00:00
Emilio Cobos Álvarez fc1a493642 Bug 1499571 - HTMLOptionsCollection::Remove shouldn't remove the first element of the collection if out of bounds. r=bzbarsky
Make it just forward to HTMLSelectElement::Remove like other browsers.

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

--HG--
extra : moz-landing-system : lando
2018-10-17 01:35:21 +00:00
Emilio Cobos Álvarez 3ebda39fd0 Bug 1499567 - Do not append an empty text node when creating options from HTMLOptionCollection::SetLength. r=bzbarsky
Only we do that. Align with other browsers instead.

I removed the max-asserts as well because I cannot make my browser assert when
running this test on a debug build.

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

--HG--
extra : moz-landing-system : lando
2018-10-17 00:10:46 +00:00
Neil Deakin 0a19485e1f Bug 326944, remove nsIComboboxControlFrame interface, r=mats 2018-09-26 10:41:12 -04:00
Neil Deakin 5c44db8004 Bug 328680, remove nsIListControlFrame interface, r=mats 2018-09-26 10:41:01 -04:00