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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 179013002: Add WebDocument::clearFocusedElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 if (!m_page) 2505 if (!m_page)
2506 return; 2506 return;
2507 Frame* frame = page()->focusController().focusedOrMainFrame(); 2507 Frame* frame = page()->focusController().focusedOrMainFrame();
2508 if (Document* document = frame->document()) 2508 if (Document* document = frame->document())
2509 document->setFocusedElement(nullptr); 2509 document->setFocusedElement(nullptr);
2510 page()->focusController().setInitialFocus(reverse ? FocusTypeBackward : Focu sTypeForward); 2510 page()->focusController().setInitialFocus(reverse ? FocusTypeBackward : Focu sTypeForward);
2511 } 2511 }
2512 2512
2513 void WebViewImpl::clearFocusedNode() 2513 void WebViewImpl::clearFocusedNode()
2514 { 2514 {
2515 // Deprecated API. Use clearFocusedElement instead.
2516 clearFocusedElement();
2517 }
2518
2519 void WebViewImpl::clearFocusedElement()
2520 {
2515 RefPtr<Frame> frame = focusedWebCoreFrame(); 2521 RefPtr<Frame> frame = focusedWebCoreFrame();
2516 if (!frame) 2522 if (!frame)
2517 return; 2523 return;
2518 2524
2519 RefPtr<Document> document = frame->document(); 2525 RefPtr<Document> document = frame->document();
2520 if (!document) 2526 if (!document)
2521 return; 2527 return;
2522 2528
2523 RefPtr<Element> oldFocusedElement = document->focusedElement(); 2529 RefPtr<Element> oldFocusedElement = document->focusedElement();
2524 2530
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4029 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4024 4030
4025 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4031 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4026 return false; 4032 return false;
4027 4033
4028 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4034 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4029 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4035 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4030 } 4036 }
4031 4037
4032 } // namespace blink 4038 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698