Граф коммитов

53 Коммитов

Автор SHA1 Сообщение Дата
Mats Palmgren 211a6840d0 Bug 1347979 - Don't call methods that may flush in nsRange::GetInnerTextNoFlush. r=smaug
MozReview-Commit-ID: AsnRqTH4FkM
2017-03-18 18:44:27 +01:00
Masayuki Nakano 85f46a7ab4 Bug 1348195 nsRange should set mCalledByJS to false before calling Selection::NotifySelectionListners() because non-*JS() methods may be called during a call of it r=smaug
When nsRange::*JS() is called, mCalledByJS is set to true.  In such case, Selection::NotifySelectionListeners() may move focus or anyway, it calls selection listeners.  Then, they may cause calling non-*JS() methods of the nsRange instance. In this case, nsRange treats the call as called by JS since mCalledByJS is still true.

For preventing this issue, before calling Selection::NotifySelectionListeners(), nsRange should set mCalledByJS to false.

This patch renames AutoCalledByJSSetter to AutoCalledByJSRestore and make it stop setting mCalledByJS automatically.  So, AutoCalledByJSRestore works same as AutoRestore now.

MozReview-Commit-ID: IYsbQTGp3VA

--HG--
extra : rebase_source : 582eb2288c035861f16149dde42c22aba555bb5a
2017-03-17 13:32:51 +09:00
Brad Werth d2ed12d9e6 Bug 1343695 Part 1: Retrieve text content with GetRenderedText. r=mats
MozReview-Commit-ID: 4VLoaTlDELG

--HG--
extra : rebase_source : d48bc3f175cc88d76087e4371e2b9efead517613
2017-03-01 16:15:22 -08:00
Masayuki Nakano 6449c8aac8 Bug 1318312 part.3 Selection should move focus at every selection change when it's called by JS r=smaug
Selection may be changed by methods of Selection or methods of Range retrieved by Selection.getRangeAt().  Selection::NotifySelectionListeners() is called after every selection change of each of them, so, this method must be a good point to move focus.

If new common ancestor of all ranges is editable and in an editing host, we should move focus to it.  Otherwise, if an editing host has focus but new common ancestor is not editable, we should move focus from the editing host.

For consistency with the other browsers, this patch doesn't move focus to other focusable element.

MozReview-Commit-ID: 6sNsuzwqECX

--HG--
extra : rebase_source : 9ba52ab0bd1249abded81019847c85182ca1926e
2017-03-14 10:36:21 +09:00
Masayuki Nakano a959abd5c5 Bug 1318312 part.2 Mark Selection as "called by JS" when every Selection API which may cause changing selection is called by JS r=smaug
Selection needs to be able to distinguish if every selection change is caused by JS (i.e., via Selection API) or the others.

This patch maps some methods of Range and Selection to *JS().  Each of them marks its instance as "used by JS" and calls corresponding method.

With this change, Selection::NotifySelectionListeners() can move focus only when it's caused by Selection API.

MozReview-Commit-ID: 1GoLHiIJ10Y

--HG--
extra : rebase_source : 02d497f9e55b3325a2e01c3041cadb90881dccb8
2017-03-10 16:55:12 +09:00
Wes Kocher 33cca3c72a Backed out 2 changesets (bug 1343695) for osx chrome mochitest assertions a=backout
Backed out changeset e5db40a036fe (bug 1343695)
Backed out changeset 687ffd715113 (bug 1343695)

MozReview-Commit-ID: 2CN1gipg3ia
2017-03-13 16:44:23 -07:00
Brad Werth 1a39a40cd5 Bug 1343695 Part 1: Retrieve text content with GetRenderedText. r=mats
MozReview-Commit-ID: 4VLoaTlDELG

--HG--
extra : rebase_source : 4cc21c8d0de752ef927982e9d451bf46d3ca9877
2017-03-01 16:15:22 -08:00
Brad Werth f210879e4b Bug 1343978 Part 1: Change ClientRectsAndTexts usage of DOMStringList to Sequence<DOMString>. r=smaug
MozReview-Commit-ID: 8mKxdPTq4Ej

