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

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

Issue 1548403002: Avoid endless loop when computing line boundaries in contentEditable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/line-for-index-endless-loop.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 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 2158
2159 VisiblePosition visiblePos = visiblePositionForIndex(0); 2159 VisiblePosition visiblePos = visiblePositionForIndex(0);
2160 VisiblePosition prevVisiblePos = visiblePos; 2160 VisiblePosition prevVisiblePos = visiblePos;
2161 visiblePos = nextLinePosition(visiblePos, 0, HasEditableAXRole); 2161 visiblePos = nextLinePosition(visiblePos, 0, HasEditableAXRole);
2162 // nextLinePosition moves to the end of the current line when there are 2162 // nextLinePosition moves to the end of the current line when there are
2163 // no more lines. 2163 // no more lines.
2164 while (visiblePos.isNotNull() && !inSameLine(prevVisiblePos, visiblePos)) { 2164 while (visiblePos.isNotNull() && !inSameLine(prevVisiblePos, visiblePos)) {
2165 lineBreaks.append(indexForVisiblePosition(visiblePos)); 2165 lineBreaks.append(indexForVisiblePosition(visiblePos));
2166 prevVisiblePos = visiblePos; 2166 prevVisiblePos = visiblePos;
2167 visiblePos = nextLinePosition(visiblePos, 0, HasEditableAXRole); 2167 visiblePos = nextLinePosition(visiblePos, 0, HasEditableAXRole);
2168
2169 // Make sure we always make forward progress.
2170 if (visiblePos.deepEquivalent().compareTo(prevVisiblePos.deepEquivalent( )) < 0)
2171 break;
2168 } 2172 }
2169 } 2173 }
2170 2174
2171 // 2175 //
2172 // Private. 2176 // Private.
2173 // 2177 //
2174 2178
2175 AXObject* AXLayoutObject::treeAncestorDisallowingChild() const 2179 AXObject* AXLayoutObject::treeAncestorDisallowingChild() const
2176 { 2180 {
2177 // Determine if this is in a tree. If so, we apply special behavior to make it work like an AXOutline. 2181 // Determine if this is in a tree. If so, we apply special behavior to make it work like an AXOutline.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 if (label && label->layoutObject()) { 2531 if (label && label->layoutObject()) {
2528 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2532 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2529 result.unite(labelRect); 2533 result.unite(labelRect);
2530 } 2534 }
2531 } 2535 }
2532 2536
2533 return result; 2537 return result;
2534 } 2538 }
2535 2539
2536 } // namespace blink 2540 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/accessibility/line-for-index-endless-loop.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698