| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 10 * | 10 * |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 } else { | 1423 } else { |
| 1424 const SpaceSplitString& oldClasses = elementData()->classNames(); | 1424 const SpaceSplitString& oldClasses = elementData()->classNames(); |
| 1425 if (featureSet.checkSelectorsForClassChange(oldClasses)) | 1425 if (featureSet.checkSelectorsForClassChange(oldClasses)) |
| 1426 return true; | 1426 return true; |
| 1427 } | 1427 } |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 return featureSet.hasSelectorForAttribute(name.localName()); | 1430 return featureSet.hasSelectorForAttribute(name.localName()); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 // Returns true is the given attribute is an event handler. | 1433 // Returns true if the given attribute is an event handler. |
| 1434 // We consider an event handler any attribute that begins with "on". | 1434 // We consider an event handler any attribute that begins with "on". |
| 1435 // It is a simple solution that has the advantage of not requiring any | 1435 // It is a simple solution that has the advantage of not requiring any |
| 1436 // code or configuration change if a new event handler is defined. | 1436 // code or configuration change if a new event handler is defined. |
| 1437 | 1437 |
| 1438 static inline bool isEventHandlerAttribute(const Attribute& attribute) { | 1438 static inline bool isEventHandlerAttribute(const Attribute& attribute) { |
| 1439 return attribute.name().namespaceURI().isNull() && | 1439 return attribute.name().namespaceURI().isNull() && |
| 1440 attribute.name().localName().startsWith("on"); | 1440 attribute.name().localName().startsWith("on"); |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 bool Element::attributeValueIsJavaScriptURL(const Attribute& attribute) { | 1443 bool Element::attributeValueIsJavaScriptURL(const Attribute& attribute) { |
| 1444 return protocolIsJavaScript( | 1444 return protocolIsJavaScript( |
| 1445 stripLeadingAndTrailingHTMLSpaces(attribute.value())); | 1445 stripLeadingAndTrailingHTMLSpaces(attribute.value())); |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 bool Element::isJavaScriptURLAttribute(const Attribute& attribute) const { | 1448 bool Element::isJavaScriptURLAttribute(const Attribute& attribute) const { |
| 1449 return isURLAttribute(attribute) && attributeValueIsJavaScriptURL(attribute); | 1449 return isURLAttribute(attribute) && attributeValueIsJavaScriptURL(attribute); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 bool Element::isScriptingAttribute(const Attribute& attribute) const { |
| 1453 return isEventHandlerAttribute(attribute) || |
| 1454 isJavaScriptURLAttribute(attribute) || |
| 1455 isHTMLContentAttribute(attribute) || |
| 1456 isSVGAnimationAttributeSettingJavaScriptURL(attribute); |
| 1457 } |
| 1458 |
| 1452 void Element::stripScriptingAttributes( | 1459 void Element::stripScriptingAttributes( |
| 1453 Vector<Attribute>& attributeVector) const { | 1460 Vector<Attribute>& attributeVector) const { |
| 1454 size_t destination = 0; | 1461 size_t destination = 0; |
| 1455 for (size_t source = 0; source < attributeVector.size(); ++source) { | 1462 for (size_t source = 0; source < attributeVector.size(); ++source) { |
| 1456 if (isEventHandlerAttribute(attributeVector[source]) || | 1463 if (isScriptingAttribute(attributeVector[source])) |
| 1457 isJavaScriptURLAttribute(attributeVector[source]) || | |
| 1458 isHTMLContentAttribute(attributeVector[source]) || | |
| 1459 isSVGAnimationAttributeSettingJavaScriptURL(attributeVector[source])) | |
| 1460 continue; | 1464 continue; |
| 1461 | 1465 |
| 1462 if (source != destination) | 1466 if (source != destination) |
| 1463 attributeVector[destination] = attributeVector[source]; | 1467 attributeVector[destination] = attributeVector[source]; |
| 1464 | 1468 |
| 1465 ++destination; | 1469 ++destination; |
| 1466 } | 1470 } |
| 1467 attributeVector.shrink(destination); | 1471 attributeVector.shrink(destination); |
| 1468 } | 1472 } |
| 1469 | 1473 |
| (...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4082 } | 4086 } |
| 4083 | 4087 |
| 4084 DEFINE_TRACE_WRAPPERS(Element) { | 4088 DEFINE_TRACE_WRAPPERS(Element) { |
| 4085 if (hasRareData()) { | 4089 if (hasRareData()) { |
| 4086 visitor->traceWrappers(elementRareData()); | 4090 visitor->traceWrappers(elementRareData()); |
| 4087 } | 4091 } |
| 4088 ContainerNode::traceWrappers(visitor); | 4092 ContainerNode::traceWrappers(visitor); |
| 4089 } | 4093 } |
| 4090 | 4094 |
| 4091 } // namespace blink | 4095 } // namespace blink |
| OLD | NEW |