Commit graph

121 commits

Author SHA1 Message Date
Ehsan Akhgari
e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Masayuki Nakano
f8844f0d9b Bug 181137 - part 7: Get rid of nsIContentIterator interface r=smaug
Now, nobody requires nsIContentIterator interface.  So, we can get rid of it.

Unfortunately, there is no macro to keep the inherited class,
ContentSubtreeIterator, in the cycle collection to make it keep managing
ContentSubtreeIterator::mRange without nsISupports interface.  Therefore, this
patch moves it into ContentIteratorBase temporarily.  Anyway, the following
patch makes those classes not refcountable.  At that time, this issue will be
fixed.

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

--HG--
extra : moz-landing-system : lando
2019-01-11 01:51:42 +00:00
Csoregi Natalia
13506c036a Backed out 8 changesets (bug 181137) for bustage on FragmentOrElement.cpp:1751. CLOSED TREE
Backed out changeset 99a977d519a0 (bug 181137)
Backed out changeset 65a4b245e851 (bug 181137)
Backed out changeset 5385d5fd9b8b (bug 181137)
Backed out changeset 83bec02c21d9 (bug 181137)
Backed out changeset b7ab59bf545e (bug 181137)
Backed out changeset b6fc7a332db7 (bug 181137)
Backed out changeset 654fdbad67db (bug 181137)
Backed out changeset 90a1ff49b6b1 (bug 181137)

--HG--
rename : dom/base/ContentIterator.h => dom/base/nsContentIterator.cpp
rename : editor/spellchecker/FilteredContentIterator.cpp => editor/spellchecker/nsFilteredContentIterator.cpp
rename : editor/spellchecker/FilteredContentIterator.h => editor/spellchecker/nsFilteredContentIterator.h
2019-01-10 11:42:27 +02:00
Masayuki Nakano
91a9670801 Bug 181137 - part 7: Get rid of nsIContentIterator interface r=smaug
Now, nobody requires nsIContentIterator interface.  So, we can get rid of it.

Unfortunately, there is no macro to keep the inherited class,
ContentSubtreeIterator, in the cycle collection to make it keep managing
ContentSubtreeIterator::mRange without nsISupports interface.  Therefore, this
patch moves it into ContentIteratorBase temporarily.  Anyway, the following
patch makes those classes not refcountable.  At that time, this issue will be
fixed.

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

--HG--
extra : moz-landing-system : lando
2019-01-10 08:47:54 +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
Emilio Cobos Álvarez
b6deca5eb0 Bug 1442466 - Fix bogus IsInNativeAnonymousSubtree function in nsWebBrowserFind. r=bzbarsky
This is ultimately the root cause of the issue. I'm landing a test to ensure we
notice the behavior change if we make it, in addition to a test for this issue
itself, to ensure that we don't get stuck, since after bug 1510485 we don't
return such nodes from nsFind when window.find is called anyway.

This code made no sense, it only returned true if the binding parent is the node
itself, which as far as I can tell cannot happen, so it was just a very
expensive way to return false.

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

--HG--
extra : moz-landing-system : lando
2018-12-11 04:18:11 +00:00
Emilio Cobos Álvarez
1288b871bf Bug 1510485 - Properly handle errors in nsFind when returning a range. r=bzbarsky
Bug 1505887 changed the behavior here from content calling into nsFind via
window.find(), by making the SetStart and SetEnd calls here fail instead of
succeed for NAC (like the text in textareas).

This patch makes us handle that error gracefully moving on to the next match,
instead of trying to preserve the previous behavior.

This means that we'll fail to highlight textarea content and such from
window.find, which Chromium does, looks like. Though Chromium doesn't expose
the ranges as selection either. In any case I don't think that this is a very
common thing given bugs like bug 1442466, which this bug fixes.

I haven't found anything close to a spec for what window.find() should do... If
we decide to go with this patch then I'll add a crashtest for this and a test
for bug 1442466 as well. Otherwise I'll add a way to skip the security check in
nsFind somehow for NAC, or relax the security restrictions in SetStart /
SetEnd, I guess.

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

--HG--
extra : moz-landing-system : lando
2018-12-11 01:06:32 +00: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
Kyle Machulis
c241567f0f Bug 1505601 - Turn nsIDocShell XPIDL const lists into cenums; r=bzbarsky
Turn all const lists and related attributes into cenums, to provide a
vague sense of type safety.

