// This function appears to heuristically guess whether to include a background // image in the smart clip. It seems to want to include sprites created from // CSS background images but to skip actual backgrounds. bool SmartClip::shouldSkipBackgroundImage(Node* node) { ASSERT(node); // Apparently we're only interested in background images on spans and divs. if (!isHTMLSpanElement(*node) && !isHTMLDivElement(*node)) return true; // This check actually makes a bit of sense. If you're going to sprite an // image out of a CSS background, you're probably going to specify a height // or a width. On the other hand, if we've got a legit background image, // it's very likely the height or the width will be set to auto. RenderObject* renderer = node->renderer(); if (renderer && (renderer->style()->logicalHeight().isAuto() || renderer->style()->logicalWidth().isAuto())) return true; return false; }
bool isPlainTextMarkup(Node* node) { DCHECK(node); if (!isHTMLDivElement(*node)) return false; HTMLDivElement& element = toHTMLDivElement(*node); if (!element.hasAttributes()) return false; if (element.hasOneChild()) return element.firstChild()->isTextNode() || element.firstChild()->hasChildren(); return element.hasChildCount(2) && isTabHTMLSpanElementTextNode(element.firstChild()->firstChild()) && element.lastChild()->isTextNode(); }