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

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

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

Powered by Google App Engine
This is Rietveld 408576698