mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1529492
- Disable caret clamping if transforms are present. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D25194 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9cdf8c0da1
commit
97109f9916
@ -314,9 +314,26 @@ nsRect nsCaret::GetGeometryForFrame(nsIFrame* aFrame, int32_t aFrameOffset,
|
||||
|
||||
// Clamp the inline-position to be within our scroll frame. If we don't, then
|
||||
// it clips us, and we don't appear at all. See bug 335560.
|
||||
nsIFrame* scrollFrame =
|
||||
nsLayoutUtils::GetClosestFrameOfType(aFrame, LayoutFrameType::Scroll);
|
||||
if (scrollFrame) {
|
||||
|
||||
// Find the ancestor scroll frame and determine whether we have any transforms
|
||||
// up the ancestor chain.
|
||||
bool hasTransform = false;
|
||||
nsIFrame* scrollFrame = nullptr;
|
||||
for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
|
||||
if (f->IsScrollFrame()) {
|
||||
scrollFrame = f;
|
||||
break;
|
||||
}
|
||||
if (f->IsTransformed()) {
|
||||
hasTransform = true;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(heycam): Skip clamping if we find any transform up the ancestor
|
||||
// chain, since the GetOffsetTo call below doesn't take transforms into
|
||||
// account. We could change this clamping to take transforms into account, but
|
||||
// the clamping seems to be broken anyway; see bug 1539720.
|
||||
if (scrollFrame && !hasTransform) {
|
||||
// First, use the scrollFrame to get at the scrollable view that we're in.
|
||||
nsIScrollableFrame* sf = do_QueryFrame(scrollFrame);
|
||||
nsIFrame* scrolled = sf->GetScrolledFrame();
|
||||
|
23
layout/reftests/bugs/1529492-1-ref.html
Normal file
23
layout/reftests/bugs/1529492-1-ref.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
.parent {
|
||||
font: 32px monospace;
|
||||
width: 26ch;
|
||||
transform: scaleX(0.5);
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
#child {
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
<div class="parent"><div id="child">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</div></div>
|
||||
<script>
|
||||
let r = document.createRange();
|
||||
let t = child.firstChild;
|
||||
r.setStart(t, 30);
|
||||
r.setEnd(t, 30);
|
||||
|
||||
let sel = getSelection();
|
||||
sel.empty();
|
||||
sel.addRange(r);
|
||||
</script>
|
28
layout/reftests/bugs/1529492-1.html
Normal file
28
layout/reftests/bugs/1529492-1.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- This test relies on caret browsing being enabled. -->
|
||||
<style>
|
||||
.parent {
|
||||
font: 32px monospace;
|
||||
width: 26ch;
|
||||
overflow: hidden;
|
||||
}
|
||||
#child {
|
||||
transform: scaleX(0.5);
|
||||
transform-origin: 0 0;
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
<div class="parent"><div id="child">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</div></div>
|
||||
<script>
|
||||
let r = document.createRange();
|
||||
let t = child.firstChild;
|
||||
|
||||
// With a scale of 0.5, the bug manifests by limiting the caret's position
|
||||
// to half way through the text. Place the selection somewhere past that.
|
||||
r.setStart(t, 30);
|
||||
r.setEnd(t, 30);
|
||||
|
||||
let sel = getSelection();
|
||||
sel.empty();
|
||||
sel.addRange(r);
|
||||
</script>
|
@ -2104,4 +2104,5 @@ pref(layout.css.supports-selector.enabled,true) == 1499386.html 1499386-ref.html
|
||||
pref(layout.css.supports-selector.enabled,false) != 1499386.html 1499386-ref.html
|
||||
== 1509425-1.html 1509425-1-ref.html
|
||||
== 1511570.html 1511570-ref.html
|
||||
pref(accessibility.browsewithcaret,true) == 1529492-1.html 1529492-1-ref.html
|
||||
== 1535040-1.html 1535040-1-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user