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

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

Issue 703193004: XSLT-in-PrivateScript (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 4400 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 ASSERT(newCurrentScript); 4411 ASSERT(newCurrentScript);
4412 m_currentScriptStack.append(newCurrentScript); 4412 m_currentScriptStack.append(newCurrentScript);
4413 } 4413 }
4414 4414
4415 void Document::popCurrentScript() 4415 void Document::popCurrentScript()
4416 { 4416 {
4417 ASSERT(!m_currentScriptStack.isEmpty()); 4417 ASSERT(!m_currentScriptStack.isEmpty());
4418 m_currentScriptStack.removeLast(); 4418 m_currentScriptStack.removeLast();
4419 } 4419 }
4420 4420
4421 void Document::applyXSLTransform(ProcessingInstruction* pi)
4422 {
4423 ASSERT(!pi->isLoading());
4424 UseCounter::count(*this, UseCounter::XSLProcessingInstruction);
4425 RefPtrWillBeRawPtr<XSLTProcessor> processor = XSLTProcessor::create(*this);
4426 processor->setXSLStyleSheet(toXSLStyleSheet(pi->sheet()));
4427 String resultMIMEType;
4428 String newSource;
4429 String resultEncoding;
4430 setParsing(true);
4431 if (!processor->transformToString(this, resultMIMEType, newSource, resultEnc oding)) {
4432 setParsing(false);
4433 return;
4434 }
4435 // FIXME: If the transform failed we should probably report an error (like M ozilla does).
4436 LocalFrame* ownerFrame = frame();
4437 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMETyp e, this, ownerFrame);
4438 InspectorInstrumentation::frameDocumentUpdated(ownerFrame);
4439 setParsing(false);
4440 }
4441
4442 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 4421 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
4443 { 4422 {
4444 m_transformSource = source; 4423 m_transformSource = source;
4445 } 4424 }
4446 4425
4447 void Document::setDesignMode(InheritedBool value) 4426 void Document::setDesignMode(InheritedBool value)
4448 { 4427 {
4449 m_designMode = value; 4428 m_designMode = value;
4450 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) { 4429 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) {
4451 if (!frame->isLocalFrame()) 4430 if (!frame->isLocalFrame())
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
4845 // We alias the SecurityOrigins to match Firefox, see Bug 15313 4824 // We alias the SecurityOrigins to match Firefox, see Bug 15313
4846 // https://bugs.webkit.org/show_bug.cgi?id=15313 4825 // https://bugs.webkit.org/show_bug.cgi?id=15313
4847 setSecurityOrigin(initializer.owner()->securityOrigin()); 4826 setSecurityOrigin(initializer.owner()->securityOrigin());
4848 } 4827 }
4849 4828
4850 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp) 4829 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp)
4851 { 4830 {
4852 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); 4831 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create());
4853 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) 4832 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument()))
4854 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare nt())->document()->contentSecurityPolicy()); 4833 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare nt())->document()->contentSecurityPolicy());
4855 if (transformSourceDocument())
4856 contentSecurityPolicy()->copyStateFrom(transformSourceDocument()->conten tSecurityPolicy());
4857 contentSecurityPolicy()->bindToExecutionContext(this); 4834 contentSecurityPolicy()->bindToExecutionContext(this);
4858 } 4835 }
4859 4836
4860 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine) 4837 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con st String& contextURL, const WTF::OrdinalNumber& contextLine)
4861 { 4838 {
4862 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne)) 4839 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi ne))
4863 return false; 4840 return false;
4864 4841
4865 // HTML says that inline script needs browsing context to create its executi on environment. 4842 // HTML says that inline script needs browsing context to create its executi on environment.
4866 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes 4843 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
5772 visitor->trace(m_autofocusElement); 5749 visitor->trace(m_autofocusElement);
5773 visitor->trace(m_focusedElement); 5750 visitor->trace(m_focusedElement);
5774 visitor->trace(m_hoverNode); 5751 visitor->trace(m_hoverNode);
5775 visitor->trace(m_activeHoverElement); 5752 visitor->trace(m_activeHoverElement);
5776 visitor->trace(m_documentElement); 5753 visitor->trace(m_documentElement);
5777 visitor->trace(m_titleElement); 5754 visitor->trace(m_titleElement);
5778 visitor->trace(m_markers); 5755 visitor->trace(m_markers);
5779 visitor->trace(m_cssTarget); 5756 visitor->trace(m_cssTarget);
5780 visitor->trace(m_currentScriptStack); 5757 visitor->trace(m_currentScriptStack);
5781 visitor->trace(m_scriptRunner); 5758 visitor->trace(m_scriptRunner);
5782 visitor->trace(m_transformSourceDocument);
5783 visitor->trace(m_listsInvalidatedAtDocument); 5759 visitor->trace(m_listsInvalidatedAtDocument);
5784 for (int i = 0; i < numNodeListInvalidationTypes; ++i) 5760 for (int i = 0; i < numNodeListInvalidationTypes; ++i)
5785 visitor->trace(m_nodeLists[i]); 5761 visitor->trace(m_nodeLists[i]);
5786 visitor->trace(m_cssCanvasElements); 5762 visitor->trace(m_cssCanvasElements);
5787 visitor->trace(m_topLayerElements); 5763 visitor->trace(m_topLayerElements);
5788 visitor->trace(m_elemSheet); 5764 visitor->trace(m_elemSheet);
5789 visitor->trace(m_nodeIterators); 5765 visitor->trace(m_nodeIterators);
5790 visitor->trace(m_ranges); 5766 visitor->trace(m_ranges);
5791 visitor->trace(m_styleEngine); 5767 visitor->trace(m_styleEngine);
5792 visitor->trace(m_formController); 5768 visitor->trace(m_formController);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5828 #ifndef NDEBUG 5804 #ifndef NDEBUG
5829 using namespace blink; 5805 using namespace blink;
5830 void showLiveDocumentInstances() 5806 void showLiveDocumentInstances()
5831 { 5807 {
5832 WeakDocumentSet& set = liveDocumentSet(); 5808 WeakDocumentSet& set = liveDocumentSet();
5833 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5809 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5834 for (Document* document : set) 5810 for (Document* document : set)
5835 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5811 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5836 } 5812 }
5837 #endif 5813 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698