Commit Graph

524 Commits

Author SHA1 Message Date
Miko Mynttinen
d362fc5ee4 Bug 1512251 - Remove unused render only selection code r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D13829
2018-12-06 19:40:50 +00:00
Daniel Holbert
0d1b724969 Bug 1512112: Remove redundant includes from source files in layout. r=TYLin
All of the removed includes are redundant (i.e. they're #included elsewhere in
the same file).

In most cases, I'm removing the second (redundant) copy of the
#include, except when that copy makes more sense (i.e. if it's in better sorted
order, or if it's paired alongside a closely-associated header while the
earlier copy is not).

Here's the script that I used to generate candidates here -- I ran this in
every subdirectory of layout, on my linux machine (warning, this writes two
files to your /tmp directory):

for FILE in *.h *.cpp; do
  nonunique=$(grep \#include $FILE | grep -v List\.h | cut -f2 -d'"'  | cut -f2- -d'/'| cut -f2- -d'/' | sort | wc -l)
  unique=$(   grep \#include $FILE | grep -v List\.h | cut -f2 -d'"'  | cut -f2- -d'/'| cut -f2- -d'/' | sort | uniq | wc -l)
  if [[ "$unique" != "$nonunique" ]]; then
    echo "$FILE: $nonunique / $unique"
    grep \#include $FILE | cut -f2 -d'"'  | grep -v List\.h | cut -f2- -d'/'| cut -f2- -d'/' | sort  > /tmp/nonunique.txt
    grep \#include $FILE | cut -f2 -d'"'  | grep -v List\.h | cut -f2- -d'/'| cut -f2- -d'/' | sort | uniq  > /tmp/unique.txt
    diff /tmp/nonunique.txt /tmp/unique.txt
    echo
  fi
done

Depends on D13773

Differential Revision: https://phabricator.services.mozilla.com/D13774
2018-12-05 18:55:59 +00:00
Botond Ballo
35c5a6a286 Bug 1511137 - Track more accurately when the main thread originates a resolution change. r=kats
The tracking is done using nsAtom origins, similarly to how updates to the
scroll offset are tracked.

Currently, APZ still uses some heuristics to deduce that the main thread
originated a resolution change in some cases, but the intention is to try
to remove those and rely only on this mechanism in the future.

Differential Revision: https://phabricator.services.mozilla.com/D13741
2018-12-05 16:29:18 +00:00
Cameron McCormack
3c9d4e9a6c Bug 1511854 - Part 2: Fix some more formatting oddities in layout/ after the clang-format. r=TYLin
Depends on D13686

Differential Revision: https://phabricator.services.mozilla.com/D13775
2018-12-05 18:44:05 +00:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Masayuki Nakano
8f607b6a26 Bug 1496288 - part 1: Make blacklist prefs for keypress event behavior changes ride the train r=smaug
Basically, we shouldn't have blacklist to disable web API.  However, the
keypress event behavior changes are not standardized things.  Therefore,
if some web developers realize that they need to change their apps when
it's too late for them, Firefox users need to use another browser for
such web apps for several weeks or more, and such things may make the users
switch their default browser.  For avoiding such worst scenario, we should
take the blacklists and if we get such compatibility reports, we should
add the domains into the blacklist even in release channel.

Differential Revision: https://phabricator.services.mozilla.com/D13374
2018-11-29 15:04:18 +00:00
Emilio Cobos Álvarez
6cd9f0fe25 Bug 1509958, bug 1508734 - Give up on an assert that doesn't hold because of bug 1510208. r=smaug
Can't land the test-case from bug 1510208 as a crashtest because it needs you to
move the mouse around, and as such it doesn't crash in the crashtest harness.

Differential Revision: https://phabricator.services.mozilla.com/D13054
2018-11-27 13:12:44 +00:00
Daniel Holbert
13ecf1232f Bug 1509972 part 1: Remove unnecessary nsAutoPtr includes from files in layout/base. r=TYLin
In each file touched by this commit, there were no mentions of nsAutoPtr
besides the #include.

I verified that the folder layout/base still builds successfully in
non-unified mode after this patch, too. So, none of these files are secretly
using nsAutoPtr and depending on some other .cpp file to provide the header.

Differential Revision: https://phabricator.services.mozilla.com/D12993
2018-11-26 22:12:20 +00:00
Dorel Luca
d10e392ea5 Backed out 6 changesets (bug 1159042) for crashtest failures. CLOSED TREE
Backed out changeset fe77c09dee31 (bug 1159042)
Backed out changeset db0e173a6ed2 (bug 1159042)
Backed out changeset 080b9ceee8ec (bug 1159042)
Backed out changeset 6a5191742ca1 (bug 1159042)
Backed out changeset 3a86c3e65d44 (bug 1159042)
Backed out changeset 845bc8316b05 (bug 1159042)
2018-11-27 06:30:07 +02:00
L. David Baron
7a0784c463 Bug 1159042 - p6. Use NS_FRAME_DYNAMIC_REFLOW_ROOT - r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D9492
2018-11-25 23:18:19 +00:00
Gerald Squelart
b5ff62e827 Bug 1159042 - p4. Make mDirtyRoots manage roots in preferred depth order - r=dbaron
When popping a dirty root, take the shallowest one first (so we reflow from
outer frames first, to avoid potential duplicate reflow of inner frames).

Prevent duplicate roots (to be reworked in a future bug).

Differential Revision: https://phabricator.services.mozilla.com/D9490
2018-11-26 23:24:34 +00:00
Gerald Squelart
6dc3cac4d0 Bug 1159042 - p3. Refactor mDirtyRoots type into a class - r=dbaron
As mDirtyRoots will be accessed through a more cohesive API, this patch hides
the storage details (nsTArray) -- but provides almost the same API for now.

Differential Revision: https://phabricator.services.mozilla.com/D9489
2018-11-25 22:08:03 +00:00
L. David Baron
0171e6da72 Bug 1159042 - p2. Allow reflow roots to have overflow, and allow that overflow to change during reflow - r=dbaron,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D9488
2018-11-25 22:07:39 +00:00
L. David Baron
b2e4e8a047 Bug 1159042 - p1. Replace rootFrame variable with isRoot boolean in PresShell::DoReflow - r=dbaron,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D9487
2018-11-25 22:07:21 +00:00
Jeff Muizelaar
a9e41ff337 Bug 1507686 - Record LayerManager URL for each paint so that we can correlate it with slow paints. r=mattwoodrow
MozReview-Commit-ID: 2RUWkboAOJz
2018-11-19 20:55:28 +13:00
Jeff Muizelaar
ae5ed06be5 Bug 1507021. Use SnappedRectangle in more places. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D11840
2018-11-19 23:03:32 +00:00
Bogdan Tara
228d1068ee Merge inbound to mozilla-central. a=merge 2018-11-16 11:47:51 +02:00
Daniel Holbert
ab2a2968bf Bug 1507313 part 3: Convert PresShell::mDelayedEvents into an array of UniquePtr (rather than nsAutoPtr). r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D11947
2018-11-15 07:40:52 +00:00
Daniel Holbert
318abefa63 Bug 1507313 part 2: Convert PresShell::mReflowCountMgr into a UniquePtr (rather than an owning raw pointer). r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D11946
2018-11-15 07:27:50 +00:00
Daniel Holbert
82a72db98a Bug 1507313 part 1: Convert nsIPresShell::mFrameConstructor into a UniquePtr (rather than an owning raw pointer). r=TYLin
Also, null out its alias mFrameManager before it's deleted.

Differential Revision: https://phabricator.services.mozilla.com/D11945
2018-11-15 07:28:33 +00:00
Brian Hackett
ca3a7009de Bug 1506007 - Don't create checkpoints while painting with AutoAssertNoContentJS on the stack, r=mstange. 2018-11-08 17:32:20 -10:00
Andrea Marchesini
ffaa03d443 Bug 1505212 - Partitioned localStorage for 3rd party tracker pages, r=ehsan, r=asuth
LocalStorage needs to be exposed in every context except for sandboxes and
NullPrincipals (data: URLs, for instance). But we need to keep data
separate in some scenarios: private-browsing and trackers.
In private-browsing, LocalStorage keeps data in memory, and it shares
StorageEvents just with other origins in the same private-browsing
environment.
For Trackers, we expose a partitioned LocalStorage, which doesn't share
data with other contexts, and it's just in memory. Partitioned localStorage
is available only for trackers listed in the
privacy.restrict3rdpartystorage.partitionedHosts pref. See
nsContentUtils::IsURIInPrefList to know the syntax for the pref value.
2018-11-13 09:51:14 +01:00
Daniel Holbert
d866b3aac3 Bug 1505254: When invalidating ancestors' intrinsic sizes, stop when we hit an abspos frame. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D11146
2018-11-07 19:03:22 +00:00
Masayuki Nakano
6213d82e9a Bug 1502795 - Set keyCode or charCode of keypress event whose value is zero to the other's non-zero value by default again unless dispatched on known broken web apps r=smaug
This patch re-enables the new behavior of bug 1479964, to set keyCode or
charCode of keypress event whose value is zero to the other's non-zero value.

However, some web apps are still broken with the new behavior.  Therefore,
this patch adds a blacklist to keep using our legacy behavior in some specific
web apps.

Note that Google Docs, Gmail and Remember The Milk are reported as broken.
However, I don't see any broken shortcut with Gmail.  Therefore, this patch
adds only Google Docs and Remeber The Milk into the blacklist.

Differential Revision: https://phabricator.services.mozilla.com/D10322
2018-11-07 06:39:10 +00:00
Nazım Can Altınova
446a489515 Bug 1417976 - Part 2: Include DocShell IDs to marker payloads r=mstange
MozReview-Commit-ID: AML1ESUnFlu

Depends on D4914

Differential Revision: https://phabricator.services.mozilla.com/D4915
2018-11-06 21:45:50 +00:00
Emilio Cobos Álvarez
b0fb206eee Bug 1504980 - Null-check + assert. r=smaug
In case fuzzers or somebody can catch this in a reproducible way...

I'd be interested in knowing what the hell is going on.

Differential Revision: https://phabricator.services.mozilla.com/D11053
2018-11-06 16:30:56 +00:00
Markus Stange
69424ded61 Bug 1504742 - Add LAYOUT category for presshell destruction stacks. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D10927
2018-11-05 19:16:22 +00:00
Emilio Cobos Álvarez
81676e363d Bug 1497524 - Properly dispatch events when the NAC event target is not the root, and it gets reframed. r=smaug
We can wait for the button fix if you want, but it was easy enough to fix, I
think.

I think we could merge NativeAnonymousContentRemoved with the walk that
NotifyFrameRemoved does, since the content should still be in the tree when that
happens. If you want, I can do that as a followup.

Differential Revision: https://phabricator.services.mozilla.com/D10845
2018-11-04 19:53:07 +00:00
Ryan Hunt
8fc281bdb4 Bug 1504220 - Move ScrollableLayerGuid, ViewID, ZoomConstraints from FrameMetrics.h r=botond
This commit attempts to lower the pain of modifying FrameMetrics.h.

It looks like most includes really only want ViewID or
ScrollableLayerGuid, so this commit factors them out into a separate
header. In the process FrameMetrics::ViewID is changed to
ScrollableLayerGuid::ViewID, which personally seems like a better
place for it now that we have RepaintRequest. Unfortunately that
requires a lot of places to be updated.

After this commit there are still a couple of major places that
FrameMetrics is included.
 * nsDisplayList.h
 * nsIScrollableFrame.h
 * Layers.h

Those are going to be more tricky or impossible to fix so they're
not in this commit.

Differential Revision: https://phabricator.services.mozilla.com/D10722
2018-11-01 15:15:46 -05:00
Masayuki Nakano
3ae0be7f6f Bug 1482425 - PresShell::PageMove() should use different rules to look for a container element for aExtend value r=smaug
PresShell::PageMove() climbs up to parent document when there is no scrollable
parent in current document.  However, if aExtend is true, it should expand
Selection in the document itself.  Therefore, it needs different rules to
look for container of expanding Selection from scrollable element to scroll.

Additionally, old rules (i.e., before the fix of bug 1369072 which caused
this regression) were also buggy.  It used parent scrollable element or
root scrollable element simply.  Therefore, if found scrollable element is
ancestor of selection limiter, it didn't work as expected.

This patch creates nsFrameSelection::GetFrameToPageSelect() to retrieve
per-page selection container element with the following rules:
- look for a scrollable element in selection limiter.
- if there is no scrollable element, use selection limiter.
- if there is no selection limiter, use the root frame.

So, nsFrameSelection::CommonPageMove() should take nsIFrame rather than
nsIScrollableFrame since container of per-page selection may be used in
non-scrollable contenteditable element.  If it's called with non-scrollable
frame, it needs to compute the expanding range with the frame size.

Differential Revision: https://phabricator.services.mozilla.com/D8954
2018-10-18 04:42:53 +00:00
Mats Palmgren
f835530426 Bug 1494745 part 2 - Make nsRefreshDriver::AddRefreshObserver void since it's infallible. r=bz
nsRefreshDriver::ObserverArray is a nsTObserverArray which is
infallible, so no need to check the return value from AppendElement
(which a later patch in this series will remove).
2018-10-14 18:12:22 +02:00
Sylvestre Ledru
cec75ca74a Bug 1498586 - Add clang-format off to avoid the reformatting of the data structures r=Ehsan
Too hard/impossible for the tool to format correctly these structs

Differential Revision: https://phabricator.services.mozilla.com/D8569
2018-10-12 20:48:24 +00:00
Edgar Chen
d47225b800 Bug 1473108 - Part 2: Make PresShell not point to unbound NAC in event content stack; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D8042
2018-10-09 12:16:15 +00:00
Edgar Chen
08afdda697 Bug 1473108 - Part 1: Devirtualize nsIPresShell::GetCurrentEventFrame/GetEventTargetContent; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D8041
2018-10-09 09:47:58 +00:00
Brad Werth
c50fd7151e Bug 1290420 Part 4: Make the PresShell create a MobileViewportManager on demand. r=botond,smaug
Depends on D3376

Differential Revision: https://phabricator.services.mozilla.com/D3377
2018-10-04 03:28:40 +00:00
Botond Ballo
8626ae6069 Bug 1290420 Part 2: Respect the metaViewportOverride flag on the docshell. r=dholbert
Depends on D3373

Differential Revision: https://phabricator.services.mozilla.com/D3375
2018-10-04 00:19:40 +00:00
Andrew McCreight
05b70f0bb6 Bug 1493737 - Fix many trivial calls to do_QueryInterface r=smaug
If class A is derived from class B, then an instance of class A can be
converted to B via a static cast, so a slower QI is not needed.

Differential Revision: https://phabricator.services.mozilla.com/D6861
2018-10-01 21:38:01 +00:00
Botond Ballo
fd72d90363 Bug 1484597 - Use the visual viewport offset in ScrollToShowRect(). r=mstange
Depends on D6075

Differential Revision: https://phabricator.services.mozilla.com/D6076
2018-09-21 19:04:49 +00:00
Botond Ballo
a6603302a2 Bug 1484597 - Expose visual viewport information more conveniently in Layout. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D6074
2018-09-21 19:01:13 +00:00
Ting-Yu Lin
1106db953a Bug 1485063 Part 3 - Move preferences which enable AccessibleCaret to StaticPrefList.h r=mats
Differential Revision: https://phabricator.services.mozilla.com/D5472
2018-09-21 22:01:29 +00:00
Nazım Can Altınova
8b992d5065 Bug 1437316 - Move the profiler marker from DoFlushPendingNotifications to inner DoReflow method r=mstange
Depends on D4943

Differential Revision: https://phabricator.services.mozilla.com/D4945
2018-09-13 20:30:21 +00:00
Nazım Can Altınova
3a2d0bba1f Bug 1437316 - Move the "PresShell::DoReflow" label frame to top side of the method r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D4943
2018-09-13 20:25:43 +00:00
Ryan VanderMeulen
7f3703664f Backed out 4 changesets (bug 1485063) for breaking text selection on Android (bug 1490818).
Backed out changeset 8ad3af468d26 (bug 1485063)
Backed out changeset 8f53e771094d (bug 1485063)
Backed out changeset 99456cff7313 (bug 1485063)
Backed out changeset d43869851540 (bug 1485063)
2018-09-13 10:21:46 -04:00
Daniel Holbert
883cc9e93e Bug 1490410: Remove unreachable return statement from DispatchKeyPressEventsEvenForNonPrintableKeys(). r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5561
2018-09-12 02:00:25 +00:00
Emilio Cobos Álvarez
963d1beb5e Bug 1490012 - FlushPendingMediaFeatureValuesChanged can kill the PresShell. r=xidorn
It can flush the parent document from MediaQueryList::RecomputeMatches, which
can destroy our pres context.

I think that flush is wrong btw, it should probably either flush layout so the
viewport size is correct, or just not flush (we should make MediaList::Matches
take a document now that we don't need a pres context to match media queries,
but that requires a bit more refactoring).

Differential Revision: https://phabricator.services.mozilla.com/D5524
2018-09-12 15:44:37 +02:00
Ting-Yu Lin
7513a6e086 Bug 1485063 Part 3 - Move preferences which enable AccessibleCaret to StaticPrefList.h. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D5472
2018-09-11 14:21:35 -07:00
Edgar Chen
d4177452de Bug 1488728 - Remove PresShell::GetEventTargetFrame; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D5025
2018-09-05 13:36:35 +00:00
Masayuki Nakano
8e0ecc58d3 Bug 1487591 - Make Selection treat AccessibleCaretEventHub as concrete class rather than nsISelectionListener r=smaug
AccessibleCaretEventHub is an nsISelectionListener of Selection whose type is
"normal".  This is added only when nsFrameSelection::Init() is called and
accessible caret is enabled.  Additionally, nsFrameSelection::Init() is
always called immediately after creating nsFrameSelection.

Therefore, when AccessibleCaretEventHub is installed to Selection, this is
always second selection listener and won't be installed multiple times.  So,
Selection can store pointer of AccessibleCaretEventHub directly only when
it's enabled and the Selection needs to notify it of selection change.

This patch makes Selection stores AccessibleCaretEventHub with RefPtr, then,
makes Selection::NotifySelectionListeners() call its OnSelectionChange()
immediately after AutoCopyListener.

Unfortunately, this patch includes making of MOZ_CAN_RUN_SCRIPT_BOUNDARY and
MOZ_CAN_RUN_SCRIPT a lot since some methods of AccessibleCaretEventHub are
marked as MOZ_CAN_RUN_SCRIPT and including AccessibleCaretEventHub.h into
Selection.h causes compile the compile errors.

Differential Revision: https://phabricator.services.mozilla.com/D4733
2018-08-31 21:19:44 +00:00
Emilio Cobos Álvarez
49ae1fde16 Bug 1486536 - Explicitly flush the StyleSet from FlushPendingNotifications. r=heycam
When CSS rules change, we usually do this implicitly from FlushUserFontSet & co.

However there's a code path that dirties the stylist but not the CSS rules, and
that's when the compat mode changes and we're an SVG document.

I don't think that can get hit (easily, at least?), but it's pretty easy to do
so and I think this is cleaner too.

This fixes that case so the stylist can't assert in that case either, and so
that we still rebuild the cascade data so that the hash maps use the right keys
for a given quirks-mode.

Differential Revision: https://phabricator.services.mozilla.com/D4361
2018-08-28 16:01:06 +02:00
Ting-Yu Lin
46d6c38f7b Bug 1482665 Part 2 - Remove nsPresContext::AppUnitsPerCSSPixel() and replace it with mozilla::AppUnitsPerCSSPixel(). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D3155
2018-08-13 14:29:28 -07:00