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

168 Коммитов

Автор SHA1 Сообщение Дата
Mirko Brodesser 106ce60267 Bug 1643721: part 16) Factor `SerializeChildrenOfContent` functionality out. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D80598
2020-06-23 12:43:04 +00:00
Mirko Brodesser 218169fc69 Bug 1643721: part 15) Add assertion to `SerializeRangeNodes`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79483
2020-06-15 09:46:33 +00:00
Mirko Brodesser 416cfa18e7 Bug 1643721: part 14) Change `SerializeToStringRecursive`'s `aDontSerializeRoot` to `enum class SerializeRoot` and drop negation. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79482
2020-06-15 09:48:06 +00:00
Mirko Brodesser eaaddb5b70 Bug 1643721: part 13) Factor serializing a text node out. r=masayuki
Reduces code duplication.

Differential Revision: https://phabricator.services.mozilla.com/D79422
2020-06-12 12:19:17 +00:00
Mirko Brodesser 6500f1b555 Bug 1643721: part 12) Hide some details of `SerializeRangeToString` in `HasInvisibleParentAndShouldBeSkipped`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79421
2020-06-12 12:19:09 +00:00
Mirko Brodesser 14de6b6aef Bug 1643721: part 11) Privatize member of `RangeContextSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79289
2020-06-12 09:02:21 +00:00
Mirko Brodesser 9e6d7fa0b2 Bug 1643721: part 10) Privatize most members of `RangeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79288
2020-06-12 08:54:41 +00:00
Mirko Brodesser 5410d5645c Bug 1643721: part 9) Remove redundant `mRangeNodeContext` from `RangeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79120
2020-06-12 08:54:33 +00:00
Mirko Brodesser 940c150e93 Bug 1643721: part 8) Move `SerializeRangeToString` to `RangeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79119
2020-06-12 08:54:31 +00:00
Mirko Brodesser 01d1a49b83 Bug 1643721: part 7) Move `mCommonInclusiveAncestors` to `RangeSerializer`. r=masayuki
Preparation for moving `SerializeRangeToString` to `RangeSerializer`.

Differential Revision: https://phabricator.services.mozilla.com/D79118
2020-06-12 08:54:23 +00:00
Mirko Brodesser 9b5aaa3706 Bug 1643721: part 6) Move `SerializeRangeContextStart` (End) to `RangeContextSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79115
2020-06-12 08:54:16 +00:00
Mirko Brodesser 80f08c9c32 Bug 1643721: part 5) Factor `RangeContextSerializer` out from `nsDocumentEncoder`. r=masayuki
Preparatory step to move `SerializeRangeContextStart` (End) to it.

Differential Revision: https://phabricator.services.mozilla.com/D79114
2020-06-12 08:54:09 +00:00
Mirko Brodesser 7773330726 Bug 1643721: part 4) Move `SerializeRangeNodes` to `RangeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79113
2020-06-12 08:54:01 +00:00
Mirko Brodesser 4ec81aed90 Bug 1643721: part 3) Factor initializing `mRangeSerializer`'s members out to `RangeSerializer::Initialize`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D79112
2020-06-12 08:53:54 +00:00
Mirko Brodesser 56c83e7372 Bug 1643721: part 2) Add `RangeNodeContext` to `nsDocumentEncoder` and `RangeSerializer`. r=masayuki
Preparatory step to move `SerializeRangeNodes` to `RangeSerializer`.

Differential Revision: https://phabricator.services.mozilla.com/D79111
2020-06-12 08:53:46 +00:00
Mirko Brodesser 639b890fdd Bug 1643721: part 1) Factor range serialization state from `nsDocumentEncoder` out to `RangeSerializer`. r=masayuki
Preparation to move `SerializeRangeNodes` to `RangeSerializer`.

Differential Revision: https://phabricator.services.mozilla.com/D79110
2020-06-12 08:53:39 +00:00
Mirko Brodesser 8f68a3ce87 Bug 1643333: part 7) Move `SerializeToStringRecursive` to `NodeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D78314
2020-06-05 08:34:33 +00:00
Mirko Brodesser 7e55972c83 Bug 1643333: part 6) Move `SerializeToStringIterative` to `NodeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D78313
2020-06-05 08:34:24 +00:00
Mirko Brodesser f5980a564e Bug 1643333: part 5) Move `SerializeNodeStart` and `SerializeNodeEnd` to `NodeSerializer`. r=masayuki
`nsDocumentEncoder` has too many responsibilities; this change
simplifies reasoning about it.

Differential Revision: https://phabricator.services.mozilla.com/D78312
2020-06-05 08:34:09 +00:00
Mirko Brodesser 2de539f94a Bug 1643333: part 4) Add `NodeSerializer`. r=masayuki
In separate reviews, `SerializeNodeStart` etc. will be moved to it.

