|
Lines 250-260
void FrameSelection::setSelectionByMouseIfDifferent(const VisibleSelection& pass
a/Source/WebCore/editing/FrameSelection.cpp_sec1
|
| 250 |
setSelection(newSelection, UserTriggered | DoNotRevealSelection | CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity); |
250 |
setSelection(newSelection, UserTriggered | DoNotRevealSelection | CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity); |
| 251 |
} |
251 |
} |
| 252 |
|
252 |
|
| 253 |
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity) |
253 |
bool FrameSelection::setSelectionWithoutUpdatingAppearance(const VisibleSelection& newSelection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity, EUserTriggered userTriggered) |
| 254 |
{ |
254 |
{ |
| 255 |
bool closeTyping = options & CloseTyping; |
255 |
bool closeTyping = options & CloseTyping; |
| 256 |
bool shouldClearTypingStyle = options & ClearTypingStyle; |
256 |
bool shouldClearTypingStyle = options & ClearTypingStyle; |
| 257 |
EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); |
|
|
| 258 |
|
257 |
|
| 259 |
VisibleSelection s = newSelection; |
258 |
VisibleSelection s = newSelection; |
| 260 |
if (shouldAlwaysUseDirectionalSelection(m_frame)) |
259 |
if (shouldAlwaysUseDirectionalSelection(m_frame)) |
|
Lines 262-268
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
a/Source/WebCore/editing/FrameSelection.cpp_sec2
|
| 262 |
|
261 |
|
| 263 |
if (!m_frame) { |
262 |
if (!m_frame) { |
| 264 |
m_selection = s; |
263 |
m_selection = s; |
| 265 |
return; |
264 |
return false; |
| 266 |
} |
265 |
} |
| 267 |
|
266 |
|
| 268 |
// <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at FrameSelection::setSelection |
267 |
// <http://bugs.webkit.org/show_bug.cgi?id=23464>: Infinite recursion at FrameSelection::setSelection |
|
Lines 277-283
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
a/Source/WebCore/editing/FrameSelection.cpp_sec3
|
| 277 |
// the frame is about to be destroyed. If this is the case, clear our selection. |
276 |
// the frame is about to be destroyed. If this is the case, clear our selection. |
| 278 |
if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) |
277 |
if (guard->hasOneRef() && !m_selection.isNonOrphanedCaretOrRange()) |
| 279 |
clear(); |
278 |
clear(); |
| 280 |
return; |
279 |
return false; |
| 281 |
} |
280 |
} |
| 282 |
} |
281 |
} |
| 283 |
|
282 |
|
|
Lines 296-302
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
a/Source/WebCore/editing/FrameSelection.cpp_sec4
|
| 296 |
if (m_selection == s) { |
295 |
if (m_selection == s) { |
| 297 |
// Even if selection was not changed, selection offsets may have been changed. |
296 |
// Even if selection was not changed, selection offsets may have been changed. |
| 298 |
updateSelectionCachesIfSelectionIsInsideTextFormControl(userTriggered); |
297 |
updateSelectionCachesIfSelectionIsInsideTextFormControl(userTriggered); |
| 299 |
return; |
298 |
return false; |
| 300 |
} |
299 |
} |
| 301 |
|
300 |
|
| 302 |
VisibleSelection oldSelection = m_selection; |
301 |
VisibleSelection oldSelection = m_selection; |
|
Lines 307-327
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
a/Source/WebCore/editing/FrameSelection.cpp_sec5
|
| 307 |
if (!s.isNone() && !(options & DoNotSetFocus)) |
306 |
if (!s.isNone() && !(options & DoNotSetFocus)) |
| 308 |
setFocusedElementIfNeeded(); |
307 |
setFocusedElementIfNeeded(); |
| 309 |
|
308 |
|
| 310 |
if (!(options & DoNotUpdateAppearance)) { |
|
|
| 311 |
#if ENABLE(TEXT_CARET) |
| 312 |
m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 313 |
#else |
| 314 |
m_frame->document()->updateStyleIfNeeded(); |
| 315 |
#endif |
| 316 |
updateAppearance(); |
| 317 |
} |
| 318 |
|
| 319 |
// Always clear the x position used for vertical arrow navigation. |
309 |
// Always clear the x position used for vertical arrow navigation. |
| 320 |
// It will be restored by the vertical arrow navigation code if necessary. |
310 |
// It will be restored by the vertical arrow navigation code if necessary. |
| 321 |
m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); |
311 |
m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); |
| 322 |
selectFrameElementInParentIfFullySelected(); |
312 |
selectFrameElementInParentIfFullySelected(); |
| 323 |
updateSelectionCachesIfSelectionIsInsideTextFormControl(userTriggered); |
313 |
updateSelectionCachesIfSelectionIsInsideTextFormControl(userTriggered); |
| 324 |
m_frame->editor().respondToChangedSelection(oldSelection, options); |
314 |
m_frame->editor().respondToChangedSelection(oldSelection, options); |
|
|
315 |
m_frame->document()->enqueueDocumentEvent(Event::create(eventNames().selectionchangeEvent, false, false)); |
| 316 |
|
| 317 |
return true; |
| 318 |
} |
| 319 |
|
| 320 |
void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity) |
| 321 |
{ |
| 322 |
EUserTriggered userTriggered = selectionOptionsToUserTriggered(options); |
| 323 |
if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity, userTriggered)) |
| 324 |
return; |
| 325 |
|
| 326 |
#if ENABLE(TEXT_CARET) |
| 327 |
m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 328 |
#else |
| 329 |
m_frame->document()->updateStyleIfNeeded(); |
| 330 |
#endif |
| 331 |
updateAppearance(); |
| 332 |
|
| 325 |
if (userTriggered == UserTriggered && !(options & DoNotRevealSelection)) { |
333 |
if (userTriggered == UserTriggered && !(options & DoNotRevealSelection)) { |
| 326 |
ScrollAlignment alignment; |
334 |
ScrollAlignment alignment; |
| 327 |
|
335 |
|
|
Lines 332-341
void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
a/Source/WebCore/editing/FrameSelection.cpp_sec6
|
| 332 |
|
340 |
|
| 333 |
revealSelection(alignment, RevealExtent); |
341 |
revealSelection(alignment, RevealExtent); |
| 334 |
} |
342 |
} |
| 335 |
#if HAVE(ACCESSIBILITY) |
343 |
|
| 336 |
notifyAccessibilityForSelectionChange(); |
344 |
notifyAccessibilityForSelectionChange(); |
| 337 |
#endif |
|
|
| 338 |
m_frame->document()->enqueueDocumentEvent(Event::create(eventNames().selectionchangeEvent, false, false)); |
| 339 |
} |
345 |
} |
| 340 |
|
346 |
|
| 341 |
static bool removingNodeRemovesPosition(Node* node, const Position& position) |
347 |
static bool removingNodeRemovesPosition(Node* node, const Position& position) |
|
Lines 1237-1243
void FrameSelection::prepareForDestruction()
a/Source/WebCore/editing/FrameSelection.cpp_sec7
|
| 1237 |
if (view) |
1243 |
if (view) |
| 1238 |
view->clearSelection(); |
1244 |
view->clearSelection(); |
| 1239 |
|
1245 |
|
| 1240 |
setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdateAppearance); |
1246 |
setSelectionWithoutUpdatingAppearance(VisibleSelection(), CloseTyping | ClearTypingStyle, |
|
|
1247 |
AlignCursorOnScrollIfNeeded, CharacterGranularity, NotUserTriggered); |
| 1241 |
m_previousCaretNode.clear(); |
1248 |
m_previousCaretNode.clear(); |
| 1242 |
} |
1249 |
} |
| 1243 |
|
1250 |
|