Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 1939303002: Enable accessible name of a control to include multiple <label> elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/frame/FrameOwner.h" 44 #include "core/frame/FrameOwner.h"
45 #include "core/frame/FrameView.h" 45 #include "core/frame/FrameView.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
48 #include "core/html/HTMLFrameOwnerElement.h" 48 #include "core/html/HTMLFrameOwnerElement.h"
49 #include "core/html/HTMLImageElement.h" 49 #include "core/html/HTMLImageElement.h"
50 #include "core/html/HTMLLabelElement.h" 50 #include "core/html/HTMLLabelElement.h"
51 #include "core/html/HTMLOptionElement.h" 51 #include "core/html/HTMLOptionElement.h"
52 #include "core/html/HTMLSelectElement.h" 52 #include "core/html/HTMLSelectElement.h"
53 #include "core/html/HTMLTextAreaElement.h" 53 #include "core/html/HTMLTextAreaElement.h"
54 #include "core/html/LabelsNodeList.h"
54 #include "core/html/shadow/ShadowElementNames.h" 55 #include "core/html/shadow/ShadowElementNames.h"
55 #include "core/layout/HitTestResult.h" 56 #include "core/layout/HitTestResult.h"
56 #include "core/layout/LayoutFieldset.h" 57 #include "core/layout/LayoutFieldset.h"
57 #include "core/layout/LayoutFileUploadControl.h" 58 #include "core/layout/LayoutFileUploadControl.h"
58 #include "core/layout/LayoutHTMLCanvas.h" 59 #include "core/layout/LayoutHTMLCanvas.h"
59 #include "core/layout/LayoutImage.h" 60 #include "core/layout/LayoutImage.h"
60 #include "core/layout/LayoutInline.h" 61 #include "core/layout/LayoutInline.h"
61 #include "core/layout/LayoutListMarker.h" 62 #include "core/layout/LayoutListMarker.h"
62 #include "core/layout/LayoutMenuList.h" 63 #include "core/layout/LayoutMenuList.h"
63 #include "core/layout/LayoutPart.h" 64 #include "core/layout/LayoutPart.h"
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 if (document && document->frame() && document->frame()->pagePopupOwner()) { 2457 if (document && document->frame() && document->frame()->pagePopupOwner()) {
2457 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation(); 2458 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation();
2458 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location(); 2459 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location();
2459 result.moveBy(IntPoint(popupOrigin - mainOrigin)); 2460 result.moveBy(IntPoint(popupOrigin - mainOrigin));
2460 } 2461 }
2461 2462
2462 // The size of the web area should be the content size, not the clipped size . 2463 // The size of the web area should be the content size, not the clipped size .
2463 if (isWebArea() && obj->frame()->view()) 2464 if (isWebArea() && obj->frame()->view())
2464 result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); 2465 result.setSize(LayoutSize(obj->frame()->view()->contentsSize()));
2465 2466
2466 // Checkboxes and radio buttons include their label as part of their rect. 2467 // Checkboxes and radio buttons include their labels as part of their rect.
2467 if (isCheckboxOrRadio()) { 2468 if (isCheckboxOrRadio() && isLabelableElement(obj->node())) {
2468 HTMLLabelElement* label = labelForElement(toElement(m_layoutObject->node ())); 2469 LabelsNodeList* labels = toLabelableElement(obj->node())->labels();
2469 if (label && label->layoutObject()) { 2470 if (labels) {
2470 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2471 for (unsigned labelIndex = 0; labelIndex < labels->length(); ++label Index) {
2471 result.unite(labelRect); 2472 AXObject* labelAXObject = axObjectCache().getOrCreate(labels->it em(labelIndex));
2473 if (labelAXObject) {
2474 LayoutRect labelRect = labelAXObject->elementRect();
2475 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.
2476 }
2477 }
2472 } 2478 }
2473 } 2479 }
2474 2480
2475 return result; 2481 return result;
2476 } 2482 }
2477 2483
2478 } // namespace blink 2484 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698