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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 #include "core/rendering/HitTestResult.h" | 65 #include "core/rendering/HitTestResult.h" |
| 66 #include "core/rendering/InlineTextBox.h" | 66 #include "core/rendering/InlineTextBox.h" |
| 67 #include "core/rendering/RenderLayer.h" | 67 #include "core/rendering/RenderLayer.h" |
| 68 #include "core/rendering/RenderPart.h" | 68 #include "core/rendering/RenderPart.h" |
| 69 #include "core/rendering/RenderText.h" | 69 #include "core/rendering/RenderText.h" |
| 70 #include "core/rendering/RenderTheme.h" | 70 #include "core/rendering/RenderTheme.h" |
| 71 #include "core/rendering/RenderView.h" | 71 #include "core/rendering/RenderView.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 "wtf/text/CString.h" | 76 #include "wtf/text/CString.h" |
| 76 #include <stdio.h> | 77 #include <stdio.h> |
| 77 | 78 |
| 78 #define EDIT_DEBUG 0 | 79 #define EDIT_DEBUG 0 |
| 79 | 80 |
| 80 namespace blink { | 81 namespace blink { |
| 81 | 82 |
| 82 using namespace HTMLNames; | 83 using namespace HTMLNames; |
| 83 | 84 |
| 84 static inline LayoutUnit NoXPosForVerticalArrowNavigation() | 85 static inline LayoutUnit NoXPosForVerticalArrowNavigation() |
| (...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1923 } | 1924 } |
| 1924 | 1925 |
| 1925 void FrameSelection::scheduleVisualUpdate() const | 1926 void FrameSelection::scheduleVisualUpdate() const |
| 1926 { | 1927 { |
| 1927 if (!m_frame) | 1928 if (!m_frame) |
| 1928 return; | 1929 return; |
| 1929 if (Page* page = m_frame->page()) | 1930 if (Page* page = m_frame->page()) |
| 1930 page->animator().scheduleVisualUpdate(); | 1931 page->animator().scheduleVisualUpdate(); |
| 1931 } | 1932 } |
| 1932 | 1933 |
| 1934 void FrameSelection::selectWordAroundPosition(const VisiblePosition& position) | |
|
yosin_UTC9
2014/10/28 06:11:46
Can we use |Position| rather than |VisiblePosition
yoichio
2014/10/28 08:28:04
No, characterAfter and Before are VisiblePosition
| |
| 1935 { | |
| 1936 // If you have a "foo| ", Selection::expandUsingGranularity selects space | |
| 1937 // after the caret. To select "foo", move |position| to previous. | |
| 1938 if (isSeparator(position.characterAfter()) && !isSeparator(position.characte rBefore())) { | |
|
yosin_UTC9
2014/10/28 06:11:46
How about this case "foo |,"?
yoichio
2014/10/28 08:28:04
To search far characters are too aggressive, I thi
| |
| 1939 selectWordAroundPosition(position.previous()); | |
| 1940 return; | |
| 1941 } | |
| 1942 | |
| 1943 VisibleSelection selection(position); | |
| 1944 selection.expandUsingGranularity(WordGranularity); | |
| 1945 String text = plainText(selection.start(), selection.end()); | |
|
yosin_UTC9
2014/10/28 06:11:46
Should we check |isSeparator(c)| for character in
yoichio
2014/10/28 08:28:04
Done.
| |
| 1946 if (text.isEmpty()) | |
| 1947 return; | |
| 1948 | |
| 1949 setSelection(selection); | |
|
yosin_UTC9
2014/10/28 06:11:46
Should we pass |WordGranuaryity| to |setSelection(
yoichio
2014/10/28 08:28:04
Done.
| |
| 1950 } | |
| 1951 | |
| 1933 } | 1952 } |
| 1934 | 1953 |
| 1935 #ifndef NDEBUG | 1954 #ifndef NDEBUG |
| 1936 | 1955 |
| 1937 void showTree(const blink::FrameSelection& sel) | 1956 void showTree(const blink::FrameSelection& sel) |
| 1938 { | 1957 { |
| 1939 sel.showTreeForThis(); | 1958 sel.showTreeForThis(); |
| 1940 } | 1959 } |
| 1941 | 1960 |
| 1942 void showTree(const blink::FrameSelection* sel) | 1961 void showTree(const blink::FrameSelection* sel) |
| 1943 { | 1962 { |
| 1944 if (sel) | 1963 if (sel) |
| 1945 sel->showTreeForThis(); | 1964 sel->showTreeForThis(); |
| 1946 } | 1965 } |
| 1947 | 1966 |
| 1948 #endif | 1967 #endif |
| OLD | NEW |