--HG--
extra : rebase_source : bd2fb4e9e9c1962f4a678bbb42816e5cfb738fa0
2017-03-02 13:13:12 -08:00
Mats Palmgren 8eb3b6cd3a Bug 1327902 - Set the range boundary point outside (before) the node if it HasIndependentSelection(). r=smaug 2017-01-08 21:27:00 +01:00
Cameron McCormack babad063ff Bug 1328832 - Part 2: Rename mozFlushType to mozilla::FlushType and make it an enum class. r=bzbarsky
MozReview-Commit-ID: D3fIngSHSsl
2017-01-05 15:31:56 +08:00
Olli Pettay 0364dbc792 Bug 1326507, remove NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS, r=mccr8
--HG--
extra : rebase_source : 3ae1207308de120b7299b13ecaa95dd1612b3459
2017-01-03 21:47:55 +02:00
Mats Palmgren a028cc0e46 Bug 1321623 - Implement DOM Selection.setBaseAndExtent(). r=smaug 2016-12-19 16:48:37 +01:00
L. David Baron 03d6962a30 Bug 1320815 - DeCOMtaminate nsIFrame::IsSelectable by returning boolean instead of nsresult. r=xidorn
MozReview-Commit-ID: EBxBcEgIvp7

--HG--
extra : rebase_source : 49e5a370df86baec014e99be56b05d451d5ee78c
2016-11-28 15:31:29 -08:00
Brad Werth 175fc88729 Bug 1314080 Part 4: Implement the new text retrieval behavior. r=smaug
MozReview-Commit-ID: 7j5BjruBNb9

--HG--
extra : rebase_source : a5649d5552a0ee9f1a9bc5e07cac2ca12610d5a1
2016-11-02 16:39:43 -07:00
Brad Werth 112882e6c5 Bug 1314080 Part 3: Add a new ChromeOnly DOM method and wire it to CollectClientRectsAndText. r=smaug
MozReview-Commit-ID: GRM87Pi3g4G

--HG--
extra : rebase_source : e18a1740203cf32be2000a0f6214f4c34a71cd7e
2016-11-02 13:31:06 -07:00
Brad Werth 8046b08b3f Bug 1314080 Part 2: Expand GetPartialTextRect with a new text collecting parameter. r=smaug
MozReview-Commit-ID: 6eEDFFwKh0c

--HG--
extra : rebase_source : eaecfa5db80dde81de2b57bbbb91dcdf603d8480
2016-11-02 12:07:49 -07:00
Brad Werth 1e29a9cf1c Bug 1314080 Part 1: Rename CollectClientRects method and add a new parameter for collecting text. r=smaug
MozReview-Commit-ID: KQPky6Fh8sG

--HG--
extra : rebase_source : 33bce65c1752aeb7a2225a981f2dadf7e2ce5916
2016-11-02 13:49:43 -07:00
Emilio Cobos Álvarez 619cb14d87 Bug 1299066: Make NS_STYLE_DISPLAY_* an enum class. Prefer indexing instead of linear search in the frame constructor r=heycam,bz
The main renaming was generated with the following python script:

```

import sys
import re

CAMEL_CASE_REGEX = re.compile(r"(^|_|-)([A-Z])([A-Z]+)")
DISPLAY_REGEX = re.compile(r"\bNS_STYLE_DISPLAY_([^M][A-Z_]+)\b")

def to_camel_case(ident):
  return re.sub(CAMEL_CASE_REGEX,
                lambda m: m.group(2) + m.group(3).lower(), ident)

def constant_to_enum(constant):
  return "StyleDisplay::" + to_camel_case(constant) + ("_" if constant == "NONE" else "")

def process_line(line):
  return re.sub(DISPLAY_REGEX,
                lambda m: constant_to_enum(m.group(1)), line)

lines = []
with open(sys.argv[1], "r") as f:
  for line in f:
    lines.append(process_line(line))

with open(sys.argv[1], "w") as f:
  for line in lines:
    f.write(line)
```

