OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 if (selectionDidNotChangeDOMPosition) | 1079 if (selectionDidNotChangeDOMPosition) |
1080 client().respondToChangedSelection(m_frame, frame().selection().selectio
nType()); | 1080 client().respondToChangedSelection(m_frame, frame().selection().selectio
nType()); |
1081 } | 1081 } |
1082 | 1082 |
1083 IntRect Editor::firstRectForRange(const EphemeralRange& range) const | 1083 IntRect Editor::firstRectForRange(const EphemeralRange& range) const |
1084 { | 1084 { |
1085 LayoutUnit extraWidthToEndOfLine = 0; | 1085 LayoutUnit extraWidthToEndOfLine = 0; |
1086 ASSERT(range.isNotNull()); | 1086 ASSERT(range.isNotNull()); |
1087 | 1087 |
1088 IntRect startCaretRect = RenderedPosition(VisiblePosition(range.startPositio
n()).deepEquivalent(), TextAffinity::Downstream).absoluteRect(&extraWidthToEndOf
Line); | 1088 IntRect startCaretRect = RenderedPosition(VisiblePosition(range.startPositio
n()).deepEquivalent(), TextAffinity::Downstream).absoluteRect(&extraWidthToEndOf
Line); |
1089 if (startCaretRect == LayoutRect()) | 1089 if (startCaretRect.isEmpty()) |
1090 return IntRect(); | 1090 return IntRect(); |
1091 | 1091 |
1092 IntRect endCaretRect = RenderedPosition(VisiblePosition(range.endPosition())
.deepEquivalent(), TextAffinity::Upstream).absoluteRect(); | 1092 IntRect endCaretRect = RenderedPosition(VisiblePosition(range.endPosition())
.deepEquivalent(), TextAffinity::Upstream).absoluteRect(); |
1093 if (endCaretRect == LayoutRect()) | 1093 if (endCaretRect.isEmpty()) |
1094 return IntRect(); | 1094 return IntRect(); |
1095 | 1095 |
1096 if (startCaretRect.y() == endCaretRect.y()) { | 1096 if (startCaretRect.y() == endCaretRect.y()) { |
1097 // start and end are on the same line | 1097 // start and end are on the same line |
1098 return IntRect(std::min(startCaretRect.x(), endCaretRect.x()), | 1098 return IntRect(std::min(startCaretRect.x(), endCaretRect.x()), |
1099 startCaretRect.y(), | 1099 startCaretRect.y(), |
1100 abs(endCaretRect.x() - startCaretRect.x()), | 1100 abs(endCaretRect.x() - startCaretRect.x()), |
1101 std::max(startCaretRect.height(), endCaretRect.height())); | 1101 std::max(startCaretRect.height(), endCaretRect.height())); |
1102 } | 1102 } |
1103 | 1103 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 } | 1301 } |
1302 | 1302 |
1303 DEFINE_TRACE(Editor) | 1303 DEFINE_TRACE(Editor) |
1304 { | 1304 { |
1305 visitor->trace(m_frame); | 1305 visitor->trace(m_frame); |
1306 visitor->trace(m_lastEditCommand); | 1306 visitor->trace(m_lastEditCommand); |
1307 visitor->trace(m_mark); | 1307 visitor->trace(m_mark); |
1308 } | 1308 } |
1309 | 1309 |
1310 } // namespace blink | 1310 } // namespace blink |
OLD | NEW |