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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 637323002: Focus unfocusable node upon reference fragment navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove tab-to-focusable_node test Created 6 years, 2 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/fast/dom/fragment-activation-focuses-target-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) 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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1355 }
1356 } 1356 }
1357 1357
1358 // Implement the rule that "" and "top" both mean top of page as in other br owsers. 1358 // Implement the rule that "" and "top" both mean top of page as in other br owsers.
1359 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top"))) 1359 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
1360 return false; 1360 return false;
1361 1361
1362 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document()); 1362 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document());
1363 1363
1364 // If the anchor accepts keyboard focus, move focus there to aid users relyi ng on keyboard navigation. 1364 // If the anchor accepts keyboard focus, move focus there to aid users relyi ng on keyboard navigation.
1365 if (anchorNode && anchorNode->isFocusable()) 1365 // If it does not accept keyboard focus, then still remove the focus for con sistency with other browsers (http://crbug.com/417636)
dmazzoni 2014/10/08 18:19:06 This comment doesn't make sense - you say "remove
robwu 2014/10/08 20:10:23 setFocusedElement first unfocuses the old element.
dmazzoni 2014/10/08 20:26:27 Oh, I get it now. I'd probably write the comment s
robwu 2014/10/09 06:12:57 Done.
1366 if (anchorNode)
1366 m_frame->document()->setFocusedElement(anchorNode); 1367 m_frame->document()->setFocusedElement(anchorNode);
1367 1368
1368 return true; 1369 return true;
1369 } 1370 }
1370 1371
1371 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode) 1372 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
1372 { 1373 {
1373 m_maintainScrollPositionAnchor = anchorNode; 1374 m_maintainScrollPositionAnchor = anchorNode;
1374 if (!m_maintainScrollPositionAnchor) 1375 if (!m_maintainScrollPositionAnchor)
1375 return; 1376 return;
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 IntSize visibleSize = expandedIntSize(visibleContentSizeF); 3032 IntSize visibleSize = expandedIntSize(visibleContentSizeF);
3032 3033
3033 IntPoint maximumOffset( 3034 IntPoint maximumOffset(
3034 contentsWidth() - visibleSize.width() - scrollOrigin().x(), 3035 contentsWidth() - visibleSize.width() - scrollOrigin().x(),
3035 contentsHeight() - visibleSize.height() - scrollOrigin().y()); 3036 contentsHeight() - visibleSize.height() - scrollOrigin().y());
3036 maximumOffset.clampNegativeToZero(); 3037 maximumOffset.clampNegativeToZero();
3037 return maximumOffset; 3038 return maximumOffset;
3038 } 3039 }
3039 3040
3040 } // namespace blink 3041 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/fragment-activation-focuses-target-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698