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

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

Issue 1438953002: Update selection when an element is focused by in-document fragment link. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/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 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 // Implement the rule that "" and "top" both mean top of page as in other br owsers. 1447 // Implement the rule that "" and "top" both mean top of page as in other br owsers.
1448 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top"))) 1448 if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
1449 return false; 1449 return false;
1450 1450
1451 if (behavior == UrlFragmentScroll) 1451 if (behavior == UrlFragmentScroll)
1452 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNod e) : m_frame->document()); 1452 maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNod e) : m_frame->document());
1453 1453
1454 // If the anchor accepts keyboard focus, move focus there to aid users relyi ng on keyboard navigation. 1454 // If the anchor accepts keyboard focus, move focus there to aid users
1455 // If anchorNode is not focusable, setFocusedElement() will still clear focu s, which matches the behavior of other browsers. 1455 // relying on keyboard navigation.
1456 if (anchorNode) 1456 // If anchorNode is not focusable, clear focus, which matches the behavior
1457 m_frame->document()->setFocusedElement(anchorNode, FocusParams(Selection BehaviorOnFocus::None, WebFocusTypeNone, nullptr)); 1457 // of other browsers.
1458 1458 if (anchorNode) {
1459 m_frame->document()->updateLayoutIgnorePendingStylesheets();
1460 if (anchorNode->isFocusable())
1461 anchorNode->focus();
1462 else
1463 m_frame->document()->clearFocusedElement();
1464 }
1459 return true; 1465 return true;
1460 } 1466 }
1461 1467
1462 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode) 1468 void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
1463 { 1469 {
1464 ASSERT(anchorNode); 1470 ASSERT(anchorNode);
1465 m_scrollAnchor = anchorNode; 1471 m_scrollAnchor = anchorNode;
1466 1472
1467 // We need to update the layout tree before scrolling. 1473 // We need to update the layout tree before scrolling.
1468 m_frame->document()->updateLayoutTreeIfNeeded(); 1474 m_frame->document()->updateLayoutTreeIfNeeded();
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 } 4041 }
4036 4042
4037 bool FrameView::canThrottleRendering() const 4043 bool FrameView::canThrottleRendering() const
4038 { 4044 {
4039 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4045 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4040 return false; 4046 return false;
4041 return m_hiddenForThrottling && m_crossOriginForThrottling; 4047 return m_hiddenForThrottling && m_crossOriginForThrottling;
4042 } 4048 }
4043 4049
4044 } // namespace blink 4050 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/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