| 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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 AnnotateForInterchange, | 1105 AnnotateForInterchange, |
| 1106 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 1106 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 String FrameSelection::selectedText(TextIteratorBehavior behavior) const { | 1109 String FrameSelection::selectedText(TextIteratorBehavior behavior) const { |
| 1110 return extractSelectedText(*this, behavior); | 1110 return extractSelectedText(*this, behavior); |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 String FrameSelection::selectedTextForClipboard() const { | 1113 String FrameSelection::selectedTextForClipboard() const { |
| 1114 if (m_frame->settings() && | 1114 if (m_frame->settings() && |
| 1115 m_frame->settings()->selectionIncludesAltImageText()) | 1115 m_frame->settings()->getSelectionIncludesAltImageText()) |
| 1116 return extractSelectedText(*this, TextIteratorEmitsImageAltText); | 1116 return extractSelectedText(*this, TextIteratorEmitsImageAltText); |
| 1117 return extractSelectedText(*this, TextIteratorDefaultBehavior); | 1117 return extractSelectedText(*this, TextIteratorDefaultBehavior); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 LayoutRect FrameSelection::bounds() const { | 1120 LayoutRect FrameSelection::bounds() const { |
| 1121 FrameView* view = m_frame->view(); | 1121 FrameView* view = m_frame->view(); |
| 1122 if (!view) | 1122 if (!view) |
| 1123 return LayoutRect(); | 1123 return LayoutRect(); |
| 1124 | 1124 |
| 1125 return intersection(unclippedBounds(), | 1125 return intersection(unclippedBounds(), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 | 1308 |
| 1309 return false; | 1309 return false; |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 GranularityStrategy* FrameSelection::granularityStrategy() { | 1312 GranularityStrategy* FrameSelection::granularityStrategy() { |
| 1313 // We do lazy initalization for m_granularityStrategy, because if we | 1313 // We do lazy initalization for m_granularityStrategy, because if we |
| 1314 // initialize it right in the constructor - the correct settings may not be | 1314 // initialize it right in the constructor - the correct settings may not be |
| 1315 // set yet. | 1315 // set yet. |
| 1316 SelectionStrategy strategyType = SelectionStrategy::Character; | 1316 SelectionStrategy strategyType = SelectionStrategy::Character; |
| 1317 Settings* settings = m_frame ? m_frame->settings() : 0; | 1317 Settings* settings = m_frame ? m_frame->settings() : 0; |
| 1318 if (settings && settings->selectionStrategy() == SelectionStrategy::Direction) | 1318 if (settings && |
| 1319 settings->getSelectionStrategy() == SelectionStrategy::Direction) |
| 1319 strategyType = SelectionStrategy::Direction; | 1320 strategyType = SelectionStrategy::Direction; |
| 1320 | 1321 |
| 1321 if (m_granularityStrategy && m_granularityStrategy->GetType() == strategyType) | 1322 if (m_granularityStrategy && m_granularityStrategy->GetType() == strategyType) |
| 1322 return m_granularityStrategy.get(); | 1323 return m_granularityStrategy.get(); |
| 1323 | 1324 |
| 1324 if (strategyType == SelectionStrategy::Direction) | 1325 if (strategyType == SelectionStrategy::Direction) |
| 1325 m_granularityStrategy = WTF::makeUnique<DirectionGranularityStrategy>(); | 1326 m_granularityStrategy = WTF::makeUnique<DirectionGranularityStrategy>(); |
| 1326 else | 1327 else |
| 1327 m_granularityStrategy = WTF::makeUnique<CharacterGranularityStrategy>(); | 1328 m_granularityStrategy = WTF::makeUnique<CharacterGranularityStrategy>(); |
| 1328 return m_granularityStrategy.get(); | 1329 return m_granularityStrategy.get(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 } | 1405 } |
| 1405 | 1406 |
| 1406 void showTree(const blink::FrameSelection* sel) { | 1407 void showTree(const blink::FrameSelection* sel) { |
| 1407 if (sel) | 1408 if (sel) |
| 1408 sel->showTreeForThis(); | 1409 sel->showTreeForThis(); |
| 1409 else | 1410 else |
| 1410 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; | 1411 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; |
| 1411 } | 1412 } |
| 1412 | 1413 |
| 1413 #endif | 1414 #endif |
| OLD | NEW |