And the following shell commands:

```
find . -name '*.cpp' -exec python display.py {} \;
find . -name '*.h' -exec python display.py {} \;
```

MozReview-Commit-ID: 91xYCbLC2Vf
2016-09-01 20:41:17 -07:00
Aryeh Gregor 0ba196de55 Bug 1211894 - Throw on range.insertNode(range.startContainer); r=smaug 2016-08-16 15:52:06 +03:00
Jonathan Kew 46917612a7 Bug 1290937 - Make innerText return text from <option> elements within a <select>, rather than ignoring them. r=smaug 2016-08-11 12:18:02 +01:00
Andrea Marchesini 163825f4a6 Bug 1281793 - Remove some non-used telemetry IDs - part 4 - random things (2), r=chutten 2016-06-28 19:30:37 +02:00
Carsten "Tomcat" Book 0f88d840e4 Backed out changeset 27b1dd843116 (bug 1281793) 2016-06-28 17:04:49 +02:00
Andrea Marchesini 430a14cd11 Bug 1281793 - Remove some non-used telemetry IDs - part 4 - random things (2), r=chutten 2016-06-28 16:44:42 +02:00
Olli Pettay b8eb7f0a9e Bug 1274806, got NS_ERROR_UNEXPECTED error when I call range.extractContents() for DOM element with iframe , r=mats 2016-06-27 01:16:27 +03:00
Jonathan Watt fb7bb15e68 Bug 1263782 - Kill off the deprecated nsINode::IsInDoc(). r=baku 2016-03-31 11:58:25 +01:00
Andrew McCreight 1837d54fa7 Bug 1249685 - Use more nsCOMPtrs for stack variables in DOM code. r=smaug 2016-02-23 16:23:43 -08:00
Mats Palmgren 28b48ce024 Bug 1216001 part 2 - Optimize nsRange::ExcludeNonSelectableNodes by counting ignorable whitespace text nodes next to an unselectable node as unselectable too. r=bz 2016-02-13 18:40:23 +01:00
Mats Palmgren f3949ab1d3 Bug 1216001 part 1 - Optimize nsRange::IsNodeSelected. r=bz 2016-02-13 18:40:23 +01:00
Phil Ringnalda 9d0e08b626 Back out 3 changesets (bug 1216001) for Win8 reftest failures in 1193519-sideways-lr-3.html and 1193519-sideways-lr-4.html and intermittent OS X failures in font-display-2.html
CLOSED TREE

Backed out changeset dbadb8fe5803 (bug 1216001)
Backed out changeset a30593ebd58e (bug 1216001)
Backed out changeset c1646ffa71b4 (bug 1216001)
2016-02-11 20:43:41 -08:00
Mats Palmgren 41740a7ab3 Bug 1216001 part 2 - Optimize nsRange::ExcludeNonSelectableNodes by counting ignorable whitespace text nodes next to an unselectable node as unselectable too. r=bz 2016-02-12 02:13:57 +01:00
Mats Palmgren a3c53b91a3 Bug 1216001 part 1 - Optimize nsRange::IsNodeSelected. r=bz 2016-02-12 02:13:57 +01:00
Kyle Huey 91efc5a86c Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug 2016-01-30 09:05:36 -08:00
Ting-Yu Lin 1889f6bc41 Bug 1227927 Part 2 - Remove nsIFrame::GetFirstPrincipalChild(). r=mats
--HG--
extra : commitid : 5qtaK1nS8RC
extra : rebase_source : dcc98f423b2446269beb6fa6a9d092ae8213f38e
2016-01-29 22:42:14 +08:00
Robert O'Callahan 00af2dcc78 Bug 264412. Optimize GetRenderedText. r=mats
With these changes we're slightly faster than Chrome on the non-reflowing part of
Olli's testcase.

