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

Side by Side Diff: Source/core/dom/Position.cpp

Issue 20572005: Allow selection to skip over contenteditable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Work around minor platform differences in test Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 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 19 matching lines...) Expand all
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "core/css/CSSComputedStyleDeclaration.h" 31 #include "core/css/CSSComputedStyleDeclaration.h"
32 #include "core/dom/PositionIterator.h" 32 #include "core/dom/PositionIterator.h"
33 #include "core/dom/Text.h" 33 #include "core/dom/Text.h"
34 #include "core/editing/TextIterator.h" 34 #include "core/editing/TextIterator.h"
35 #include "core/editing/VisiblePosition.h" 35 #include "core/editing/VisiblePosition.h"
36 #include "core/editing/VisibleUnits.h" 36 #include "core/editing/VisibleUnits.h"
37 #include "core/editing/htmlediting.h" 37 #include "core/editing/htmlediting.h"
38 #include "core/html/HTMLHtmlElement.h" 38 #include "core/html/HTMLHtmlElement.h"
39 #include "core/html/HTMLTableElement.h" 39 #include "core/html/HTMLTableElement.h"
40 #include "core/page/Frame.h"
41 #include "core/page/Settings.h"
40 #include "core/platform/Logging.h" 42 #include "core/platform/Logging.h"
41 #include "core/rendering/InlineIterator.h" 43 #include "core/rendering/InlineIterator.h"
42 #include "core/rendering/InlineTextBox.h" 44 #include "core/rendering/InlineTextBox.h"
43 #include "core/rendering/RenderBlock.h" 45 #include "core/rendering/RenderBlock.h"
44 #include "core/rendering/RenderInline.h" 46 #include "core/rendering/RenderInline.h"
45 #include "core/rendering/RenderText.h" 47 #include "core/rendering/RenderText.h"
46 #include "wtf/text/CString.h" 48 #include "wtf/text/CString.h"
47 #include "wtf/unicode/CharacterNames.h" 49 #include "wtf/unicode/CharacterNames.h"
48 50
49 namespace WebCore { 51 namespace WebCore {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 894
893 if (isHTMLHtmlElement(m_anchorNode.get())) 895 if (isHTMLHtmlElement(m_anchorNode.get()))
894 return false; 896 return false;
895 897
896 if (renderer->isBlockFlow()) { 898 if (renderer->isBlockFlow()) {
897 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) { 899 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) {
898 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer )) 900 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer ))
899 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode()); 901 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode());
900 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary(); 902 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary();
901 } 903 }
902 } else 904 } else {
903 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelect None(deprecatedNode()) && atEditingBoundary(); 905 Frame* frame = m_anchorNode->document().frame();
906 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsi ngEnabled();
907 return (caretBrowsing || m_anchorNode->rendererIsEditable()) && !Positio n::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
908 }
904 909
905 return false; 910 return false;
906 } 911 }
907 912
908 bool Position::inRenderedText() const 913 bool Position::inRenderedText() const
909 { 914 {
910 if (isNull() || !deprecatedNode()->isTextNode()) 915 if (isNull() || !deprecatedNode()->isTextNode())
911 return false; 916 return false;
912 917
913 RenderObject* renderer = deprecatedNode()->renderer(); 918 RenderObject* renderer = deprecatedNode()->renderer();
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 pos.showTreeForThis(); 1384 pos.showTreeForThis();
1380 } 1385 }
1381 1386
1382 void showTree(const WebCore::Position* pos) 1387 void showTree(const WebCore::Position* pos)
1383 { 1388 {
1384 if (pos) 1389 if (pos)
1385 pos->showTreeForThis(); 1390 pos->showTreeForThis();
1386 } 1391 }
1387 1392
1388 #endif 1393 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/stay-in-textarea-expected.txt ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698