Commit Graph

628 Commits

Author SHA1 Message Date
Markus Stange
beff53a46a Bug 1500692 - Centralize profiling category definition and add infrastructure for subcategories. r=njn
The actual subcategories will be added in later patches, so that there are no
unused categories.

Differential Revision: https://phabricator.services.mozilla.com/D11334
2019-02-16 17:37:43 +00:00
Emilio Cobos Álvarez
eca9cd7148 Bug 1525509 - Add release asserts. r=dholbert
Just for my sanity. I think the other scroll observer is sane after a quick
look, but this will ensure we don't ship security issues.

Differential Revision: https://phabricator.services.mozilla.com/D19725
2019-02-15 06:29:55 +00:00
Masayuki Nakano
d5b2f69aa2 Bug 1466208 - part 21: Clean up PresShell::EventHandler::EventTargetData::MaybeRetargetToActiveDocument() with early-return style r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D19319
2019-02-15 02:08:37 +00:00
Sylvestre Ledru
0ad8a25536 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D19663
2019-02-15 08:15:57 +00:00
Masayuki Nakano
60882535de Bug 1466208 - part 20: Create PresShell::EventHandler::EventTargetData::MaybeRetargetToActiveDocument() r=smaug
Now, we can create methods to update event target into EventTargetData().
This moves a block in PresShell::EventHandler::HandleEvent() to retarget
to active document into the new method.

Differential Revision: https://phabricator.services.mozilla.com/D19318
2019-02-15 02:06:31 +00:00
Ryan Hunt
12f738fea0 Bug 1520363 - Rename nsIScrollableFrame::GetAnchor() to Anchor(). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D19872
2019-02-15 01:25:55 +00:00
Masayuki Nakano
83bf14c100 Bug 1466208 - part 19: Group PresShell, nsIFrame and nsIContent with a struct r=smaug
PresShell::EventHandler::HandleEvent() looks for PresShell, nsIFrame and
nsIContent a lot for aGUIEvent.  Sometimes part of them are modified,
otherwise, all of them are modified by some reasons.  Therefore, for
splitting each of the modifiers into separated methods, we need a struct
for making them as a group and usable for in/out parameter.

(If you have some ideas of better name, let me know.)

Differential Revision: https://phabricator.services.mozilla.com/D19317
2019-02-12 23:23:27 +00:00
Masayuki Nakano
3bb3c42905 Bug 1466208 - part 18: Create PresShell::EventHandler::MaybeDiscardOrDelayMouseEvent() r=smaug
This patch moves the block, which discard or put the event into the delayed event
queue if handling event is a mouse event, to new method.

Differential Revision: https://phabricator.services.mozilla.com/D19301
2019-02-12 04:12:20 +00:00
Masayuki Nakano
128298f1ab Bug 1466208 - part 17: Make PresShell::EventHandler::HandleEventWithPointerCapturingContentWithoutItsFrame() to handle event when there is pointer capturing content but it does not have primary frame r=smaug
This patch splits the part handling event when there is pointer capturing
content but it does not have frame.

Differential Revision: https://phabricator.services.mozilla.com/D19300
2019-02-12 04:10:33 +00:00
Masayuki Nakano
b3b4a480f6 Bug 1506508 - Make PresShell::EventHandler::HandleEvent() flush any dirty region before deciding to event target of eMouseDown and eMouseUp r=smaug
When preceding mouse event is handled, that may cause changing style of the
target.  Therefore, when an eMouseDown or eMouseUp event is handled, handlers
require the latest layout.  Currently, nsViewManager::DispatchEvent() tries
to guarantee that with calling nsIPresShell::FlushPendingNotifications()
with FlushType::Layout.  However, this just flushes the pending layout in
the PresShell associated with the nsViewManager instance.  I.e., if the
target is in a child PresShell, its layout hasn't been flushed.

This patch makes PresShell::EventHandler::HandleEvent() flush pending
notifications at first of handling events using coordinates (only when
eMouseDown or eMouseUp, though).  Then, when it realizes that the event
should be handled in a child PresShell, makes it flush its pending
notifications and then, recompute event target with the latest layout if
the layout is actually changed.