--HG--
extra : commitid : 75liwqsBeJY
extra : rebase_source : 34ee5d1fdfbb3b9d2ef8945f78ded935debb9106
2015-10-30 19:22:33 +13:00
Robert O'Callahan 7c373233ed Bug 264412. Implement HTMLElement.innerText. r=smaug,mats
--HG--
extra : commitid : KjCvQzulwP3
extra : rebase_source : 01aae50d1ee8304e56d3d1e21a7c65c2f9060a72
2015-10-30 18:37:03 +13:00
Robert O'Callahan 0e2b65352f Revert incorrectly committed changes ab657569f554 and a396f4262479
--HG--
extra : commitid : IHQ60dccnSZ
extra : amend_source : 9302339fd951446a37909b31a1ccb56aff470325
2015-10-24 22:38:22 +13:00
Robert O'Callahan b09242d6c1 Bug 264412. Implement HTMLElement.innerText. r=smaug,mats
--HG--
extra : commitid : LLiSI8usEMT
extra : rebase_source : 928b4fd451c28b57a43a873f05b7bf030ba13083
2015-10-21 10:23:17 +13:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Aryeh Gregor 006ecb6285 Bug 1192855 - Check validity in advance for nsRange::InsertNode; r=hsivonen 2015-10-07 16:07:39 +03:00
Bobby Holley 110f12e7ca Bug 1072150 - Use the opt-out for various sloppy consumers. r=bz 2015-09-24 14:02:41 -07:00
Michael Layzell fe31896607 Bug 571294 - Part 1: Implement selection events behind the dom.select_events.enabled pref, r=smaug 2015-09-12 17:56:44 -04:00
Birunthan Mohanathas 30785d4b43 Bug 1182980 - Part 2: Use nsTHashtable::Iterator in nsRange. r=khuey 2015-07-22 09:42:01 -07:00
Eric Rahm 74e29ff0f6 Bug 1183893 - Remove warning if invalid node type is passed to nsRange::SetEnd. r=smaug 2015-07-14 17:54:58 -07:00
Eric Rahm 1f14babe74 Bug 1183891 - Remove warning if invalid node type is passed to nsRange::SetStart. r=smaug 2015-07-14 17:52:25 -07:00
Andrew McCreight 9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Boris Zbarsky 1e816696de Bug 1157898 part 4. Add ErrorResult::ErrorCodeIs() and use it in various places to get rid of ErrorCode(). r=peterv 2015-04-27 09:18:52 -04:00
Boris Zbarsky 839141fb74 Bug 1157898 part 3. Fix the remaining consumers of rv.ErrorCode() in NS_ENSURE_* expressions to not do that. r=peterv 2015-04-27 09:18:52 -04:00
Boris Zbarsky 418f0f69c3 Bug 1157898 part 2. Make code of the form "NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());" use Failed and StealNSResult instead. r=peterv
This patch was generated with the following command:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 's/NS_ENSURE_SUCCESS\(([a-zA-Z0-9]+)\.ErrorCode\(\), \1.ErrorCode\(\)\);/NS_ENSURE_TRUE(!\1.Failed(), \1.StealNSResult());/'
2015-04-27 09:18:52 -04:00
Boris Zbarsky 1540774b0c Bug 1157898 part 1. Make code of the form "return rv.ErrorCode();" where rv is an ErrorResult use StealNSResult instead. r=peterv
This patch was generated with the following command:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 's/return ([a-zA-Z0-9]+)\.ErrorCode\(\);/return \1.StealNSResult();/'
2015-04-27 09:18:51 -04:00
Nathan Froyd 2b1ae6e2ca Bug 1153267 - part 1 - use smart-pointer .forget() instead of NS_ADDREF+assign; r=ehsan 2015-03-31 10:03:49 -04:00