| OLD | NEW |
| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.g
et()), element); | 701 clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.g
et()), element); |
| 702 | 702 |
| 703 if (oldDocument && oldDocument != newDocument) | 703 if (oldDocument && oldDocument != newDocument) |
| 704 oldDocument->setFocusedElement(nullptr); | 704 oldDocument->setFocusedElement(nullptr); |
| 705 | 705 |
| 706 if (newFocusedFrame && !newFocusedFrame->page()) { | 706 if (newFocusedFrame && !newFocusedFrame->page()) { |
| 707 setFocusedFrame(nullptr); | 707 setFocusedFrame(nullptr); |
| 708 return false; | 708 return false; |
| 709 } | 709 } |
| 710 |
| 711 if (type != FocusTypePage) |
| 712 m_wasFocusedByMouse = type == FocusTypeMouse; |
| 713 |
| 710 setFocusedFrame(newFocusedFrame); | 714 setFocusedFrame(newFocusedFrame); |
| 711 | 715 |
| 712 // Setting the focused node can result in losing our last reft to node when
JS event handlers fire. | 716 // Setting the focused node can result in losing our last reft to node when
JS event handlers fire. |
| 713 RefPtrWillBeRawPtr<Element> protect ALLOW_UNUSED = element; | 717 RefPtrWillBeRawPtr<Element> protect ALLOW_UNUSED = element; |
| 714 if (newDocument) { | 718 if (newDocument) { |
| 715 bool successfullyFocused = newDocument->setFocusedElement(element, type)
; | 719 bool successfullyFocused = newDocument->setFocusedElement(element, type)
; |
| 716 if (!successfullyFocused) | 720 if (!successfullyFocused) |
| 717 return false; | 721 return false; |
| 718 } | 722 } |
| 719 | 723 |
| 720 return true; | 724 return true; |
| 721 } | 725 } |
| 722 | 726 |
| 727 bool FocusController::setWasFocusedByMouse(bool wasFocusedByMouse) |
| 728 { |
| 729 if (m_wasFocusedByMouse != wasFocusedByMouse) { |
| 730 m_wasFocusedByMouse = wasFocusedByMouse; |
| 731 return true; |
| 732 } |
| 733 return false; |
| 734 } |
| 735 |
| 723 void FocusController::setActive(bool active) | 736 void FocusController::setActive(bool active) |
| 724 { | 737 { |
| 725 if (m_isActive == active) | 738 if (m_isActive == active) |
| 726 return; | 739 return; |
| 727 | 740 |
| 728 m_isActive = active; | 741 m_isActive = active; |
| 729 | 742 |
| 730 Frame* frame = focusedOrMainFrame(); | 743 Frame* frame = focusedOrMainFrame(); |
| 731 if (frame->isLocalFrame()) | 744 if (frame->isLocalFrame()) |
| 732 toLocalFrame(frame)->selection().pageActivationChanged(); | 745 toLocalFrame(frame)->selection().pageActivationChanged(); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); | 932 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); |
| 920 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); | 933 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); |
| 921 if (container && container->isDocumentNode()) | 934 if (container && container->isDocumentNode()) |
| 922 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 935 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
| 923 } while (!consumed && container); | 936 } while (!consumed && container); |
| 924 | 937 |
| 925 return consumed; | 938 return consumed; |
| 926 } | 939 } |
| 927 | 940 |
| 928 } // namespace blink | 941 } // namespace blink |
| OLD | NEW |