зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1514570 - Only graphics elements should support tabindex r=dholbert
This commit is contained in:
Родитель
45401d6c92
Коммит
717a265944
|
@ -212,7 +212,7 @@ static bool IsNodeInEditableRegion(nsINode* aNode) {
|
|||
}
|
||||
|
||||
bool SVGAElement::IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex) {
|
||||
if (nsSVGElement::IsSVGFocusable(aIsFocusable, aTabIndex)) {
|
||||
if (SVGGraphicsElement::IsSVGFocusable(aIsFocusable, aTabIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ class SVGDefsElement final : public SVGGraphicsElement {
|
|||
// nsIContent
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
// defs elements are not focusable.
|
||||
bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override {
|
||||
return nsIContent::IsFocusableInternal(aTabIndex, aWithMouse);
|
||||
}
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,5 +28,39 @@ SVGGraphicsElement::SVGGraphicsElement(
|
|||
|
||||
SVGGraphicsElement::~SVGGraphicsElement() {}
|
||||
|
||||
bool SVGGraphicsElement::IsSVGFocusable(bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
// In designMode documents we only allow focusing the document.
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
|
||||
*aIsFocusable = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t tabIndex = TabIndex();
|
||||
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = tabIndex;
|
||||
}
|
||||
|
||||
// If a tabindex is specified at all, or the default tabindex is 0, we're
|
||||
// focusable
|
||||
*aIsFocusable = tabIndex >= 0 || HasAttr(nsGkAtoms::tabindex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SVGGraphicsElement::IsFocusableInternal(int32_t* aTabIndex,
|
||||
bool aWithMouse) {
|
||||
bool isFocusable = false;
|
||||
IsSVGFocusable(&isFocusable, aTabIndex);
|
||||
return isFocusable;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -25,6 +25,8 @@ class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests {
|
|||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
|
||||
bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
|
||||
nsSVGElement* AsSVGElement() final { return this; }
|
||||
};
|
||||
|
||||
|
|
|
@ -1017,38 +1017,6 @@ already_AddRefed<SVGAnimatedString> nsSVGElement::ClassName() {
|
|||
return mClassAttribute.ToDOMAnimatedString(this);
|
||||
}
|
||||
|
||||
bool nsSVGElement::IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex) {
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
|
||||
// In designMode documents we only allow focusing the document.
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
|
||||
*aIsFocusable = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t tabIndex = TabIndex();
|
||||
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = tabIndex;
|
||||
}
|
||||
|
||||
// If a tabindex is specified at all, or the default tabindex is 0, we're
|
||||
// focusable
|
||||
*aIsFocusable = tabIndex >= 0 || HasAttr(nsGkAtoms::tabindex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool nsSVGElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) {
|
||||
bool isFocusable = false;
|
||||
IsSVGFocusable(&isFocusable, aTabIndex);
|
||||
return isFocusable;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Helper class: MappedAttrParser, for parsing values of mapped attributes
|
||||
|
||||
|
|
|
@ -304,10 +304,6 @@ class nsSVGElement : public nsSVGElementBase // nsIContent
|
|||
nsSVGElement* GetViewportElement();
|
||||
already_AddRefed<mozilla::dom::SVGAnimatedString> ClassName();
|
||||
|
||||
virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
|
||||
virtual bool IsFocusableInternal(int32_t* aTabIndex,
|
||||
bool aWithMouse) override;
|
||||
|
||||
void UpdateContentDeclarationBlock();
|
||||
const mozilla::DeclarationBlock* GetContentDeclarationBlock() const;
|
||||
|
||||
|
|
|
@ -17,30 +17,9 @@
|
|||
[canvas[tabindex\] should be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[clipPath[tabindex\] should not be focusable.]
|
||||
[mesh[tabindex\] should be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[defs[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[hatch[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[linearGradient[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[marker[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[mask[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[meshgradient[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[pattern[tabindex\] should not be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
[radialGradient[tabindex\] should not be focusable.]
|
||||
[unknown[tabindex\] should be focusable.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче