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

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: Address feedback from aboxhall 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 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 if (document && document->frame() && document->frame()->pagePopupOwner()) { 2459 if (document && document->frame() && document->frame()->pagePopupOwner()) {
2459 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation(); 2460 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation();
2460 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location(); 2461 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location();
2461 result.moveBy(IntPoint(popupOrigin - mainOrigin)); 2462 result.moveBy(IntPoint(popupOrigin - mainOrigin));
2462 } 2463 }
2463 2464
2464 // The size of the web area should be the content size, not the clipped size . 2465 // The size of the web area should be the content size, not the clipped size .
2465 if (isWebArea() && obj->frame()->view()) 2466 if (isWebArea() && obj->frame()->view())
2466 result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); 2467 result.setSize(LayoutSize(obj->frame()->view()->contentsSize()));
2467 2468
2468 // Checkboxes and radio buttons include their label as part of their rect. 2469 // Checkboxes and radio buttons include their labels as part of their rect.
2469 if (isCheckboxOrRadio()) { 2470 if (isCheckboxOrRadio() && isLabelableElement(obj->node())) {
2470 HTMLLabelElement* label = labelForElement(toElement(m_layoutObject->node ())); 2471 LabelsNodeList* labels = toLabelableElement(obj->node())->labels();
2471 if (label && label->layoutObject()) { 2472 if (labels) {
2472 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2473 for (unsigned labelIndex = 0; labelIndex < labels->length(); ++label Index) {
2473 result.unite(labelRect); 2474 AXObject* labelAXObject = axObjectCache().getOrCreate(labels->it em(labelIndex));
2475 if (labelAXObject) {
2476 LayoutRect labelRect = labelAXObject->elementRect();
2477 result.unite(labelRect);
2478 }
2479 }
2474 } 2480 }
2475 } 2481 }
2476 2482
2477 return result; 2483 return result;
2478 } 2484 }
2479 2485
2480 } // namespace blink 2486 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698