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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 RenderBlock* FrameSelection::caretRenderer() const | 1215 RenderBlock* FrameSelection::caretRenderer() const |
1216 { | 1216 { |
1217 return CaretBase::caretRenderer(m_selection.start().deprecatedNode()); | 1217 return CaretBase::caretRenderer(m_selection.start().deprecatedNode()); |
1218 } | 1218 } |
1219 | 1219 |
1220 static bool isNonOrphanedCaret(const VisibleSelection& selection) | 1220 static bool isNonOrphanedCaret(const VisibleSelection& selection) |
1221 { | 1221 { |
1222 return selection.isCaret() && !selection.start().isOrphan() && !selection.en
d().isOrphan(); | 1222 return selection.isCaret() && !selection.start().isOrphan() && !selection.en
d().isOrphan(); |
1223 } | 1223 } |
1224 | 1224 |
| 1225 static bool isTextFormControl(const VisibleSelection& selection) |
| 1226 { |
| 1227 return enclosingTextFormControl(selection.start()); |
| 1228 } |
| 1229 |
1225 LayoutRect FrameSelection::localCaretRect() | 1230 LayoutRect FrameSelection::localCaretRect() |
1226 { | 1231 { |
1227 if (shouldUpdateCaretRect()) { | 1232 if (shouldUpdateCaretRect()) { |
1228 if (!isNonOrphanedCaret(m_selection)) | 1233 if (!isNonOrphanedCaret(m_selection)) |
1229 clearCaretRect(); | 1234 clearCaretRect(); |
1230 else if (updateCaretRect(m_frame->document(), VisiblePosition(m_selectio
n.start(), m_selection.affinity()))) | 1235 else if (isTextFormControl(m_selection)) |
1231 m_absCaretBoundsDirty = true; | 1236 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Positi
onWithAffinity(m_selection.start().isCandidate() ? m_selection.start() : Positio
n(), m_selection.affinity())); |
| 1237 else |
| 1238 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Visibl
ePosition(m_selection.start(), m_selection.affinity())); |
1232 } | 1239 } |
1233 | 1240 |
1234 return localCaretRectWithoutUpdate(); | 1241 return localCaretRectWithoutUpdate(); |
1235 } | 1242 } |
1236 | 1243 |
1237 IntRect FrameSelection::absoluteCaretBounds() | 1244 IntRect FrameSelection::absoluteCaretBounds() |
1238 { | 1245 { |
1239 recomputeCaretRect(); | 1246 recomputeCaretRect(); |
1240 return m_absCaretBounds; | 1247 return m_absCaretBounds; |
1241 } | 1248 } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 sel.showTreeForThis(); | 1925 sel.showTreeForThis(); |
1919 } | 1926 } |
1920 | 1927 |
1921 void showTree(const blink::FrameSelection* sel) | 1928 void showTree(const blink::FrameSelection* sel) |
1922 { | 1929 { |
1923 if (sel) | 1930 if (sel) |
1924 sel->showTreeForThis(); | 1931 sel->showTreeForThis(); |
1925 } | 1932 } |
1926 | 1933 |
1927 #endif | 1934 #endif |
OLD | NEW |