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

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: Don't modify visited set when computing aria-labelledby Created 4 years, 6 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/HTMLInputElement.h" 50 #include "core/html/HTMLInputElement.h"
51 #include "core/html/HTMLLabelElement.h" 51 #include "core/html/HTMLLabelElement.h"
52 #include "core/html/HTMLOptionElement.h" 52 #include "core/html/HTMLOptionElement.h"
53 #include "core/html/HTMLSelectElement.h" 53 #include "core/html/HTMLSelectElement.h"
54 #include "core/html/HTMLTextAreaElement.h" 54 #include "core/html/HTMLTextAreaElement.h"
55 #include "core/html/LabelsNodeList.h"
55 #include "core/html/shadow/ShadowElementNames.h" 56 #include "core/html/shadow/ShadowElementNames.h"
56 #include "core/layout/HitTestResult.h" 57 #include "core/layout/HitTestResult.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/LayoutTextControl.h" 64 #include "core/layout/LayoutTextControl.h"
64 #include "core/layout/LayoutView.h" 65 #include "core/layout/LayoutView.h"
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 if (document && document->frame() && document->frame()->pagePopupOwner()) { 2462 if (document && document->frame() && document->frame()->pagePopupOwner()) {
2462 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation(); 2463 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc ation();
2463 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location(); 2464 IntPoint mainOrigin = axObjectCache().rootObject()->documentFrameView()- >contentsToScreen(IntRect()).location();
2464 result.moveBy(IntPoint(popupOrigin - mainOrigin)); 2465 result.moveBy(IntPoint(popupOrigin - mainOrigin));
2465 } 2466 }
2466 2467
2467 // The size of the web area should be the content size, not the clipped size . 2468 // The size of the web area should be the content size, not the clipped size .
2468 if (isWebArea() && obj->frame()->view()) 2469 if (isWebArea() && obj->frame()->view())
2469 result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); 2470 result.setSize(LayoutSize(obj->frame()->view()->contentsSize()));
2470 2471
2471 // Checkboxes and radio buttons include their label as part of their rect. 2472 // Checkboxes and radio buttons include their labels as part of their rect.
2472 if (isCheckboxOrRadio()) { 2473 if (isCheckboxOrRadio() && isLabelableElement(obj->node())) {
2473 HTMLLabelElement* label = labelForElement(toElement(m_layoutObject->node ())); 2474 LabelsNodeList* labels = toLabelableElement(obj->node())->labels();
2474 if (label && label->layoutObject()) { 2475 if (labels) {
2475 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2476 for (unsigned labelIndex = 0; labelIndex < labels->length(); ++label Index) {
2476 result.unite(labelRect); 2477 AXObject* labelAXObject = axObjectCache().getOrCreate(labels->it em(labelIndex));
2478 if (labelAXObject) {
2479 LayoutRect labelRect = labelAXObject->elementRect();
2480 result.unite(labelRect);
2481 }
2482 }
2477 } 2483 }
2478 } 2484 }
2479 2485
2480 return result; 2486 return result;
2481 } 2487 }
2482 2488
2483 } // namespace blink 2489 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698