| 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.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "sky/engine/core/dom/Element.h" | 26 #include "sky/engine/core/dom/Element.h" |
| 27 | 27 |
| 28 #include "gen/sky/core/CSSValueKeywords.h" | 28 #include "gen/sky/core/CSSValueKeywords.h" |
| 29 #include "gen/sky/core/HTMLNames.h" | 29 #include "gen/sky/core/HTMLNames.h" |
| 30 #include "gen/sky/platform/RuntimeEnabledFeatures.h" | 30 #include "gen/sky/platform/RuntimeEnabledFeatures.h" |
| 31 #include "sky/engine/bindings/exception_messages.h" | 31 #include "sky/engine/bindings/exception_messages.h" |
| 32 #include "sky/engine/bindings/exception_state.h" | 32 #include "sky/engine/bindings/exception_state.h" |
| 33 #include "sky/engine/core/animation/AnimationTimeline.h" | 33 #include "sky/engine/core/animation/AnimationTimeline.h" |
| 34 #include "sky/engine/core/animation/css/CSSAnimations.h" | 34 #include "sky/engine/core/animation/css/CSSAnimations.h" |
| 35 #include "sky/engine/core/css/CSSImageValue.h" | |
| 36 #include "sky/engine/core/css/CSSStyleSheet.h" | 35 #include "sky/engine/core/css/CSSStyleSheet.h" |
| 37 #include "sky/engine/core/css/CSSValuePool.h" | 36 #include "sky/engine/core/css/CSSValuePool.h" |
| 38 #include "sky/engine/core/css/PropertySetCSSStyleDeclaration.h" | 37 #include "sky/engine/core/css/PropertySetCSSStyleDeclaration.h" |
| 39 #include "sky/engine/core/css/StylePropertySet.h" | 38 #include "sky/engine/core/css/StylePropertySet.h" |
| 40 #include "sky/engine/core/css/parser/BisonCSSParser.h" | 39 #include "sky/engine/core/css/parser/BisonCSSParser.h" |
| 41 #include "sky/engine/core/css/resolver/StyleResolver.h" | 40 #include "sky/engine/core/css/resolver/StyleResolver.h" |
| 42 #include "sky/engine/core/dom/Attr.h" | 41 #include "sky/engine/core/dom/Attr.h" |
| 43 #include "sky/engine/core/dom/ClientRect.h" | 42 #include "sky/engine/core/dom/ClientRect.h" |
| 44 #include "sky/engine/core/dom/ClientRectList.h" | 43 #include "sky/engine/core/dom/ClientRectList.h" |
| 45 #include "sky/engine/core/dom/DOMTokenList.h" | 44 #include "sky/engine/core/dom/DOMTokenList.h" |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affected
ByAttributeSelector(name.localName())) | 1422 if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affected
ByAttributeSelector(name.localName())) |
| 1424 setNeedsStyleRecalc(LocalStyleChange); | 1423 setNeedsStyleRecalc(LocalStyleChange); |
| 1425 | 1424 |
| 1426 if (isUpgradedCustomElement()) | 1425 if (isUpgradedCustomElement()) |
| 1427 CustomElement::AttributeDidChange(this, name.localName(), oldValue, newV
alue); | 1426 CustomElement::AttributeDidChange(this, name.localName(), oldValue, newV
alue); |
| 1428 | 1427 |
| 1429 if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInter
estGroup::createForAttributesMutation(*this, name)) | 1428 if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInter
estGroup::createForAttributesMutation(*this, name)) |
| 1430 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this,
name, oldValue)); | 1429 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this,
name, oldValue)); |
| 1431 } | 1430 } |
| 1432 | 1431 |
| 1433 static bool needsURLResolutionForInlineStyle(const Element& element, const Docum
ent& oldDocument, const Document& newDocument) | |
| 1434 { | |
| 1435 if (oldDocument == newDocument) | |
| 1436 return false; | |
| 1437 if (oldDocument.baseURL() == newDocument.baseURL()) | |
| 1438 return false; | |
| 1439 const StylePropertySet* style = element.inlineStyle(); | |
| 1440 if (!style) | |
| 1441 return false; | |
| 1442 for (unsigned i = 0; i < style->propertyCount(); ++i) { | |
| 1443 // FIXME: Should handle all URL-based properties: CSSImageSetValue, CSSC
ursorImageValue, etc. | |
| 1444 if (style->propertyAt(i).value()->isImageValue()) | |
| 1445 return true; | |
| 1446 } | |
| 1447 return false; | |
| 1448 } | |
| 1449 | |
| 1450 static void reResolveURLsInInlineStyle(const Document& document, MutableStylePro
pertySet& style) | |
| 1451 { | |
| 1452 for (unsigned i = 0; i < style.propertyCount(); ++i) { | |
| 1453 StylePropertySet::PropertyReference property = style.propertyAt(i); | |
| 1454 // FIXME: Should handle all URL-based properties: CSSImageSetValue, CSSC
ursorImageValue, etc. | |
| 1455 if (property.value()->isImageValue()) | |
| 1456 toCSSImageValue(property.value())->reResolveURL(document); | |
| 1457 } | |
| 1458 } | |
| 1459 | |
| 1460 void Element::didMoveToNewDocument(Document& oldDocument) | 1432 void Element::didMoveToNewDocument(Document& oldDocument) |
| 1461 { | 1433 { |
| 1462 Node::didMoveToNewDocument(oldDocument); | 1434 Node::didMoveToNewDocument(oldDocument); |
| 1463 | |
| 1464 if (needsURLResolutionForInlineStyle(*this, oldDocument, document())) | |
| 1465 reResolveURLsInInlineStyle(document(), ensureMutableInlineStyle()); | |
| 1466 } | 1435 } |
| 1467 | 1436 |
| 1468 void Element::cloneAttributesFromElement(const Element& other) | 1437 void Element::cloneAttributesFromElement(const Element& other) |
| 1469 { | 1438 { |
| 1470 other.synchronizeAllAttributes(); | 1439 other.synchronizeAllAttributes(); |
| 1471 if (!other.m_elementData) { | 1440 if (!other.m_elementData) { |
| 1472 m_elementData.clear(); | 1441 m_elementData.clear(); |
| 1473 return; | 1442 return; |
| 1474 } | 1443 } |
| 1475 | 1444 |
| 1476 const AtomicString& oldID = getIdAttribute(); | 1445 const AtomicString& oldID = getIdAttribute(); |
| 1477 const AtomicString& newID = other.getIdAttribute(); | 1446 const AtomicString& newID = other.getIdAttribute(); |
| 1478 | 1447 |
| 1479 if (!oldID.isNull() || !newID.isNull()) | 1448 if (!oldID.isNull() || !newID.isNull()) |
| 1480 updateId(oldID, newID); | 1449 updateId(oldID, newID); |
| 1481 | 1450 |
| 1482 // If 'other' has a mutable ElementData, convert it to an immutable one so w
e can share it between both elements. | 1451 // If 'other' has a mutable ElementData, convert it to an immutable one so w
e can share it between both elements. |
| 1483 // We can only do this if there are no presentation attributes and sharing t
he data won't result in different case sensitivity of class or id. | 1452 // We can only do this if there are no presentation attributes and sharing t
he data won't result in different case sensitivity of class or id. |
| 1484 if (other.m_elementData->isUnique()) | 1453 if (other.m_elementData->isUnique()) |
| 1485 const_cast<Element&>(other).m_elementData = toUniqueElementData(other.m_
elementData)->makeShareableCopy(); | 1454 const_cast<Element&>(other).m_elementData = toUniqueElementData(other.m_
elementData)->makeShareableCopy(); |
| 1486 | 1455 |
| 1487 if (!other.m_elementData->isUnique() && !needsURLResolutionForInlineStyle(ot
her, other.document(), document())) | 1456 if (!other.m_elementData->isUnique()) |
| 1488 m_elementData = other.m_elementData; | 1457 m_elementData = other.m_elementData; |
| 1489 else | 1458 else |
| 1490 m_elementData = other.m_elementData->makeUniqueCopy(); | 1459 m_elementData = other.m_elementData->makeUniqueCopy(); |
| 1491 | 1460 |
| 1492 AttributeCollection attributes = m_elementData->attributes(); | 1461 AttributeCollection attributes = m_elementData->attributes(); |
| 1493 AttributeCollection::iterator end = attributes.end(); | 1462 AttributeCollection::iterator end = attributes.end(); |
| 1494 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) | 1463 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) |
| 1495 attributeChangedFromParserOrByCloning(it->name(), it->value(), ModifiedB
yCloning); | 1464 attributeChangedFromParserOrByCloning(it->name(), it->value(), ModifiedB
yCloning); |
| 1496 } | 1465 } |
| 1497 | 1466 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 GraphicsContext context(canvas->skCanvas()); | 1671 GraphicsContext context(canvas->skCanvas()); |
| 1703 | 1672 |
| 1704 // Very simplified painting to allow painting an arbitrary (layer-less) subt
ree. | 1673 // Very simplified painting to allow painting an arbitrary (layer-less) subt
ree. |
| 1705 Vector<RenderBox*> layers; | 1674 Vector<RenderBox*> layers; |
| 1706 PaintInfo paintInfo(&context, box->absoluteBoundingBoxRect(), box); | 1675 PaintInfo paintInfo(&context, box->absoluteBoundingBoxRect(), box); |
| 1707 box->paint(paintInfo, LayoutPoint(), layers); | 1676 box->paint(paintInfo, LayoutPoint(), layers); |
| 1708 // Note we're ignoring any layers encountered. | 1677 // Note we're ignoring any layers encountered. |
| 1709 } | 1678 } |
| 1710 | 1679 |
| 1711 } // namespace blink | 1680 } // namespace blink |
| OLD | NEW |