Commit graph

93 commits

Author SHA1 Message Date
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
Boris Zbarsky
46cae9462a Bug 1387143 part 3. Stop using nsISelection in nsISelectionController. r=mats 2018-05-08 13:52:36 -04:00
Boris Zbarsky
c9bcb72283 Bug 1455674 part 1. Stop using nsIDOMElement in nsIEditor. r=masayuki 2018-04-26 23:35:18 -04:00
Boris Zbarsky
dac6314cb8 Bug 1456588 part 2. Change nsIFocusManager::MoveFocus to take Element. r=enndeakin 2018-04-26 10:37:47 -04:00
Boris Zbarsky
8a0b50bea8 Bug 1456588 part 1. Change nsIFocusManager::SetFocus to take Element. r=enndeakin 2018-04-26 10:37:46 -04:00
Adrian Wielgosik
b3c501adc4 Bug 1447389 - Remove nsIDOMNodeList. r=bz
MozReview-Commit-ID: 11szZP6dS6V

--HG--
extra : rebase_source : 9acfb352750e53d3b36684fa945a18e817c9b82e
2018-04-25 23:01:30 +02:00
Emilio Cobos Álvarez
6766804ba7 Bug 1454251: Remove nsINode::eCOMMENT. r=bz
MozReview-Commit-ID: AbSPU25fFbM
2018-04-20 09:51:57 +02:00
Andrew McCreight
3f7472aec1 Bug 1449670, part 1 - Convert IsNodeOfType(nsINode::eTEXT) to IsText(). r=bz
This method is not a virtual call, and also looks nicer.

This patch was mostly generated by a Python script, but I manually
cleaned up the code in a few places where statements didn't need to be
split across multiple lines any more.

MozReview-Commit-ID: 8JExxqSRc59

--HG--
extra : rebase_source : df6330a89e8d65dfe7a6fda0c8cb9f9732302efc
2018-04-12 15:41:00 -07:00
Boris Zbarsky
b3e9f0c75d Bug 1449601. Stop dereferencing a null mIterNode in find code. r=mystor
MozReview-Commit-ID: 2buTShJNqFp
2018-04-09 16:30:31 -04:00
Boris Zbarsky
df07d2d834 Bug 1447890 part 5. Remove nsISelection::RemoveAllRanges. r=mystor
MozReview-Commit-ID: EeMje9KW6An
2018-03-27 00:35:23 -04:00
Boris Zbarsky
24781001eb Bug 1447890 part 4. Remove nsISelection::GetRangeCount. r=mystor
MozReview-Commit-ID: FypNZE0oQiW
2018-03-27 00:35:22 -04:00
Boris Zbarsky
54d1f87ff4 Bug 1447890 part 1. Remove nsISelection::AddRange. r=mystor
MozReview-Commit-ID: 1JNLZp7tbII
2018-03-27 00:35:22 -04:00
Boris Zbarsky
3906df8d57 Bug 1447889 part 8. Remove nsIDOMRange::SelectNode/SelectNodeContents. r=mystor
MozReview-Commit-ID: 2hbF6pT31Xd
2018-03-27 00:35:21 -04:00
Boris Zbarsky
b94366962a Bug 1447889 part 6. Remove nsIDOMRange::SetStart/End. r=mystor
MozReview-Commit-ID: 8yOZMWBexsN
2018-03-27 00:35:21 -04:00
Boris Zbarsky
696d273ef4 Bug 1447889 part 4. Remove nsIDOMRange::GetStart/EndContainer/Offset. r=mystor
I got a bit carried away with fixing up consumers to use nsINode...  But as a
result removing these methods all together made sense.

MozReview-Commit-ID: 2z9Q6D7GY92
2018-03-27 00:35:21 -04:00
Boris Zbarsky
7c392f077e Bug 1418085 part 6. Remove nsIDOMHTMLElement. r=mystor
MozReview-Commit-ID: 5QUyFeAQYZQ
2018-01-30 00:25:36 -05:00
Boris Zbarsky
8c61d57bca Bug 1276438 part 6. Stop using nsIDOMHTMLDocument::GetBody. r=mystor
MozReview-Commit-ID: EcDTnByuZsm
2018-01-26 00:53:35 -05:00
Boris Zbarsky
4d88c28e4d Bug 1432186 part 17. Remove nsIDOMNode's parentNode attribute. r=mccr8
MozReview-Commit-ID: 4xzDwwEqnvE
2018-01-29 23:10:52 -05:00
Boris Zbarsky
abfab07da3 Bug 1432186 part 5. Remove nsIDOMNode's nodeType attribute. r=mccr8
MozReview-Commit-ID: LKsBgKcqtBS
2018-01-29 23:10:50 -05:00
Boris Zbarsky
c646473558 Bug 1432186 part 3. Remove nsIDOMNode's nodeName attribute. r=mccr8
MozReview-Commit-ID: Jg0Tuvdi6uX
2018-01-29 23:10:50 -05:00
Jonathan Kew
1a613e00cb Bug 1424898 - patch 2 - De-virtualize nsIWordBreaker and rename to mozilla::intl::WordBreaker. r=m_kato
--HG--
rename : intl/lwbrk/nsSampleWordBreaker.cpp => intl/lwbrk/WordBreaker.cpp
rename : intl/lwbrk/nsIWordBreaker.h => intl/lwbrk/WordBreaker.h
2017-12-13 22:17:38 -06:00
Sylvestre Ledru
d022c8a191 Bug 1424867 - Fix an ignored-qualifiers warning in nsFind.cpp r=smaug
MozReview-Commit-ID: JcNxEejtkWx

