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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "core/frame/Settings.h" | 52 #include "core/frame/Settings.h" |
53 #include "core/html/HTMLBodyElement.h" | 53 #include "core/html/HTMLBodyElement.h" |
54 #include "core/html/HTMLFormElement.h" | 54 #include "core/html/HTMLFormElement.h" |
55 #include "core/html/HTMLFrameElementBase.h" | 55 #include "core/html/HTMLFrameElementBase.h" |
56 #include "core/html/HTMLInputElement.h" | 56 #include "core/html/HTMLInputElement.h" |
57 #include "core/html/HTMLSelectElement.h" | 57 #include "core/html/HTMLSelectElement.h" |
58 #include "core/layout/HitTestRequest.h" | 58 #include "core/layout/HitTestRequest.h" |
59 #include "core/layout/HitTestResult.h" | 59 #include "core/layout/HitTestResult.h" |
60 #include "core/layout/Layer.h" | 60 #include "core/layout/Layer.h" |
61 #include "core/layout/LayoutPart.h" | 61 #include "core/layout/LayoutPart.h" |
| 62 #include "core/layout/LayoutText.h" |
62 #include "core/layout/LayoutTheme.h" | 63 #include "core/layout/LayoutTheme.h" |
63 #include "core/layout/LayoutView.h" | 64 #include "core/layout/LayoutView.h" |
64 #include "core/layout/line/InlineTextBox.h" | 65 #include "core/layout/line/InlineTextBox.h" |
65 #include "core/page/EditorClient.h" | 66 #include "core/page/EditorClient.h" |
66 #include "core/page/EventHandler.h" | 67 #include "core/page/EventHandler.h" |
67 #include "core/page/FocusController.h" | 68 #include "core/page/FocusController.h" |
68 #include "core/page/FrameTree.h" | 69 #include "core/page/FrameTree.h" |
69 #include "core/page/Page.h" | 70 #include "core/page/Page.h" |
70 #include "core/page/SpatialNavigation.h" | 71 #include "core/page/SpatialNavigation.h" |
71 #include "core/rendering/RenderText.h" | |
72 #include "platform/SecureTextInput.h" | 72 #include "platform/SecureTextInput.h" |
73 #include "platform/geometry/FloatQuad.h" | 73 #include "platform/geometry/FloatQuad.h" |
74 #include "platform/graphics/GraphicsContext.h" | 74 #include "platform/graphics/GraphicsContext.h" |
75 #include "platform/text/UnicodeUtilities.h" | 75 #include "platform/text/UnicodeUtilities.h" |
76 #include "wtf/text/CString.h" | 76 #include "wtf/text/CString.h" |
77 #include <stdio.h> | 77 #include <stdio.h> |
78 | 78 |
79 #define EDIT_DEBUG 0 | 79 #define EDIT_DEBUG 0 |
80 | 80 |
81 namespace blink { | 81 namespace blink { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // Replacing text can be viewed as a deletion followed by insertion. | 387 // Replacing text can be viewed as a deletion followed by insertion. |
388 if (positionOffset >= offset && positionOffset <= offset + oldLength) | 388 if (positionOffset >= offset && positionOffset <= offset + oldLength) |
389 positionOffset = offset; | 389 positionOffset = offset; |
390 | 390 |
391 // Adjust the offset if the position is after the end of the deleted content
s | 391 // Adjust the offset if the position is after the end of the deleted content
s |
392 // (positionOffset > offset + oldLength) to avoid having a stale offset. | 392 // (positionOffset > offset + oldLength) to avoid having a stale offset. |
393 if (positionOffset > offset + oldLength) | 393 if (positionOffset > offset + oldLength) |
394 positionOffset = positionOffset - oldLength + newLength; | 394 positionOffset = positionOffset - oldLength + newLength; |
395 | 395 |
396 // Due to case folding (http://unicode.org/Public/UCD/latest/ucd/CaseFolding
.txt), | 396 // Due to case folding (http://unicode.org/Public/UCD/latest/ucd/CaseFolding
.txt), |
397 // RenderText length may be different from Text length. A correct implement
ation | 397 // LayoutText length may be different from Text length. A correct implement
ation |
398 // would translate the RenderText offset to a Text offset; this is just a sa
fety | 398 // would translate the LayoutText offset to a Text offset; this is just a sa
fety |
399 // precaution to avoid offset values that run off the end of the Text. | 399 // precaution to avoid offset values that run off the end of the Text. |
400 if (positionOffset > node->length()) | 400 if (positionOffset > node->length()) |
401 positionOffset = node->length(); | 401 positionOffset = node->length(); |
402 | 402 |
403 // CharacterNode in VisibleSelection must be Text node, because Comment | 403 // CharacterNode in VisibleSelection must be Text node, because Comment |
404 // and ProcessingInstruction node aren't visible. | 404 // and ProcessingInstruction node aren't visible. |
405 return Position(toText(node), positionOffset); | 405 return Position(toText(node), positionOffset); |
406 } | 406 } |
407 | 407 |
408 void FrameSelection::didUpdateCharacterData(CharacterData* node, unsigned offset
, unsigned oldLength, unsigned newLength) | 408 void FrameSelection::didUpdateCharacterData(CharacterData* node, unsigned offset
, unsigned oldLength, unsigned newLength) |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 sel.showTreeForThis(); | 1944 sel.showTreeForThis(); |
1945 } | 1945 } |
1946 | 1946 |
1947 void showTree(const blink::FrameSelection* sel) | 1947 void showTree(const blink::FrameSelection* sel) |
1948 { | 1948 { |
1949 if (sel) | 1949 if (sel) |
1950 sel->showTreeForThis(); | 1950 sel->showTreeForThis(); |
1951 } | 1951 } |
1952 | 1952 |
1953 #endif | 1953 #endif |
OLD | NEW |