зеркало из https://github.com/mozilla/gecko-dev.git
Bug 389283 - Choose cursor value based on selectability. r=dbaron
MozReview-Commit-ID: 2c4RcXgwz1U --HG-- extra : rebase_source : c3525339d5d64f24c6f0667244885b8b33042072
This commit is contained in:
Родитель
6f58b63037
Коммит
ae670d64ee
|
@ -4525,29 +4525,13 @@ nsTextFrame::GetCursor(const nsPoint& aPoint,
|
|||
{
|
||||
FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
|
||||
if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
|
||||
bool selectable;
|
||||
IsSelectable(&selectable, nullptr);
|
||||
if (!selectable) {
|
||||
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
|
||||
} else {
|
||||
aCursor.mCursor = GetWritingMode().IsVertical()
|
||||
? NS_STYLE_CURSOR_VERTICAL_TEXT : NS_STYLE_CURSOR_TEXT;
|
||||
// If this is editable, we should ignore tabindex value.
|
||||
if (mContent->IsEditable()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If tabindex >= 0, use default cursor to indicate it's not selectable
|
||||
nsIFrame *ancestorFrame = this;
|
||||
while ((ancestorFrame = ancestorFrame->GetParent()) != nullptr) {
|
||||
nsIContent *ancestorContent = ancestorFrame->GetContent();
|
||||
if (ancestorContent && ancestorContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
|
||||
nsAutoString tabIndexStr;
|
||||
ancestorContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
|
||||
if (!tabIndexStr.IsEmpty()) {
|
||||
nsresult rv;
|
||||
int32_t tabIndexVal = tabIndexStr.ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv) && tabIndexVal >= 0) {
|
||||
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче