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

83 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano d8cc4e966b Bug 1286464 part.4 ContentEventHandler::SetRangeFromFlatTextOffset() should set end of the range to after a line break when the range is end between a set of native line breakers r=smaug
Currently, ContentEventHandler::SetRangeFromFlatTextOffset() sets end point to before a line breaker when the end of queried range is between a set of native line breakers (i.e., "\r]\n" on Windows). This causes unexpected empty range (e.g., "[]\n") when it queries a text rect at [\r]\n.

Therefore, it should select an XP line breaker in such case (i.e., the range should be "[\n]" when it queries "[\r]\n" or "\r[\n]").

Note that we don't need to do anything at setting selection start because it's always aligned to before the line breaker.

MozReview-Commit-ID: 6ht8QNAhibY

--HG--
extra : rebase_source : b7933554c2a5bf51b8faabe3a96d006971510e0a
2016-07-28 17:23:47 +09:00
Masayuki Nakano 92692b4cb4 Bug 1286464 part.3 Make static methods, AdjustTextRectNode() and GetFirstFrameInRange(), members of ContentEventHandler r=smaug
This patch makes the static methods members of ContentEventHandler because ContentEventHandler::NodePosition is useful for them.

* nsINode* AdjustTextRectNode(nsINode*, int32_t&) -> NodePosition GetNodeHavingFlatText(nsINode* int32_t)
* nsIFrame* GetFirstFrameInRange(nsRange*, int32_t&) -> FrameAndNodeOffset GetFirstFrameHavingFlatTextInRange(nsRange*)

So, this patch avoids unclear in/out arguments of them.

MozReview-Commit-ID: 7yWeIkRdGj

--HG--
extra : rebase_source : 635cec95ee9f3d73f619186925464ae17010e929
2016-08-05 12:43:40 +09:00
Masayuki Nakano 24e9e4a700 Bug 1286464 part.2 GetFirstFrameInRange() should return node offset since it may return different node's frame r=m_kato
GetFirstFrameInRange() uses AdjustTextRectNode() which may return different node before retrieving the result frame. Therefore, the caller may need offset in the new node.

MozReview-Commit-ID: 2AQU5WfahT9

--HG--
extra : rebase_source : c753d34dc2691da2ec25c9f5a6fe17d67af24a70
2016-07-14 22:57:00 +09:00
Masayuki Nakano bc5856516b Bug 1286464 part.1 Cleaning up ContentEventHandler::OnQueryTextRectArray() r=m_kato
MozReview-Commit-ID: BDLkQLrzoUI

--HG--
extra : rebase_source : c1b0074bde0580be466259f82d0756ff18e29f53
2016-07-14 22:46:37 +09:00
Masayuki Nakano 8a489e63dd Bug 1257446 part.2 ContentEventHandler::OnQueryTextRectArray() shouldn't set empty rect to the result r=m_kato
Returning empty rects for eQueryTextRectArray causes each dispatcher needing to check every rect. It doesn't make sense especially compared with eQueryTextRect.

So, it should ensure that empty rect won't be returned to dispatchers.

MozReview-Commit-ID: CpMqqihzSDf

--HG--
extra : rebase_source : 0343e2eecf5e25043d260157cf4d8b0874e0ceb6
2016-07-12 20:28:06 +09:00
Masayuki Nakano f382711dc3 Bug 1260651 part.59 Rename nsEditor to mozilla::EditorBase (and also their file names) r=mccr8
This patch also renames:

EditorInputEventDispatcher -> mozilla::EditorInputEventDispatcher

And some variable names are renamed from aEditor or mEditor to aEditorBase or mEditorBase for making their types clearer.

MozReview-Commit-ID: 2FCXWpLMn8e

--HG--
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/EditorBase.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/EditorBase.h
2016-07-08 13:10:13 +09:00
Makoto Kato 689ca97c17 Bug 1203871 - Part 2. Implement eQueryTextRectArray. r=masayuki
It will use on ContentCache.  Also, SetRangeFromFlatTextOffset issue will hanle on another bug.

MozReview-Commit-ID: 9Yu8bLlcZS5

