Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1561663003: CL for perf tryjob on win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState) 2510 void Element::setInnerHTML(const String& html, ExceptionState& exceptionState)
2511 { 2511 {
2512 InspectorInstrumentation::willSetInnerHTML(this); 2512 InspectorInstrumentation::willSetInnerHTML(this);
2513 2513
2514 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu terHTML(html, this, AllowScriptingContent, "innerHTML", exceptionState)) { 2514 if (RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOu terHTML(html, this, AllowScriptingContent, "innerHTML", exceptionState)) {
2515 ContainerNode* container = this; 2515 ContainerNode* container = this;
2516 if (isHTMLTemplateElement(*this)) 2516 if (isHTMLTemplateElement(*this))
2517 container = toHTMLTemplateElement(this)->content(); 2517 container = toHTMLTemplateElement(this)->content();
2518 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e); 2518 replaceChildrenWithFragment(container, fragment.release(), exceptionStat e);
2519 } 2519 }
2520
2521 taintElementIfFromIsolatedWorld();
2520 } 2522 }
2521 2523
2522 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState) 2524 void Element::setOuterHTML(const String& html, ExceptionState& exceptionState)
2523 { 2525 {
2524 Node* p = parentNode(); 2526 Node* p = parentNode();
2525 if (!p) { 2527 if (!p) {
2526 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node."); 2528 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt has no parent node.");
2527 return; 2529 return;
2528 } 2530 }
2529 if (!p->isElementNode()) { 2531 if (!p->isElementNode()) {
2530 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node."); 2532 exceptionState.throwDOMException(NoModificationAllowedError, "This eleme nt's parent is of type '" + p->nodeName() + "', which is not an element node.");
2531 return; 2533 return;
2532 } 2534 }
2533 2535
2534 RefPtrWillBeRawPtr<Element> parent = toElement(p); 2536 RefPtrWillBeRawPtr<Element> parent = toElement(p);
2535 RefPtrWillBeRawPtr<Node> prev = previousSibling(); 2537 RefPtrWillBeRawPtr<Node> prev = previousSibling();
2536 RefPtrWillBeRawPtr<Node> next = nextSibling(); 2538 RefPtrWillBeRawPtr<Node> next = nextSibling();
2537 2539
2538 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(html, parent.get(), AllowScriptingContent, "outerHTML", exceptionState); 2540 RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterH TML(html, parent.get(), AllowScriptingContent, "outerHTML", exceptionState);
2539 if (exceptionState.hadException()) 2541 if (exceptionState.hadException())
2540 return; 2542 return;
2541 2543
2542 parent->replaceChild(fragment.release(), this, exceptionState); 2544 parent->replaceChild(fragment.release(), this, exceptionState);
2543 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr; 2545 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr;
2544 if (!exceptionState.hadException() && node && node->isTextNode()) 2546 if (!exceptionState.hadException() && node && node->isTextNode())
2545 mergeWithNextTextNode(toText(node.get()), exceptionState); 2547 mergeWithNextTextNode(toText(node.get()), exceptionState);
2546 2548
2547 if (!exceptionState.hadException() && prev && prev->isTextNode()) 2549 if (!exceptionState.hadException() && prev && prev->isTextNode())
2548 mergeWithNextTextNode(toText(prev.get()), exceptionState); 2550 mergeWithNextTextNode(toText(prev.get()), exceptionState);
2551
2552 if (node && node->isElementNode())
2553 toElement(node)->taintElementIfFromIsolatedWorld();
2554 else
2555 parent->taintElementIfFromIsolatedWorld();
2549 } 2556 }
2550 2557
2551 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState) 2558 Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat e& exceptionState)
2552 { 2559 {
2553 if (equalIgnoringCase(where, "beforeBegin")) { 2560 if (equalIgnoringCase(where, "beforeBegin")) {
2554 if (ContainerNode* parent = this->parentNode()) { 2561 if (ContainerNode* parent = this->parentNode()) {
2555 parent->insertBefore(newChild, this, exceptionState); 2562 parent->insertBefore(newChild, this, exceptionState);
2556 if (!exceptionState.hadException()) 2563 if (!exceptionState.hadException())
2557 return newChild; 2564 return newChild;
2558 } 2565 }
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3609 if (!activityLogger) 3616 if (!activityLogger)
3610 return; 3617 return;
3611 Vector<String, 4> argv; 3618 Vector<String, 4> argv;
3612 argv.append(element); 3619 argv.append(element);
3613 argv.append(attributeName.toString()); 3620 argv.append(attributeName.toString());
3614 argv.append(oldValue); 3621 argv.append(oldValue);
3615 argv.append(newValue); 3622 argv.append(newValue);
3616 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data()); 3623 activityLogger->logEvent("blinkSetAttribute", argv.size(), argv.data());
3617 } 3624 }
3618 3625
3626 void Element::taintElementIfFromIsolatedWorld()
3627 {
3628 ASSERT(v8::Isolate::GetCurrent()->InContext());
3629 DOMWrapperWorld& currentWorld = DOMWrapperWorld::current(v8::Isolate::GetCur rent());
3630 if (currentWorld.isOfIsolatedWorldOrigin()) {
3631 TrackExceptionState exceptionState;
3632 this->setAttribute("extension-attribution", WebString(String::number(cur rentWorld.originWorldId())), exceptionState);
3633 }
3634 }
3635
3619 DEFINE_TRACE(Element) 3636 DEFINE_TRACE(Element)
3620 { 3637 {
3621 #if ENABLE(OILPAN) 3638 #if ENABLE(OILPAN)
3622 if (hasRareData()) 3639 if (hasRareData())
3623 visitor->trace(elementRareData()); 3640 visitor->trace(elementRareData());
3624 visitor->trace(m_elementData); 3641 visitor->trace(m_elementData);
3625 #endif 3642 #endif
3626 ContainerNode::trace(visitor); 3643 ContainerNode::trace(visitor);
3627 } 3644 }
3628 3645
3629 } // namespace blink 3646 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698