Differential Revision: https://phabricator.services.mozilla.com/D13720
2019-02-11 23:25:45 +00:00
Masayuki Nakano
85215a6036 Bug 1466208 - part 16: Clean up PresShell::EventHandler::ComputeRootFrameToHandleEvent() and its helper methods with early-return style r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D18526
2019-02-08 23:12:18 +00:00
Masayuki Nakano
532f2534a4 Bug 1466208 - part 15: Split PresShell::EventHandler::ComputeRootFrameToHandleEvent() r=smaug
PresShell::EventHandler::ComputeRootFrameToHandleEvent() computes root frame
to handle event with popup frame and/or capturing content.  The former result
can be rewritten with the latter.  So, for cleaning it up with early return
style, we need to split it to 2 methods.

Differential Revision: https://phabricator.services.mozilla.com/D18525
2019-02-08 23:10:13 +00:00
Masayuki Nakano
58adacb7af Bug 1466208 - part 14: Create PresShell::EventHandler::ComputeRootFrameToHandleEvent() r=smaug
In some reasons, handling event should be handled in specific frame even if
the coordinates are out of the frame.  PresShell::EventHandler::HandleEvent()
computes it with popups, capturing content, etc.  This patch moves the blocks
into new method for making HandleEvent() simpler.

Note that most of the code is just moved.  The following patch will clean it
up.

Differential Revision: https://phabricator.services.mozilla.com/D18523
2019-02-08 07:11:01 +00:00
Masayuki Nakano
9bc1cc9cee Bug 1466208 - part 13: Create PresShell::EventHandler::MaybeFlushThrottledStyles() r=smaug
PresShell::EventHandler::HandleEvent() tries to flush pending animation first
when it decides frame to handle events using coordinates.  This patch moves
the code into the new method.

Differential Revision: https://phabricator.services.mozilla.com/D18522
2019-02-08 05:05:45 +00:00
Emilio Cobos Álvarez
1b8bb6cc44 Bug 1525371 - Remove ArenaRefPtr. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D18735
2019-02-07 11:15:39 +01:00
Masayuki Nakano
b618bdaf55 Bug 1466208 - part 12: Get rid of frame variable from PresShell::EventHandler::HandleEvent() r=smaug
There is an unclear variable `frame` in PresShell::EventHandler::HandleEvent().
It's overwritten with different frame and its meanings is changed sometimes.
Finally, it's necessary only in the `if (aGUIEvent->IsUsingCoordinates())`
block.  Therefore, we can move it into the block and rename it when them for
each purpose.

Differential Revision: https://phabricator.services.mozilla.com/D18521
2019-02-07 01:53:38 +00:00
Hiroyuki Ikezoe
d23883e0af Bug 1516377 - Use the layout viewport for position:fixed elements if the viewport is larger than. r=botond
Both of reftests in this commit are based on an exmaple [1] in the Viewports
Explainer written by David Bokan.

position-fixed-out-of-view.html fails without the fix because the position:fixed
element is rendered at the right edge of the visual viewport so that it's
visible in the first place.

position-fixed-on-minimum-scale-size.html does NOT fail without the fix either
because the position:fixed element sticks at the right edge of the visual
viewport so that it still be there even after the visual viewport offset has
been changed.

[1] https://github.com/bokand/bokand.github.io/blob/master/web_viewports_explainer.md#chrome-2

Differential Revision: https://phabricator.services.mozilla.com/D18797
2019-02-07 05:39:33 +00:00
Masayuki Nakano
fbc68eb6a7 Bug 1466208 - part 11: Create PresShell::EventHandler::MaybeDiscardOrDelayKeyboardEvent() r=smaug
PresShell::EventHandler::HandleEvent() discards or puts off to dispatch
the handling event if it's a keyboard event and event dispatching is
suppressed by the document.

This patch moves the block into the new method for making HandleEvent() simpler.

Differential Revision: https://phabricator.services.mozilla.com/D18520
2019-02-07 01:49:31 +00:00
Razvan Maries
ea310235e6 Merge mozilla-central to autoland. a=merge on a CLOSED TREE 2019-02-05 18:59:13 +02:00
Emilio Cobos Álvarez
1c2c94c72b Bug 1523181 - Don't implicitly flush the user font set.
Summary:
Flushing it at a bad time can cancel loads whose timer / completion
handler is in progress, which makes no sense.