Depends on D11715

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

--HG--
extra : moz-landing-system : lando
2018-11-28 03:30:56 +00:00
Gabriele Svelto
266ef73c96 Bug 1503207 - Remove nsWeakPtr.h and cleanup all files including weak reference-related headers r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D10251

--HG--
extra : moz-landing-system : lando
2018-10-31 20:39:03 +00:00
Andrew McCreight
ea6021b769 Bug 1494127 - Fix trivial calls to do_QueryInterface that return an nsresult r=smaug
Calls to do_QueryInterface to a base class can be replaced by a static
cast, which is faster.

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

--HG--
extra : moz-landing-system : lando
2018-10-01 21:38:43 +00:00
Ehsan Akhgari
6c19b5c6fd Bug 1491735 - Remove the XPCOM registration for nsWebBrowserFind; r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D5993
2018-09-17 19:48:13 -04:00
Nicholas Nethercote
534cc02919 Bug 1488628 - Change nsIWebBrowsing.searchString to an AString. r=froydnj
--HG--
extra : rebase_source : b7c2bdded7dbd278bfbb2297c0d1ea6c4ca4934c
2018-09-05 13:38:51 +10:00
Emilio Cobos Álvarez
d88bf18c3f Bug 1455891: Use GetFlattenedTreeParent more in nsFind. r=mats
This is the right thing to use for this kind of stuff.

MozReview-Commit-ID: FrgD48LjRSG
2018-07-06 06:53:22 +02:00
Emilio Cobos Álvarez
d35cc30c13 Bug 1455891: Remove nsFindContentIterator. r=mats
MozReview-Commit-ID: 58AFqqaSLcC
2018-07-06 06:53:22 +02:00
Emilio Cobos Álvarez
a7404f40c6 Bug 1455891: Use TreeIterator in nsFind. r=mats
MozReview-Commit-ID: GSY5w6NYRS
2018-07-06 06:53:22 +02:00
Emilio Cobos Álvarez
312b570c68 Bug 1472529: More nsFind cleanup. r=mats
The general setup is that the State struct is used to iterate over text nodes
explicitly, and keeps references to the ranges so that we don't need to pass all
them around everywhere.

We need to teach nsFindContentIterator to rewind into NAC to be able to get rid
of mIterNode, which was getting out of sync when we failed to rewind to the
anchor node.

MozReview-Commit-ID: 5czYADrm1WX
2018-07-03 02:07:48 +02:00
Emilio Cobos Álvarez
832ed77502 Bug 1470861: Mark some nsFind arguments const. rs=mats
MozReview-Commit-ID: 8zh1y2vRyWj
2018-06-26 14:39:41 +02:00
Emilio Cobos Álvarez
e57e03c212 Bug 1470861: Mark some methods const now that they don't mutate nsFind itself. r=mats
This patch is idempotent.

MozReview-Commit-ID: BBZlZ5FrP5K
2018-06-26 14:39:41 +02:00
Emilio Cobos Álvarez
f4d177be39 Bug 1470861: Make GetBlockParent static. r=mats
This patch is idempotent.

MozReview-Commit-ID: L5JfCfnlKzM
2018-06-26 14:39:41 +02:00
Emilio Cobos Álvarez
d9babd5836 Bug 1470861: Remove useless code. r=mats
We're throwing away the computation when aContinueOk is true, so we can remove
that call. Removing that call removes the last usage of aContinueOk, so remove
that handling as well.

This patch is idempotent.

MozReview-Commit-ID: E3sogickWp9
2018-06-26 14:39:41 +02:00
Emilio Cobos Álvarez
6b84d00cdd Bug 1470861: Make state-passing explicit in nsFind. r=mats
Instead of tweaking member variables and resetting them afterwards, just have an
object that we pass around.

This makes a bit easier to reason about nsFind IMO, and makes us able to use
more complex iterators that don't keep strong references to anything and that
kind of stuff, since we don't keep an iterator member around, and we don't
mutate the DOM from nsFind.

This patch is idempotent.

