Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 425393002: Simplify code for finding body in FrameSelection::setSelectionFromNone() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 // entire WebView is editable or designMode is on for this document). 1816 // entire WebView is editable or designMode is on for this document).
1817 1817
1818 Document* document = m_frame->document(); 1818 Document* document = m_frame->document();
1819 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsi ngEnabled(); 1819 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsi ngEnabled();
1820 if (!isNone() || !(document->hasEditableStyle() || caretBrowsing)) 1820 if (!isNone() || !(document->hasEditableStyle() || caretBrowsing))
1821 return; 1821 return;
1822 1822
1823 Element* documentElement = document->documentElement(); 1823 Element* documentElement = document->documentElement();
1824 if (!documentElement) 1824 if (!documentElement)
1825 return; 1825 return;
1826 HTMLBodyElement* body = isHTMLBodyElement(*documentElement) ? toHTMLBodyElem ent(documentElement) : Traversal<HTMLBodyElement>::next(*documentElement); 1826 if (HTMLBodyElement* body = Traversal<HTMLBodyElement>::firstChild(*document Element))
1827 if (body)
1828 setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), DOWNSTR EAM)); 1827 setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), DOWNSTR EAM));
1829 } 1828 }
1830 1829
1831 bool FrameSelection::dispatchSelectStart() 1830 bool FrameSelection::dispatchSelectStart()
1832 { 1831 {
1833 Node* selectStartTarget = m_selection.extent().containerNode(); 1832 Node* selectStartTarget = m_selection.extent().containerNode();
1834 if (!selectStartTarget) 1833 if (!selectStartTarget)
1835 return true; 1834 return true;
1836 1835
1837 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart)); 1836 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 sel.showTreeForThis(); 1924 sel.showTreeForThis();
1926 } 1925 }
1927 1926
1928 void showTree(const blink::FrameSelection* sel) 1927 void showTree(const blink::FrameSelection* sel)
1929 { 1928 {
1930 if (sel) 1929 if (sel)
1931 sel->showTreeForThis(); 1930 sel->showTreeForThis();
1932 } 1931 }
1933 1932
1934 #endif 1933 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698