OLD | NEW |
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 return minNode; | 216 return minNode; |
217 } | 217 } |
218 | 218 |
219 // This function appears to heuristically guess whether to include a background | 219 // This function appears to heuristically guess whether to include a background |
220 // image in the smart clip. It seems to want to include sprites created from | 220 // image in the smart clip. It seems to want to include sprites created from |
221 // CSS background images but to skip actual backgrounds. | 221 // CSS background images but to skip actual backgrounds. |
222 bool SmartClip::shouldSkipBackgroundImage(Node* node) | 222 bool SmartClip::shouldSkipBackgroundImage(Node* node) |
223 { | 223 { |
| 224 ASSERT(node); |
224 // Apparently we're only interested in background images on spans and divs. | 225 // Apparently we're only interested in background images on spans and divs. |
225 if (!node->hasTagName(HTMLNames::spanTag) && !node->hasTagName(HTMLNames::di
vTag)) | 226 if (!isHTMLSpanElement(*node) && !isHTMLDivElement(*node)) |
226 return true; | 227 return true; |
227 | 228 |
228 // This check actually makes a bit of sense. If you're going to sprite an | 229 // This check actually makes a bit of sense. If you're going to sprite an |
229 // image out of a CSS background, you're probably going to specify a height | 230 // image out of a CSS background, you're probably going to specify a height |
230 // or a width. On the other hand, if we've got a legit background image, | 231 // or a width. On the other hand, if we've got a legit background image, |
231 // it's very likely the height or the width will be set to auto. | 232 // it's very likely the height or the width will be set to auto. |
232 RenderObject* renderer = node->renderer(); | 233 RenderObject* renderer = node->renderer(); |
233 if (renderer && (renderer->style()->logicalHeight().isAuto() || renderer->st
yle()->logicalWidth().isAuto())) | 234 if (renderer && (renderer->style()->logicalHeight().isAuto() || renderer->st
yle()->logicalWidth().isAuto())) |
234 return true; | 235 return true; |
235 | 236 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 287 |
287 result.append(nodeValue); | 288 result.append(nodeValue); |
288 } | 289 } |
289 } | 290 } |
290 } | 291 } |
291 | 292 |
292 return result.toString(); | 293 return result.toString(); |
293 } | 294 } |
294 | 295 |
295 } // namespace WebCore | 296 } // namespace WebCore |
OLD | NEW |