OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
10 * | 10 * |
(...skipping 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 // When focusing an editable element in an iframe, don't reset the selection | 2628 // When focusing an editable element in an iframe, don't reset the selection |
2629 // if it already contains a selection. | 2629 // if it already contains a selection. |
2630 if (this == frame->selection().rootEditableElement()) | 2630 if (this == frame->selection().rootEditableElement()) |
2631 return; | 2631 return; |
2632 | 2632 |
2633 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 2633 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
2634 // needs to be audited. See http://crbug.com/590369 for more details. | 2634 // needs to be audited. See http://crbug.com/590369 for more details. |
2635 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 2635 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
2636 | 2636 |
2637 // FIXME: We should restore the previous selection if there is one. | 2637 // FIXME: We should restore the previous selection if there is one. |
2638 VisibleSelection newSelection = createVisibleSelection( | |
2639 firstPositionInOrBeforeNode(this), TextAffinity::Downstream); | |
2640 // Passing DoNotSetFocus as this function is called after | 2638 // Passing DoNotSetFocus as this function is called after |
2641 // FocusController::setFocusedElement() and we don't want to change the | 2639 // FocusController::setFocusedElement() and we don't want to change the |
2642 // focus to a new Element. | 2640 // focus to a new Element. |
2643 frame->selection().setSelection(newSelection, | 2641 frame->selection().setSelection( |
2644 FrameSelection::CloseTyping | | 2642 SelectionInDOMTree::Builder() |
2645 FrameSelection::ClearTypingStyle | | 2643 .collapse(firstPositionInOrBeforeNode(this)) |
2646 FrameSelection::DoNotSetFocus); | 2644 .build(), |
| 2645 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | |
| 2646 FrameSelection::DoNotSetFocus); |
2647 frame->selection().revealSelection(); | 2647 frame->selection().revealSelection(); |
2648 } else if (layoutObject() && !layoutObject()->isLayoutPart()) { | 2648 } else if (layoutObject() && !layoutObject()->isLayoutPart()) { |
2649 layoutObject()->scrollRectToVisible(boundingBox()); | 2649 layoutObject()->scrollRectToVisible(boundingBox()); |
2650 } | 2650 } |
2651 } | 2651 } |
2652 | 2652 |
2653 void Element::blur() { | 2653 void Element::blur() { |
2654 cancelFocusAppearanceUpdate(); | 2654 cancelFocusAppearanceUpdate(); |
2655 if (adjustedFocusedElementInTreeScope() == this) { | 2655 if (adjustedFocusedElementInTreeScope() == this) { |
2656 Document& doc = document(); | 2656 Document& doc = document(); |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4076 } | 4076 } |
4077 | 4077 |
4078 DEFINE_TRACE_WRAPPERS(Element) { | 4078 DEFINE_TRACE_WRAPPERS(Element) { |
4079 if (hasRareData()) { | 4079 if (hasRareData()) { |
4080 visitor->traceWrappers(elementRareData()); | 4080 visitor->traceWrappers(elementRareData()); |
4081 } | 4081 } |
4082 ContainerNode::traceWrappers(visitor); | 4082 ContainerNode::traceWrappers(visitor); |
4083 } | 4083 } |
4084 | 4084 |
4085 } // namespace blink | 4085 } // namespace blink |
OLD | NEW |