Commit Graph

304 Commits

Author SHA1 Message Date
Mirko Brodesser
c17992a6a8 Bug 1613378: part 8) Add assertion to nsAutoScrollTimer::Init. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62043
2020-02-11 10:50:52 +00:00
Mirko Brodesser
6987d4de09 Bug 1613378: part 7) Remove Selection's default constructor. r=smaug
Removes duplicated code and reveals the dependency to frame selection.

Differential Revision: https://phabricator.services.mozilla.com/D62040
2020-02-11 10:50:54 +00:00
Mirko Brodesser
2526009e0c Bug 1613378: part 6) Remove copy&pasted IsValidSelectionPoint function. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62039
2020-02-11 10:50:57 +00:00
Brindusan Cristian
145328323c Backed out 5 changesets (bug 1613378) for mochitest failures at test_general.html. CLOSED TREE
Backed out changeset f38b806ee78b (bug 1613378)
Backed out changeset cee4bbabc4b5 (bug 1613378)
Backed out changeset e3a2ab6d7267 (bug 1613378)
Backed out changeset 6fe76439f1d3 (bug 1613378)
Backed out changeset f3baf3407cbe (bug 1613378)
2020-02-11 12:27:49 +02:00
Mirko Brodesser
61c92f2396 Bug 1613378: part 10) Declare some table/Selection related method arguments const. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62258
2020-02-11 09:25:27 +00:00
Mirko Brodesser
3f62bd8985 Bug 1613378: part 9) Clarify dependency to mFrameSelection in Selection when adding/removing ranges. r=smaug
Moreover, this is potentially more efficient because
`GetRangesForIntervalArray` doesn't have to be called when there's no
frame selection.

Differential Revision: https://phabricator.services.mozilla.com/D62198
2020-02-11 09:25:45 +00:00
Mirko Brodesser
1660738aa0 Bug 1613378: part 8) Add assertion to nsAutoScrollTimer::Init. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62043
2020-02-11 09:26:07 +00:00
Mirko Brodesser
e6f168dee2 Bug 1613378: part 7) Remove Selection's default constructor. r=smaug
Removes duplicated code and reveals the dependency to frame selection.

Differential Revision: https://phabricator.services.mozilla.com/D62040
2020-02-11 09:26:07 +00:00
Mirko Brodesser
998152ff13 Bug 1613378: part 6) Remove copy&pasted IsValidSelectionPoint function. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62039
2020-02-10 13:25:03 +00:00
Emilio Cobos Álvarez
1c221fea7d Bug 1614208 - Stop including AccessibleCaretEventHub and PresShell.h from Selection.h. r=TYLin
And fix a bunch of fallout as we now don't include nsDocShell.h everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D62169
2020-02-11 01:22:29 +00:00
Mirko Brodesser
99c81d1a4d Bug 1613378: part 5) Decouple UserSelectRangesToAdd from Selection class. r=smaug
Depends on D62037

Differential Revision: https://phabricator.services.mozilla.com/D62038
2020-02-07 16:16:36 +00:00
Mirko Brodesser
2aa7c9ceb3 Bug 1613378: part 4) Declare some methods in nsFrameSelection static. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D62037
2020-02-07 16:13:27 +00:00
Mirko Brodesser
052900bbdb Bug 1613378: part 3) Remove Selection::GetTableCellLocationFromRange's dependency to mFrameSelection and declare it static. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D61693
2020-02-07 09:24:53 +00:00
Mirko Brodesser
b3397c6d4f Bug 1613378: part 1) Decouple Selection::GetTableSelectionType from Selection class. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D61691
2020-02-07 09:24:34 +00:00
Mirko Brodesser
7c8f46210a Bug 1612828: part 3) Remove nsresult return type from Selection::FindInsertionPoint. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D61533
2020-02-05 12:22:08 +00:00
Mirko Brodesser
a251c4d152 Bug 1612828: part 2) Remove nsresult return type fromSelection::FindInsertionPoint's comparator`. r=smaug
Will allow to replace the hand-crafted binary search from the method.

Differential Revision: https://phabricator.services.mozilla.com/D61532
2020-02-05 12:21:59 +00:00
Mirko Brodesser
b03ce1dd0e Bug 1612828: part 1) Change signature of Selection::SubtractRange. r=smaug
Preparatory step to remove `nsresult` from
`Selection::FindInsertionPoint`, as that requires certain arguments to
be non-null.

