OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "sky/engine/core/dom/NodeRenderingTraversal.h" | 60 #include "sky/engine/core/dom/NodeRenderingTraversal.h" |
61 #include "sky/engine/core/dom/NodeTraversal.h" | 61 #include "sky/engine/core/dom/NodeTraversal.h" |
62 #include "sky/engine/core/dom/NodeWithIndex.h" | 62 #include "sky/engine/core/dom/NodeWithIndex.h" |
63 #include "sky/engine/core/dom/RequestAnimationFrameCallback.h" | 63 #include "sky/engine/core/dom/RequestAnimationFrameCallback.h" |
64 #include "sky/engine/core/dom/ScriptedAnimationController.h" | 64 #include "sky/engine/core/dom/ScriptedAnimationController.h" |
65 #include "sky/engine/core/dom/SelectorQuery.h" | 65 #include "sky/engine/core/dom/SelectorQuery.h" |
66 #include "sky/engine/core/dom/StaticNodeList.h" | 66 #include "sky/engine/core/dom/StaticNodeList.h" |
67 #include "sky/engine/core/dom/StyleEngine.h" | 67 #include "sky/engine/core/dom/StyleEngine.h" |
68 #include "sky/engine/core/dom/Text.h" | 68 #include "sky/engine/core/dom/Text.h" |
69 #include "sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.h" | 69 #include "sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.h" |
70 #include "sky/engine/core/dom/custom/CustomElementRegistrationContext.h" | 70 #include "sky/engine/core/dom/custom2/new_custom_element_registry.h" |
71 #include "sky/engine/core/dom/shadow/ElementShadow.h" | 71 #include "sky/engine/core/dom/shadow/ElementShadow.h" |
72 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 72 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
73 #include "sky/engine/core/editing/FrameSelection.h" | 73 #include "sky/engine/core/editing/FrameSelection.h" |
74 #include "sky/engine/core/editing/SpellChecker.h" | 74 #include "sky/engine/core/editing/SpellChecker.h" |
75 #include "sky/engine/core/events/Event.h" | 75 #include "sky/engine/core/events/Event.h" |
76 #include "sky/engine/core/events/EventListener.h" | 76 #include "sky/engine/core/events/EventListener.h" |
77 #include "sky/engine/core/events/HashChangeEvent.h" | 77 #include "sky/engine/core/events/HashChangeEvent.h" |
78 #include "sky/engine/core/events/PageTransitionEvent.h" | 78 #include "sky/engine/core/events/PageTransitionEvent.h" |
79 #include "sky/engine/core/events/ScopedEventQueue.h" | 79 #include "sky/engine/core/events/ScopedEventQueue.h" |
80 #include "sky/engine/core/fetch/ResourceFetcher.h" | 80 #include "sky/engine/core/fetch/ResourceFetcher.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 , m_startTime(currentTime()) | 243 , m_startTime(currentTime()) |
244 , m_renderView(0) | 244 , m_renderView(0) |
245 #if !ENABLE(OILPAN) | 245 #if !ENABLE(OILPAN) |
246 , m_weakFactory(this) | 246 , m_weakFactory(this) |
247 #endif | 247 #endif |
248 , m_contextDocument(initializer.contextDocument()) | 248 , m_contextDocument(initializer.contextDocument()) |
249 , m_loadEventDelayCount(0) | 249 , m_loadEventDelayCount(0) |
250 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 250 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
251 , m_didSetReferrerPolicy(false) | 251 , m_didSetReferrerPolicy(false) |
252 , m_referrerPolicy(ReferrerPolicyDefault) | 252 , m_referrerPolicy(ReferrerPolicyDefault) |
253 , m_registrationContext(initializer.registrationContext()) | 253 , m_elementRegistry(initializer.elementRegistry()) |
254 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) | 254 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) |
255 , m_timeline(AnimationTimeline::create(this)) | 255 , m_timeline(AnimationTimeline::create(this)) |
256 , m_templateDocumentHost(nullptr) | 256 , m_templateDocumentHost(nullptr) |
257 , m_hasViewportUnits(false) | 257 , m_hasViewportUnits(false) |
258 , m_styleRecalcElementCounter(0) | 258 , m_styleRecalcElementCounter(0) |
259 { | 259 { |
260 setClient(this); | 260 setClient(this); |
261 | 261 |
262 if (!m_registrationContext) | 262 if (!m_elementRegistry) |
263 m_registrationContext = CustomElementRegistrationContext::create(); | 263 m_elementRegistry = NewCustomElementRegistry::Create(); |
264 | 264 |
265 m_fetcher = ResourceFetcher::create(this); | 265 m_fetcher = ResourceFetcher::create(this); |
266 | 266 |
267 // We depend on the url getting immediately set in subframes, but we | 267 // We depend on the url getting immediately set in subframes, but we |
268 // also depend on the url NOT getting immediately set in opened windows. | 268 // also depend on the url NOT getting immediately set in opened windows. |
269 // See fast/dom/early-frame-url.html | 269 // See fast/dom/early-frame-url.html |
270 // and fast/dom/location-new-window-no-crash.html, respectively. | 270 // and fast/dom/location-new-window-no-crash.html, respectively. |
271 // FIXME: Can/should we unify this behavior? | 271 // FIXME: Can/should we unify this behavior? |
272 if (initializer.shouldSetURL()) | 272 if (initializer.shouldSetURL()) |
273 setURL(initializer.url()); | 273 setURL(initializer.url()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 #endif | 331 #endif |
332 | 332 |
333 setClient(0); | 333 setClient(0); |
334 | 334 |
335 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); | 335 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); |
336 } | 336 } |
337 | 337 |
338 PassRefPtr<Document> Document::create(Document& document) | 338 PassRefPtr<Document> Document::create(Document& document) |
339 { | 339 { |
340 DocumentInit init = DocumentInit::fromContext(document.contextDocument()) | 340 DocumentInit init = DocumentInit::fromContext(document.contextDocument()) |
341 .withRegistrationContext(document.registrationContext()); | 341 .withElementRegistry(document.elementRegistry()); |
342 return adoptRef(new Document(init)); | 342 return adoptRef(new Document(init)); |
343 } | 343 } |
344 | 344 |
345 #if !ENABLE(OILPAN) | 345 #if !ENABLE(OILPAN) |
346 void Document::dispose() | 346 void Document::dispose() |
347 { | 347 { |
348 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); | 348 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); |
349 | 349 |
350 // We must make sure not to be retaining any of our children through | 350 // We must make sure not to be retaining any of our children through |
351 // these extra pointers or we will create a reference cycle. | 351 // these extra pointers or we will create a reference cycle. |
352 m_focusedElement = nullptr; | 352 m_focusedElement = nullptr; |
353 m_hoverNode = nullptr; | 353 m_hoverNode = nullptr; |
354 m_activeHoverElement = nullptr; | 354 m_activeHoverElement = nullptr; |
355 m_titleElement = nullptr; | 355 m_titleElement = nullptr; |
356 m_userActionElements.documentDidRemoveLastRef(); | 356 m_userActionElements.documentDidRemoveLastRef(); |
357 | 357 |
358 detachParser(); | 358 detachParser(); |
359 | 359 |
360 m_registrationContext.clear(); | 360 m_elementRegistry.clear(); |
361 | 361 |
362 if (m_importsController) | 362 if (m_importsController) |
363 HTMLImportsController::removeFrom(*this); | 363 HTMLImportsController::removeFrom(*this); |
364 | 364 |
365 // removeDetachedChildren() doesn't always unregister IDs, | 365 // removeDetachedChildren() doesn't always unregister IDs, |
366 // so tear down scope information upfront to avoid having stale references i
n the map. | 366 // so tear down scope information upfront to avoid having stale references i
n the map. |
367 destroyTreeScopeData(); | 367 destroyTreeScopeData(); |
368 | 368 |
369 removeDetachedChildren(); | 369 removeDetachedChildren(); |
370 | 370 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS
tate& exceptionState) | 411 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS
tate& exceptionState) |
412 { | 412 { |
413 if (!isValidName(name)) { | 413 if (!isValidName(name)) { |
414 exceptionState.ThrowDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 414 exceptionState.ThrowDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
415 return nullptr; | 415 return nullptr; |
416 } | 416 } |
417 | 417 |
418 return HTMLElementFactory::createElement(name, *this, false); | 418 return HTMLElementFactory::createElement(name, *this, false); |
419 } | 419 } |
420 | 420 |
421 PassRefPtr<DartValue> Document::registerElement(DartState*, const AtomicString&
name, ExceptionState& exceptionState) | 421 void Document::registerElement(const AtomicString& name, PassRefPtr<DartValue> t
ype, ExceptionState& es) |
422 { | 422 { |
423 // TODO(abarth): Add back custom elment registration. | 423 m_elementRegistry->RegisterElement(name, type); |
424 return DartValue::Create(); | |
425 } | 424 } |
426 | 425 |
427 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() | 426 CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() |
428 { | 427 { |
429 if (!m_customElementMicrotaskRunQueue) | 428 if (!m_customElementMicrotaskRunQueue) |
430 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); | 429 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); |
431 return m_customElementMicrotaskRunQueue.get(); | 430 return m_customElementMicrotaskRunQueue.get(); |
432 } | 431 } |
433 | 432 |
434 void Document::setImportsController(HTMLImportsController* controller) | 433 void Document::setImportsController(HTMLImportsController* controller) |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 PassRefPtr<Node> Document::cloneNode(bool deep) | 1455 PassRefPtr<Node> Document::cloneNode(bool deep) |
1457 { | 1456 { |
1458 RefPtr<Document> clone = cloneDocumentWithoutChildren(); | 1457 RefPtr<Document> clone = cloneDocumentWithoutChildren(); |
1459 if (deep) | 1458 if (deep) |
1460 cloneChildNodes(clone.get()); | 1459 cloneChildNodes(clone.get()); |
1461 return clone.release(); | 1460 return clone.release(); |
1462 } | 1461 } |
1463 | 1462 |
1464 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() | 1463 PassRefPtr<Document> Document::cloneDocumentWithoutChildren() |
1465 { | 1464 { |
1466 return create(DocumentInit(url()).withRegistrationContext(registrationContex
t())); | 1465 return create(DocumentInit(url()).withElementRegistry(elementRegistry())); |
1467 } | 1466 } |
1468 | 1467 |
1469 void Document::evaluateMediaQueryListIfNeeded() | 1468 void Document::evaluateMediaQueryListIfNeeded() |
1470 { | 1469 { |
1471 if (!m_evaluateMediaQueriesOnStyleRecalc) | 1470 if (!m_evaluateMediaQueriesOnStyleRecalc) |
1472 return; | 1471 return; |
1473 evaluateMediaQueryList(); | 1472 evaluateMediaQueryList(); |
1474 m_evaluateMediaQueriesOnStyleRecalc = false; | 1473 m_evaluateMediaQueriesOnStyleRecalc = false; |
1475 } | 1474 } |
1476 | 1475 |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 using namespace blink; | 2223 using namespace blink; |
2225 void showLiveDocumentInstances() | 2224 void showLiveDocumentInstances() |
2226 { | 2225 { |
2227 WeakDocumentSet& set = liveDocumentSet(); | 2226 WeakDocumentSet& set = liveDocumentSet(); |
2228 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2227 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
2229 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2228 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
2230 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2229 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
2231 } | 2230 } |
2232 } | 2231 } |
2233 #endif | 2232 #endif |
OLD | NEW |