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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (const Attribute* attribute = GetElementData()->Attributes().Find(name)) | 423 if (const Attribute* attribute = GetElementData()->Attributes().Find(name)) |
424 return attribute->Value(); | 424 return attribute->Value(); |
425 return g_null_atom; | 425 return g_null_atom; |
426 } | 426 } |
427 | 427 |
428 AtomicString Element::LowercaseIfNecessary(const AtomicString& name) const { | 428 AtomicString Element::LowercaseIfNecessary(const AtomicString& name) const { |
429 return IsHTMLElement() && GetDocument().IsHTMLDocument() ? name.LowerASCII() | 429 return IsHTMLElement() && GetDocument().IsHTMLDocument() ? name.LowerASCII() |
430 : name; | 430 : name; |
431 } | 431 } |
432 | 432 |
| 433 const AtomicString& Element::nonce() const { |
| 434 return HasRareData() ? GetElementRareData()->GetNonce() : g_empty_atom; |
| 435 } |
| 436 |
| 437 void Element::setNonce(const AtomicString& nonce) { |
| 438 EnsureElementRareData().SetNonce(nonce); |
| 439 } |
| 440 |
433 void Element::scrollIntoView(bool align_to_top) { | 441 void Element::scrollIntoView(bool align_to_top) { |
434 GetDocument().EnsurePaintLocationDataValidForNode(this); | 442 GetDocument().EnsurePaintLocationDataValidForNode(this); |
435 | 443 |
436 if (!GetLayoutObject()) | 444 if (!GetLayoutObject()) |
437 return; | 445 return; |
438 | 446 |
439 bool make_visible_in_visual_viewport = | 447 bool make_visible_in_visual_viewport = |
440 !GetDocument().GetPage()->GetSettings().GetInertVisualViewport(); | 448 !GetDocument().GetPage()->GetSettings().GetInertVisualViewport(); |
441 | 449 |
442 LayoutRect bounds = BoundingBox(); | 450 LayoutRect bounds = BoundingBox(); |
(...skipping 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 GetDocument())) | 3994 GetDocument())) |
3987 element_data_ = other.element_data_; | 3995 element_data_ = other.element_data_; |
3988 else | 3996 else |
3989 element_data_ = other.element_data_->MakeUniqueCopy(); | 3997 element_data_ = other.element_data_->MakeUniqueCopy(); |
3990 | 3998 |
3991 AttributeCollection attributes = element_data_->Attributes(); | 3999 AttributeCollection attributes = element_data_->Attributes(); |
3992 for (const Attribute& attr : attributes) { | 4000 for (const Attribute& attr : attributes) { |
3993 AttributeChangedFromParserOrByCloning( | 4001 AttributeChangedFromParserOrByCloning( |
3994 attr.GetName(), attr.Value(), AttributeModificationReason::kByCloning); | 4002 attr.GetName(), attr.Value(), AttributeModificationReason::kByCloning); |
3995 } | 4003 } |
| 4004 |
| 4005 if (other.nonce() != g_null_atom) |
| 4006 setNonce(other.nonce()); |
3996 } | 4007 } |
3997 | 4008 |
3998 void Element::CloneDataFromElement(const Element& other) { | 4009 void Element::CloneDataFromElement(const Element& other) { |
3999 CloneAttributesFromElement(other); | 4010 CloneAttributesFromElement(other); |
4000 CopyNonAttributePropertiesFromElement(other); | 4011 CopyNonAttributePropertiesFromElement(other); |
4001 } | 4012 } |
4002 | 4013 |
4003 void Element::CreateUniqueElementData() { | 4014 void Element::CreateUniqueElementData() { |
4004 if (!element_data_) { | 4015 if (!element_data_) { |
4005 element_data_ = UniqueElementData::Create(); | 4016 element_data_ = UniqueElementData::Create(); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 } | 4348 } |
4338 | 4349 |
4339 DEFINE_TRACE_WRAPPERS(Element) { | 4350 DEFINE_TRACE_WRAPPERS(Element) { |
4340 if (HasRareData()) { | 4351 if (HasRareData()) { |
4341 visitor->TraceWrappers(GetElementRareData()); | 4352 visitor->TraceWrappers(GetElementRareData()); |
4342 } | 4353 } |
4343 ContainerNode::TraceWrappers(visitor); | 4354 ContainerNode::TraceWrappers(visitor); |
4344 } | 4355 } |
4345 | 4356 |
4346 } // namespace blink | 4357 } // namespace blink |
OLD | NEW |