| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 return; | 658 return; |
| 659 | 659 |
| 660 bool caretBrowsing = oldFocusedFrame->settings()->caretBrowsingEnabled(); | 660 bool caretBrowsing = oldFocusedFrame->settings()->caretBrowsingEnabled(); |
| 661 if (caretBrowsing) | 661 if (caretBrowsing) |
| 662 return; | 662 return; |
| 663 | 663 |
| 664 Node* selectionStartNode = selection.selection().start().deprecatedNode(); | 664 Node* selectionStartNode = selection.selection().start().deprecatedNode(); |
| 665 if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendant
Of(newFocusedNode)) | 665 if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendant
Of(newFocusedNode)) |
| 666 return; | 666 return; |
| 667 | 667 |
| 668 if (!enclosingTextFormControl(selectionStartNode)) |
| 669 return; |
| 670 |
| 668 if (selectionStartNode->isInShadowTree() && selectionStartNode->shadowHost()
== newFocusedNode) | 671 if (selectionStartNode->isInShadowTree() && selectionStartNode->shadowHost()
== newFocusedNode) |
| 669 return; | 672 return; |
| 670 | 673 |
| 671 if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode())
{ | |
| 672 if (mousePressNode->renderer() && !mousePressNode->canStartSelection())
{ | |
| 673 // Don't clear the selection for contentEditable elements, but do | |
| 674 // clear it for input and textarea. See bug 38696. | |
| 675 if (!enclosingTextFormControl(selection.start())) | |
| 676 return; | |
| 677 } | |
| 678 } | |
| 679 | |
| 680 selection.clear(); | 674 selection.clear(); |
| 681 } | 675 } |
| 682 | 676 |
| 683 bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
ocusedFrame, FocusType type) | 677 bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF
ocusedFrame, FocusType type) |
| 684 { | 678 { |
| 685 RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame()); | 679 RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame()); |
| 686 RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame
->document() : 0; | 680 RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame
->document() : 0; |
| 687 | 681 |
| 688 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0
; | 682 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0
; |
| 689 if (element && oldFocusedElement == element) | 683 if (element && oldFocusedElement == element) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); | 919 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); |
| 926 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); | 920 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); |
| 927 if (container && container->isDocumentNode()) | 921 if (container && container->isDocumentNode()) |
| 928 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 922 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
| 929 } while (!consumed && container); | 923 } while (!consumed && container); |
| 930 | 924 |
| 931 return consumed; | 925 return consumed; |
| 932 } | 926 } |
| 933 | 927 |
| 934 } // namespace blink | 928 } // namespace blink |
| OLD | NEW |