The test case is a special case that changes focused element from a text control
to an editing host. Therefore, without a focus change, focused editor is
changed from a `TextEditor` to `HTMLEditor`. At this time, `IMEContentObserver`
needs to switch the observing target from the anonymous content if `<input>` to
children of it.
However, the editable content becomes completely changed without a focus change
in the DOM. Therefore, `IMEStateManager` needs to synthesize a fake focus move
for IME. Therefore, this patch make `IMEStateManager` recreate
`IMEContentObserver` if active one is not observing editable content for the
focused element under "current" conditions at checking it. (When
`IMEContentObserver` is being destroyed, it sends "blur" notification to IME
and the new `IMEContentObserver` instance posts "focus" notification with
all editable content data. I.e., recreating `IMEContentObserver` generates
a fake focus move from IME point of view.)
Additionally, there is the opposite case, that is, editing host of an `<input>`
whose type is not a text control may become a text control. Therefore, this
adds new WPTs to check the handler is the text editor for the text control or
the HTML editor. The tests passed on Firefox and Chrome at least.
FYI: I guess that in this case, we need to kick `focus` event listener of the
`HTMLEditor`, but anyway, users cannot change the content because it's the
case that an atomic content is the editing host. Therefore, I don't touch
about that in this patch.
Differential Revision: https://phabricator.services.mozilla.com/D193262
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.
This was done by going through all the frame classes, trying to preserve
behavior.
The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).
Differential Revision: https://phabricator.services.mozilla.com/D194703
Out-of-flow creates `nsPlaceholderFrame`, and `nsIFrame::PeekOffset` related
methods treat words can cross its boundaries. However, it looks odd that a
sequence of content split by `nsPlaceholderFrame` is treated as a word.
Therefore, I think that `nsIFrame::IsLogicallyAtLineEdge` and
`nsIFrame::IsVisuallyAtLineEdge` should ignore placeholder to check whether the
frame is first/last of the line.
Additionally, I think that `nsIFrame::PeekOffsetForWord` should not allow
`nsIFrame::GetFrameFromDirection` to cross `nsPlaceholderFrame` boundaries
if it's already found some characters.
Differential Revision: https://phabricator.services.mozilla.com/D176250
This is a simple mistake of the previous patch. The code path is originally for
a left click handling. Therefore, there is no check whether the click point is
in a selection range because in that case, left click should collapse selection.
However, the selection should not be collapse when it's a right click in a
selection range because the context menu target is the selection range.
The `ui.mouse.right_click.collapse_selection.stop_if_non_collapsed_selection`
pref is set to `true` by default. Therefore, the existence of a non-collapsed
selection has hidden this bug. However, if it's set to `false`, this always
happens. Additionally, editor does not set ancestor limiter of selection if the
root element is editable [1]. I think that we can now remove this special path,
but it's risky. Therefore, this patch just adds the new check into the method.
1. https://searchfox.org/mozilla-central/rev/ce4599d3d4e20e34cb6db68f255c3dff1aec246b/editor/libeditor/EditorBase.cpp#5448,5450-5451
Differential Revision: https://phabricator.services.mozilla.com/D193529
This refactors the logic for testing whether something has a clip-path or mask and what to do about it in one place rather than using many overlapping functions.
Differential Revision: https://phabricator.services.mozilla.com/D190767
The border property is just useless, we only use it to store stuff
across border style changes, which makes zero sense because we clear it
when we start reflowing.
Differential Revision: https://phabricator.services.mozilla.com/D191177
The other browsers move focus and `Selection` whe right click even if the
clicked element is not editable and even if there is a non-collapsed selection.
Fortunately, we already have similar code for the middle button press.
Therefore, we can make it run when the pressed button is the secondary button.
This also fixes bug 416546 and does not resurrect bug 709476.
However, this patch adds 2 prefs for making users customizable. Our traditional
behavior is, we never collapse non-collapses selection with a right click even
if clicked outside the selection. This allows users to open context menu for
selected text much easier. Therefore, even though the behavior is different
from the others, we should keep the traditional behavior, but some users may
want the other browsers' behavior instead. For them, this should be switchable
by a pref.
Additionally, I'm still not sure collapsing selection with a right click in
non-editable content especially for users using the caret browsing mode.
Therefore, for making things safer, this adds a pref to disable the new behavior
in the non-editable content.
Differential Revision: https://phabricator.services.mozilla.com/D189991
Because we use NULL to indicate the auto value, once a page contributes a
non-auto page value then that will be all that is seen by ComputePageValue
when a later page doesn't have a page-name at all.
Actually checking for the page-name value will fix page-name values when
an empty/auto page-name follows pages with a non-auto value. It is also
slightly more efficient, as it avoids a frame property lookup and instead
just looks at the computed style.
While we are here, remove an assert that is clearly not possible to occur
anymore, and add a short explanation of the code in ComputePageValue.
Differential Revision: https://phabricator.services.mozilla.com/D188544
On 50 runs of TodoMVC-React-Complex-DOM a profile without this patch had 113 samples in Combines3DTransformWithAncestors. A profile with this patch had 40 samples.
Differential Revision: https://phabricator.services.mozilla.com/D188402
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.
This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.
It's also a bit nicer to add things there if we need to in the future.
Differential Revision: https://phabricator.services.mozilla.com/D187578
This shouldn't change behavior, but it packs the two arguments to
DestroyFrom into a single thing, and makes nsIFrame::Destroy not so easy
to call without a previous context.
This is a prerequisite to pass aDestroyContext to various things that
right now just mint one, which can cause badness, see bug 1851787 and
related bugs.
It's also a bit nicer to add things there if we need to in the future.
Differential Revision: https://phabricator.services.mozilla.com/D187578
A negative outline-offset value should be clamped per spec as to stop it
from becoming invisible with large negative values.
Spec ref: https://www.w3.org/TR/css-ui-4/#outline-offset
Also added a new WPT reftest for this case as no tests existed prior,
updated related WPT expectations, and updated a few old layout reftests.
Differential Revision: https://phabricator.services.mozilla.com/D185357
A negative outline-offset value should be clamped per spec as to stop it
from becoming invisible with large negative values.
Spec ref: https://www.w3.org/TR/css-ui-4/#outline-offset
Also added a new WPT reftest for this case as no tests existed prior,
updated related WPT expectations, and updated an old layout reftest.
Differential Revision: https://phabricator.services.mozilla.com/D185357
This patch introduces functional pseudo parameters, i.e. `::highlight(foo)`,
for `getComputedStyle()`. This required adapting the parse algorithm (`nsCSSPseudoElements::ParsePseudoElement()`) and forwarding the functional pseudo parameter into the style engine.
Differential Revision: https://phabricator.services.mozilla.com/D183773
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.
Differential Revision: https://phabricator.services.mozilla.com/D183921
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.
Differential Revision: https://phabricator.services.mozilla.com/D183921