Also added a extra flag NO_RESELECT, to avoid selecting the same option (with
default value false) again after setting it to its default value, and later no
way of deselecting it because it's dirtiness is set to false already.
MozReview-Commit-ID: L35sBMWwi3m
The spec says that we don't need to change the ready state when getting the error.
If the ready state is "HAVE_METADATA", it means we could get the video's duration
at that time.
However, if we shutdown decoder too early, we won't get the correct duration.
In addition, since we remove old decoder prior to create new one in the function
HTMLMediaElement::SetDecoder(), we can remove the decoder checking assertion
in HTMLMediaElement::InitializeDecoderForChannel().
MozReview-Commit-ID: CHRJHng8Xm0
--HG--
extra : rebase_source : 32b2114f5b4bce2d777826295959a6ce0701984d
In order to facilitate the movement of code with side-effects called by Element::SetAttr to Element::BeforeSetAttr and Element::AfterSetAttr, Element::AfterSetAttr should have access to the old value of the attribute. This includes information about whether there was previously a value set or not.
Accomplishing this involved passing an additional argument through functions that find and change the old attribute value in order to ensure that we can differentiate between an empty old value and an absent old value (attribute was not set).
Note that while I tried to ensure that accurate values (and their absence) are reported to Element::AfterSetAttr, I largely ignored SVG. While the old value reported for SVG values should be however accurate the value already being reported to SetAttrAndNotify was, SVG elements do not currently report unset values properly because they will never pass a null pointer to SetAttrAndNotify.
MozReview-Commit-ID: K1mha8CNFZP
--HG--
extra : rebase_source : 42776eb01451d371e4aebcc17fe3dd112c8d268b
Currently, edit commands for native key bindings are stored in widget. This is
stateful and really complicated in content process because it needs to cache
them.
We can make this simpler if we make WidgetKeyboardEvent store edit commands for
the key combination. Then, child process can handle it even if it's delayed
event or it's a nested event.
This patch adds arrays to WidgetKeyboardEvent to store edit commands which are
initialized with nsIWidget::ExecuteNativeKeyBinding() and adds
WidgetKeyboardEvent::ExecuteEditCommands() to execute stored edit commands as
same as nsIWidget::ExecutenativeKeyBinding().
MozReview-Commit-ID: BGRvBrLz5lp
--HG--
extra : rebase_source : b7ecd704d9c331ca1e0aedc66f230114015b853b
input.value setter removes editor flags and max-length to set value. To clean up code, I would like to use RAII class to set and restore it.
Actually, when the frame is being destroyed by InsertText, it isn't restored. But it might be safe since the flags is set again on nsTextEditorState::PrepareEditor by focus.
MozReview-Commit-ID: J0OYYluWD8z
--HG--
extra : rebase_source : b0489a381cdea76fe98f328cbd88cd18d2576a93
If the video is paused, then set the "TextTrack.mode=hidden/showing", in this case, TimeMarchesOn will return at step 7,
not update the screen. So call DispatchUpdateCueDisplay explicitly to update the screen.
MozReview-Commit-ID: IuazaeSXX31
--HG--
extra : rebase_source : fbc72c1fa9327e9719e54b63b70cbcd3be3e4069
Defer determining whether we have usable decoders to an off-main thread in
order to avoid janking the main thread.
MozReview-Commit-ID: Ape5zEBBMrz
--HG--
extra : rebase_source : 1b77046ebb7bb2d4ff1ba53afce904d3de45c335
Actually, we use GetValue to check whether value is empty or not for placeholder. But since GetValue uses TextEditor::OutputToString when on editor, it is expensive. Since editor has DocumentIsEmpty method, we should use it for this case.
MozReview-Commit-ID: rQX8yjnWQz
--HG--
extra : rebase_source : 25ec89385d704f5c4d2d0a15021c2a59b0201983
Since we don't want to show media control for media without audio track (eg. GIFV),
it's no need to register audio agent for them.
MozReview-Commit-ID: 22YrMkpNrcP
--HG--
extra : rebase_source : 78a6c41b6018f91ed9370fb2f15c650fe76ba3a1
According to the spec, content from loopback addresses should no longer
be treated as mixed content even in secure origins. See:
- 349501cdaa
- https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
Note that we only whitelist '127.0.0.1' and '::1' to match Chrome 53 and
later. See:
- 130ee686fa
It is unclear if HTTPS origins should be able to use workers and WebSocket
connections through a loopback HTTP address. They are not supported in Chrome
(whether this is intentional or not is uncertain) so lets just ignore them for
now.
See also: https://github.com/w3c/web-platform-tests/pull/5304
Should also update audio playing changed after resumed from page.
MozReview-Commit-ID: 66vuJJFeWN3
--HG--
extra : rebase_source : 06802b2e49f5e712a1d9fd34d4ae017995faaa75
Nobody uses them anymore. Therefore, we can remove them from the tree.
MozReview-Commit-ID: KTqCeI2eeFW
--HG--
extra : rebase_source : f3fc274f39c135af51245efd4c4aebbc4c49a61f
The part is mainly to set urgent-start for loading media when it's initiated by
user interaction. For the HTMLMedia element, it has its algorithm to pre-load
the media and users will get feedback once they play the media. Thus, I only
set urgent-start when the media element has autoplay attribute since the sooner
enough resource is loaded the sooner the media will be played.
MozReview-Commit-ID: 7nu3PUt8iYo
--HG--
extra : rebase_source : f1abfecdccb74f4ec79a057534c2e9a1bfd5ae41
This part is mainly to mark the channel as urgent-start if src related
attributes in HTMLImageElement and HTMLInputElement is set and the channel is
open due to user interaction. Unfortunately, we cannot just check the event
state just after creating channel since some loading image tasks will be queue
and execute in stable state. Thus, I store the event state in elements and
pass it to the place where create the channel.
MozReview-Commit-ID: GBdAkPfVzsn
--HG--
extra : rebase_source : 715352317b4b600f8a7f78b7bc22b894bb272d27
maxlength will be set by nsTextControlFrame::AttributeChanged via RestyleManager. If element is display:none, RestyleManager won't call Frame's AttributeChanged. So we should always initialize maxlength when setting focus.
Also, wrap attribute for textarea element will be updated by HTMLTextAreaElement even if display:none. So this issue doesn't occur. maxlength might have to be updated by HTMLInputElement. But it is unnecessary to update editor's maxlength on display:none since this is used on focused editor.
MozReview-Commit-ID: JHODOBTv62v
--HG--
extra : rebase_source : eeabd25f6f7d2802b5a97ae8be225182c6df88de
Otherwise we will fail the assertion (!mDecoder, "Shouldn't have a decoder")
in HTMLMediaElement::InitializeDecoderForChannel().
MozReview-Commit-ID: 1zShp0th3Uv
--HG--
extra : rebase_source : 9b61fd8f6817e33c7d041e4b49bc34ccbc357a15
The crash happens when:
1. there are multiple <source> children.
2. decode error happens on the 1st child.
MozReview-Commit-ID: 60UXaQ475Nh
--HG--
extra : rebase_source : b7e61ae909cfa10fb2db3c41b278449de41b9450
This patch implements:
. noModule getter/setter for HTMLScriptElement
. the nomodule attribute for HTMLScriptElement
. and the logic in nsScriptLoader that denies the loading of a nomodule script
. with tests
In our current setup, in which links with an href attribute always match either
:link or :visited, no matter whether that attribute's value is a valid URI,
changes to the attribute always put the element into either the "match nothing"
state or the "match :link" state, via calls to Link::ResetLinkState.
The only thing FlushPendingLinkUpdates is needed for is (lazily, in case it
turns out to not be needed because the element got removed from the DOM anyway)
registering a history observer to switch the link state to :visited as needed.
This means that selector matching consumers that would never expose :visited
state to start with don't need to worry about calling FlushPendingLinkUpdates.
The container of a radio group is the form, if it belongs to a form, or the
document object otherwise.
When moving a radio out of a form, we should add it back to a radio group.
Similary, before moving the radio to a form, we should remove it from the
original radio group.
MozReview-Commit-ID: 22WsEhz2SXH
--HG--
extra : rebase_source : 68dbd50da523b734086d8e5de6e6ae179b0b4af0
Otherwise we end up calling into editor code and doing a bunch of work even though the value hasn't actually changed, when a value with \r in it is set repeatedly.
Currently, attribute and child arrays (implemented in dom/base/nsAttrAndChildArray.h) start out empty. When cloning, the array ends up being resized multiple times in order to add the attributes and children that are being cloned from the original node. This would be quicker if the array was initialized to the correct size in the first place so that resizes are not necessary.
However, preallocating space for children is only necessary when performing a deep clone. Therefore, an additional parameter is being added to the Clone, CopyInnerTo, and CloneDocHelper methods to indicate whether preallocation of children should happen. Attributes are copied either way, so that part of the array is preallocated in both cases.
MozReview-Commit-ID: 3iVezeAKXnI
--HG--
extra : rebase_source : 9c3deec6d7aafd6411044d623d4863637b45fd58
This avoids conflicts with mozilla::dom::FrameType.
MozReview-Commit-ID: 7aEMbHRaTFk
--HG--
extra : rebase_source : 2d01321f5ce0ec8c0e3f70984674f82678034b3c
This code only became dead very recently; in the first patch improving this
issue (which fixed an underlying issue with the code, but not the tests).
r=baku
MozReview-Commit-ID: 3QP5LrNPstJ
--HG--
extra : rebase_source : 845856d77640cf94b074dc0b9f976ae1a1fb927a
In order to reduce the size of HTMLInputElement for performance gain, we're
going to allocate input type=file related member variables only when type=file.
--HG--
extra : rebase_source : de31e8c55ee44b6ef7f8143b39e64d369d021856
nsIFilePicker.displaySpecialDirectory is a string that can be set to TmpD,
Desk, or any other special directory value. The real value of this directory
will be read in the parent process.
There was a cycle amoung a window object -> a HTMLMediaElement -> a MediaDecoder -> a Promise (-> back to the window object).
And we have no way to break the cycle since the MediaDecoder does not participate into the collection.
By moving the Promise form MediaDecoder to HTMLMediaElement, we will be able to break the cycle since the HTMLMediaElement is in the collection.
We'll implement the cycle collection in the next patch.
MozReview-Commit-ID: CyVXBl6IMI3
--HG--
extra : rebase_source : 195a322ce3e6fe933e72be4aec5d2ebfa1f54865
This switches over from using nsStringBuffer to nsString for URLValueData's
|mString| member. This avoids various tedious conversions and can provide
potential performance improvements by avoiding length calculations.
MozReview-Commit-ID: 5eRifUZrAso
Since the inner fields of date/time input are now <span> instead of <input>
text, we are adding an API for binding code to set the focus state of the
bound input element when inner fields are focused/blurred.
MozReview-Commit-ID: 9wvu57xT6HZ
--HG--
extra : rebase_source : c6c3832fe0aa0fe9429052dcb5b15a3497c33fa4
When adding support for RTL in date/time input box, we noticed that bidi text
was not displayed properly with mixed of inline and block elements. By
changing our editabled fields from <input> to <span>, we can rely on bidi
algorithm and markups to display the inner fields in the right order.
MozReview-Commit-ID: 7r8OVSJXJRU
--HG--
extra : rebase_source : b130a5424b533930a57695a65196454c72d7be10
In the next patch we want to add a method called
GetUnanimatedStyleContextForElementNoFlush but that's much too long. Instead it
seems better to just drop 'ForElement' from all these methods since it should be
fairly obvious we are getting the style context for an element given that the
first argument is an element.
MozReview-Commit-ID: JQKaEuCKV2F
--HG--
extra : rebase_source : 3ba51f3b00d1ec7bc91102629d9c0abb88992fef
In the new architecture of Quantum DOM, all timer callback need a
specified event target. So, we add the new document arg to Start
function to get the event target from it. And update all callers.
MozReview-Commit-ID: a482mukqGc
--HG--
extra : rebase_source : 36f9d47a4afd7c7113adf3f274656b694b8d0943
In the new architecture of Quantum DOM, all runnables need a name label.
So, we add the new string-label arg to Start function, and update all
callers.
MozReview-Commit-ID: G9LXFjtFcQv
--HG--
extra : rebase_source : a19b605013be56d01780c831d2a48ada8825b1c7
Before this change, if you did formatBlock on "a<span
contenteditable=false>b</span>c", it would become "acb", because the "a"
and "c" would be moved to the front of the node, and the "b" would be
left alone at the end because the editing code doesn't want to move it.
Now we will move the "b" as well, even though it's not editable, so that
the node remains "abc". The rule is that a non-editable element cannot
have its attributes or children changed, but it can have its parent
changed, so there's nothing wrong with moving it here.
On the way, I fixed an exception in insert*List if there was an
uneditable inline node around. I don't intend to fix all the todo's in
the test, but now it should have better coverage, at least.
MozReview-Commit-ID: 3okcGq4an3f
This also removes the TABLE_ATTRS_DIRTY optimization. Constructing nsMappedAttributes isn't really expensive and we do it all the time anyway.
MozReview-Commit-ID: 2krt1nFUzgl
--HG--
extra : rebase_source : 18d400aed6f427e5efc503b87b6ee2d9af74f3f5
On Fennec, we use external video player to play unsupported type media.
In this bug, we can't execute play() successfully because the spec said that
we should abort the play if the value of media element's error is
MEDIA_ERR_SRC_NOT_SUPPORTED [1].
Therefore, we do a hack for unsupported type media, we don't set its error, but
we would still remember the src is unsupported type. When media element starts
playing, we would use an external video player to play that src.
[1] https://goo.gl/GlLbeA
MozReview-Commit-ID: 42HxQtXdWDe
--HG--
extra : rebase_source : 83425528eacee8af1829eaead2fef39b0be51ae5
Since the audible state would depend on pause and suspend state, we should do
the check after finishing play() or pause().
MozReview-Commit-ID: 1yhxuQDw067
--HG--
extra : rebase_source : 888bac3da52f42b75eeb1c3db1337e223d792a11
If the media element is paused, it should be non-audible.
MozReview-Commit-ID: 2HjV9gNNcnV
--HG--
extra : rebase_source : 39b0812788d020d3f9c1a96afa1397b32057de8c
Since the window would know when need to resume the media, we don't need the
add/removeMediaContent() anymore.
MozReview-Commit-ID: F9MSiqqnOiV
--HG--
extra : rebase_source : fa86b3977e13d1f2a6b6233b6d608ccc331b5bf7
Since the window would know when need to resume the media, we don't need the
add/removeMediaContent() anymore.
MozReview-Commit-ID: F9MSiqqnOiV
--HG--
extra : rebase_source : 28a8312373054b8e29b93267677de99dd862a074
This commit refactors the SetDomain method in a Document to call a new function
IsRegistrableDomainSuffixOfOrEqualTo(), defined in HTML [1]. This commit tries
not to rename anything except input variables, so as to remain as clear as
possible. It likely should have various variables renamed, but given the
author's unfamiliarity with this module, review seems a good time to do that.
It's also duplicating comments a little bit; let me know which one(s) you'd like
to keep!
Note: Commentary on the HTML change is available in the PR [2], and the
rationale for this behavior in Web Auentication, where this algorithm will be
used, is also recorded [3].
Update 1: Refactored two new protected methods to avoid code duplication.
Update 2: Bugfix: Be sure to use CreateInheritingURIForHost for the
provided domain so as to catch internationalized domains.
Update 3: Nit-fix and rebase
[1] https://html.spec.whatwg.org/multipage/browsers.html#is-a-registrable-domain-suffix-of-or-is-equal-to
[2] https://github.com/whatwg/html/pull/2365
[3] https://github.com/w3ctag/spec-reviews/issues/97#issuecomment-175766580
MozReview-Commit-ID: 4Dr8yOMdhez
--HG--
extra : rebase_source : 634bd3c7b60c7ad996ee38ab7314071b426e3f6f
This mMediaTracksConstructed flag should belong to a MediaDecoder,
every time a HTMLMediaElement switches its MediaDecoder, the flag should be reset to false again.
So, we move the mMediaTracksConstructed flag back to MediaDecoder, by this way,
HTMLMediaElement provides only the mechanism to construct and remove media tracks,
and MediaDecoder uses the flag, mMediaTracksConstructed, to provide policy.
MozReview-Commit-ID: L7mMAmLjQCy
--HG--
extra : rebase_source : 1625d604afb34bffe79eda06a46c9feb780a14d9
Since canvas element is only run on main thread, and OwnerDoc is never null,
we should be able to use the new Dispatch API directly.
A trivial indent fix is included in this patch as well.
Since this is a one-line-change, I decided not to split this to a separated
patch.
MozReview-Commit-ID: ExjUdOdPGd4
--HG--
extra : rebase_source : b990bf9caff0616658541a29ae46aa4c8df616e3
We should remove the media control interface immediately when the document is inacitve, even it was paused by media control before.
MozReview-Commit-ID: GBDhzEFOTXE
--HG--
extra : rebase_source : f357d19ceb26d307d1d68696ad875d044e14aa8b
This commit refactors the SetDomain method in a Document to call a new function
IsRegistrableDomainSuffixOfOrEqualTo(), defined in HTML [1]. This commit tries
not to rename anything except input variables, so as to remain as clear as
possible. It likely should have various variables renamed, but given the
author's unfamiliarity with this module, review seems a good time to do that.
It's also duplicating comments a little bit; let me know which one(s) you'd like
to keep!
Note: Commentary on the HTML change is available in the PR [2], and the
rationale for this behavior in Web Auentication, where this algorithm will be
used, is also recorded [3].
Updates: Refactored two new protected methods to avoid code duplication.
[1] https://html.spec.whatwg.org/multipage/browsers.html#is-a-registrable-domain-suffix-of-or-is-equal-to
[2] https://github.com/whatwg/html/pull/2365
[3] https://github.com/w3ctag/spec-reviews/issues/97#issuecomment-175766580
MozReview-Commit-ID: 4Dr8yOMdhez
--HG--
extra : rebase_source : 5d042c4e97b8866027c81ea0f1c544ce1721b7c4
Move the creation of MediaElementGMPCrashHelper out from MediaDecoder.cpp
which reduces the dependency of MediaDecoder to HTMLMediaElement.
MozReview-Commit-ID: E60aMfcFr7V
--HG--
extra : rebase_source : f50a8ee6f2fbec0bdf117eb1217066bc9c701745
extra : source : dd4e52da6d0d6205fe61d0caba44bbff008fd21a
ConstructMediaTracks and RemoveMediaTracks are actually HTMLMediaElement's responsibilities.
MozReview-Commit-ID: 8lOdzD4pN7N
--HG--
extra : rebase_source : 7159d2c62b77429e5b2305b9e3eb7a0020a3b52c
extra : source : 0467c059be3cd8f066da5fc912b7738a5b9c4dd9
Open a GetOwnerDoc() method to the MediaDecoderOwner interface and then we can get the
owner document via a pointer to MediaDecoderOwner in MediaDecoder.
MozReview-Commit-ID: JCzQDLx1MsU
--HG--
extra : rebase_source : e194c95cb1513046ec7aa19d6c6e9f8231971a2d
extra : source : 1b9c45911a036e3677b6636cda84a636681d71de
In order to support asynchronous loading of extension content scripts, we need
to be able to exit the HTML parser flush loop immediately after inserting the
document element. Normally this doesn't cause problems, but when we enter edit
mode with an empty element selected, the editor inserts a <br> node, and a
<br> node at the start of the <html> element causes issues.
These changes solve that issue by putting off entering editor mode until we
begin laying out the document.
MozReview-Commit-ID: H2ksNz0jRxs
--HG--
extra : rebase_source : 26e0d254744363f5bd60f3b4f4df7b51c3dc446f
This will make the timing of the change more consistent between SetAttr and
UnsetAttr, and ensure that we have both the old and new type available in
AfterSetAttr.
MozReview-Commit-ID: Gsrxkkve7BC
The UpdateState calls in BeforeSetAttr were there in case an AttributeWillChange
observer examined the element state and expected it to be updated to whatever
changes BeforeSetAttr made. But at this point, AttributeWillChange runs before
BeforeSetAttr, and there is no code that runs between BeforeSetAttr and the
subsequent UpdateState in SetAttrAndNotify/UnsetAttr that cares or could care
about the state of the element. So it's safe to do no state updates in
BeforeSetAttr and just do the single UpdateState we already do.
MozReview-Commit-ID: BQOPVgHyC0H
This removes the requirement that BeforeSetAttr comes before AttributeWillChange
(which needs the preparsed new value).
MozReview-Commit-ID: 87C6Mjc7ARh
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
--HG--
extra : rebase_source : c21a65694d6e1c42fd88f73632f7ac8f38d005ae
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
--HG--
extra : rebase_source : c21a65694d6e1c42fd88f73632f7ac8f38d005ae
We never suspend videos that is NOT in-tree because we found that, according to the Telemetry data, most (>70%) videos
which are used as the argument of drawImage() are not in-tree. So, by preventing suspending not-in-tree videos, we should
be able to alleviate the pain of not able to resume video decoders synchronously.
MozReview-Commit-ID: 8eqs0pHZLIt
--HG--
extra : rebase_source : 964c0047753696cad2e40bcf74c2b8ee9faccdea
extra : source : 93c38caa15b1a29f8f1e8e6d3a5e859f97bc1aae
Initialize the MediaDecoder::mIsElementVisible to be "!aOwner->IsHidden()" at the MediaDecoder's constructor is wrong.
Insted, we initialize both MediaDecoder::mIsDocumentVisible and MediaDecoder::mIsElementVisible to be false at the construtor,
and then assign the HTMLMediaElement's real values to them at HTMLMediaElement::FinishDecoderSetup() via the the MediaDecoder::SetActiviyChangesToDecoder().
The initialization values of MediaDecoder::mIsDocumentVisible and MediaDecoder::mIsElementVisible (in the constructor) do not matter because the valuse are
not read untile the first MediaDecoder::SetActiviyChangesToDecoder() method call.
MozReview-Commit-ID: Cdovq5pG9Nv
--HG--
extra : rebase_source : 91f3b4c2515124b4c195dd246bd9b404178a35de
extra : source : 81b5e89a5bd20f37b8c3daa1230db30808026ff4
Make HTMLMediaElement no longer has logic of deciding visibility, it just passes all information into MediaDecoder.
MozReview-Commit-ID: ApVcEQfboO
--HG--
extra : rebase_source : 88c70b0cf1933d9cf814359909463a811be2ab9f
extra : source : 669d1340d3c93d3e0eab55ce87693f842cf40247
Move all the policy rules into this method now, will then move the policies into MediaDecoder at next patch.
MozReview-Commit-ID: ILAYLrTwCJy
--HG--
extra : rebase_source : 8ae3adcbbd8f2fd61f0da0de437f41f78d945c89
extra : source : feb8ad754e86b43e15bf2eeb3a2ba2dc24a00599
MDSM's dormant mechanism has nothing to do with the HTMLMediaElement's states now.
MozReview-Commit-ID: 4RSHsexy7fi
--HG--
extra : rebase_source : cb84fda2c182c63c6276b143ce071afc01c694d8
extra : source : af0217686959affe143167487588faab137212ce
These prefs have been added close to two years ago:
dom.url.encode_decode_hash and dom.url.getters_decode_hash
The main reason for their existence was in case we encounter any web-compat issues. At this point the extra code is mostly useless, and flipping the pref may lead to crashes.
MozReview-Commit-ID: LhAHkYmv0TR
--HG--
extra : rebase_source : 8f2d50d5633496cf165b3925d952bb6475bce3e0