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

Side by Side Diff: sky/engine/core/page/FocusController.cpp

Issue 681553003: Remove a bunch of unused or never-set settings. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « sky/engine/core/page/EventHandler.cpp ('k') | sky/engine/core/rendering/RenderBlock.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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return false; 327 return false;
328 } 328 }
329 329
330 bool FocusController::advanceFocusInDocumentOrder(FocusType type, bool initialFo cus) 330 bool FocusController::advanceFocusInDocumentOrder(FocusType type, bool initialFo cus)
331 { 331 {
332 LocalFrame* frame = focusedOrMainFrame(); 332 LocalFrame* frame = focusedOrMainFrame();
333 ASSERT(frame); 333 ASSERT(frame);
334 Document* document = frame->document(); 334 Document* document = frame->document();
335 335
336 Node* currentNode = document->focusedElement(); 336 Node* currentNode = document->focusedElement();
337 // FIXME: Not quite correct when it comes to focus transitions leaving/enter ing the WebView itself
338 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEn abled();
339
340 if (caretBrowsing && !currentNode)
341 currentNode = frame->selection().start().deprecatedNode();
342 337
343 document->updateLayoutIgnorePendingStylesheets(); 338 document->updateLayoutIgnorePendingStylesheets();
344 339
345 RefPtrWillBeRawPtr<Node> node = findFocusableNodeAcrossFocusScope(type, Focu sNavigationScope::focusNavigationScopeOf(currentNode ? currentNode : document), currentNode); 340 RefPtrWillBeRawPtr<Node> node = findFocusableNodeAcrossFocusScope(type, Focu sNavigationScope::focusNavigationScopeOf(currentNode ? currentNode : document), currentNode);
346 341
347 if (!node) { 342 if (!node) {
348 // We didn't find a node to focus, so we should try to pass focus to Chr ome. 343 // We didn't find a node to focus, so we should try to pass focus to Chr ome.
349 if (!initialFocus && m_page->chrome().canTakeFocus(type)) { 344 if (!initialFocus && m_page->chrome().canTakeFocus(type)) {
350 document->setFocusedElement(nullptr); 345 document->setFocusedElement(nullptr);
351 setFocusedFrame(nullptr); 346 setFocusedFrame(nullptr);
(...skipping 26 matching lines...) Expand all
378 // and HTMLTextAreaElement) do extra work in their focus() methods. 373 // and HTMLTextAreaElement) do extra work in their focus() methods.
379 Document& newDocument = element->document(); 374 Document& newDocument = element->document();
380 375
381 if (&newDocument != document) { 376 if (&newDocument != document) {
382 // Focus is going away from this document, so clear the focused node. 377 // Focus is going away from this document, so clear the focused node.
383 document->setFocusedElement(nullptr); 378 document->setFocusedElement(nullptr);
384 } 379 }
385 380
386 setFocusedFrame(newDocument.frame()); 381 setFocusedFrame(newDocument.frame());
387 382
388 if (caretBrowsing) {
389 Position position = firstPositionInOrBeforeNode(element);
390 VisibleSelection newSelection(position, position, DOWNSTREAM);
391 frame->selection().setSelection(newSelection);
392 }
393
394 element->focus(false, type); 383 element->focus(false, type);
395 return true; 384 return true;
396 } 385 }
397 386
398 Node* FocusController::findFocusableNodeAcrossFocusScope(FocusType type, FocusNa vigationScope scope, Node* currentNode) 387 Node* FocusController::findFocusableNodeAcrossFocusScope(FocusType type, FocusNa vigationScope scope, Node* currentNode)
399 { 388 {
400 ASSERT(!currentNode || !isNonFocusableShadowHost(currentNode)); 389 ASSERT(!currentNode || !isNonFocusableShadowHost(currentNode));
401 Node* found; 390 Node* found;
402 if (currentNode && type == FocusTypeForward && isKeyboardFocusableShadowHost (currentNode)) { 391 if (currentNode && type == FocusTypeForward && isKeyboardFocusableShadowHost (currentNode)) {
403 Node* foundInInnerFocusScope = findFocusableNodeRecursively(type, FocusN avigationScope::ownedByShadowHost(currentNode), 0); 392 Node* foundInInnerFocusScope = findFocusableNodeRecursively(type, FocusN avigationScope::ownedByShadowHost(currentNode), 0);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 { 604 {
616 if (m_isActive == active) 605 if (m_isActive == active)
617 return; 606 return;
618 607
619 m_isActive = active; 608 m_isActive = active;
620 609
621 focusedOrMainFrame()->selection().pageActivationChanged(); 610 focusedOrMainFrame()->selection().pageActivationChanged();
622 } 611 }
623 612
624 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/page/EventHandler.cpp ('k') | sky/engine/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698