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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 m_granularity = CharacterGranularity; | 1088 m_granularity = CharacterGranularity; |
1089 | 1089 |
1090 setCaretRectNeedsUpdate(); | 1090 setCaretRectNeedsUpdate(); |
1091 | 1091 |
1092 return true; | 1092 return true; |
1093 } | 1093 } |
1094 | 1094 |
1095 // FIXME: Maybe baseline would be better? | 1095 // FIXME: Maybe baseline would be better? |
1096 static bool absoluteCaretY(const VisiblePosition &c, int &y) | 1096 static bool absoluteCaretY(const VisiblePosition &c, int &y) |
1097 { | 1097 { |
1098 IntRect rect = c.absoluteCaretBounds(); | 1098 IntRect rect = absoluteCaretBoundsOf(c); |
1099 if (rect.isEmpty()) | 1099 if (rect.isEmpty()) |
1100 return false; | 1100 return false; |
1101 y = rect.y() + rect.height() / 2; | 1101 y = rect.y() + rect.height() / 2; |
1102 return true; | 1102 return true; |
1103 } | 1103 } |
1104 | 1104 |
1105 bool FrameSelection::modify(EAlteration alter, unsigned verticalDistance, Vertic
alDirection direction, EUserTriggered userTriggered, CursorAlignOnScroll align) | 1105 bool FrameSelection::modify(EAlteration alter, unsigned verticalDistance, Vertic
alDirection direction, EUserTriggered userTriggered, CursorAlignOnScroll align) |
1106 { | 1106 { |
1107 if (!verticalDistance) | 1107 if (!verticalDistance) |
1108 return false; | 1108 return false; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 { | 1854 { |
1855 LayoutRect rect; | 1855 LayoutRect rect; |
1856 | 1856 |
1857 switch (selectionType()) { | 1857 switch (selectionType()) { |
1858 case NoSelection: | 1858 case NoSelection: |
1859 return; | 1859 return; |
1860 case CaretSelection: | 1860 case CaretSelection: |
1861 rect = LayoutRect(absoluteCaretBounds()); | 1861 rect = LayoutRect(absoluteCaretBounds()); |
1862 break; | 1862 break; |
1863 case RangeSelection: | 1863 case RangeSelection: |
1864 rect = LayoutRect(revealExtentOption == RevealExtent ? VisiblePosition(e
xtent()).absoluteCaretBounds() : enclosingIntRect(unclippedBounds())); | 1864 rect = LayoutRect(revealExtentOption == RevealExtent ? absoluteCaretBoun
dsOf(VisiblePosition(extent())) : enclosingIntRect(unclippedBounds())); |
1865 break; | 1865 break; |
1866 } | 1866 } |
1867 | 1867 |
1868 Position start = this->start(); | 1868 Position start = this->start(); |
1869 ASSERT(start.anchorNode()); | 1869 ASSERT(start.anchorNode()); |
1870 if (start.anchorNode() && start.anchorNode()->layoutObject()) { | 1870 if (start.anchorNode() && start.anchorNode()->layoutObject()) { |
1871 // FIXME: This code only handles scrolling the startContainer's layer, b
ut | 1871 // FIXME: This code only handles scrolling the startContainer's layer, b
ut |
1872 // the selection rect could intersect more than just that. | 1872 // the selection rect could intersect more than just that. |
1873 if (DocumentLoader* documentLoader = m_frame->loader().documentLoader()) | 1873 if (DocumentLoader* documentLoader = m_frame->loader().documentLoader()) |
1874 documentLoader->initialScrollState().wasScrolledByUser = true; | 1874 documentLoader->initialScrollState().wasScrolledByUser = true; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2069 |
2070 void showTree(const blink::FrameSelection* sel) | 2070 void showTree(const blink::FrameSelection* sel) |
2071 { | 2071 { |
2072 if (sel) | 2072 if (sel) |
2073 sel->showTreeForThis(); | 2073 sel->showTreeForThis(); |
2074 else | 2074 else |
2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
2076 } | 2076 } |
2077 | 2077 |
2078 #endif | 2078 #endif |
OLD | NEW |