Commit Graph

337 Commits

Author SHA1 Message Date
Kirk Steuber
e74f1cd513 Bug 1363481 - Add the old attribute value as a parameter to Element::AfterSetAttr r=bz
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
2017-05-18 14:09:01 -07:00
Jessica Jong
937e398a92 Bug 1363258 - Part 2: Factor ConvertNumberToString out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 8ZHrdvpjr0m

--HG--
extra : rebase_source : c52d219ada73a663740212c3229ecf90e5c5c2f6
2017-05-10 17:03:46 +08:00
Jessica Jong
83f65520f8 Bug 1363258 - Part 1: Factor ConvertStringToNumber out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 8DratVTlToP

--HG--
extra : rebase_source : 86427e784b91ad724976b1881846aa4a395a6c7e
2017-05-10 17:03:33 +08:00
Wes Kocher
1b5ad2c128 Merge inbound to central, a=merge
MozReview-Commit-ID: DfRZi0gKjit
2017-05-10 16:48:03 -07:00
johndai1984
2ce869a458 Bug 1340477 - Support feature detection for autocomplete attribute. r=smaug 2017-05-09 22:57:00 -04:00
Milan Sreckovic
725d1c193f Bug 1358297: Part 3. Create special case for stripping CR and LF on TSubstring, and use it in all the places that it is called. Use ASCIIMask to make it fast. r=froydnj
MozReview-Commit-ID: 5ugh3Ma0OtH

--HG--
extra : rebase_source : 956a7a0535c3b7433fadfa65d0cfc26d9915f61a
2017-05-10 13:12:36 -04:00
Masayuki Nakano
b56195251f Bug 1363278 Get rid of nsIPhonetic and HTMLInputElement.phonetic r=smaug
Nobody uses them anymore.  Therefore, we can remove them from the tree.

MozReview-Commit-ID: KTqCeI2eeFW

--HG--
extra : rebase_source : f3fc274f39c135af51245efd4c4aebbc4c49a61f
2017-05-09 16:27:08 +09:00
Tom Tung
0e308b0c4f Bug 1348050 - Part 3: Mark channel as urgent-start for loading image. r=baku,mayhemer
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
2017-04-25 09:17:38 +08:00
Jessica Jong
9acf65dee9 Bug 1345767 - Part 7: Factor HasBadInput() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: AUdI2dKMh4U

--HG--
extra : rebase_source : 83a5ce2f2adfc18594ab82a8de35ec8ff90652f2
2017-05-04 15:43:21 +08:00
Jessica Jong
30c9b6fbb3 Bug 1345767 - Part 6: Factor IsRangeOverflow/Underflow() and HasStepMismatch() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 4jmjPK1Wxhz

--HG--
extra : rebase_source : b0d8fee369edb0d04d78d818ffadffa0ae95809c
2017-05-04 15:33:38 +08:00
Jessica Jong
75671019e8 Bug 1345767 - Part 5: Factor HasPatternMismatch() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 2JWhbfEJhTm

--HG--
extra : rebase_source : 0f3a0a58ebc4148ef591cb3aea970b060957dbef
2017-05-04 15:10:57 +08:00
Jessica Jong
ea4dea7a00 Bug 1345767 - Part 4: Factor HasTypeMismatch() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 7kW0Ojnp2OE

--HG--
extra : rebase_source : a4107eecb5e41c886b71adf55f91f0e2b19d047b
2017-05-04 15:08:24 +08:00
Jessica Jong
ee7fa8727c Bug 1345767 - Part 3: Factor IsValueMissing() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: AE6SSA43Vx5

--HG--
extra : rebase_source : b51483419c3a0804871f78842b576406790bd8fc
2017-05-04 14:47:08 +08:00
Jessica Jong
b15f522fed Bug 1345767 - Part 2: Factor IsTooLong/Short() out of HTMLInputElement. r=smaug
MozReview-Commit-ID: 5svYqBEFgzk

--HG--
extra : rebase_source : a8842e76d7ca6c57ccf6c1115832a2a8e4153bb0
2017-05-04 11:54:29 +08:00
Jessica Jong
606150d6f4 Bug 1345767 - Part 1: Create classes for each of the input types. r=smaug
MozReview-Commit-ID: 4O6YHHGsLBP

--HG--
extra : rebase_source : 8cf558b33ae865c532f65a9c786ad8b78e272b99
2017-05-04 11:43:46 +08:00
Wes Kocher
6d6d039d43 Backed out 4 changesets (bug 1358297) for hazard build failures a=backout
Backed out changeset 95211a496191 (bug 1358297)
Backed out changeset 3c1b426a5cce (bug 1358297)
Backed out changeset 9201d345a1d5 (bug 1358297)
Backed out changeset c926817dea60 (bug 1358297)

