| Index: Source/core/accessibility/AXObject.cpp
|
| diff --git a/Source/core/accessibility/AXObject.cpp b/Source/core/accessibility/AXObject.cpp
|
| index fdc942a5c53ca2774b7c5a8f44d26726cba6bf35..f431d9eed873402d3040b29a143268ae763a89b4 100644
|
| --- a/Source/core/accessibility/AXObject.cpp
|
| +++ b/Source/core/accessibility/AXObject.cpp
|
| @@ -709,7 +709,13 @@ static int computeBestScrollOffset(int currentScrollOffset, int subfocusMin, int
|
| // only a portion that's as large as the viewport, centering on
|
| // the subfocus as much as possible.
|
| if (objectMax - objectMin > viewportSize) {
|
| - // Subfocus must be within focus:
|
| + // Since it's impossible to fit the whole object in the
|
| + // viewport, exit now if the subfocus is already within the viewport.
|
| + if (subfocusMin - currentScrollOffset >= viewportMin
|
| + && subfocusMax - currentScrollOffset <= viewportMax)
|
| + return currentScrollOffset;
|
| +
|
| + // Subfocus must be within focus.
|
| subfocusMin = std::max(subfocusMin, objectMin);
|
| subfocusMax = std::min(subfocusMax, objectMax);
|
|
|
|
|