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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) | 1447 if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) |
1448 cache->selectionChanged(m_selection.start().containerNode()); | 1448 cache->selectionChanged(m_selection.start().containerNode()); |
1449 } | 1449 } |
1450 } | 1450 } |
1451 | 1451 |
1452 void FrameSelection::focusedOrActiveStateChanged() | 1452 void FrameSelection::focusedOrActiveStateChanged() |
1453 { | 1453 { |
1454 bool activeAndFocused = isFocusedAndActive(); | 1454 bool activeAndFocused = isFocusedAndActive(); |
1455 | 1455 |
1456 RefPtr<Document> document = m_frame->document(); | 1456 RefPtr<Document> document = m_frame->document(); |
1457 document->updateStyleIfNeeded(); | 1457 document->updateRenderTreeIfNeeded(); |
1458 | 1458 |
1459 // Because RenderObject::selectionBackgroundColor() and | 1459 // Because RenderObject::selectionBackgroundColor() and |
1460 // RenderObject::selectionForegroundColor() check if the frame is active, | 1460 // RenderObject::selectionForegroundColor() check if the frame is active, |
1461 // we have to update places those colors were painted. | 1461 // we have to update places those colors were painted. |
1462 if (RenderView* view = document->renderView()) | 1462 if (RenderView* view = document->renderView()) |
1463 view->repaintSelection(); | 1463 view->repaintSelection(); |
1464 | 1464 |
1465 // Caret appears in the active frame. | 1465 // Caret appears in the active frame. |
1466 if (activeAndFocused) | 1466 if (activeAndFocused) |
1467 setSelectionFromNone(); | 1467 setSelectionFromNone(); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 ASSERT(isCaret()); | 1630 ASSERT(isCaret()); |
1631 bool caretPaint = m_caretPaint; | 1631 bool caretPaint = m_caretPaint; |
1632 if (isCaretBlinkingSuspended() && caretPaint) | 1632 if (isCaretBlinkingSuspended() && caretPaint) |
1633 return; | 1633 return; |
1634 m_caretPaint = !caretPaint; | 1634 m_caretPaint = !caretPaint; |
1635 invalidateCaretRect(); | 1635 invalidateCaretRect(); |
1636 } | 1636 } |
1637 | 1637 |
1638 void FrameSelection::notifyRendererOfSelectionChange(EUserTriggered userTriggere
d) | 1638 void FrameSelection::notifyRendererOfSelectionChange(EUserTriggered userTriggere
d) |
1639 { | 1639 { |
1640 m_frame->document()->updateStyleIfNeeded(); | 1640 m_frame->document()->updateRenderTreeIfNeeded(); |
1641 | 1641 |
1642 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start
())) | 1642 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start
())) |
1643 textControl->selectionChanged(userTriggered == UserTriggered); | 1643 textControl->selectionChanged(userTriggered == UserTriggered); |
1644 } | 1644 } |
1645 | 1645 |
1646 // Helper function that tells whether a particular node is an element that has a
n entire | 1646 // Helper function that tells whether a particular node is an element that has a
n entire |
1647 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>. | 1647 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>. |
1648 static bool isFrameElement(const Node* n) | 1648 static bool isFrameElement(const Node* n) |
1649 { | 1649 { |
1650 if (!n) | 1650 if (!n) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 | 1701 |
1702 String FrameSelection::selectedTextForClipboard() const | 1702 String FrameSelection::selectedTextForClipboard() const |
1703 { | 1703 { |
1704 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex
t()) | 1704 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex
t()) |
1705 return extractSelectedText(*this, TextIteratorEmitsImageAltText); | 1705 return extractSelectedText(*this, TextIteratorEmitsImageAltText); |
1706 return selectedText(); | 1706 return selectedText(); |
1707 } | 1707 } |
1708 | 1708 |
1709 FloatRect FrameSelection::bounds(bool clipToVisibleContent) const | 1709 FloatRect FrameSelection::bounds(bool clipToVisibleContent) const |
1710 { | 1710 { |
1711 m_frame->document()->updateStyleIfNeeded(); | 1711 m_frame->document()->updateRenderTreeIfNeeded(); |
1712 | 1712 |
1713 FrameView* view = m_frame->view(); | 1713 FrameView* view = m_frame->view(); |
1714 RenderView* renderView = m_frame->contentRenderer(); | 1714 RenderView* renderView = m_frame->contentRenderer(); |
1715 | 1715 |
1716 if (!view || !renderView) | 1716 if (!view || !renderView) |
1717 return FloatRect(); | 1717 return FloatRect(); |
1718 | 1718 |
1719 LayoutRect selectionRect = renderView->selectionBounds(clipToVisibleContent)
; | 1719 LayoutRect selectionRect = renderView->selectionBounds(clipToVisibleContent)
; |
1720 return clipToVisibleContent ? intersection(selectionRect, view->visibleConte
ntRect()) : selectionRect; | 1720 return clipToVisibleContent ? intersection(selectionRect, view->visibleConte
ntRect()) : selectionRect; |
1721 } | 1721 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 sel.showTreeForThis(); | 1875 sel.showTreeForThis(); |
1876 } | 1876 } |
1877 | 1877 |
1878 void showTree(const WebCore::FrameSelection* sel) | 1878 void showTree(const WebCore::FrameSelection* sel) |
1879 { | 1879 { |
1880 if (sel) | 1880 if (sel) |
1881 sel->showTreeForThis(); | 1881 sel->showTreeForThis(); |
1882 } | 1882 } |
1883 | 1883 |
1884 #endif | 1884 #endif |
OLD | NEW |