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

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

Issue 1941463002: Removes the restriction placed on the role of the accessibility object when calling the next/previo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment and discovered that images don't work. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/inline-text-box-next-on-line.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 { 1011 {
1012 if (!getLayoutObject() || !getLayoutObject()->isText()) 1012 if (!getLayoutObject() || !getLayoutObject()->isText())
1013 return; 1013 return;
1014 1014
1015 clearChildren(); 1015 clearChildren();
1016 addInlineTextBoxChildren(true); 1016 addInlineTextBoxChildren(true);
1017 } 1017 }
1018 1018
1019 AXObject* AXLayoutObject::nextOnLine() const 1019 AXObject* AXLayoutObject::nextOnLine() const
1020 { 1020 {
1021 if (!m_layoutObject) 1021 if (!getLayoutObject())
1022 return 0; 1022 return nullptr;
1023 1023
1024 InlineBox* inlineBox; 1024 InlineBox* inlineBox = nullptr;
1025 if (m_layoutObject->isLayoutInline()) 1025 if (getLayoutObject()->isLayoutInline())
1026 inlineBox = toLayoutInline(m_layoutObject)->lastLineBox(); 1026 inlineBox = toLayoutInline(getLayoutObject())->lastLineBox();
1027 else if (m_layoutObject->isText()) 1027 else if (getLayoutObject()->isText())
1028 inlineBox = toLayoutText(m_layoutObject)->lastTextBox(); 1028 inlineBox = toLayoutText(getLayoutObject())->lastTextBox();
1029 else
1030 return 0;
1031 1029
1032 AXObject* result = 0; 1030 if (!inlineBox)
1031 return nullptr;
1032
1033 AXObject* result = nullptr;
1033 for (InlineBox* next = inlineBox->nextOnLine(); next; next = next->nextOnLin e()) { 1034 for (InlineBox* next = inlineBox->nextOnLine(); next; next = next->nextOnLin e()) {
1034 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(next->g etLineLayoutItem()); 1035 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(next->g etLineLayoutItem());
1035 result = axObjectCache().getOrCreate(layoutObject); 1036 result = axObjectCache().getOrCreate(layoutObject);
1036 if (result) 1037 if (result)
1037 break; 1038 break;
1038 } 1039 }
1039 1040
1040 // A static text node might span multiple lines. Try to return the first inl ine 1041 // A static text node might span multiple lines. Try to return the first inl ine
1041 // text box within that static text if possible. 1042 // text box within that static text if possible.
1042 if (result && result->roleValue() == StaticTextRole && result->children().si ze()) 1043 if (result && result->roleValue() == StaticTextRole && result->children().si ze())
1043 result = result->children()[0].get(); 1044 result = result->children()[0].get();
1044 1045
1045 return result; 1046 return result;
1046 } 1047 }
1047 1048
1048 AXObject* AXLayoutObject::previousOnLine() const 1049 AXObject* AXLayoutObject::previousOnLine() const
1049 { 1050 {
1050 if (!m_layoutObject) 1051 if (!getLayoutObject())
1051 return 0; 1052 return nullptr;
1052 1053
1053 InlineBox* inlineBox; 1054 InlineBox* inlineBox = nullptr;
1054 if (m_layoutObject->isLayoutInline()) 1055 if (getLayoutObject()->isLayoutInline())
1055 inlineBox = toLayoutInline(m_layoutObject)->firstLineBox(); 1056 inlineBox = toLayoutInline(getLayoutObject())->firstLineBox();
1056 else if (m_layoutObject->isText()) 1057 else if (getLayoutObject()->isText())
1057 inlineBox = toLayoutText(m_layoutObject)->firstTextBox(); 1058 inlineBox = toLayoutText(getLayoutObject())->firstTextBox();
1058 else
1059 return 0;
1060 1059
1061 AXObject* result = 0; 1060 if (!inlineBox)
1061 return nullptr;
1062
1063 AXObject* result = nullptr;
1062 for (InlineBox* prev = inlineBox->prevOnLine(); prev; prev = prev->prevOnLin e()) { 1064 for (InlineBox* prev = inlineBox->prevOnLine(); prev; prev = prev->prevOnLin e()) {
1063 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(prev->g etLineLayoutItem()); 1065 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(prev->g etLineLayoutItem());
1064 result = axObjectCache().getOrCreate(layoutObject); 1066 result = axObjectCache().getOrCreate(layoutObject);
1065 if (result) 1067 if (result)
1066 break; 1068 break;
1067 } 1069 }
1068 1070
1069 // A static text node might span multiple lines. Try to return the last inli ne 1071 // A static text node might span multiple lines. Try to return the last inli ne
1070 // text box within that static text if possible. 1072 // text box within that static text if possible.
1071 if (result && result->roleValue() == StaticTextRole && result->children().si ze()) 1073 if (result && result->roleValue() == StaticTextRole && result->children().si ze())
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 if (label && label->layoutObject()) { 2467 if (label && label->layoutObject()) {
2466 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2468 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2467 result.unite(labelRect); 2469 result.unite(labelRect);
2468 } 2470 }
2469 } 2471 }
2470 2472
2471 return result; 2473 return result;
2472 } 2474 }
2473 2475
2474 } // namespace blink 2476 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/inline-text-box-next-on-line.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698