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

Side by Side Diff: Source/core/rendering/TextAutosizer.cpp

Issue 482903002: Get rid of loops looking for the first Element ancestor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits 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 | « Source/core/editing/htmlediting.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #endif 114 #endif
115 115
116 static const RenderObject* parentElementRenderer(const RenderObject* renderer) 116 static const RenderObject* parentElementRenderer(const RenderObject* renderer)
117 { 117 {
118 // At style recalc, the renderer's parent may not be attached, 118 // At style recalc, the renderer's parent may not be attached,
119 // so we need to obtain this from the DOM tree. 119 // so we need to obtain this from the DOM tree.
120 const Node* node = renderer->node(); 120 const Node* node = renderer->node();
121 if (!node) 121 if (!node)
122 return 0; 122 return 0;
123 123
124 for (node = node->parentNode(); node; node = node->parentNode()) { 124 // FIXME: This should be using NodeRenderingTraversal::parent().
125 if (node->isElementNode()) 125 if (Element* parent = node->parentElement())
126 return node->renderer(); 126 return parent->renderer();
127 }
128 return 0; 127 return 0;
129 } 128 }
130 129
131 static bool isNonTextAreaFormControl(const RenderObject* renderer) 130 static bool isNonTextAreaFormControl(const RenderObject* renderer)
132 { 131 {
133 const Node* node = renderer ? renderer->node() : 0; 132 const Node* node = renderer ? renderer->node() : 0;
134 if (!node || !node->isElementNode()) 133 if (!node || !node->isElementNode())
135 return false; 134 return false;
136 const Element* element = toElement(node); 135 const Element* element = toElement(node);
137 136
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1151 }
1153 return computedSize; 1152 return computedSize;
1154 } 1153 }
1155 1154
1156 void TextAutosizer::trace(Visitor* visitor) 1155 void TextAutosizer::trace(Visitor* visitor)
1157 { 1156 {
1158 visitor->trace(m_document); 1157 visitor->trace(m_document);
1159 } 1158 }
1160 1159
1161 } // namespace blink 1160 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/htmlediting.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698