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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con st char* reason) | 377 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con st char* reason) |
378 { | 378 { |
379 String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + frame->document()->url().string() + "' from frame with URL '" + a ctiveURL.string() + "'. " + reason + "\n"; | 379 String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + frame->document()->url().string() + "' from frame with URL '" + a ctiveURL.string() + "'. " + reason + "\n"; |
380 | 380 |
381 // FIXME: should we print to the console of the document performing the navi gation instead? | 381 // FIXME: should we print to the console of the document performing the navi gation instead? |
382 frame->document()->domWindow()->printErrorMessage(message); | 382 frame->document()->domWindow()->printErrorMessage(message); |
383 } | 383 } |
384 | 384 |
385 uint64_t Document::s_globalTreeVersion = 0; | 385 uint64_t Document::s_globalTreeVersion = 0; |
386 | 386 |
387 // This class should be passed only to Document::postTask. | |
388 class FocusedNodeChecker: public ScriptExecutionContext::Task { | |
esprehn
2013/05/20 22:03:44
Missing a space before : and this should be FINAL
tkent
2013/05/20 22:29:45
Done.
| |
389 public: | |
390 static PassOwnPtr<FocusedNodeChecker> create() | |
391 { | |
392 return adoptPtr(new FocusedNodeChecker()); | |
393 } | |
394 virtual ~FocusedNodeChecker() { } | |
395 | |
396 private: | |
397 FocusedNodeChecker() { } | |
esprehn
2013/05/20 22:03:44
It be nicer if this was called CheckFocusedNodeTas
tkent
2013/05/20 22:29:45
Done.
| |
398 virtual void performTask(ScriptExecutionContext* context) OVERRIDE | |
399 { | |
400 ASSERT(context->isDocument()); | |
401 Document* document = toDocument(context); | |
402 document->didRunFocusedNodeCheker(); | |
403 if (document->focusedNode() && !document->focusedNode()->isFocusable()) | |
404 document->setFocusedNode(0); | |
405 } | |
406 }; | |
407 | |
387 Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) | 408 Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) |
388 : ContainerNode(0, CreateDocument) | 409 : ContainerNode(0, CreateDocument) |
389 , TreeScope(this) | 410 , TreeScope(this) |
390 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired) | 411 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer Fired) |
391 , m_lastStyleResolverAccessTime(0) | 412 , m_lastStyleResolverAccessTime(0) |
392 , m_activeParserCount(0) | 413 , m_activeParserCount(0) |
393 , m_contextFeatures(ContextFeatures::defaultSwitch()) | 414 , m_contextFeatures(ContextFeatures::defaultSwitch()) |
394 , m_compatibilityMode(NoQuirksMode) | 415 , m_compatibilityMode(NoQuirksMode) |
395 , m_compatibilityModeLocked(false) | 416 , m_compatibilityModeLocked(false) |
417 , m_didPostFocusedNodeChecker(false) | |
396 , m_domTreeVersion(++s_globalTreeVersion) | 418 , m_domTreeVersion(++s_globalTreeVersion) |
397 , m_mutationObserverTypes(0) | 419 , m_mutationObserverTypes(0) |
398 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this)) | 420 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this)) |
399 , m_visitedLinkState(VisitedLinkState::create(this)) | 421 , m_visitedLinkState(VisitedLinkState::create(this)) |
400 , m_readyState(Complete) | 422 , m_readyState(Complete) |
401 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) | 423 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) |
402 , m_pendingStyleRecalcShouldForce(false) | 424 , m_pendingStyleRecalcShouldForce(false) |
403 , m_frameElementsShouldIgnoreScrolling(false) | 425 , m_frameElementsShouldIgnoreScrolling(false) |
404 , m_containsValidityStyleRules(false) | 426 , m_containsValidityStyleRules(false) |
405 , m_updateFocusAppearanceRestoresSelection(false) | 427 , m_updateFocusAppearanceRestoresSelection(false) |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1801 if (Element* oe = ownerElement()) | 1823 if (Element* oe = ownerElement()) |
1802 oe->document()->updateLayout(); | 1824 oe->document()->updateLayout(); |
1803 | 1825 |
1804 updateStyleIfNeeded(); | 1826 updateStyleIfNeeded(); |
1805 | 1827 |
1806 StackStats::LayoutCheckPoint layoutCheckPoint; | 1828 StackStats::LayoutCheckPoint layoutCheckPoint; |
1807 | 1829 |
1808 // Only do a layout if changes have occurred that make it necessary. | 1830 // Only do a layout if changes have occurred that make it necessary. |
1809 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout())) | 1831 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout())) |
1810 frameView->layout(); | 1832 frameView->layout(); |
1833 | |
1834 if (m_focusedNode && !m_didPostFocusedNodeChecker) { | |
1835 postTask(FocusedNodeChecker::create()); | |
1836 m_didPostFocusedNodeChecker = true; | |
1837 } | |
1811 } | 1838 } |
1812 | 1839 |
1813 // FIXME: This is a bad idea and needs to be removed eventually. | 1840 // FIXME: This is a bad idea and needs to be removed eventually. |
1814 // Other browsers load stylesheets before they continue parsing the web page. | 1841 // Other browsers load stylesheets before they continue parsing the web page. |
1815 // Since we don't, we can run JavaScript code that needs answers before the | 1842 // Since we don't, we can run JavaScript code that needs answers before the |
1816 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 1843 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
1817 // lets us get reasonable answers. The long term solution to this problem is | 1844 // lets us get reasonable answers. The long term solution to this problem is |
1818 // to instead suspend JavaScript execution. | 1845 // to instead suspend JavaScript execution. |
1819 void Document::updateLayoutIgnorePendingStylesheets() | 1846 void Document::updateLayoutIgnorePendingStylesheets() |
1820 { | 1847 { |
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5890 return; | 5917 return; |
5891 | 5918 |
5892 Vector<RefPtr<Element> > associatedFormControls; | 5919 Vector<RefPtr<Element> > associatedFormControls; |
5893 copyToVector(m_associatedFormControls, associatedFormControls); | 5920 copyToVector(m_associatedFormControls, associatedFormControls); |
5894 | 5921 |
5895 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); | 5922 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); |
5896 m_associatedFormControls.clear(); | 5923 m_associatedFormControls.clear(); |
5897 } | 5924 } |
5898 | 5925 |
5899 } // namespace WebCore | 5926 } // namespace WebCore |
OLD | NEW |