Differential Revision: https://phabricator.services.mozilla.com/D78311
2020-06-05 08:40:24 +00:00
Mirko Brodesser 1a5cc89d26 Bug 1643333: part 3) Change `IsInvisibleNodeAndShouldBeSkipped` to static method. r=masayuki
Will help to factor out functionality of serializing a node.

Differential Revision: https://phabricator.services.mozilla.com/D78310
2020-06-05 08:33:49 +00:00
Mirko Brodesser fbcdd1ee26 Bug 1643333: part 2) Document `nsDocumentEncoder::mFlags`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D78309
2020-06-05 08:33:40 +00:00
Mirko Brodesser 6183b21358 Bug 1643333: part 1) const qualify argument of `IsInvisibleNodeAndShouldBeSkipped`. r=masayuki
Prepartory step for the following parts.

Differential Revision: https://phabricator.services.mozilla.com/D78308
2020-06-05 08:33:30 +00:00
Mirko Brodesser 81a6751c80 Bug 1634663: part 1) Declare `Selection::GetRangeAt`'s callers `const` around dom/ code. r=masayuki
Only where possible, of course.

Differential Revision: https://phabricator.services.mozilla.com/D73444
2020-05-02 23:43:02 +00:00
Mirko Brodesser fc91f37b49 Bug 1433073: part 3) Mimic old behavior of computing `mCommonInclusiveAncestors`. r=hsivonen
This reverts a previously introduced regression. See the Bugzilla
comments of this bug.

The key consequence of this is change is that copy-pasting multiple
click-selected table rows now works again for some applications (and
shouldn't be broken for others). That's because the clipboard flavor
"text/_moz_htmlcontext" doesn't contain a superfluous "<tr>" anymore.

The fix could presumably be more elegant, but it would be hard to ensure
no other applications relying on the old behavior break.

Differential Revision: https://phabricator.services.mozilla.com/D71982
2020-04-23 10:14:47 +00:00
Mirko Brodesser edab46f37b Bug 1623858: part 21) Add some const correctness to `nsDocumentEncoder::SerializeSelection`. r=hsivonen
Depends on D68580

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

--HG--
extra : moz-landing-system : lando
2020-03-30 08:48:19 +00:00
Mirko Brodesser d252ed1175 Bug 1623333: part 2) Declare `Selection::mSelectionType` `const`. r=smaug
Simplifies reasoning about it.

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

--HG--
extra : moz-landing-system : lando
2020-03-19 09:25:02 +00:00
Simon Giesecke d94419173b Bug 1613985 - Use default for equivalent-to-default constructors/destructors in dom/base. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63102

--HG--
extra : moz-landing-system : lando
2020-02-21 10:41:47 +00:00
Mirko Brodesser e7ed18f679 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

--HG--
extra : moz-landing-system : lando
2020-02-11 10:50:54 +00:00
Brindusan Cristian a68356b907 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 931ef1e3fa 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

--HG--
extra : moz-landing-system : lando
2020-02-11 09:26:07 +00:00
Mirko Brodesser 56780ebd31 Bug 1609662: part 17) Clean up some code around Selection and ranges in `nsDocumentEncoder`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D60644

--HG--
extra : moz-landing-system : lando
2020-01-27 09:25:12 +00:00
Mirko Brodesser efd738af5b Bug 1608071: part 2) Rename `nsContentUtils::GetCommonAncestor` and related methods. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D59319

--HG--
extra : moz-landing-system : lando
2020-01-13 10:29:44 +00:00
Gabriele Svelto ace6d1063f 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

--HG--
extra : moz-landing-system : lando
2019-12-06 09:24:56 +00:00
Dorel Luca a381d5c96d Backed out changeset f6e53d1c6518 (bug 1600545) for Android build bustage. CLOSED TREE 2019-12-04 17:32:27 +02:00
Gabriele Svelto bc9290f767 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

--HG--
extra : moz-landing-system : lando
2019-12-04 15:01:19 +00:00
Mirko Brodesser b2de103bf9 Bug 1593222: part 12) Rename "nsNodeUtils.*" to "MutationObservers.*". r=smaug
Depends on D51827

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

--HG--
rename : dom/base/nsNodeUtils.cpp => dom/base/MutationObservers.cpp
rename : dom/base/nsNodeUtils.h => dom/base/MutationObservers.h
extra : moz-landing-system : lando
2019-11-06 09:08:06 +00:00
Mirko Brodesser 47bb9d8c1a Bug 1593222: part 3) Move `nsNodeUtils::GetFirstChildOfTemplateOrNode` to `nsINode`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D51608

