mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1336388 - Use overlapping tilt mechanism in always tilt mode. r=mtseng
MozReview-Commit-ID: LwWnAbHiTBH --HG-- extra : rebase_source : fb71526b2205edcaa40c5f6d2ace863ad7831a2a
This commit is contained in:
parent
3d19c8f732
commit
723732ff7f
@ -429,30 +429,41 @@ AccessibleCaretManager::UpdateCaretsForSelectionMode(UpdateCaretsHint aHint)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
AccessibleCaretManager::UpdateCaretsForOverlappingTilt()
|
||||
{
|
||||
if (mFirstCaret->IsVisuallyVisible() && mSecondCaret->IsVisuallyVisible()) {
|
||||
if (mFirstCaret->Intersects(*mSecondCaret)) {
|
||||
if (mFirstCaret->LogicalPosition().x <=
|
||||
mSecondCaret->LogicalPosition().x) {
|
||||
mFirstCaret->SetAppearance(Appearance::Left);
|
||||
mSecondCaret->SetAppearance(Appearance::Right);
|
||||
} else {
|
||||
mFirstCaret->SetAppearance(Appearance::Right);
|
||||
mSecondCaret->SetAppearance(Appearance::Left);
|
||||
}
|
||||
} else {
|
||||
mFirstCaret->SetAppearance(Appearance::Normal);
|
||||
mSecondCaret->SetAppearance(Appearance::Normal);
|
||||
}
|
||||
if (!mFirstCaret->IsVisuallyVisible() || !mSecondCaret->IsVisuallyVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mFirstCaret->Intersects(*mSecondCaret)) {
|
||||
mFirstCaret->SetAppearance(Appearance::Normal);
|
||||
mSecondCaret->SetAppearance(Appearance::Normal);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mFirstCaret->LogicalPosition().x <=
|
||||
mSecondCaret->LogicalPosition().x) {
|
||||
mFirstCaret->SetAppearance(Appearance::Left);
|
||||
mSecondCaret->SetAppearance(Appearance::Right);
|
||||
} else {
|
||||
mFirstCaret->SetAppearance(Appearance::Right);
|
||||
mSecondCaret->SetAppearance(Appearance::Left);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AccessibleCaretManager::UpdateCaretsForAlwaysTilt(nsIFrame* aStartFrame,
|
||||
nsIFrame* aEndFrame)
|
||||
{
|
||||
// When a short LTR word in RTL environment is selected, the two carets
|
||||
// tilted inward might be overlapped. Make them tilt outward.
|
||||
if (UpdateCaretsForOverlappingTilt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFirstCaret->IsVisuallyVisible()) {
|
||||
auto startFrameWritingMode = aStartFrame->GetWritingMode();
|
||||
mFirstCaret->SetAppearance(startFrameWritingMode.IsBidiLTR() ?
|
||||
|
@ -226,7 +226,8 @@ protected:
|
||||
nsIFrame* aEndFrame) const;
|
||||
|
||||
// Check if the two carets is overlapping to become tilt.
|
||||
virtual void UpdateCaretsForOverlappingTilt();
|
||||
// @return true if the two carets become tilt; false, otherwise.
|
||||
virtual bool UpdateCaretsForOverlappingTilt();
|
||||
|
||||
// Make the two carets always tilt.
|
||||
virtual void UpdateCaretsForAlwaysTilt(nsIFrame* aStartFrame,
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void UpdateCaretsForOverlappingTilt() override {}
|
||||
virtual bool UpdateCaretsForOverlappingTilt() override { return true; }
|
||||
|
||||
virtual void UpdateCaretsForAlwaysTilt(nsIFrame* aStartFrame,
|
||||
nsIFrame* aEndFrame)
|
||||
|
Loading…
Reference in New Issue
Block a user