Differential Revision: https://phabricator.services.mozilla.com/D61531
2020-02-05 12:21:46 +00:00
Mirko Brodesser
a9637d3829 Bug 1613071: rename RangeData to StyledRange and move it to separate file. r=smaug
Breaks the dependency from Selection.h. Allows reuse for Selection
across the Shadow DOM boundary, which will require styled ranges to be
stored in `DocumentOrShadowRoot` too.

Differential Revision: https://phabricator.services.mozilla.com/D61549
2020-02-05 09:12:23 +00:00
Cosmin Sabou
aaccd3328f Backed out changeset 6c68992f760e (bug 1613071) for build bustages on XPathGenerator.cpp
CLOSED TREE
2020-02-04 16:40:28 +02:00
Mirko Brodesser
e8e6350a14 Bug 1613071: rename RangeData to StyledRange and move it to separate file. r=smaug
Breaks the dependency from Selection.h. Allows reuse for Selection
across the Shadow DOM boundary, which will require styled ranges to be
stored in `DocumentOrShadowRoot` too.

Differential Revision: https://phabricator.services.mozilla.com/D61549
2020-02-04 14:14:03 +00:00
Mirko Brodesser
c89d6901d7 Bug 1611853: return early in Selection::AddRangeAndSelectFramesAndNotifyListeners when it didn't add a range. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D61448
2020-02-04 08:43:06 +00:00
Masayuki Nakano
da5eb5e37c Bug 1612085 - part 3: Remove dirty hack of Selection::mCachedRange r=smaug
Previously, I added `Selection::mCachedRange` to save allocation cost of
`nsRange`.  However, with the previous patch, we don't need the hack anymore
since ranges removed by `Selection::RemoveAllRanges()` are always kept in
the global cache of `nsRange`.  Therefore, we can remove the ugly hack right
now.

Differential Revision: https://phabricator.services.mozilla.com/D61239
2020-01-30 12:44:33 +00:00
Masayuki Nakano
4f417fdeec Bug 1612085 - part 1: Hide constructor of nsRange r=smaug
`nsRange` instances are allocated a lot in the heap especially by editor and
spellchecker.  The allocation cost is too bad for benchmarks.  Therefore,
we should reuse released instances as far as possible.  For managing it in
static factory methods of `nsRange`, we need to hide `nsRange` constructor.

Differential Revision: https://phabricator.services.mozilla.com/D61237
2020-01-30 13:23:35 +00:00
Mirko Brodesser
1bfd8fedac Bug 1609662: part 19) Change Selection::EqualsRangeAtPoint to HasEqualRangeBoundariesAt. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60950
2020-01-24 14:40:35 +00:00
Mirko Brodesser
a0366af1b3 Bug 1609662: part 18) Remove RangeMatchesBeginPoint function in Selection. r=smaug
The name was misleading.

Differential Revision: https://phabricator.services.mozilla.com/D60949
2020-01-24 13:01:59 +00:00
Mirko Brodesser
d11d6d5661 Bug 1600267: part 19) Emit warnings when Selection couldn't compare nodes and pretends some order. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60818
2020-01-23 17:38:17 +00:00
Mirko Brodesser
fc88294425 Bug 1600267: part 18) Remove remaining ComparePoints_Deprecated calls in Selection. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60691
2020-01-22 15:51:18 +00:00
Mirko Brodesser
d502ba2cd7 Bug 1609662: part 15) Rename some methods in Selection. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60256
2020-01-21 16:02:20 +00:00
Mirko Brodesser
1358417fac Bug 1609662: part 13) Declare some methods in Selection const. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60254
2020-01-21 16:01:59 +00:00
Mirko Brodesser
d098dc766c Bug 1609662: part 12) Replace unreachable code with assertions in Selection::AddRangeAndSelectFramesAndNotifyListeners. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60227
2020-01-21 16:01:52 +00:00
Mirko Brodesser
8a2c23fc9e Bug 1609662: part 11) Rename nsTextFrame::SetSelectedRange and add nsIFrame::SelectionStateChanged. r=emilio,smaug
Differential Revision: https://phabricator.services.mozilla.com/D60157
2020-01-21 16:01:45 +00:00
Mirko Brodesser
6aae3d9fbc Bug 1609662: part 8) Rename aItem to aRange in Selection::AddRangesForSelectableNodes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60132
2020-01-20 12:39:19 +00:00
Mirko Brodesser
4a2ddcf017 Bug 1609662: part 4) Move documentation of Selection::FindInsertionPoint. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60128
2020-01-20 12:38:49 +00:00
Mirko Brodesser
729f28d82f Bug 1609662: part 3) Rename Selection::AddTableCellRange to Selection::MaybeAddTableCellRange. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60127
2020-01-20 12:38:42 +00:00
Mirko Brodesser
d02e84d2d2 Bug 1608071: part 2) Rename nsContentUtils::GetCommonAncestor and related methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59319
2020-01-13 10:29:44 +00:00
Mirko Brodesser
67d3228536 Bug 1608438: part 2) Move ancient explanation about Selection::Extend inside that method. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59512
2020-01-10 16:12:04 +00:00
Mirko Brodesser
ae176ba030 Bug 1608438: part 1) Rename obscure variables in Selection::Extend. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59511
2020-01-10 16:11:37 +00:00
Mirko Brodesser
7a871c605e Bug 1600267: part 8) Call ComparePoints instead of ComparePoints_Deprecated in Selection. r=smaug
Some calls to `ComparePoints_Deprecated` remain, because adapting them
would require to add boilerplate code, which potentially will be deleted
again once `ComparePoints` supports crossing the Shadow DOM boundary.