--HG--
extra : rebase_source : c8eba70bdedf303b0fa649c1a609fe6120983e65
extra : histedit_source : 4189807b57ede13c1546e95052fcc298c8581d06
2016-06-23 10:40:04 +01:00
Masayuki Nakano 60bb642e47 Bug 1275528 part.1 Support a way to query content relative to insertion point r=smaug
Native IME handler may want to query content relative to start of selection (or composition if there is it). Additionally, in e10s mode, insertion point in actual content may be different from the cache in parent.  Therefore, in some cases, it does make sense to query content with offset relative to start of selection or composition.

This patch implements it simply and only in non-e10s mode.

Additionally, this fixes a bug of nsQueryContentEventResult::GetOffset() which hasn't been accepted its calls even if the event message is valid (eQueryTextContent, eQueryTextRect and eQueryCaretRect).

MozReview-Commit-ID: 34I7vyTUAgO

--HG--
extra : rebase_source : d79ba0dc3e002f7691495ee1ff8bdb3854d8f6fe
2016-06-16 14:10:49 +09:00
Masayuki Nakano 13d4f396fe Bug 1185307 part.2 Replace upcast from nsISelection to mozilla::dom::Selection with nsISelection::AsSelection() r=smaug
MozReview-Commit-ID: Gs3oiAgJFG9

--HG--
extra : rebase_source : a136405d99ff3361a595157986b3a33026bcd5f5
2016-06-17 22:32:49 +09:00
Masayuki Nakano 99f2ffe496 Bug 1275914 part.6 ContentEventHandler::OnQuerySelectedText() shouldn't refer anchor and focus of selection if there are 2 or more selection ranges r=smaug
Selection's focus and anchor node and offset are stored only for the last range.  However, ContentEventHandler needs its first range.  Therefore, ContentEventHandler shouldn't refer them if there are two or more selection ranges.

MozReview-Commit-ID: ACflFE3ZrOM

--HG--
extra : rebase_source : 9a2d1ef0e18a07881f77deff579830a4a0c97fc5
2016-06-11 22:22:10 +09:00
Masayuki Nakano 4e5c167f73 Bug 1275914 part.5 Support special selections at handling eQuerySelectedText r=smaug
TextComposition needs to query first IME selection.  Therefore, we need to add support to query special selection range with eQuerySelectedText.

First, WidgetQueryContentEvent::mInput should have mSelectionType which should be initialized with InitForQuerySelectedText() but unfortunately, there is no method for eQuerySelectedText.  Therefore, this patch initializes WidgetQueryContentEvent::mInit::mSelectionType with SelectionType::eNormal in its constructor.

Next, ContentEventHandler needs to support to handle eQuerySelectedText with special selection types.  However, we need to create 2 paths in some cases, one is for normal selection and the other is for special selections because there are no selection ranges may be usual case for special selections but not so for normal selection.  Therefore, ContentEventHandler::InitCommon() becomes a little bit more complicated.  ContentEventHandler::mSelection and ContentEventHandler::mFirstSelectedRange is initialized with the specified selection type but normal selection type is also necessary to compute the selection root since the selection root is computed from the first selected range which may not be anywhere if its selection type is not normal.

Finally, ContentEventHandler::OnQuerySelectedText() returns "there are no selections" as succeeded case in special selection type cases.

MozReview-Commit-ID: 9WzUx8b5piw

--HG--
extra : rebase_source : fb07b40748b594d36315f1fc21c0a02ff9f668bb
2016-06-21 13:13:11 +09:00
Masayuki Nakano cbe8f5268a Bug 1259656 part.1 Rename WidgetEvent::refPoint to WidgetEvent::mRefPoint r=smaug
MozReview-Commit-ID: ESWM5ZyBpSR

--HG--
extra : rebase_source : c5e1e3f60bcdde2a7f6c399e72430b29a3e552cd
2016-04-18 23:09:02 +09:00
Masayuki Nakano 07b6f24132 Bug 1259657 Rename WidgetGUIEvent::widget to WidgetGUIEvent::mWidget r=smaug
MozReview-Commit-ID: 167PQWJDEHW

--HG--
extra : rebase_source : 6cd44095b9f33e03190972f043087786cbd772f2
2016-04-14 17:03:14 +09:00
Jonathan Watt 9480920b04 Bug 1263785 - Kill off the deprecated nsINode::GetCurrentDoc. r=baku 2016-03-31 12:46:32 +01:00
Jonathan Kew 08b2b1357c Bug 1261671 - ContentEventHandler::ConvertToRootRelativeOffset() should return the root-relative result in the frame's own appUnits, not the root's appUnits in the case when they're different. r=masayuki 2016-04-12 07:06:38 +01:00
Xidorn Quan 60bcaa5c0b Bug 1257121 part 4 - Use return value rather than out param to return font metrics. r=jfkthame
MozReview-Commit-ID: 6xrHYbgHGVd

