| 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 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2633 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2634 // while dispatching the event, so protect it to prevent writing the
end | 2634 // while dispatching the event, so protect it to prevent writing the
end |
| 2635 // time into freed memory. | 2635 // time into freed memory. |
| 2636 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); | 2636 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); |
| 2637 m_loadEventProgress = UnloadEventInProgress; | 2637 m_loadEventProgress = UnloadEventInProgress; |
| 2638 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); | 2638 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); |
| 2639 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { | 2639 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { |
| 2640 DocumentLoadTiming* timing = documentLoader->timing(); | 2640 DocumentLoadTiming* timing = documentLoader->timing(); |
| 2641 ASSERT(timing->navigationStart()); | 2641 ASSERT(timing->navigationStart()); |
| 2642 timing->markUnloadEventStart(); | 2642 timing->markUnloadEventStart(); |
| 2643 m_frame->domWindow()->dispatchEvent(unloadEvent, this); | 2643 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, this); |
| 2644 timing->markUnloadEventEnd(); | 2644 timing->markUnloadEventEnd(); |
| 2645 } else { | 2645 } else { |
| 2646 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); | 2646 m_frame->localDOMWindow()->dispatchEvent(unloadEvent, m_frame->d
ocument()); |
| 2647 } | 2647 } |
| 2648 } | 2648 } |
| 2649 m_loadEventProgress = UnloadEventHandled; | 2649 m_loadEventProgress = UnloadEventHandled; |
| 2650 } | 2650 } |
| 2651 | 2651 |
| 2652 if (!m_frame) | 2652 if (!m_frame) |
| 2653 return; | 2653 return; |
| 2654 | 2654 |
| 2655 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). | 2655 // Don't remove event listeners from a transitional empty document (see http
s://bugs.webkit.org/show_bug.cgi?id=28716 for more information). |
| 2656 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() | 2656 bool keepEventListeners = m_frame->loader().stateMachine()->isDisplayingInit
ialEmptyDocument() && m_frame->loader().provisionalDocumentLoader() |
| (...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5205 m_scriptedAnimationController->cancelCallback(id); | 5205 m_scriptedAnimationController->cancelCallback(id); |
| 5206 } | 5206 } |
| 5207 | 5207 |
| 5208 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) | 5208 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) |
| 5209 { | 5209 { |
| 5210 if (!m_scriptedAnimationController) | 5210 if (!m_scriptedAnimationController) |
| 5211 return; | 5211 return; |
| 5212 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS
tartTime); | 5212 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS
tartTime); |
| 5213 } | 5213 } |
| 5214 | 5214 |
| 5215 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 | 5215 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 |
| 5216 { | 5216 { |
| 5217 // Match behavior from when these types were integers, and avoid surprises f
rom someone explicitly | 5217 // Match behavior from when these types were integers, and avoid surprises f
rom someone explicitly |
| 5218 // passing Infinity/NaN. | 5218 // passing Infinity/NaN. |
| 5219 if (!std::isfinite(pageX)) | 5219 if (!std::isfinite(pageX)) |
| 5220 pageX = 0; | 5220 pageX = 0; |
| 5221 if (!std::isfinite(pageY)) | 5221 if (!std::isfinite(pageY)) |
| 5222 pageY = 0; | 5222 pageY = 0; |
| 5223 if (!std::isfinite(screenX)) | 5223 if (!std::isfinite(screenX)) |
| 5224 screenX = 0; | 5224 screenX = 0; |
| 5225 if (!std::isfinite(screenY)) | 5225 if (!std::isfinite(screenY)) |
| 5226 screenY = 0; | 5226 screenY = 0; |
| 5227 if (!std::isfinite(radiusX)) | 5227 if (!std::isfinite(radiusX)) |
| 5228 radiusX = 0; | 5228 radiusX = 0; |
| 5229 if (!std::isfinite(radiusY)) | 5229 if (!std::isfinite(radiusY)) |
| 5230 radiusY = 0; | 5230 radiusY = 0; |
| 5231 if (!std::isfinite(rotationAngle)) | 5231 if (!std::isfinite(rotationAngle)) |
| 5232 rotationAngle = 0; | 5232 rotationAngle = 0; |
| 5233 if (!std::isfinite(force)) | 5233 if (!std::isfinite(force)) |
| 5234 force = 0; | 5234 force = 0; |
| 5235 | 5235 |
| 5236 // FIXME: It's not clear from the documentation at | 5236 // FIXME: It's not clear from the documentation at |
| 5237 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html | 5237 // http://developer.apple.com/library/safari/#documentation/UserExperience/R
eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html |
| 5238 // 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 | 5238 // 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 |
| 5239 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 | 5239 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781
9 |
| 5240 LocalFrame* frame = window ? window->frame() : this->frame(); | 5240 LocalFrame* frame = window && window->isLocalDOMWindow() ? toLocalDOMWindow(
window)->frame() : this->frame(); |
| 5241 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); | 5241 return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY)
, FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); |
| 5242 } | 5242 } |
| 5243 | 5243 |
| 5244 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch>>& touches) const | 5244 PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<Ref
PtrWillBeMember<Touch>>& touches) const |
| 5245 { | 5245 { |
| 5246 return TouchList::adopt(touches); | 5246 return TouchList::adopt(touches); |
| 5247 } | 5247 } |
| 5248 | 5248 |
| 5249 DocumentLoader* Document::loader() const | 5249 DocumentLoader* Document::loader() const |
| 5250 { | 5250 { |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5831 #ifndef NDEBUG | 5831 #ifndef NDEBUG |
| 5832 using namespace blink; | 5832 using namespace blink; |
| 5833 void showLiveDocumentInstances() | 5833 void showLiveDocumentInstances() |
| 5834 { | 5834 { |
| 5835 WeakDocumentSet& set = liveDocumentSet(); | 5835 WeakDocumentSet& set = liveDocumentSet(); |
| 5836 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5836 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5837 for (Document* document : set) | 5837 for (Document* document : set) |
| 5838 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5838 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5839 } | 5839 } |
| 5840 #endif | 5840 #endif |
| OLD | NEW |