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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 | 356 |
357 return false; | 357 return false; |
358 } | 358 } |
359 | 359 |
360 static void printNavigationErrorMessage(const LocalFrame& frame, const KURL& act
iveURL, const char* reason) | 360 static void printNavigationErrorMessage(const LocalFrame& frame, const KURL& act
iveURL, const char* reason) |
361 { | 361 { |
362 String message = "Unsafe JavaScript attempt to initiate navigation for frame
with URL '" + frame.document()->url().string() + "' from frame with URL '" + ac
tiveURL.string() + "'. " + reason + "\n"; | 362 String message = "Unsafe JavaScript attempt to initiate navigation for frame
with URL '" + frame.document()->url().string() + "' from frame with URL '" + ac
tiveURL.string() + "'. " + reason + "\n"; |
363 | 363 |
364 // FIXME: should we print to the console of the document performing the navi
gation instead? | 364 // FIXME: should we print to the console of the document performing the navi
gation instead? |
365 frame.domWindow()->printErrorMessage(message); | 365 frame.localDOMWindow()->printErrorMessage(message); |
366 } | 366 } |
367 | 367 |
368 uint64_t Document::s_globalTreeVersion = 0; | 368 uint64_t Document::s_globalTreeVersion = 0; |
369 | 369 |
370 #ifndef NDEBUG | 370 #ifndef NDEBUG |
371 using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>; | 371 using WeakDocumentSet = WillBeHeapHashSet<RawPtrWillBeWeakMember<Document>>; |
372 static WeakDocumentSet& liveDocumentSet() | 372 static WeakDocumentSet& liveDocumentSet() |
373 { | 373 { |
374 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); | 374 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrW
illBeNoop(new WeakDocumentSet()))); |
375 return *set; | 375 return *set; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 registerObserver(document); | 437 registerObserver(document); |
438 } | 438 } |
439 | 439 |
440 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
lasses) | 440 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
lasses) |
441 : ContainerNode(0, CreateDocument) | 441 : ContainerNode(0, CreateDocument) |
442 , TreeScope(*this) | 442 , TreeScope(*this) |
443 , m_hasNodesWithPlaceholderStyle(false) | 443 , m_hasNodesWithPlaceholderStyle(false) |
444 , m_evaluateMediaQueriesOnStyleRecalc(false) | 444 , m_evaluateMediaQueriesOnStyleRecalc(false) |
445 , m_pendingSheetLayout(NoLayoutWithPendingSheets) | 445 , m_pendingSheetLayout(NoLayoutWithPendingSheets) |
446 , m_frame(initializer.frame()) | 446 , m_frame(initializer.frame()) |
447 , m_domWindow(m_frame ? m_frame->domWindow() : 0) | 447 , m_domWindow(m_frame ? m_frame->localDOMWindow() : 0) |
448 , m_importsController(initializer.importsController()) | 448 , m_importsController(initializer.importsController()) |
449 , m_activeParserCount(0) | 449 , m_activeParserCount(0) |
450 , m_contextFeatures(ContextFeatures::defaultSwitch()) | 450 , m_contextFeatures(ContextFeatures::defaultSwitch()) |
451 , m_wellFormed(false) | 451 , m_wellFormed(false) |
452 , m_printing(false) | 452 , m_printing(false) |
453 , m_paginatedForScreen(false) | 453 , m_paginatedForScreen(false) |
454 , m_compatibilityMode(NoQuirksMode) | 454 , m_compatibilityMode(NoQuirksMode) |
455 , m_compatibilityModeLocked(false) | 455 , m_compatibilityModeLocked(false) |
456 , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWa
itingForResourcesTimerFired) | 456 , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWa
itingForResourcesTimerFired) |
457 , m_hasAutofocused(false) | 457 , m_hasAutofocused(false) |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2628 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
2629 // while dispatching the event, so protect it to prevent writing the
end | 2629 // while dispatching the event, so protect it to prevent writing the
end |
2630 // time into freed memory. | 2630 // time into freed memory. |
2631 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); | 2631 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); |
2632 m_loadEventProgress = UnloadEventInProgress; | 2632 m_loadEventProgress = UnloadEventInProgress; |
2633 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); | 2633 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); |
2634 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { | 2634 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { |
2635 DocumentLoadTiming* timing = documentLoader->timing(); | 2635 DocumentLoadTiming* timing = documentLoader->timing(); |
2636 ASSERT(timing->navigationStart()); | 2636 ASSERT(timing->navigationStart()); |
2637 timing->markUnloadEventStart(); | 2637 timing->markUnloadEventStart(); |
2638 m_frame->domWindow()->dispatchEvent(unloadEvent, this); | 2638 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); |
2639 timing->markUnloadEventEnd(); | 2639 timing->markUnloadEventEnd(); |
2640 } else { | 2640 } else { |
2641 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); | 2641 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); |
2642 } | 2642 } |
2643 } | 2643 } |
2644 m_loadEventProgress = UnloadEventHandled; | 2644 m_loadEventProgress = UnloadEventHandled; |
2645 } | 2645 } |
2646 | 2646 |
2647 if (!m_frame) | 2647 if (!m_frame) |
2648 return; | 2648 return; |
2649 | 2649 |
2650 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). | 2650 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). |
2651 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() | 2651 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() |
(...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5199 m_scriptedAnimationController->cancelCallback(id); | 5199 m_scriptedAnimationController->cancelCallback(id); |
5200 } | 5200 } |
5201 | 5201 |
5202 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) | 5202 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) |
5203 { | 5203 { |
5204 if (!m_scriptedAnimationController) | 5204 if (!m_scriptedAnimationController) |
5205 return; | 5205 return; |
5206 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS
tartTime); | 5206 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS
tartTime); |
5207 } | 5207 } |
5208 | 5208 |
5209 PassRefPtrWillBeRawPtr<Touch> Document::createTouch(LocalDOMWindow* window, Even
tTarget* target, int identifier, double pageX, double pageY, double screenX, dou
ble screenY, double radiusX, double radiusY, float rotationAngle, float force) c
onst | 5209 PassRefPtrWillBeRawPtr<Touch> Document::createTouch(DOMWindow* window, EventTarg
et* target, int identifier, double pageX, double pageY, double screenX, double s
creenY, double radiusX, double radiusY, float rotationAngle, float force) const |
5210 { | 5210 { |
5211 // Match behavior from when these types were integers, and avoid surprises f
rom someone explicitly | 5211 // Match behavior from when these types were integers, and avoid surprises f
rom someone explicitly |
5212 // passing Infinity/NaN. | 5212 // passing Infinity/NaN. |
5213 if (!std::isfinite(pageX)) | 5213 if (!std::isfinite(pageX)) |
5214 pageX = 0; | 5214 pageX = 0; |
5215 if (!std::isfinite(pageY)) | 5215 if (!std::isfinite(pageY)) |
5216 pageY = 0; | 5216 pageY = 0; |
5217 if (!std::isfinite(screenX)) | 5217 if (!std::isfinite(screenX)) |
5218 screenX = 0; | 5218 screenX = 0; |
5219 if (!std::isfinite(screenY)) | 5219 if (!std::isfinite(screenY)) |
5220 screenY = 0; | 5220 screenY = 0; |
5221 if (!std::isfinite(radiusX)) | 5221 if (!std::isfinite(radiusX)) |
5222 radiusX = 0; | 5222 radiusX = 0; |
5223 if (!std::isfinite(radiusY)) | 5223 if (!std::isfinite(radiusY)) |
5224 radiusY = 0; | 5224 radiusY = 0; |
5225 if (!std::isfinite(rotationAngle)) | 5225 if (!std::isfinite(rotationAngle)) |
5226 rotationAngle = 0; | 5226 rotationAngle = 0; |
5227 if (!std::isfinite(force)) | 5227 if (!std::isfinite(force)) |
5228 force = 0; | 5228 force = 0; |
5229 | 5229 |
5230 // FIXME: It's not clear from the documentation at | 5230 // FIXME: It's not clear from the documentation at |
5231 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html | 5231 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html |
5232 // when this method should throw and nor is it by inspection of iOS behavior
. It would be nice to verify any cases where it throws under iOS | 5232 // when this method should throw and nor is it by inspection of iOS behavior
. It would be nice to verify any cases where it throws under iOS |
5233 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 | 5233 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 |
5234 LocalFrame* frame = window ? window->frame() : this->frame(); | 5234 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow(
window)->frame() : this->frame(); |
5235 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); | 5235 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); |
5236 } | 5236 } |
5237 | 5237 |
5238 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch>>& touches) const | 5238 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch>>& touches) const |
5239 { | 5239 { |
5240 return TouchList::adopt(touches); | 5240 return TouchList::adopt(touches); |
5241 } | 5241 } |
5242 | 5242 |
5243 DocumentLoader* Document::loader() const | 5243 DocumentLoader* Document::loader() const |
5244 { | 5244 { |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5825 #ifndef NDEBUG | 5825 #ifndef NDEBUG |
5826 using namespace blink; | 5826 using namespace blink; |
5827 void showLiveDocumentInstances() | 5827 void showLiveDocumentInstances() |
5828 { | 5828 { |
5829 WeakDocumentSet& set = liveDocumentSet(); | 5829 WeakDocumentSet& set = liveDocumentSet(); |
5830 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5830 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5831 for (Document* document : set) | 5831 for (Document* document : set) |
5832 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5832 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5833 } | 5833 } |
5834 #endif | 5834 #endif |
OLD | NEW |