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