--HG--
extra : moz-landing-system : lando
2019-11-05 14:06:05 +00:00
Mirko Brodesser 45015bce27 Bug 1576899: change `nsIContentSerializer` to take output string as argument in `nsIContentSerializer::Init`. r=hsivonen
Before, all `nsIContentSerializer::Append`* methods took an output
string. The state of `nsPlainTextSerializer` depended on the string
pointing to the same object.

Now, it's ensured that the same output string is used between
`nsIContentSerializer::Init` and `nsIContentSerializer::Finish`.

Moreover, `nsHTMLCopyEncoder::EncodeToStringWithContext` re-used
`mSerializer` without initializing it again. This was error-prone,
because after serializing with `mSerializer`, it's internal state might
have changed to an undesirable one (e.g.
`nsPlainTextSerializer::mWrapColumn` could've been modified).
Hence, it is now initialized again before serializing the common
ancestors.

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

--HG--
extra : moz-landing-system : lando
2019-08-28 11:54:49 +00:00
longsonr 40d4617494 Bug 1570799 - pass the original element into nsXMLContentSerializer::CheckElementEnd so that we can determine whether it has children properly r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D43450

--HG--
extra : moz-landing-system : lando
2019-08-27 20:33:46 +00:00
Emilio Cobos Álvarez 8a8e0391b0 Bug 1571517 - Don't bail out when serializing a range starting at the end of an element. r=mbrodesser
We have a range that starts at the end of a cell, and ends somewhere else.

We were bailing out recursively from the beginning, causing the serialization to
be the empty string rather than the actually selected text.

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

--HG--
extra : moz-landing-system : lando
2019-08-20 11:20:16 +00:00
Mirko Brodesser 5e6d66382d Bug 1574463: remove unused `nsIDocumentEncoder::OutputNonTextContentAsPlaceholder`. r=hsivonen
Doesn't seem to be used by comm-central/Thunderbird.

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

--HG--
extra : moz-landing-system : lando
2019-08-19 07:56:05 +00:00
Masayuki Nakano 23a22c597a Bug 1569902 - part 2: Stop using attribute to consider whether a `<br>` element is a special node for empty last line or not r=m_kato,smaug
Editor creates a `<br>` element to end of a block if last line
of the block is empty because caret should be placed as there is an empty
line.  Such special `<br>` element has `type` attribute whose value is "_moz".
However, adding/removing the attribute is expensive and such hacky attribute
shouldn't be referred nor changed by web apps.

Therefore, this patch makes `HTMLBRElement` take another specific flag whether
it's a special node for empty last line.  For making the meaning clearer,
this patch calls the such `<br>` elements as "padding `<br>` element for
empty last line" insead of "moz-br".  So, this patch also includes a lot of
renaming methods and variables, and modifying related comments.

Note that with this change, `IMEContentObserver` counts the padding `<br>`
element in `<textarea>` because it's inserted before setting the new flag
and setting the flag does not cause DOM tree mutation.  This issue will be
fixed by the following patches.

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

--HG--
extra : moz-landing-system : lando
2019-08-02 05:45:18 +00:00
Mirko Brodesser 1788c9c941 Bug 1562876: rename `Selection::AddRangeInternal` to `Selection::AddRangeAndSelectFramesAndNotifyListeners`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D36601
2019-07-03 13:26:13 +02:00
Sylvestre Ledru f1fbd2ff00 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-06-08 08:26:37 +00:00
Ehsan Akhgari adf073ce68 Bug 836176 - Part 3: Remove nsIHTMLDocument; r=farre
Differential Revision: https://phabricator.services.mozilla.com/D32925

--HG--
extra : moz-landing-system : lando
2019-06-04 17:27:43 +00:00
Mirko Brodesser 899bfb263a Bug 1554222: delegate serializing in `nsDocumentEncoder` depending on encoding scope to separate methods. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D32486

--HG--
extra : moz-landing-system : lando
2019-05-27 07:50:19 +00:00
Mirko Brodesser 0ad0e91ed8 Bug 1554147: rename `mCommonParent` and encapsulate `mStartDepth` and `mEndDepth` in `ContextInfoDepth`. r=hsivonen
In order to simplify `nsDocumentEncoder`.

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

--HG--
extra : moz-landing-system : lando
2019-05-27 07:45:15 +00:00
Sylvestre Ledru d57d4905f1 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2019-05-25 17:46:15 +00:00
arthur.iakab af8e458c5f Backed out changeset a296439a25ff (bug 1519636) for frequent Windows cppunit failures CLOSED TREE 2019-05-24 14:26:01 +03:00