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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 | 1729 |
1730 LayoutRect selectionRect = renderView->selectionBounds(clipToVisibleContent)
; | 1730 LayoutRect selectionRect = renderView->selectionBounds(clipToVisibleContent)
; |
1731 return clipToVisibleContent ? intersection(selectionRect, view->visibleConte
ntRect()) : selectionRect; | 1731 return clipToVisibleContent ? intersection(selectionRect, view->visibleConte
ntRect()) : selectionRect; |
1732 } | 1732 } |
1733 | 1733 |
1734 // Scans logically forward from "start", including any child frames. | 1734 // Scans logically forward from "start", including any child frames. |
1735 static HTMLFormElement* scanForForm(Node* start) | 1735 static HTMLFormElement* scanForForm(Node* start) |
1736 { | 1736 { |
1737 if (!start) | 1737 if (!start) |
1738 return 0; | 1738 return 0; |
1739 Element* element = start->isElementNode() ? toElement(start) : ElementTraver
sal::next(start); | 1739 Element* element = start->isElementNode() ? toElement(start) : ElementTraver
sal::next(*start); |
1740 for (; element; element = ElementTraversal::next(element)) { | 1740 for (; element; element = ElementTraversal::next(*element)) { |
1741 if (element->hasTagName(formTag)) | 1741 if (element->hasTagName(formTag)) |
1742 return toHTMLFormElement(element); | 1742 return toHTMLFormElement(element); |
1743 if (element->isHTMLElement() && toHTMLElement(element)->isFormControlEle
ment()) | 1743 if (element->isHTMLElement() && toHTMLElement(element)->isFormControlEle
ment()) |
1744 return toHTMLFormControlElement(element)->form(); | 1744 return toHTMLFormControlElement(element)->form(); |
1745 if (element->hasTagName(frameTag) || element->hasTagName(iframeTag)) { | 1745 if (element->hasTagName(frameTag) || element->hasTagName(iframeTag)) { |
1746 Node* childDocument = toHTMLFrameElementBase(element)->contentDocume
nt(); | 1746 Node* childDocument = toHTMLFrameElementBase(element)->contentDocume
nt(); |
1747 if (HTMLFormElement* frameResult = scanForForm(childDocument)) | 1747 if (HTMLFormElement* frameResult = scanForForm(childDocument)) |
1748 return frameResult; | 1748 return frameResult; |
1749 } | 1749 } |
1750 } | 1750 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 // Put a caret inside the body if the entire frame is editable (either the | 1803 // Put a caret inside the body if the entire frame is editable (either the |
1804 // entire WebView is editable or designMode is on for this document). | 1804 // entire WebView is editable or designMode is on for this document). |
1805 | 1805 |
1806 Document* document = m_frame->document(); | 1806 Document* document = m_frame->document(); |
1807 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsi
ngEnabled(); | 1807 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsi
ngEnabled(); |
1808 if (!isNone() || !(document->rendererIsEditable() || caretBrowsing)) | 1808 if (!isNone() || !(document->rendererIsEditable() || caretBrowsing)) |
1809 return; | 1809 return; |
1810 | 1810 |
1811 Node* node = document->documentElement(); | 1811 Node* node = document->documentElement(); |
1812 while (node && !node->hasTagName(bodyTag)) | 1812 while (node && !node->hasTagName(bodyTag)) |
1813 node = NodeTraversal::next(node); | 1813 node = NodeTraversal::next(*node); |
1814 if (node) | 1814 if (node) |
1815 setSelection(VisibleSelection(firstPositionInOrBeforeNode(node), DOWNSTR
EAM)); | 1815 setSelection(VisibleSelection(firstPositionInOrBeforeNode(node), DOWNSTR
EAM)); |
1816 } | 1816 } |
1817 | 1817 |
1818 bool FrameSelection::dispatchSelectStart() | 1818 bool FrameSelection::dispatchSelectStart() |
1819 { | 1819 { |
1820 Node* selectStartTarget = m_selection.extent().containerNode(); | 1820 Node* selectStartTarget = m_selection.extent().containerNode(); |
1821 if (!selectStartTarget) | 1821 if (!selectStartTarget) |
1822 return true; | 1822 return true; |
1823 | 1823 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 sel.showTreeForThis(); | 1856 sel.showTreeForThis(); |
1857 } | 1857 } |
1858 | 1858 |
1859 void showTree(const WebCore::FrameSelection* sel) | 1859 void showTree(const WebCore::FrameSelection* sel) |
1860 { | 1860 { |
1861 if (sel) | 1861 if (sel) |
1862 sel->showTreeForThis(); | 1862 sel->showTreeForThis(); |
1863 } | 1863 } |
1864 | 1864 |
1865 #endif | 1865 #endif |
OLD | NEW |