--HG--
extra : rebase_source : 2e168a9151f734c9c4802b5d9a10381cbd20d870
2017-12-12 08:11:39 -06:00
Nicholas Nethercote
d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Nika Layzell
cbc8fa8a3b Bug 1399626 - Part 4: Allow initializing nsIContentIterator with RangeBoundaries, r=masayuki
This patch adds an overload to nsIContentIterator::Init which accepts
RangeBoundary objects, and modifies the codepath to avoid using the offset of
the start or end nodes to construct the nsIContentIterator.

MozReview-Commit-ID: 5ZqKeiUunoN
2017-10-02 11:58:00 -04:00
Masayuki Nakano
4ce89d8f61 Bug 1369072 - part3: nsXBLPrototypeHandler::DispatchXBLCommand() should use controller of visible window r=smaug
With previous change, KeyboardEvent is dispatched even when invisible window
has focus.  However, nsRootWindow::GetControllerForCommand() returns controller
for focused window even when the window is invisible because it uses
nsFocusManager::GetFocusedDescendant() to retrieve focused window.

Perhaps, we can assume that users won't expect to do something with invisible
window when they type some keys.  Then, nsRootWindow::GetControllerForCommand()
should return controller for visible ancestor window if focused window is
invisible.

This patch makes nsFocusManager::GetFocusedDescendant() can return only visible
descendants.  However, it already has a bool argument.  Therefore, it should
have a flag instead of adding new flag.  Most changes of this patch is replacing
its callers.

Then, nsRootWindow::GetControllerForCommand() and nsRootWindow::GetControllers()
should have a bool flag if it should return controller(s) for visible window.
This patch adds a bool flag for it.  Fortunately, the interface isn't scriptable.

Finally, this patch makes nsXBLPrototypeHandler::DispatchXBLCommand() and
EventStateManager::DoContentCommandEvent() retrieve controller for visible
window since they are always handles user input.

MozReview-Commit-ID: GygttTHuKRm

--HG--
extra : rebase_source : 1341273c4606298cb9b890b9312d9f5c8a75d144
2017-09-07 22:54:49 +09:00
Masayuki Nakano
e3529fd155 Bug 1375502 - part2: Add nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t) r=mats
nsIContentIterator::Init() takes nsRange but it's too expensive for some users.
So, there should be another Init() which can be specified a range in DOM tree
with 2 pairs of nsINode* and uint32_t.

MozReview-Commit-ID: 6JXic0KOM2d

--HG--
extra : rebase_source : 28ff355a2aa0dcb5d65495806ef8c67f1da642ea
2017-06-26 17:26:27 +09:00
Nicholas Nethercote
f582d96b98 Bug 1390428 (part 9) - Remove nsXPIDLCString. r=erahm.
This is straightforward, with only two notable things.

- `#include "nsXPIDLString.h" is replaced with `#include "nsString.h"`
  throughout, because all nsXPIDLString.h did was include nsString.h. The
  exception is for files which already include nsString.h, in which case the
  patch just removes the nsXPIDLString.h inclusion.

- The patch removes the |xpidl_string| gtest, but improves the |voided| test to
  cover some of its ground, e.g. testing Adopt(nullptr).

--HG--
extra : rebase_source : 452cc4a08046a1adb1a8099a7e85a1917de5add8
2017-08-17 15:29:03 +10:00
Masayuki Nakano
2f92264fb7 Bug 1377978 - Make nsRange use uint32_t to offset r=smaug
DOM Standard defines that offset of Range is unsigned long.  However, nsRange uses int32_t to them.

This patch makes nsRange use uint32_t instead.  However, this patch does NOT allow to set over INT32_MAX as offset values since a lot of users of nsRange cannot treat the values as over INT32_MAX because a lot of internal APIs take int32_t as offsets.

For easier to search such points, this patch adds static_cast<int32_t> to uint32_t variables when they are used for int32_t arguments.

And note that nsContentUtils::ComparePoints() behaves odd.  It accepts negative offset and compares such value with valid offset simply.  This patch still uses int32_t offset variables in nsRange::CompareNodeToRange() even though it may be negative value if nsINode::IndexOf() returns -1 because the caller of it depends on this behavior.

MozReview-Commit-ID: 8RbOgA86JuT

--HG--
extra : rebase_source : 46d526c6d50dfa2f104439b19b8691477b17a4af
2017-07-19 22:49:52 +09:00
Sylvestre Ledru
4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00