OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 } | 1353 } |
1354 } | 1354 } |
1355 | 1355 |
1356 // Implement the rule that "" and "top" both mean top of page as in other br
owsers. | 1356 // Implement the rule that "" and "top" both mean top of page as in other br
owsers. |
1357 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top"))) | 1357 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top"))) |
1358 return false; | 1358 return false; |
1359 | 1359 |
1360 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) :
m_frame->document()); | 1360 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) :
m_frame->document()); |
1361 | 1361 |
1362 // If the anchor accepts keyboard focus, move focus there to aid users relyi
ng on keyboard navigation. | 1362 // If the anchor accepts keyboard focus, move focus there to aid users relyi
ng on keyboard navigation. |
1363 if (anchorNode && anchorNode->isFocusable()) | 1363 // If anchorNode is not focusable, setFocusedElement() will still clear focu
s, which matches the behavior of other browsers. |
| 1364 if (anchorNode) |
1364 m_frame->document()->setFocusedElement(anchorNode); | 1365 m_frame->document()->setFocusedElement(anchorNode); |
1365 | 1366 |
1366 return true; | 1367 return true; |
1367 } | 1368 } |
1368 | 1369 |
1369 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode) | 1370 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode) |
1370 { | 1371 { |
1371 m_maintainScrollPositionAnchor = anchorNode; | 1372 m_maintainScrollPositionAnchor = anchorNode; |
1372 if (!m_maintainScrollPositionAnchor) | 1373 if (!m_maintainScrollPositionAnchor) |
1373 return; | 1374 return; |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3032 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3033 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
3033 | 3034 |
3034 IntPoint maximumOffset( | 3035 IntPoint maximumOffset( |
3035 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3036 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
3036 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3037 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
3037 maximumOffset.clampNegativeToZero(); | 3038 maximumOffset.clampNegativeToZero(); |
3038 return maximumOffset; | 3039 return maximumOffset; |
3039 } | 3040 } |
3040 | 3041 |
3041 } // namespace blink | 3042 } // namespace blink |
OLD | NEW |