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

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

Issue 1945563002: Set currentScript for SVGScriptElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test case Created 4 years, 7 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 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #include "core/loader/appcache/ApplicationCacheHost.h" 189 #include "core/loader/appcache/ApplicationCacheHost.h"
190 #include "core/page/ChromeClient.h" 190 #include "core/page/ChromeClient.h"
191 #include "core/page/EventWithHitTestResults.h" 191 #include "core/page/EventWithHitTestResults.h"
192 #include "core/page/FocusController.h" 192 #include "core/page/FocusController.h"
193 #include "core/page/FrameTree.h" 193 #include "core/page/FrameTree.h"
194 #include "core/page/Page.h" 194 #include "core/page/Page.h"
195 #include "core/page/PointerLockController.h" 195 #include "core/page/PointerLockController.h"
196 #include "core/page/scrolling/RootScroller.h" 196 #include "core/page/scrolling/RootScroller.h"
197 #include "core/page/scrolling/ScrollingCoordinator.h" 197 #include "core/page/scrolling/ScrollingCoordinator.h"
198 #include "core/svg/SVGDocumentExtensions.h" 198 #include "core/svg/SVGDocumentExtensions.h"
199 #include "core/svg/SVGScriptElement.h"
199 #include "core/svg/SVGTitleElement.h" 200 #include "core/svg/SVGTitleElement.h"
200 #include "core/svg/SVGUseElement.h" 201 #include "core/svg/SVGUseElement.h"
201 #include "core/timing/DOMWindowPerformance.h" 202 #include "core/timing/DOMWindowPerformance.h"
202 #include "core/timing/Performance.h" 203 #include "core/timing/Performance.h"
203 #include "core/workers/SharedWorkerRepositoryClient.h" 204 #include "core/workers/SharedWorkerRepositoryClient.h"
204 #include "core/xml/parser/XMLDocumentParser.h" 205 #include "core/xml/parser/XMLDocumentParser.h"
205 #include "platform/DateComponents.h" 206 #include "platform/DateComponents.h"
206 #include "platform/EventDispatchForbiddenScope.h" 207 #include "platform/EventDispatchForbiddenScope.h"
207 #include "platform/Histogram.h" 208 #include "platform/Histogram.h"
208 #include "platform/Language.h" 209 #include "platform/Language.h"
(...skipping 4366 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation)) 4576 if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equa lIgnoringCase(linkElement->rel(), openSearchRelation))
4576 continue; 4577 continue;
4577 if (linkElement->href().isEmpty()) 4578 if (linkElement->href().isEmpty())
4578 continue; 4579 continue;
4579 return linkElement->href(); 4580 return linkElement->href();
4580 } 4581 }
4581 4582
4582 return KURL(); 4583 return KURL();
4583 } 4584 }
4584 4585
4585 HTMLScriptElement* Document::currentScriptForBinding() const 4586 void Document::currentScriptForBinding(ScriptElement& scriptElement) const
4586 { 4587 {
4587 if (HTMLScriptElement* script = currentScript()) 4588 if (Element* script = currentScript()) {
4588 return script->isInV1ShadowTree() ? nullptr : script; 4589 if (script->isInV1ShadowTree())
4589 return nullptr; 4590 return;
4591 if (isHTMLScriptElement(script))
4592 scriptElement.setHTMLScriptElement(toHTMLScriptElement(script));
4593 else if (isSVGScriptElement(script))
4594 scriptElement.setSVGScriptElement(toSVGScriptElement(script));
4595 }
fs 2016/05/03 10:56:00 NOTREACHED()?
ramya.v 2016/05/04 04:18:41 Below test cases are failing if we put ASSERT_NOT_
fs 2016/05/04 08:42:54 Well, the placement in PS3 is definitely wrong - c
ramya.v 2016/05/04 09:35:51 Got your point. Thanks. Done.
4590 } 4596 }
4591 4597
4592 void Document::pushCurrentScript(HTMLScriptElement* newCurrentScript) 4598 void Document::pushCurrentScript(const ScriptElement& newCurrentScript)
4593 { 4599 {
4594 DCHECK(newCurrentScript); 4600 DCHECK(!newCurrentScript.isNull());
4595 m_currentScriptStack.append(newCurrentScript); 4601 Element* scriptToPush;
4602 if (newCurrentScript.isHTMLScriptElement())
4603 scriptToPush = newCurrentScript.getAsHTMLScriptElement();
4604 else
4605 scriptToPush = newCurrentScript.getAsSVGScriptElement();
4606 m_currentScriptStack.append(scriptToPush);
4596 } 4607 }
4597 4608
4598 void Document::popCurrentScript() 4609 void Document::popCurrentScript()
4599 { 4610 {
4600 DCHECK(!m_currentScriptStack.isEmpty()); 4611 DCHECK(!m_currentScriptStack.isEmpty());
4601 m_currentScriptStack.removeLast(); 4612 m_currentScriptStack.removeLast();
4602 } 4613 }
4603 4614
4604 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 4615 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
4605 { 4616 {
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
5973 #ifndef NDEBUG 5984 #ifndef NDEBUG
5974 using namespace blink; 5985 using namespace blink;
5975 void showLiveDocumentInstances() 5986 void showLiveDocumentInstances()
5976 { 5987 {
5977 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5988 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5978 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5989 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5979 for (Document* document : set) 5990 for (Document* document : set)
5980 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 5991 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
5981 } 5992 }
5982 #endif 5993 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698