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

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: Update one more instance 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
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 if (Element* parent = node->parentElement())
125 if (node->isElementNode()) 125 return parent->renderer();
esprehn 2014/08/19 01:02:45 This code is wrong, add a FIXME: That it should be
Inactive 2014/08/19 12:51:45 Done.
126 return node->renderer();
127 }
128 return 0; 126 return 0;
129 } 127 }
130 128
131 static bool isNonTextAreaFormControl(const RenderObject* renderer) 129 static bool isNonTextAreaFormControl(const RenderObject* renderer)
132 { 130 {
133 const Node* node = renderer ? renderer->node() : 0; 131 const Node* node = renderer ? renderer->node() : 0;
134 if (!node || !node->isElementNode()) 132 if (!node || !node->isElementNode())
135 return false; 133 return false;
136 const Element* element = toElement(node); 134 const Element* element = toElement(node);
137 135
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1150 }
1153 return computedSize; 1151 return computedSize;
1154 } 1152 }
1155 1153
1156 void TextAutosizer::trace(Visitor* visitor) 1154 void TextAutosizer::trace(Visitor* visitor)
1157 { 1155 {
1158 visitor->trace(m_document); 1156 visitor->trace(m_document);
1159 } 1157 }
1160 1158
1161 } // namespace blink 1159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698