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

Side by Side Diff: Source/modules/accessibility/AXObject.cpp

Issue 1118753004: Fix another case where scrollToMakeVisible was off. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: null-check scrollParent Created 5 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 | « LayoutTests/accessibility/scroll-to-make-visible-div-overflow-expected.txt ('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, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 { 1120 {
1121 // Search up the parent chain until we find the first one that's scrollable. 1121 // Search up the parent chain until we find the first one that's scrollable.
1122 AXObject* scrollParent = parentObject(); 1122 AXObject* scrollParent = parentObject();
1123 ScrollableArea* scrollableArea = 0; 1123 ScrollableArea* scrollableArea = 0;
1124 while (scrollParent) { 1124 while (scrollParent) {
1125 scrollableArea = scrollParent->getScrollableAreaIfScrollable(); 1125 scrollableArea = scrollParent->getScrollableAreaIfScrollable();
1126 if (scrollableArea) 1126 if (scrollableArea)
1127 break; 1127 break;
1128 scrollParent = scrollParent->parentObject(); 1128 scrollParent = scrollParent->parentObject();
1129 } 1129 }
1130 if (!scrollableArea) 1130 if (!scrollParent || !scrollableArea)
1131 return; 1131 return;
1132 1132
1133 IntRect objectRect = pixelSnappedIntRect(elementRect()); 1133 IntRect objectRect = pixelSnappedIntRect(elementRect());
1134 IntPoint scrollPosition = scrollableArea->scrollPosition(); 1134 IntPoint scrollPosition = scrollableArea->scrollPosition();
1135 IntRect scrollVisibleRect = scrollableArea->visibleContentRect(); 1135 IntRect scrollVisibleRect = scrollableArea->visibleContentRect();
1136 1136
1137 // Convert the object rect into local coordinates.
1138 if (!scrollParent->isAXScrollView()) {
1139 objectRect.moveBy(scrollPosition);
1140 objectRect.moveBy(-pixelSnappedIntRect(scrollParent->elementRect()).loca tion());
1141 }
1142
1137 int desiredX = computeBestScrollOffset( 1143 int desiredX = computeBestScrollOffset(
1138 scrollPosition.x(), 1144 scrollPosition.x(),
1139 objectRect.x() + subfocus.x(), objectRect.x() + subfocus.maxX(), 1145 objectRect.x() + subfocus.x(), objectRect.x() + subfocus.maxX(),
1140 objectRect.x(), objectRect.maxX(), 1146 objectRect.x(), objectRect.maxX(),
1141 0, scrollVisibleRect.width()); 1147 0, scrollVisibleRect.width());
1142 int desiredY = computeBestScrollOffset( 1148 int desiredY = computeBestScrollOffset(
1143 scrollPosition.y(), 1149 scrollPosition.y(),
1144 objectRect.y() + subfocus.y(), objectRect.y() + subfocus.maxY(), 1150 objectRect.y() + subfocus.y(), objectRect.y() + subfocus.maxY(),
1145 objectRect.y(), objectRect.maxY(), 1151 objectRect.y(), objectRect.maxY(),
1146 0, scrollVisibleRect.height()); 1152 0, scrollVisibleRect.height());
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1361 }
1356 1362
1357 const AtomicString& AXObject::internalRoleName(AccessibilityRole role) 1363 const AtomicString& AXObject::internalRoleName(AccessibilityRole role)
1358 { 1364 {
1359 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector(); 1365 static const Vector<AtomicString>* internalRoleNameVector = createInternalRo leNameVector();
1360 1366
1361 return internalRoleNameVector->at(role); 1367 return internalRoleNameVector->at(role);
1362 } 1368 }
1363 1369
1364 } // namespace blink 1370 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/accessibility/scroll-to-make-visible-div-overflow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698