Reviewers: jfkthame, jwatt, heycam

Tags: #secure-revision

Bug #: 1523181

Differential Revision: https://phabricator.services.mozilla.com/D17856
2019-02-05 13:30:13 +01:00
Masayuki Nakano
8785054d71 Bug 1466208 - part 10: Create PresShell::EventHandler::MaybeDiscardEvent() to check whether it's safe to handle the event r=smaug
It may not be safe to handle events even when
PresShell::EventHandler::HandleEvent().  In such case, we need to discard
received events with notifying somebody.  This patch move this rare case
jobs into the new method, MaybeDiscardEvent().  Then, the caller, HandleEvnet(),
becomes easier to read.

Differential Revision: https://phabricator.services.mozilla.com/D16960
2019-02-02 02:20:28 +00:00
Masayuki Nakano
f84b2e4e4e Bug 1466208 - part 9: Create PresShell::EventHandler::MaybeHandleEventWithAnotherPresShell() to handle event with another PresShell if necessary r=smaug
Let's move the redirection of coming event in
PresShell::EventHandler::HandleEvent() into a method.  This makes the caller
easier to read.

Differential Revision: https://phabricator.services.mozilla.com/D16959
2019-02-02 02:20:25 +00:00
Masayuki Nakano
256f72d56a Bug 1524214 - Grab caching capturing content with local variable r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D18209
2019-02-01 20:44:28 +00:00
Masayuki Nakano
871c75f9bd Bug 1466208 - part 8: Clean up PresShell::EventHandler::GetFrameForHandlingEventWith() r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D16958
2019-02-01 02:18:55 +00:00
Masayuki Nakano
5133af6274 Bug 1514940 - part 1: Forcibly disable new keyCode/charCode value of keypress events if the document is Confluence r=smaug,Ehsan,kmag
Old Confluence does not aware of conflated model keypress event (see UI Events
spec, https://w3c.github.io/uievents/#determine-keypress-keyCode).
Additionally, Confluence can be hosted with any domains.  Therefore, we cannot
use blacklist to disable the conflated model keypress event only on it.

This patch checks whether current or parent document is Confluence with JS
module, called KeyPressEventModelCheckerChild.  For kicking this module,
nsHTMLDocument dispatches an custom event, CheckKeyPressEventModel, when it
becomes editable only first time.  Finally, if it's a Confluence instance, the
module let PresShell know that we need to use split model keypress event in it.

Differential Revision: https://phabricator.services.mozilla.com/D17907
2019-02-05 11:35:43 +00:00
Masayuki Nakano
3955587b28 Bug 1466208 - part 7: Create PresShell::EventHandler::GetFrameForHandlingEventWith() to retrieve a frame which is necessary to handle event with another PresShell instance r=smaug
Next, we need to look for a frame for first parameter of calling
PresShell::HandleEvent() of another PresShell instance.  This patch creates
PresShell::EventHandler::GetFrameForHandlingEventWith() to do it.

Unfortunately, the result is used in 3 patterns.  One is, the caller should
stop handling the event.  Another one is, the caller should keep handling
the event by itself.  The other is, the caller should call
PresShell::HandleEvent() of different PresShell instance.  Therefore, this
patch makes the method take aFrame of the caller.  Then, the caller can check
the last 2 patterns with check the result is same as aFrame.  This is not so
smart approach, but I have no better idea without adding a bool argument or
making the return type bool and adding out argument of nsIFrame.

Differential Revision: https://phabricator.services.mozilla.com/D16957
2019-02-01 02:15:54 +00:00
Masayuki Nakano
50d87bbdb4 Bug 1466208 - part 6: Clean up PresShell::EventHandler::GetRetargetEventDocument() r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D16956
2019-01-31 02:28:07 +00:00
Masayuki Nakano
1fad9ec40a Bug 1466208 - part 5: Create PresShell::EventHandler::GetRetargetEventDocument() retrieve retarget document of coming event r=smaug
In some cases, PresShell::EventHandler::HandleEvent() needs to call
HandleEvent() of another instance.

For retrieving the instance, we need to compute retarget document first.
This patch makes new method to retrieve it.  The following patch will clean
up it.

Differential Revision: https://phabricator.services.mozilla.com/D16955
2019-01-31 02:24:51 +00:00
Masayuki Nakano
f7753088ce Bug 1466208 - part 4: Create PresShell::EventHandler::GetCapturingContentFor() to retrieve capturing content for specific event r=smaug
PresShell::HandleEvent() treats capturing content only when received event is
related to pointing device.  And it's used in 2 purposes.  One is for computing
to target document of coming event.  The other is for handling events using
coordinates.  Therefore, if we create a helper method to retrieve it, we can
move the variable into smaller blocks.

Differential Revision: https://phabricator.services.mozilla.com/D16954
2019-01-30 07:17:43 +00:00
Masayuki Nakano
e508c8b0d6 Bug 1466208 - part 3: Rewrite PresShell::EventHandler::MaybeHandleEventWithAccessibleCaret() with early-return style r=smaug
Because of spinning out from PresShell::EventHandler::HandleEvent(), we can use
early-return style in MaybeHandleEventWithAccessibleCaret().  This patch
rewrites MaybeHandleEventWithAccessibleCaret() with the style.

Differential Revision: https://phabricator.services.mozilla.com/D16953
2019-01-30 02:33:05 +00:00
garvitdelhi
cdc6f539cb Bug 1519185: Remove AttributeWillChange aNewValue parameter r=emilio,bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D17073
2019-01-29 17:59:38 +01:00
Cosmin Sabou
ef6c5d87ab Backed out 2 changesets (bug 1519185) build bustages on nsMenuGroupOwnerX.mm. CLOSED TREE
Backed out changeset e1de5282e21a (bug 1519185)
Backed out changeset 00d8afb01890 (bug 1519185)
2019-01-29 18:22:46 +02:00
garvitdelhi
790b1c35a4 Bug 1519185: Remove AttributeWillChange aNewValue parameter r=emilio,bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D17073
2019-01-29 15:27:02 +00:00
Emilio Cobos Álvarez
d0c4aad899 Bug 1523062 - Devirtualize a few nsIPresShell bits. r=TYLin,rhunt
No good reason they're virtual, since there's only one nsIPresShell
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D17735
2019-01-29 15:24:31 +01:00
Masayuki Nakano
28b5853d21 Bug 1466208 - part 2: Create PresShell::EventHandler::MaybeHandleEventWithAccessibleCaret() to handle event with AccessbleCaretEventHub r=smaug
PresShell::EventHandler::HandleEvent() is too big.  That makes us difficult to
understand the flow of them.  So, first of all, we should split the method to
smaller chunks.  Then, we can understand what we're doing in HandleEvent() more.

This patch creates MaybeHandleEventWithAccessibleCaret() for first handling
block in HandleEvent().  Note that the following patch will clean it up.
I.e., this patch just moves the existing block into the new method.

Differential Revision: https://phabricator.services.mozilla.com/D16952
2019-01-29 10:30:35 +00:00
Masayuki Nakano
eab27bcccb Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them.  So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling.  That's too bad because some
of them may depend on the calling order, etc.

So, for grouping them, PresShell should create a stack class instance to handle
each event.  Then, we can store shared information in it only while we're
handling an event.

This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.

Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent.  Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget.  Therefore, this
patch does not make the new class store the event as a member.

Differential Revision: https://phabricator.services.mozilla.com/D16951
2019-01-29 06:04:05 +00:00
Emilio Cobos Álvarez
8ea8402e17 Bug 1514511 - Don't flush if the document is in the bfcache. r=bzbarsky
I think this is slightly better fix given the amount of offenders we have that
don't make sure this is the case.

Generally we get through the flush just fine, but there's code that relies on
nsIDocument::GetShell to return something meaningful, like the styleset code
that gets a pres context.

Differential Revision: https://phabricator.services.mozilla.com/D14689
2019-01-26 08:59:17 +01:00
Bobby Holley
8c2421bab3 Bug 1522017 - Introduce StackingContextParams to avoid death by a thousand argument. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D17434
2019-01-24 10:44:35 -08:00
Ryan Hunt
b45158768e Bug 1518640 - Use the visual viewport for anchor node selection. r=botond 2019-01-22 13:37:16 -06:00
Csoregi Natalia
08beb9e515 Backed out 2 changesets (bug 1518640) for reftest failures on gfx/layers/apz/test/reftest/frame-reconstruction-scroll-clamping.html. CLOSED TREE
Backed out changeset 27bbb318ecb4 (bug 1518640)
Backed out changeset 3b192e4631cc (bug 1518640)
2019-01-22 22:37:00 +02:00
Ryan Hunt
23066b81ce Bug 1518640 - Use the visual viewport for anchor node selection. r=botond 2019-01-22 13:37:16 -06:00
Cosmin Sabou
57bb107987 Merge mozilla-inbound to mozilla-central. a=merge 2019-01-19 11:57:49 +02:00
Greg Tatum
7ced9eb1ec Bug 1520526 - Add categories to all profiler markers; r=mstange
This commit adds categories to all markers. This way the profiler's
marker categories and frame label categories agree. There are a few
duplicate category properties on some of the marker payloads, but
this could be cleaned up in a follow-up if needed.

Differential Revision: https://phabricator.services.mozilla.com/D16864
2019-01-18 15:40:15 +00:00
sotaro
f342513ae1 Bug 1508522 - Relax aysnc animation size restriction with WebRender r=mattwoodrow
Performance of sync animation with large images is worse with WebRender than non-WebRender case. We want to use async animation as much as possible and relax aysnc animation size restriction. With WebRender, memory usage increase for async animation is limited compared to non-WebRender case.  Image does not needs additional TextureClient allocation for async animation and majority of frames are comverted to WebRenderCommands. Then we could relax aysnc animation size restriction with WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D16791
2019-01-17 23:59:44 +00:00
Ryan Hunt
47e6aceb92 Bug 1519462 - Coalesce all scroll anchor adjustments to be performed after layout when flushing notifcations. r=dholbert
We currently perform anchor adjustment in three spots:
  1. If the target of RestyleManager::RecomputePosition is in a scroll anchor chain
  2. If the reflow root is in a scroll anchor chain
  3. In nsHTMLScrollFrame::DidReflow, for itself

It looks like it's possible for a scroll anchor container to be adjusted by (1)
and (2 or 3) in the same PresShell flush.

This should be okay, except that we consume mSuppressAnchorAdjustment when
performing an adjustment, and this can lead us to miss the second time that
we perform adjustments in a PresShell flush.

This commit reworks how we run anchor adjustments so that we collect all
scroll anchor containers that should be adjusted, and only perform the
adjustments once.

Differential Revision: https://phabricator.services.mozilla.com/D16407
2019-01-13 00:54:05 -06:00
Ting-Yu Lin
fc359f1610 Bug 1503420 Part 1 - Adjust some callers of nsIFrame::List() to stop passing 0 as a const char* argument. r=dholbert
To reproduce, execute
"GECKO_FRAMECTOR_DEBUG_FLAGS=really-noisy-content-updates ./mach run".

nsIFrame::List()'s second argument should be a const char*, not an
integer. We can fix the bug by omitting it because the default value of
the argument is an empty string.

Differential Revision: https://phabricator.services.mozilla.com/D16075
2019-01-09 21:02:13 +00:00
Oana Pop Rus
5847bf8ce1 Merge mozilla-central to autoland. a=merge CLOSED TREE 2019-01-15 11:39:31 +02:00
Botond Ballo
e7b3975365 Bug 1509575 - Make nsIPresShell::mVisualViewportOffset a Maybe so we can tell if it's ever been set. r=kats
This allows us to e.g. avoid sending a value that's (0,0) because it hasn't
been set yet in a visual scroll update.

Depends on D16346

Differential Revision: https://phabricator.services.mozilla.com/D16477
2019-01-15 01:30:55 +00:00
Cameron McCormack
f111c08be6 Bug 1519296 - Part 3: Make PresShell::AddOverrideStyleSheet append its sheet rather than prepend r=emilio
We only ever add a single sheet (EditorOverride.css) there anyway.

Depends on D16282

Differential Revision: https://phabricator.services.mozilla.com/D16283
2019-01-12 06:45:52 +00:00
Cameron McCormack
836359028d Bug 1519296 - Part 2: Make PresShell::AddUserSheet just find the right place to insert r=emilio
Depends on D16281

Differential Revision: https://phabricator.services.mozilla.com/D16282
2019-01-12 06:46:00 +00:00