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

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 841873006: All documents should have a RegistrationContext. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentInit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 , m_renderView(0) 260 , m_renderView(0)
261 #if !ENABLE(OILPAN) 261 #if !ENABLE(OILPAN)
262 , m_weakFactory(this) 262 , m_weakFactory(this)
263 #endif 263 #endif
264 , m_contextDocument(initializer.contextDocument()) 264 , m_contextDocument(initializer.contextDocument())
265 , m_loadEventDelayCount(0) 265 , m_loadEventDelayCount(0)
266 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 266 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
267 , m_didSetReferrerPolicy(false) 267 , m_didSetReferrerPolicy(false)
268 , m_referrerPolicy(ReferrerPolicyDefault) 268 , m_referrerPolicy(ReferrerPolicyDefault)
269 , m_directionSetOnDocumentElement(false) 269 , m_directionSetOnDocumentElement(false)
270 , m_registrationContext(initializer.registrationContext(this)) 270 , m_registrationContext(initializer.registrationContext())
271 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 271 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
272 , m_timeline(AnimationTimeline::create(this)) 272 , m_timeline(AnimationTimeline::create(this))
273 , m_templateDocumentHost(nullptr) 273 , m_templateDocumentHost(nullptr)
274 , m_hasViewportUnits(false) 274 , m_hasViewportUnits(false)
275 , m_styleRecalcElementCounter(0) 275 , m_styleRecalcElementCounter(0)
276 { 276 {
277 setClient(this); 277 setClient(this);
278 278
279 if (!m_registrationContext)
280 m_registrationContext = CustomElementRegistrationContext::create();
281
279 m_fetcher = ResourceFetcher::create(this); 282 m_fetcher = ResourceFetcher::create(this);
280 283
281 // We depend on the url getting immediately set in subframes, but we 284 // We depend on the url getting immediately set in subframes, but we
282 // also depend on the url NOT getting immediately set in opened windows. 285 // also depend on the url NOT getting immediately set in opened windows.
283 // See fast/dom/early-frame-url.html 286 // See fast/dom/early-frame-url.html
284 // and fast/dom/location-new-window-no-crash.html, respectively. 287 // and fast/dom/location-new-window-no-crash.html, respectively.
285 // FIXME: Can/should we unify this behavior? 288 // FIXME: Can/should we unify this behavior?
286 if (initializer.shouldSetURL()) 289 if (initializer.shouldSetURL())
287 setURL(initializer.url()); 290 setURL(initializer.url());
288 291
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return Element::create(QualifiedName(name), this); 446 return Element::create(QualifiedName(name), this);
444 } 447 }
445 448
446 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri ng& name, ExceptionState& exceptionState) 449 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri ng& name, ExceptionState& exceptionState)
447 { 450 {
448 return registerElement(scriptState, name, Dictionary(), exceptionState); 451 return registerElement(scriptState, name, Dictionary(), exceptionState);
449 } 452 }
450 453
451 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri ng& name, const Dictionary& options, ExceptionState& exceptionState) 454 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri ng& name, const Dictionary& options, ExceptionState& exceptionState)
452 { 455 {
453 if (!registrationContext()) {
454 exceptionState.throwDOMException(NotSupportedError, "No element registra tion context is available.");
455 return ScriptValue();
456 }
457
458 CustomElementConstructorBuilder constructorBuilder(scriptState, &options); 456 CustomElementConstructorBuilder constructorBuilder(scriptState, &options);
459 registrationContext()->registerElement(this, &constructorBuilder, name, exce ptionState); 457 registrationContext().registerElement(this, &constructorBuilder, name, excep tionState);
460 return constructorBuilder.bindingsReturnValue(); 458 return constructorBuilder.bindingsReturnValue();
461 } 459 }
462 460
463 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() 461 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue()
464 { 462 {
465 if (!m_customElementMicrotaskRunQueue) 463 if (!m_customElementMicrotaskRunQueue)
466 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e(); 464 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e();
467 return m_customElementMicrotaskRunQueue.get(); 465 return m_customElementMicrotaskRunQueue.get();
468 } 466 }
469 467
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 2550
2553 Document& Document::ensureTemplateDocument() 2551 Document& Document::ensureTemplateDocument()
2554 { 2552 {
2555 if (isTemplateDocument()) 2553 if (isTemplateDocument())
2556 return *this; 2554 return *this;
2557 2555
2558 if (m_templateDocument) 2556 if (m_templateDocument)
2559 return *m_templateDocument; 2557 return *m_templateDocument;
2560 2558
2561 if (isHTMLDocument()) { 2559 if (isHTMLDocument()) {
2562 DocumentInit init = DocumentInit::fromContext(contextDocument(), blankUR L()).withNewRegistrationContext(); 2560 DocumentInit init = DocumentInit::fromContext(contextDocument(), blankUR L());
2563 m_templateDocument = HTMLDocument::create(init); 2561 m_templateDocument = HTMLDocument::create(init);
2564 } else { 2562 } else {
2565 m_templateDocument = Document::create(DocumentInit(blankURL())); 2563 m_templateDocument = Document::create(DocumentInit(blankURL()));
2566 } 2564 }
2567 2565
2568 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. 2566 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor.
2569 2567
2570 return *m_templateDocument.get(); 2568 return *m_templateDocument.get();
2571 } 2569 }
2572 2570
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 using namespace blink; 2638 using namespace blink;
2641 void showLiveDocumentInstances() 2639 void showLiveDocumentInstances()
2642 { 2640 {
2643 WeakDocumentSet& set = liveDocumentSet(); 2641 WeakDocumentSet& set = liveDocumentSet();
2644 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2642 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2645 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2643 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2646 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2644 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2647 } 2645 }
2648 } 2646 }
2649 #endif 2647 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentInit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698