--HG--
extra : rebase_source : 4d0cea24689588d8a1daa1869502e31ac7c3dc56
2016-03-17 13:55:48 +08:00
Xidorn Quan 8acf32453c Bug 1257121 part 3 - Add GetInflatedFontMetricsForFrame function to simplify a common use pattern. r=jfkthame
MozReview-Commit-ID: 4KMLCz6wQHQ

--HG--
extra : rebase_source : 08964aef3b335163985dd6818b4a6ae3a4e34fce
2016-03-17 12:07:47 +08:00
Xidorn Quan b3ea3fa801 Bug 1251995 part 2 - Add gfxTextRun::Range to replace parameter pairs like (offset, length) and (start, end). r=jfkthame
Although this makes some places more complicated, code should generally
be simpler and clearer. It could slightly improve performance on x64 for
functions with more than four parameters, since it makes more data be
passed via registers rather than the stack.

MozReview-Commit-ID: D0GM2Jyrr6W

--HG--
extra : source : bd88a2e478e23edf1845f724a32fef908c8cc007
2016-03-08 15:56:18 +08:00
Carsten "Tomcat" Book b9f86983b1 Backed out changeset bf004c055beb (bug 1251995) 2016-03-07 12:18:19 +01:00
Xidorn Quan 8e3206382b Bug 1251995 part 2 - Add gfxTextRun::Range to replace parameter pairs like (offset, length) and (start, end). r=jfkthame
Although this makes some places more complicated, code should generally
be simpler and clearer. It could slightly improve performance on x64 for
functions with more than four parameters, since it makes more data be
passed via registers rather than the stack.

MozReview-Commit-ID: D0GM2Jyrr6W

--HG--
extra : rebase_source : 29961e56b5fe14b244046b3dc52b1f922c206218
2016-02-29 16:50:17 +08:00
Jim Chen 6e298a23a6 Bug 1248459 - Don't query out-of-bounds selection; r=masayuki
During a query selection event, fail if the selection is outside of the
editor's root content. This can happen if the placeholder text in an
input field is somehow selected. The placeholder is in a separate
element outside of the root content.

Also fix a bug in test_imestate, where the selection was not properly
reset at the start of a test.
2016-03-03 13:10:07 -05:00
Wes Kocher a0271adb8d Backed out 2 changesets (bug 1248459) for test_imestate.html failures in mochitest-chrome-3 runs
Backed out changeset 62d7f81e434a (bug 1248459)
Backed out changeset 6aeedf17f577 (bug 1248459)

