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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "core/page/EditorClient.h" | 71 #include "core/page/EditorClient.h" |
72 #include "core/page/FocusController.h" | 72 #include "core/page/FocusController.h" |
73 #include "core/page/FrameTree.h" | 73 #include "core/page/FrameTree.h" |
74 #include "core/page/Page.h" | 74 #include "core/page/Page.h" |
75 #include "core/page/SpatialNavigation.h" | 75 #include "core/page/SpatialNavigation.h" |
76 #include "core/paint/PaintLayer.h" | 76 #include "core/paint/PaintLayer.h" |
77 #include "platform/SecureTextInput.h" | 77 #include "platform/SecureTextInput.h" |
78 #include "platform/geometry/FloatQuad.h" | 78 #include "platform/geometry/FloatQuad.h" |
79 #include "platform/graphics/GraphicsContext.h" | 79 #include "platform/graphics/GraphicsContext.h" |
80 #include "platform/text/UnicodeUtilities.h" | 80 #include "platform/text/UnicodeUtilities.h" |
| 81 #include "wtf/AutoReset.h" |
81 #include "wtf/PtrUtil.h" | 82 #include "wtf/PtrUtil.h" |
82 #include "wtf/text/CString.h" | 83 #include "wtf/text/CString.h" |
83 #include <stdio.h> | 84 #include <stdio.h> |
84 | 85 |
85 #define EDIT_DEBUG 0 | 86 #define EDIT_DEBUG 0 |
86 | 87 |
87 namespace blink { | 88 namespace blink { |
88 | 89 |
89 using namespace HTMLNames; | 90 using namespace HTMLNames; |
90 | 91 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 updatePostionAfterAdoptingTextNodeSplit(selection().start(), oldNode); | 584 updatePostionAfterAdoptingTextNodeSplit(selection().start(), oldNode); |
584 Position end = | 585 Position end = |
585 updatePostionAfterAdoptingTextNodeSplit(selection().end(), oldNode); | 586 updatePostionAfterAdoptingTextNodeSplit(selection().end(), oldNode); |
586 updateSelectionIfNeeded(base, extent, start, end); | 587 updateSelectionIfNeeded(base, extent, start, end); |
587 } | 588 } |
588 | 589 |
589 void FrameSelection::updateSelectionIfNeeded(const Position& base, | 590 void FrameSelection::updateSelectionIfNeeded(const Position& base, |
590 const Position& extent, | 591 const Position& extent, |
591 const Position& start, | 592 const Position& start, |
592 const Position& end) { | 593 const Position& end) { |
| 594 AutoReset<bool> scope(&m_inUpdateSelectionIfNeeded, true); |
| 595 |
593 if (base == selection().base() && extent == selection().extent() && | 596 if (base == selection().base() && extent == selection().extent() && |
594 start == selection().start() && end == selection().end()) | 597 start == selection().start() && end == selection().end()) |
595 return; | 598 return; |
596 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to | 599 // TODO(yosin): We should move to call |TypingCommand::closeTyping()| to |
597 // |Editor| class. | 600 // |Editor| class. |
598 if (!document().isRunningExecCommand()) | 601 if (!document().isRunningExecCommand()) |
599 TypingCommand::closeTyping(m_frame); | 602 TypingCommand::closeTyping(m_frame); |
600 VisibleSelection newSelection; | 603 VisibleSelection newSelection; |
601 if (selection().isBaseFirst()) | 604 if (selection().isBaseFirst()) |
602 newSelection.setWithoutValidation(start, end); | 605 newSelection.setWithoutValidation(start, end); |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 } | 1408 } |
1406 | 1409 |
1407 void showTree(const blink::FrameSelection* sel) { | 1410 void showTree(const blink::FrameSelection* sel) { |
1408 if (sel) | 1411 if (sel) |
1409 sel->showTreeForThis(); | 1412 sel->showTreeForThis(); |
1410 else | 1413 else |
1411 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1414 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
1412 } | 1415 } |
1413 | 1416 |
1414 #endif | 1417 #endif |
OLD | NEW |