Chromium Code Reviews| 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()); | |
|
yosin_UTC9
2014/07/29 07:00:20
nit: I don't think we need to use |!!| for casting
yoichio
2014/07/29 08:05:17
Done.
| |
| 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 { |
| 1231 m_absCaretBoundsDirty = true; | 1236 if (isTextFormControl(m_selection)) |
|
yosin_UTC9
2014/07/29 07:00:20
nit: We can combine |else| and |if|.
yoichio
2014/07/29 08:05:17
Done.
| |
| 1237 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Po sitionWithAffinity(m_selection.start().isCandidate() ? m_selection.start() : Pos ition(), m_selection.affinity())); | |
|
yosin_UTC9
2014/07/29 07:00:20
Q: Why do we need to check |start()| is editable p
yoichio
2014/07/29 08:05:17
updateCaretRect suppose that an argument Visible p
| |
| 1238 else | |
| 1239 m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), Vi siblePosition(m_selection.start(), m_selection.affinity())); | |
| 1240 } | |
| 1232 } | 1241 } |
| 1233 | 1242 |
| 1234 return localCaretRectWithoutUpdate(); | 1243 return localCaretRectWithoutUpdate(); |
| 1235 } | 1244 } |
| 1236 | 1245 |
| 1237 IntRect FrameSelection::absoluteCaretBounds() | 1246 IntRect FrameSelection::absoluteCaretBounds() |
| 1238 { | 1247 { |
| 1239 recomputeCaretRect(); | 1248 recomputeCaretRect(); |
| 1240 return m_absCaretBounds; | 1249 return m_absCaretBounds; |
| 1241 } | 1250 } |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1918 sel.showTreeForThis(); | 1927 sel.showTreeForThis(); |
| 1919 } | 1928 } |
| 1920 | 1929 |
| 1921 void showTree(const blink::FrameSelection* sel) | 1930 void showTree(const blink::FrameSelection* sel) |
| 1922 { | 1931 { |
| 1923 if (sel) | 1932 if (sel) |
| 1924 sel->showTreeForThis(); | 1933 sel->showTreeForThis(); |
| 1925 } | 1934 } |
| 1926 | 1935 |
| 1927 #endif | 1936 #endif |
| OLD | NEW |