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

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

Issue 25490002: Refactoring: Change the order of conditions to avoid computing rendererIsEditable() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unrelated changes Created 7 years, 2 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 | « no previous file | Source/core/page/EventHandler.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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "wtf/text/CString.h" 48 #include "wtf/text/CString.h"
49 #include "wtf/unicode/CharacterNames.h" 49 #include "wtf/unicode/CharacterNames.h"
50 50
51 namespace WebCore { 51 namespace WebCore {
52 52
53 using namespace HTMLNames; 53 using namespace HTMLNames;
54 54
55 static Node* nextRenderedEditable(Node* node) 55 static Node* nextRenderedEditable(Node* node)
56 { 56 {
57 while ((node = node->nextLeafNode())) { 57 while ((node = node->nextLeafNode())) {
58 if (!node->rendererIsEditable())
59 continue;
60 RenderObject* renderer = node->renderer(); 58 RenderObject* renderer = node->renderer();
61 if (!renderer) 59 if (!renderer)
62 continue; 60 continue;
61 if (!node->rendererIsEditable())
62 continue;
63 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) 63 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
64 return node; 64 return node;
65 } 65 }
66 return 0; 66 return 0;
67 } 67 }
68 68
69 static Node* previousRenderedEditable(Node* node) 69 static Node* previousRenderedEditable(Node* node)
70 { 70 {
71 while ((node = node->previousLeafNode())) { 71 while ((node = node->previousLeafNode())) {
72 if (!node->rendererIsEditable())
73 continue;
74 RenderObject* renderer = node->renderer(); 72 RenderObject* renderer = node->renderer();
75 if (!renderer) 73 if (!renderer)
76 continue; 74 continue;
75 if (!node->rendererIsEditable())
76 continue;
77 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) 77 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
78 return node; 78 return node;
79 } 79 }
80 return 0; 80 return 0;
81 } 81 }
82 82
83 Position::Position(PassRefPtr<Node> anchorNode, LegacyEditingOffset offset) 83 Position::Position(PassRefPtr<Node> anchorNode, LegacyEditingOffset offset)
84 : m_anchorNode(anchorNode) 84 : m_anchorNode(anchorNode)
85 , m_offset(offset.value()) 85 , m_offset(offset.value())
86 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs et)) 86 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs et))
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 pos.showTreeForThis(); 1384 pos.showTreeForThis();
1385 } 1385 }
1386 1386
1387 void showTree(const WebCore::Position* pos) 1387 void showTree(const WebCore::Position* pos)
1388 { 1388 {
1389 if (pos) 1389 if (pos)
1390 pos->showTreeForThis(); 1390 pos->showTreeForThis();
1391 } 1391 }
1392 1392
1393 #endif 1393 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698