| OLD | NEW |
| 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 InlineBox* inlineBox; | 999 InlineBox* inlineBox; |
| 1000 if (m_layoutObject->isLayoutInline()) | 1000 if (m_layoutObject->isLayoutInline()) |
| 1001 inlineBox = toLayoutInline(m_layoutObject)->lastLineBox(); | 1001 inlineBox = toLayoutInline(m_layoutObject)->lastLineBox(); |
| 1002 else if (m_layoutObject->isText()) | 1002 else if (m_layoutObject->isText()) |
| 1003 inlineBox = toLayoutText(m_layoutObject)->lastTextBox(); | 1003 inlineBox = toLayoutText(m_layoutObject)->lastTextBox(); |
| 1004 else | 1004 else |
| 1005 return 0; | 1005 return 0; |
| 1006 | 1006 |
| 1007 AXObject* result = 0; | 1007 AXObject* result = 0; |
| 1008 for (InlineBox* next = inlineBox->nextOnLine(); next; next = next->nextOnLin
e()) { | 1008 for (InlineBox* next = inlineBox->nextOnLine(); next; next = next->nextOnLin
e()) { |
| 1009 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(next->l
ineLayoutItem()); | 1009 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(next->g
etLineLayoutItem()); |
| 1010 result = axObjectCache().getOrCreate(layoutObject); | 1010 result = axObjectCache().getOrCreate(layoutObject); |
| 1011 if (result) | 1011 if (result) |
| 1012 break; | 1012 break; |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 // A static text node might span multiple lines. Try to return the first inl
ine | 1015 // A static text node might span multiple lines. Try to return the first inl
ine |
| 1016 // text box within that static text if possible. | 1016 // text box within that static text if possible. |
| 1017 if (result && result->roleValue() == StaticTextRole && result->children().si
ze()) | 1017 if (result && result->roleValue() == StaticTextRole && result->children().si
ze()) |
| 1018 result = result->children()[0].get(); | 1018 result = result->children()[0].get(); |
| 1019 | 1019 |
| 1020 return result; | 1020 return result; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 AXObject* AXLayoutObject::previousOnLine() const | 1023 AXObject* AXLayoutObject::previousOnLine() const |
| 1024 { | 1024 { |
| 1025 if (!m_layoutObject) | 1025 if (!m_layoutObject) |
| 1026 return 0; | 1026 return 0; |
| 1027 | 1027 |
| 1028 InlineBox* inlineBox; | 1028 InlineBox* inlineBox; |
| 1029 if (m_layoutObject->isLayoutInline()) | 1029 if (m_layoutObject->isLayoutInline()) |
| 1030 inlineBox = toLayoutInline(m_layoutObject)->firstLineBox(); | 1030 inlineBox = toLayoutInline(m_layoutObject)->firstLineBox(); |
| 1031 else if (m_layoutObject->isText()) | 1031 else if (m_layoutObject->isText()) |
| 1032 inlineBox = toLayoutText(m_layoutObject)->firstTextBox(); | 1032 inlineBox = toLayoutText(m_layoutObject)->firstTextBox(); |
| 1033 else | 1033 else |
| 1034 return 0; | 1034 return 0; |
| 1035 | 1035 |
| 1036 AXObject* result = 0; | 1036 AXObject* result = 0; |
| 1037 for (InlineBox* prev = inlineBox->prevOnLine(); prev; prev = prev->prevOnLin
e()) { | 1037 for (InlineBox* prev = inlineBox->prevOnLine(); prev; prev = prev->prevOnLin
e()) { |
| 1038 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(prev->l
ineLayoutItem()); | 1038 LayoutObject* layoutObject = LineLayoutAPIShim::layoutObjectFrom(prev->g
etLineLayoutItem()); |
| 1039 result = axObjectCache().getOrCreate(layoutObject); | 1039 result = axObjectCache().getOrCreate(layoutObject); |
| 1040 if (result) | 1040 if (result) |
| 1041 break; | 1041 break; |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 // A static text node might span multiple lines. Try to return the last inli
ne | 1044 // A static text node might span multiple lines. Try to return the last inli
ne |
| 1045 // text box within that static text if possible. | 1045 // text box within that static text if possible. |
| 1046 if (result && result->roleValue() == StaticTextRole && result->children().si
ze()) | 1046 if (result && result->roleValue() == StaticTextRole && result->children().si
ze()) |
| 1047 result = result->children()[result->children().size() - 1].get(); | 1047 result = result->children()[result->children().size() - 1].get(); |
| 1048 | 1048 |
| (...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 if (label && label->layoutObject()) { | 2546 if (label && label->layoutObject()) { |
| 2547 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); | 2547 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe
ct(); |
| 2548 result.unite(labelRect); | 2548 result.unite(labelRect); |
| 2549 } | 2549 } |
| 2550 } | 2550 } |
| 2551 | 2551 |
| 2552 return result; | 2552 return result; |
| 2553 } | 2553 } |
| 2554 | 2554 |
| 2555 } // namespace blink | 2555 } // namespace blink |
| OLD | NEW |