Differential Revision: https://phabricator.services.mozilla.com/D57615
2019-12-20 12:33:10 +00:00
Mirko Brodesser
9317c60217 Bug 1600267: part 1) Rename nsContentUtils::ComparePoints to ComparePoints_Deprecated. r=smaug
In a follow-up commit a new `ComparePoints` method with cleaner
arguments and return value will be added.

Differential Revision: https://phabricator.services.mozilla.com/D55295
2019-12-19 13:27:08 +00:00
Mirko Brodesser
a6d48bc820 Bug 1587433: part 7.2) Adapt callers of RangeBoundaryBase::Offset(). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D54459
2019-12-16 11:31:52 +00:00
Mirko Brodesser
49d6303174 Bug 1587433: part 4) In Selection::SetBaseAndExtent check offsets are valid before constructing range boundaries. r=smaug
Avoid warnings.

Differential Revision: https://phabricator.services.mozilla.com/D54277
2019-12-16 11:31:37 +00:00
Csoregi Natalia
fa83972cc0 Backed out 11 changesets (bug 1587433) for bustages on RangeBoundary.h. CLOSED TREE
Backed out changeset 18f8d61039b0 (bug 1587433)
Backed out changeset 69ad70a4f85e (bug 1587433)
Backed out changeset 79ec11ba7fde (bug 1587433)
Backed out changeset f8a7e23843b8 (bug 1587433)
Backed out changeset f9255884980f (bug 1587433)
Backed out changeset 50a798e664a1 (bug 1587433)
Backed out changeset b225586edea6 (bug 1587433)
Backed out changeset b1d9e55ece86 (bug 1587433)
Backed out changeset 7ebbcb2da488 (bug 1587433)
Backed out changeset 4032df295a67 (bug 1587433)
Backed out changeset 0e1577031add (bug 1587433)
2019-12-16 13:25:51 +02:00
Mirko Brodesser
3818e3e55a Bug 1587433: part 7.2) Adapt callers of RangeBoundaryBase::Offset(). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D54459
2019-12-16 11:04:01 +00:00
Mirko Brodesser
8c124a364a Bug 1587433: part 4) In Selection::SetBaseAndExtent check offsets are valid before constructing range boundaries. r=smaug
Avoid warnings.

Differential Revision: https://phabricator.services.mozilla.com/D54277
2019-12-11 12:24:40 +00:00
Gabriele Svelto
eb403b8785 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442
2019-12-06 09:24:56 +00:00
Boris Zbarsky
2df1df0176 Bug 1517588. Use nsIPrincipal::IsSystemPrincipal instead of nsContentUtils::IsSystemPrincipal r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D53067
2019-12-05 04:44:32 +00:00
Edgar Chen
d7b2ad878b Bug 1601285 - Remove AutoPrepareFocusRange from Selection.cpp; r=smaug
In bug 1373999, we moved nsFrameSelection from Selection.cpp to nsFrameSelection.cpp. And AutoPrepareFocusRange is only used in nsFrameSelection. It looks like somehow we left duplicated codes in Selection.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D55806
2019-12-04 22:06:00 +00:00
Dorel Luca
67889e1013 Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto
dc6fa2e86c Bug 1600545 - Remove useless inclusions of header files generated from IDL files in dom/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55442
2019-12-04 15:01:19 +00:00
Mirko Brodesser
90e32194c1 Bug 1587716: change RangeBoundaryBase's offset argument to uint32_t. r=smaug
`uint32_t`, because `nsRange::ComparePoints` requires it -- by webidl
interface -- to be unsigned long.

Moreover it makes `RangeBoundaryBase`'s interface cleaner, because it
already exposes the offset as a `uint32_t`.

Differential Revision: https://phabricator.services.mozilla.com/D50054
2019-10-23 08:22:36 +00:00