MozReview-Commit-ID: 874DF43K7Dp
2017-05-05 12:45:46 -07:00
Milan Sreckovic
196fb1a3bc Bug 1358297: Part 3. Create special case for stripping CR and LF on TSubstring, and use it in all the places that it is called. Use ASCIIMask to make it fast. r=froydnj
MozReview-Commit-ID: 3p97cCGfy6i

--HG--
extra : rebase_source : a91d9a5e6e61495cfe78b06959b200e48ca16535
2017-05-05 13:37:13 -04:00
Jessica Jong
57c042eeb9 Bug 1358448 - Add radio back to a radio group after moving out of a form. r=smaug
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
2017-05-01 23:10:00 +02:00
Jessica Jong
2c707b79aa Bug 1361267 - Followup to fix wrong if statement in ClearGetFilesHelpers(). r=smaug
MozReview-Commit-ID: AIqOg0mSuAC
2017-05-02 01:09:00 +02:00
Boris Zbarsky
ff31c3ca29 Bug 1357206 part 3. Rename eSetValue_MoveCursorToEnd to eSetValue_MoveCursorToEndIfValueChanged, because those are the semantics we want for it. r=ehsan
No actual behavior change here.
2017-05-01 13:26:21 -04:00
Kirk Steuber
7fdb378650 Bug 1359556 - Optimize cloneNode by preinitializing attribute and child arrays r=bz
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
2017-04-20 12:57:48 -07:00
Jessica Jong
bdf639f264 Bug 1357981 - Allocate input type=file related member variables only when needed. f=smaug, r=baku
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
2017-04-26 02:36:00 -04:00
Andrea Marchesini
8beb8af7d4 Bug 1357846 - Introducing nsIFilePicker.displaySpecialDirectory, r=smaug
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.
2017-04-26 18:20:19 +02:00
Ray Lin
acabd05355 Bug 1340483 - Part 4. Update input visibility accordingly. r=heycam
MozReview-Commit-ID: 7eBhj7w4qhP

--HG--
extra : rebase_source : 3610353fbb4e8d4c1abed57536a0bab3a537b134
2017-03-30 17:38:59 +08:00
Ray Lin
f50d5b5b45 Bug 1340483 - Part 3. Enable preview function only when input is marked as autofill field. r=heycam
MozReview-Commit-ID: FFqYJ3icRd7

--HG--
extra : rebase_source : 2ba1caff6676a3af769e8aac58a19e9d9de81254
2017-03-22 16:55:56 +08:00
Ray Lin
903f54b822 Bug 1340483 - Part 2. Expose chrome-only previewValue attribute. r=baku,heycam
MozReview-Commit-ID: BCu0vXVm6wj

--HG--
extra : rebase_source : 22d67ab3824c0df53daf3e3299a45c17746f62a3
2017-03-21 00:08:01 +08:00
Ray Lin
c444b0fb87 Bug 1340483 - Part 1. Create empty anonymous node for autofill preview. r=heycam
MozReview-Commit-ID: GTVgIPoogp9

--HG--
extra : rebase_source : 1dd63792ec76c167473c91bc8dc5ec87cbd93c08
2017-03-20 11:53:40 +08:00
Masayuki Nakano
09c6c60b8a Bug 1343642 - Ensure to grab nsFrameSelection before calling its methods unless calling only const methods. r=smaug
MozReview-Commit-ID: 9GKujCcrhly
2017-04-06 13:11:52 +09:00
Jessica Jong
68680ac23a Bug 1346085 - Part 2: Set input element's focus state when inner fields are focused/blurred. r=smaug
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
2017-04-05 15:02:30 +08:00
KuoE0
4f17947f0f Bug 1348738 - (Part 4) Add a nsIDocument arg to nsRepeatService::Start to get the event target from it. r=dholbert
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
2017-03-29 16:40:05 +08:00
KuoE0
5f42875bfd Bug 1348738 - (Part 3) Add a string-label arg to nsRepeatService::Start and upgrade to InitWithNamedFuncCallback from InitWithFuncCallback. r=dholbert
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
2017-03-29 16:32:52 +08:00
Olli Pettay
d5caa7c6c0 Bug 1352687, try to recycle HTMLInputElement's nsTextEditorState, r=baku
--HG--
extra : rebase_source : 05c8dc2bd0c29ce3064548e1cabac2d62803cabc
2017-04-03 20:40:48 +03:00
Olli Pettay
d47c995985 Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
--HG--
extra : rebase_source : b7d76ce3321ea0d622da74a72b7278fd0fa63310
2017-03-31 22:49:00 -04:00
Olli Pettay
31b1f5cc92 Backout Bug 1351860, r=backout 2017-03-31 16:55:32 -04:00
Olli Pettay
b84c192a09 Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
--HG--
extra : rebase_source : 5f2cac2c4e944e2c9f2f1acf0d3064e153c40451
2017-03-31 13:13:36 -04:00
Jessica Jong
093aa14344 Bug 1344642 - Part 2: Add a new pref for input type=week, month and datetime-local. r=smaug
--HG--
extra : rebase_source : 9cacecf2b14cdd8caabd56993b22d0bbb27eae6b
2017-03-17 11:01:59 +08:00
Jessica Jong
3c909e1184 Bug 1344642 - Part 1: Cleanup dom.forms.datepicker related code. r=smaug
This patch basically reverts Bug 825294.

