Index: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
index c780186a855528cd7f12301a390698cbf61c3ff1..e33fd8df5f5625b48042c36ff3b7daf3386a9a05 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp |
@@ -51,6 +51,7 @@ |
#include "core/html/HTMLOptionElement.h" |
#include "core/html/HTMLSelectElement.h" |
#include "core/html/HTMLTextAreaElement.h" |
+#include "core/html/LabelsNodeList.h" |
#include "core/html/shadow/ShadowElementNames.h" |
#include "core/layout/HitTestResult.h" |
#include "core/layout/LayoutFieldset.h" |
@@ -2463,12 +2464,17 @@ LayoutRect AXLayoutObject::computeElementRect() const |
if (isWebArea() && obj->frame()->view()) |
result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); |
- // Checkboxes and radio buttons include their label as part of their rect. |
- if (isCheckboxOrRadio()) { |
- HTMLLabelElement* label = labelForElement(toElement(m_layoutObject->node())); |
- if (label && label->layoutObject()) { |
- LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRect(); |
- result.unite(labelRect); |
+ // Checkboxes and radio buttons include their labels as part of their rect. |
+ if (isCheckboxOrRadio() && isLabelableElement(obj->node())) { |
+ LabelsNodeList* labels = toLabelableElement(obj->node())->labels(); |
+ if (labels) { |
+ for (unsigned labelIndex = 0; labelIndex < labels->length(); ++labelIndex) { |
+ AXObject* labelAXObject = axObjectCache().getOrCreate(labels->item(labelIndex)); |
+ if (labelAXObject) { |
+ LayoutRect labelRect = labelAXObject->elementRect(); |
+ result.unite(labelRect); |
aboxhall
2016/05/13 20:19:16
This doesn't change in this change, but it never o
dmazzoni
2016/05/13 22:22:42
Agreed, it's a bit weird.
|
+ } |
+ } |
} |
} |