MozReview-Commit-ID: ERDnL6Q8QTU
2018-06-26 14:39:41 +02:00
Emilio Cobos Álvarez
04873dccda Bug 1470861: Make nsFind::ResetAll reset mIterNode / mIterOffset too. r=mats
We do reset them implicitly next time we call Find(..), since we call
ResetAll() at the beginning of it, then NextNode(..), which unconditionally
overrides them, but this is clearer for the next thing I want to do.

This patch is idempotent.

MozReview-Commit-ID: 6OW8MfkftTM
2018-06-26 14:17:40 +02:00
Emilio Cobos Álvarez
f066564ff0 Bug 1470861: Cleanup GetBlockParent. r=mats
This patch is idempotent.

MozReview-Commit-ID: 1e9y2Fn76kU
2018-06-26 14:17:27 +02:00
Emilio Cobos Álvarez
c87bf3439a Bug 1470861: Trivially simplify some code in nsWebBrowserFind. r=mats
MozReview-Commit-ID: AaLVbxRbaCU
2018-06-26 14:16:59 +02:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Emilio Cobos Álvarez
ccb5a9420c No bug - Remove unneeded DEBUG_FIND ifdef. r=me
MozReview-Commit-ID: DlLynspfZFC
2018-06-25 21:19:31 +02:00
Emilio Cobos Álvarez
d07da09344 No bug - Remove useless QI in DEBUG_FIND code. r=me
MozReview-Commit-ID: B6vME1WYne3
2018-06-25 11:43:21 +02:00
Emilio Cobos Álvarez
fe09ffd3af Bug 1465478: Introduce Element::FromNode. r=smaug
And use it in a couple places I noticed.

MozReview-Commit-ID: 8baSMrbdEbF
2018-05-31 02:46:10 +02:00
Emilio Cobos Álvarez
cba41943f0 Bug 1457336: Forget the last matched character when switching blocks. r=mats
This fixes browser/components/extensions/test/browser/file_find_frames.html with
my patches. We were relying on traversing suppressed whitespace to match the
whole word properly there.

You can see the bug with the following test-case:

<p>Banana 0</p><p>Banana 1</p>

If you try to match "banana" using "Whole word", you'll only find the first
word, because we keep c = '0'. If there's a newline between the two paragraphs,
like in the test, before my patch we we would traverse it (even though it's
suppressed whitespace) and keep c = '\n', which makes the match succeed.

Fix it forgetting the state of the match completely, including c.

That test was firing a lot of "GetOffsetTo() called on frames from different
documents" assertions... That's probably worth looking into as a followup.

MozReview-Commit-ID: AzId7YWQcJI
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
8949ef0819 Bug 1457336: Skip only undisplayed nodes, not invisible nodes. r=mats
MozReview-Commit-ID: 5KgV1lqmim3
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
da5b832355 Bug 1457336: Make some functions static. r=mats
This patch should have no change in behavior.

MozReview-Commit-ID: AOAZ09g78fr
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
fefcb53570 Bug 1457336: Make the debug find code less noisy. r=mats
Not sure how useful it really is compared to rr but...

MozReview-Commit-ID: 4II28NYDCNo
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
e481b55668 Bug 1457336: Remove dead code. r=mats
There's nothing referencing this macro...

MozReview-Commit-ID: 5NzVOFAOQMw
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
cb363f61b7 Bug 1457336: Teach nsFind about display in general. r=mats
I ended up not using the nsIFrame methods both for consistency with the plain
text serializer and because of include hell due to nsStyleStructInlines /
nsIFrameInlines.

Find doesn't care about nodes with no frames anyway, so it didn't seem worth
doing the fallback if there's no style information.

I'll file a bug for IsHTMLBlock.

MozReview-Commit-ID: 3T317a4xCB
2018-05-30 12:52:46 +02:00
Emilio Cobos Álvarez
340d7141bb Bug 1457286: Teach nsFind about display: contents. r=mats
MozReview-Commit-ID: LODyc8yuuSs
2018-05-30 12:45:24 +02:00
Boris Zbarsky
ce1b5e3b44 Bug 1455676 part 13. Remove use of nsIDOMNode from toolkit/. r=mossop
This needs pretty careful review for the update service changes, though I think
they're pretty mechanical and safe.
2018-05-29 22:58:49 -04:00
Cosmin Sabou
f571cc5fe1 Backed out 10 changesets (bug 1457336, bug 1457286) for android mochitest failures on dom/base/test/test_find.html.
Backed out changeset 6b7bc00d68ae (bug 1457336)
Backed out changeset 585572d3a8e3 (bug 1457336)
Backed out changeset ded57fc8fd13 (bug 1457336)
Backed out changeset b7a0af3470b0 (bug 1457336)
Backed out changeset 3d17cdf86d69 (bug 1457336)
Backed out changeset 9df9a6524aad (bug 1457336)
Backed out changeset 727e25c0e3ad (bug 1457336)
Backed out changeset 91f27da56d68 (bug 1457336)
Backed out changeset 072fa168f471 (bug 1457336)
Backed out changeset 1f645546750f (bug 1457286)
2018-05-30 01:21:31 +03:00
Emilio Cobos Álvarez
2d4be8c685 Bug 1457336: Forget the last matched character when switching blocks. r=mats
This fixes browser/components/extensions/test/browser/file_find_frames.html with
my patches. We were relying on traversing suppressed whitespace to match the
whole word properly there.

You can see the bug with the following test-case:

<p>Banana 0</p><p>Banana 1</p>

If you try to match "banana" using "Whole word", you'll only find the first
word, because we keep c = '0'. If there's a newline between the two paragraphs,
like in the test, before my patch we we would traverse it (even though it's
suppressed whitespace) and keep c = '\n', which makes the match succeed.

Fix it forgetting the state of the match completely, including c.

That test was firing a lot of "GetOffsetTo() called on frames from different
documents" assertions... That's probably worth looking into as a followup.

MozReview-Commit-ID: AzId7YWQcJI
2018-05-29 21:39:13 +02:00
Emilio Cobos Álvarez
699a696c0f Bug 1457336: Skip only undisplayed nodes, not invisible nodes. r=mats
MozReview-Commit-ID: 5KgV1lqmim3
2018-05-29 21:39:12 +02:00
Emilio Cobos Álvarez
576df97088 Bug 1457336: Make some functions static. r=mats
This patch should have no change in behavior.

MozReview-Commit-ID: AOAZ09g78fr
2018-05-29 21:39:11 +02:00
Emilio Cobos Álvarez
b6544fd549 Bug 1457336: Make the debug find code less noisy. r=mats
Not sure how useful it really is compared to rr but...

MozReview-Commit-ID: 4II28NYDCNo
2018-05-29 21:39:10 +02:00
Emilio Cobos Álvarez
8836218620 Bug 1457336: Remove dead code. r=mats
There's nothing referencing this macro...

MozReview-Commit-ID: 5NzVOFAOQMw
2018-05-29 21:39:09 +02:00
Emilio Cobos Álvarez
eb51d5da24 Bug 1457336: Teach nsFind about display in general. r=mats
I ended up not using the nsIFrame methods both for consistency with the plain
text serializer and because of include hell due to nsStyleStructInlines /
nsIFrameInlines.

Find doesn't care about nodes with no frames anyway, so it didn't seem worth
doing the fallback if there's no style information.

I'll file a bug for IsHTMLBlock.

MozReview-Commit-ID: 3T317a4xCB
2018-05-29 21:39:08 +02:00
Emilio Cobos Álvarez
ae03041f5b Bug 1457286: Teach nsFind about display: contents. r=mats
MozReview-Commit-ID: LODyc8yuuSs
2018-05-29 21:39:07 +02:00
Boris Zbarsky
2e09ba1f75 Bug 1377980 part 2. Remove most C++ use of nsIDOMRange. r=mccr8 2018-05-17 12:01:38 -04:00
Boris Zbarsky
40d2bf9d7f Bug 1377980 part 1. Remove use of nsIDOMRange in xpidl. r=mcc8 2018-05-17 12:01:37 -04:00
Adrian Wielgosik
3309929466 Bug 1460940 - Remove nsIDOMDocument uses in toolkit/. r=bz
MozReview-Commit-ID: LJhw1bKsUkn

--HG--
extra : rebase_source : bb6f877f75ced11f33ae37d7d2e430e54d82517c
2018-05-11 19:46:15 +02:00
Boris Zbarsky
1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky
a44e6132ff Bug 1387143 part 28. Remove nsISelection::AsSelection(). r=mats 2018-05-08 13:52:42 -04:00