MozReview-Commit-ID: 10008f0KqYP
2016-02-26 13:51:56 -08:00
Jim Chen 1bd5f611b1 Bug 1248459 - Don't query out-of-bounds selection; r=masayuki
During a query selection event, fail if the selection is outside of the
editor's root content. This can happen if the placeholder text in an
input field is somehow selected. The placeholder is in a separate
element outside of the root content.
2016-02-26 14:38:57 -05:00
Kyle Huey 91efc5a86c Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug 2016-01-30 09:05:36 -08:00
Carsten "Tomcat" Book 5adcabb340 merge mozilla-inbound to mozilla-central a=merge 2015-12-02 15:20:57 +01:00
Masayuki Nakano c62bfb339f Bug 1213589 part.9 ContentEventHandler::ShouldBreakLineBefore() should return false if the content is unknown HTML element r=smaug 2015-12-02 13:20:01 +09:00
Masayuki Nakano ca5b42279c Bug 1213589 part.8 When there are no nodes causing text, ContentEventHandler should set start of the editor root to start of the range r=smaug 2015-12-02 13:20:01 +09:00
Masayuki Nakano 14e03f9711 Bug 1213589 part.6 ContentEventHandler should insert line breaks at open tag of elements except non-replaced inline elements r=smaug 2015-12-02 13:20:00 +09:00
Masayuki Nakano 661b0d48d5 Bug 1213589 part.5 Redesign the rules to create range in ContentEventHandler::SetRangeFromFlatTextOffset() r=smaug 2015-12-02 13:20:00 +09:00
Masayuki Nakano 6edaa422d8 Bug 1213859 part.4 ContentEventHandler should use NS_NewPreContentIterator rathr than NS_NewContentIterator at converting between DOM tree and flattened text r=smaug 2015-12-02 13:20:00 +09:00
Masayuki Nakano ae9603b782 Bug 1213589 part.3 ContentEventHandler::GetFlatTextLengthInRange() should handle specially when it's called by nsIMutationObserver::ContentRemoved() r=smaug 2015-12-02 13:20:00 +09:00
Masayuki Nakano 18395c1495 Bug 1213589 part.2 Clean up GenerateFlatTextContent(), GelerateFlatFontRanges() and GetFlatTextOffsetOfRange() of ContentEventHandler r=smaug 2015-12-02 13:20:00 +09:00
Masayuki Nakano 1b1d719d0f Bug 1213589 part.1 Make ContentEventHandler::GetTextLength() and GetNativeTextLength() called only with a text node r=smaug 2015-12-02 13:20:00 +09:00
Mark Capella e7b070ed41 Bug 1215959 - (GeckoCaret2) Upgrade Core and AccessibleCaret, r=smaug 2015-12-01 15:25:06 -05:00
Botond Ballo 6a70e1aa18 Bug 1222661 - Replace FromUntyped(obj) calls with FromUnknown*(obj). r=nical
--HG--
extra : rebase_source : c1afe8560b838e1a3be0ce50847861b1815d3dc9
extra : source : d649f163c825736efaf3ac3ad73040beeb48a6ef
2015-11-09 18:22:25 -05: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
Masayuki Nakano f961371a5e Bug 1109410 Resolve CSS transform in ContentEventHandler::ConvertToRootViewRelativeOffset() r=roc 2015-10-05 14:46:39 +09:00
Masayuki Nakano 1d6a202900 Bug 895274 part.187 Rename NS_QUERY_TEXT_RECT to eQueryTextRect r=smaug 2015-09-11 21:21:26 +09:00
Masayuki Nakano 09e1247ff7 Bug 895274 part.158 Rename NS_QUERY_DOM_WIDGET_HITTEST to eQueryDOMWidgetHittest r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano 26489b9f11 Bug 895274 part.157 Rename NS_QUERY_CHARACTER_AT_POINT to eQueryCharacterAtPoint r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano b9be65c10e Bug 895274 part.156 Rename NS_QUERY_CONTENT_STATE to eQueryContentState r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano bb413ca230 Bug 895274 part.155 Rename NS_QUERY_EDITOR_RECT to eQueryEditorRect r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano 4a34ce078a Bug 895274 part.154 Rename NS_QUERY_CARET_RECT to eQueryCaretRect r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano e463292274 Bug 895274 part.153 Rename NS_QUERY_TEXT_CONTENT to eQueryTextContent r=smaug 2015-09-10 10:40:05 +09:00
Masayuki Nakano a8fd5ffc76 Bug 895274 part.152 Rename NS_QUERY_SELECTED_TEXT to eQuerySelectedText r=smaug 2015-09-10 10:40:05 +09:00
Masayuki Nakano 07dbf0fd06 Bug 895274 part.151 Rename NS_QUERY_SELECTION_AS_TRANSFERABLE to eQuerySelectionAsTransferable r=smaug 2015-09-10 10:40:05 +09:00
Masayuki Nakano b7165d94e4 Bug 1200980 part.2 QueryContentEvent should be handled via IMEContentObserver if there is an instance of it r=smaug 2015-09-08 12:54:14 +09:00
Masayuki Nakano 843b8bcf91 Bug 1180240 ContentEventHandler::OnQuerySelectedText() should refer mFirstSelectedRange if mSelection doesn't have selection ranges actually r=smaug 2015-07-07 11:06:37 +09:00
Masayuki Nakano e2eee0e06e Bug 1179090 ContentEventHandler should assume that there is selection at beginning of the document when there is no selection range r=smaug 2015-07-03 13:20:28 +09:00
Masayuki Nakano 3273d3f447 Bug 1179086 ContentEventHandler should use /n on Mac rather than /r r=smaug+smichaud+josh 2015-07-02 10:00:44 +09:00