--HG--
extra : rebase_source : 58b235bfddb5acd1ec0cf1afd8f34cbb8c4e09c1
2017-03-17 11:01:57 +08:00
Boris Zbarsky
85fd027b51 Bug 1347640 part 2. Move a few more things from AfterSetAttr to HandleTypeChange. r=smaug
We also stop doing some unnecessary work (e.g. canceling image requests if our old type wasn't image).

MozReview-Commit-ID: GLPl1McLL9N
2017-03-16 14:50:42 -04:00
Boris Zbarsky
a1462692fb Bug 1347640 part 1. Move the changing of HTMLInputElement's mType from ParseAttribute to AfterSetAttr. r=smaug
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
2017-03-16 14:50:42 -04:00
Boris Zbarsky
70911690a2 Bug 656197 part 5. Remove UpdateState calls from AfterSetAttr, since they are no longer needed there. r=smaug
MozReview-Commit-ID: DmCf6Ndno2i
2017-03-16 14:50:42 -04:00
Boris Zbarsky
f890715ffc Bug 656197 part 1. Remove the generic attr preparsing mechanism from BeforeSetAttr and just preparse class attributes directly in the one place that needs to do it. r=smaug
This removes the requirement that BeforeSetAttr comes before AttributeWillChange
(which needs the preparsed new value).

MozReview-Commit-ID: 87C6Mjc7ARh
2017-03-16 14:50:41 -04:00
Boris Zbarsky
f80dd7a663 Bug 1345237. Propagate uint32_t deeper into the editor state and text control frame code. r=mystor
MozReview-Commit-ID: KeUo8My6eBJ
2017-03-09 14:44:45 -05:00
Boris Zbarsky
0bf4f56f8c Bug 1345606. setRangeText should mark the text control as dirty. r=ehsan
MozReview-Commit-ID: 9le2PoelGei
2017-03-09 14:44:36 -05:00
Boris Zbarsky
0cf9adf6a5 Bug 1343037 part 18. Implement nsTextEditorState::SetRangeText. r=ehsan
MozReview-Commit-ID: FEo9yv5iu6U
2017-03-09 14:44:06 -05:00
Boris Zbarsky
060aadda89 Bug 1343037 part 16. Implement a version of nsTextEditorState::SetSelectionRange that takes a string for the direction. r=ehsan
MozReview-Commit-ID: E8zYAWolg94
2017-03-09 14:44:06 -05:00
Boris Zbarsky
0270554a22 Bug 1343037 part 15. Implement nsTextEditorState::GetSelectionDirection. r=ehsan
MozReview-Commit-ID: 1bLLYhjmlff
2017-03-09 14:44:06 -05:00
Boris Zbarsky
b72fd0bc98 Bug 1343037 part 14. Implement nsTextEditorState::SetSelectionDirection. r=ehsan
This introduces two behavior changes:

1)  In cached mode, we used to treat unknown selection directions as "none".
    Now we treat it like "forward", consistently with the "have an editor" mode.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionDirection changes.

MozReview-Commit-ID: 4nBCAm3mAiz
2017-03-09 14:44:06 -05:00
Boris Zbarsky
e0ef9813e4 Bug 1343037 part 13. Implement nsTextEditorState::SetSelectionEnd. r=ehsan
This introduces three behavior changes:

1)  Before this change, in cached mode, we did not enforce the "start <= end"
    invariant.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionEnd changes.
3)  Changes the IDL type of HTMLInputElement's selectionEnd attribute to
    "unsigned long" to match the spec and HTMLTextareaElement.

MozReview-Commit-ID: J3Gkhr8VnbS
2017-03-09 14:44:05 -05:00
Boris Zbarsky
badbeff5ec Bug 1343037 part 12. Implement nsTextEditorState::SetSelectionStart. r=ehsan
This introduces three behavior changes:

1)  Before this change, in cached mode, we did not enforce the "start <= end"
    invariant.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionStart changes.
3)  Changes the IDL type of HTMLInputElement's selectionStart attribute to
    "unsigned long" to match the spec and HTMLTextareaElement.

MozReview-Commit-ID: JM9XXMMPUHM
2017-03-09 14:44:05 -05:00
Boris Zbarsky
a44c859126 Bug 1343037 part 9. Simplify the setup around the editor state's GetSelectionDirection function. r=ehsan
Really, there are only two cases we need to worry about.  Either
IsSelectionCached(), and then our SelectionProperties has the data we want, or
not and then we have a non-null mSelCon which has the data we want.

MozReview-Commit-ID: AEW9D1zG6sM
2017-03-09 14:44:05 -05:00