Chromium Code Reviews| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 | 670 |
| 671 if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode()) { | 671 if (Node* mousePressNode = newFocusedFrame->eventHandler().mousePressNode()) { |
| 672 if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) { | 672 if (mousePressNode->renderer() && !mousePressNode->canStartSelection()) { |
| 673 // Don't clear the selection for contentEditable elements, but do | 673 // Don't clear the selection for contentEditable elements, but do |
| 674 // clear it for input and textarea. See bug 38696. | 674 // clear it for input and textarea. See bug 38696. |
| 675 if (!enclosingTextFormControl(selection.start())) | 675 if (!enclosingTextFormControl(selection.start())) |
| 676 return; | 676 return; |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 selection.clear(); | 680 if (newFocusedNode && (newFocusedNode->hasEditableStyle() |
|
leviw_travelin_and_unemployed
2014/07/29 19:56:40
Is it actually possible for newFocusedNode to be n
yosin_UTC9
2014/07/30 00:48:07
Yes. EventHandler::handleMouseFocus() calls Focus
leviw_travelin_and_unemployed
2014/07/30 19:19:19
I know we can have no newFocusedNode, I'm just not
| |
| 681 || (newFocusedNode->isElementNode() && isHTMLTextFormControlElement(toEl ement(newFocusedNode))))) { | |
| 682 selection.clear(); | |
| 683 return; | |
| 684 } | |
| 681 } | 685 } |
| 682 | 686 |
| 683 bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF ocusedFrame, FocusType type) | 687 bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newF ocusedFrame, FocusType type) |
| 684 { | 688 { |
| 685 RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame()); | 689 RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame()); |
| 686 RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame ->document() : 0; | 690 RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame ->document() : 0; |
| 687 | 691 |
| 688 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0 ; | 692 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0 ; |
| 689 if (element && oldFocusedElement == element) | 693 if (element && oldFocusedElement == element) |
| 690 return true; | 694 return true; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); | 934 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); |
| 931 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); | 935 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); |
| 932 if (container && container->isDocumentNode()) | 936 if (container && container->isDocumentNode()) |
| 933 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 937 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
| 934 } while (!consumed && container); | 938 } while (!consumed && container); |
| 935 | 939 |
| 936 return consumed; | 940 return consumed; |
| 937 } | 941 } |
| 938 | 942 |
| 939 } // namespace blink | 943 } // namespace blink |
| OLD | NEW |