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

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

Issue 19098002: Introduce isHTMLHtmlElement and toHTMLHtmlElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 5 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/PositionIterator.cpp » ('j') | 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, 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 17 matching lines...) Expand all
28 28
29 #include <stdio.h> 29 #include <stdio.h>
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/HTMLTableElement.h" 39 #include "core/html/HTMLTableElement.h"
39 #include "core/platform/Logging.h" 40 #include "core/platform/Logging.h"
40 #include "core/rendering/InlineIterator.h" 41 #include "core/rendering/InlineIterator.h"
41 #include "core/rendering/InlineTextBox.h" 42 #include "core/rendering/InlineTextBox.h"
42 #include "core/rendering/RenderBlock.h" 43 #include "core/rendering/RenderBlock.h"
43 #include "core/rendering/RenderInline.h" 44 #include "core/rendering/RenderInline.h"
44 #include "core/rendering/RenderText.h" 45 #include "core/rendering/RenderText.h"
45 #include "wtf/text/CString.h" 46 #include "wtf/text/CString.h"
46 #include "wtf/unicode/CharacterNames.h" 47 #include "wtf/unicode/CharacterNames.h"
47 48
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 if (renderer->isBR()) 896 if (renderer->isBR())
896 // FIXME: The condition should be m_anchorType == PositionIsBeforeAnchor , but for now we still need to support legacy positions. 897 // FIXME: The condition should be m_anchorType == PositionIsBeforeAnchor , but for now we still need to support legacy positions.
897 return !m_offset && m_anchorType != PositionIsAfterAnchor && !nodeIsUser SelectNone(deprecatedNode()->parentNode()); 898 return !m_offset && m_anchorType != PositionIsAfterAnchor && !nodeIsUser SelectNone(deprecatedNode()->parentNode());
898 899
899 if (renderer->isText()) 900 if (renderer->isText())
900 return !nodeIsUserSelectNone(deprecatedNode()) && inRenderedText(); 901 return !nodeIsUserSelectNone(deprecatedNode()) && inRenderedText();
901 902
902 if (isTableElement(deprecatedNode()) || editingIgnoresContent(deprecatedNode ())) 903 if (isTableElement(deprecatedNode()) || editingIgnoresContent(deprecatedNode ()))
903 return (atFirstEditingPositionForNode() || atLastEditingPositionForNode( )) && !nodeIsUserSelectNone(deprecatedNode()->parentNode()); 904 return (atFirstEditingPositionForNode() || atLastEditingPositionForNode( )) && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
904 905
905 if (m_anchorNode->hasTagName(htmlTag)) 906 if (isHTMLHtmlElement(m_anchorNode.get()))
906 return false; 907 return false;
907 908
908 if (renderer->isBlockFlow()) { 909 if (renderer->isBlockFlow()) {
909 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) { 910 if (toRenderBlock(renderer)->logicalHeight() || m_anchorNode->hasTagName (bodyTag)) {
910 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer )) 911 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer ))
911 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode()); 912 return atFirstEditingPositionForNode() && !Position::nodeIsUserS electNone(deprecatedNode());
912 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary(); 913 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSe lectNone(deprecatedNode()) && atEditingBoundary();
913 } 914 }
914 } else 915 } else
915 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelect None(deprecatedNode()) && atEditingBoundary(); 916 return m_anchorNode->rendererIsEditable() && !Position::nodeIsUserSelect None(deprecatedNode()) && atEditingBoundary();
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 pos.showTreeForThis(); 1392 pos.showTreeForThis();
1392 } 1393 }
1393 1394
1394 void showTree(const WebCore::Position* pos) 1395 void showTree(const WebCore::Position* pos)
1395 { 1396 {
1396 if (pos) 1397 if (pos)
1397 pos->showTreeForThis(); 1398 pos->showTreeForThis();
1398 } 1399 }
1399 1400
1400 #endif 1401 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/PositionIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698