| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/CharacterData.h" | 34 #include "core/dom/CharacterData.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
| 37 #include "core/dom/ElementTraversal.h" | 37 #include "core/dom/ElementTraversal.h" |
| 38 #include "core/dom/NodeTraversal.h" | 38 #include "core/dom/NodeTraversal.h" |
| 39 #include "core/dom/Text.h" | 39 #include "core/dom/Text.h" |
| 40 #include "core/editing/Editor.h" | 40 #include "core/editing/Editor.h" |
| 41 #include "core/editing/GranularityStrategy.h" | 41 #include "core/editing/GranularityStrategy.h" |
| 42 #include "core/editing/InputMethodController.h" | 42 #include "core/editing/InputMethodController.h" |
| 43 #include "core/editing/RenderedPosition.h" | 43 #include "core/editing/RenderedPosition.h" |
| 44 #include "core/editing/SelectionController.h" |
| 44 #include "core/editing/SpellChecker.h" | 45 #include "core/editing/SpellChecker.h" |
| 45 #include "core/editing/TypingCommand.h" | 46 #include "core/editing/TypingCommand.h" |
| 46 #include "core/editing/VisibleUnits.h" | 47 #include "core/editing/VisibleUnits.h" |
| 47 #include "core/editing/htmlediting.h" | 48 #include "core/editing/htmlediting.h" |
| 48 #include "core/editing/iterators/TextIterator.h" | 49 #include "core/editing/iterators/TextIterator.h" |
| 49 #include "core/editing/markup.h" | 50 #include "core/editing/markup.h" |
| 50 #include "core/events/Event.h" | 51 #include "core/events/Event.h" |
| 51 #include "core/frame/FrameView.h" | 52 #include "core/frame/FrameView.h" |
| 52 #include "core/frame/LocalDOMWindow.h" | 53 #include "core/frame/LocalDOMWindow.h" |
| 53 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale
d()) | 321 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale
d()) |
| 321 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; | 322 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; |
| 322 else | 323 else |
| 323 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; | 324 alignment = (align == AlignCursorOnScrollAlways) ? ScrollAlignment::
alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; |
| 324 | 325 |
| 325 revealSelection(alignment, RevealExtent); | 326 revealSelection(alignment, RevealExtent); |
| 326 } | 327 } |
| 327 | 328 |
| 328 notifyAccessibilityForSelectionChange(); | 329 notifyAccessibilityForSelectionChange(); |
| 329 notifyCompositorForSelectionChange(); | 330 notifyCompositorForSelectionChange(); |
| 331 notifyEventHandlerForSelectionChange(); |
| 330 m_frame->localDOMWindow()->enqueueDocumentEvent(Event::create(EventTypeNames
::selectionchange)); | 332 m_frame->localDOMWindow()->enqueueDocumentEvent(Event::create(EventTypeNames
::selectionchange)); |
| 331 } | 333 } |
| 332 | 334 |
| 333 static bool removingNodeRemovesPosition(Node& node, const Position& position) | 335 static bool removingNodeRemovesPosition(Node& node, const Position& position) |
| 334 { | 336 { |
| 335 if (!position.anchorNode()) | 337 if (!position.anchorNode()) |
| 336 return false; | 338 return false; |
| 337 | 339 |
| 338 if (position.anchorNode() == node) | 340 if (position.anchorNode() == node) |
| 339 return true; | 341 return true; |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 } | 1500 } |
| 1499 | 1501 |
| 1500 void FrameSelection::notifyCompositorForSelectionChange() | 1502 void FrameSelection::notifyCompositorForSelectionChange() |
| 1501 { | 1503 { |
| 1502 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1504 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
| 1503 return; | 1505 return; |
| 1504 | 1506 |
| 1505 scheduleVisualUpdate(); | 1507 scheduleVisualUpdate(); |
| 1506 } | 1508 } |
| 1507 | 1509 |
| 1510 void FrameSelection::notifyEventHandlerForSelectionChange() |
| 1511 { |
| 1512 m_frame->eventHandler().selectionController().notifySelectionChanged(); |
| 1513 } |
| 1514 |
| 1508 void FrameSelection::focusedOrActiveStateChanged() | 1515 void FrameSelection::focusedOrActiveStateChanged() |
| 1509 { | 1516 { |
| 1510 bool activeAndFocused = isFocusedAndActive(); | 1517 bool activeAndFocused = isFocusedAndActive(); |
| 1511 | 1518 |
| 1512 RefPtrWillBeRawPtr<Document> document = m_frame->document(); | 1519 RefPtrWillBeRawPtr<Document> document = m_frame->document(); |
| 1513 document->updateLayoutTreeIfNeeded(); | 1520 document->updateLayoutTreeIfNeeded(); |
| 1514 | 1521 |
| 1515 // Because LayoutObject::selectionBackgroundColor() and | 1522 // Because LayoutObject::selectionBackgroundColor() and |
| 1516 // LayoutObject::selectionForegroundColor() check if the frame is active, | 1523 // LayoutObject::selectionForegroundColor() check if the frame is active, |
| 1517 // we have to update places those colors were painted. | 1524 // we have to update places those colors were painted. |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 | 2047 |
| 2041 void showTree(const blink::FrameSelection* sel) | 2048 void showTree(const blink::FrameSelection* sel) |
| 2042 { | 2049 { |
| 2043 if (sel) | 2050 if (sel) |
| 2044 sel->showTreeForThis(); | 2051 sel->showTreeForThis(); |
| 2045 else | 2052 else |
| 2046 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2053 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
| 2047 } | 2054 } |
| 2048 | 2055 |
| 2049 #endif | 2056 #endif |
| OLD | NEW |