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

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: Add new test, address feedback 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 905
904 if (isHTMLHtmlElement(m_anchorNode.get())) 906 if (isHTMLHtmlElement(m_anchorNode.get()))
905 return false; 907 return false;
906 908
907 if (renderer->isBlockFlow()) { 909 if (renderer->isBlockFlow()) {
908 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) { 910 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) {
909 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer )) 911 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer ))
910 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode()); 912 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode());
911 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary(); 913 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary();
912 } 914 }
913 } else 915 } else {
914 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelect None(deprecatedNode()) && atEditingBoundary(); 916 Frame* frame = m_anchorNode->document().frame();
917 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsi ngEnabled();
918 return (caretBrowsing || m_anchorNode->rendererIsEditable()) && !Positio n::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
919 }
915 920
916 return false; 921 return false;
917 } 922 }
918 923
919 bool Position::inRenderedText() const 924 bool Position::inRenderedText() const
920 { 925 {
921 if (isNull() || !deprecatedNode()->isTextNode()) 926 if (isNull() || !deprecatedNode()->isTextNode())
922 return false; 927 return false;
923 928
924 RenderObject* renderer = deprecatedNode()->renderer(); 929 RenderObject* renderer = deprecatedNode()->renderer();
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 pos.showTreeForThis(); 1395 pos.showTreeForThis();
1391 } 1396 }
1392 1397
1393 void showTree(const WebCore::Position* pos) 1398 void showTree(const WebCore::Position* pos)
1394 { 1399 {
1395 if (pos) 1400 if (pos)
1396 pos->showTreeForThis(); 1401 pos->showTreeForThis();
1397 } 1402 }
1398 1403
1399 #endif 1404 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698