| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con
st char* reason) | 363 static void printNavigationErrorMessage(Frame* frame, const KURL& activeURL, con
st char* reason) |
| 364 { | 364 { |
| 365 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"; | 365 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"; |
| 366 | 366 |
| 367 // FIXME: should we print to the console of the document performing the navi
gation instead? | 367 // FIXME: should we print to the console of the document performing the navi
gation instead? |
| 368 frame->document()->domWindow()->printErrorMessage(message); | 368 frame->document()->domWindow()->printErrorMessage(message); |
| 369 } | 369 } |
| 370 | 370 |
| 371 uint64_t Document::s_globalTreeVersion = 0; | 371 uint64_t Document::s_globalTreeVersion = 0; |
| 372 | 372 |
| 373 // This class should be passed only to Document::postTask. |
| 374 class CheckFocusedNodeTask FINAL : public ScriptExecutionContext::Task { |
| 375 public: |
| 376 static PassOwnPtr<CheckFocusedNodeTask> create() |
| 377 { |
| 378 return adoptPtr(new CheckFocusedNodeTask()); |
| 379 } |
| 380 virtual ~CheckFocusedNodeTask() { } |
| 381 |
| 382 private: |
| 383 CheckFocusedNodeTask() { } |
| 384 virtual void performTask(ScriptExecutionContext* context) OVERRIDE |
| 385 { |
| 386 ASSERT(context->isDocument()); |
| 387 Document* document = toDocument(context); |
| 388 document->didRunCheckFocusedNodeTask(); |
| 389 if (!document->focusedNode()) |
| 390 return; |
| 391 if (document->focusedNode()->renderer() && document->focusedNode()->rend
erer()->needsLayout()) |
| 392 return; |
| 393 if (!document->focusedNode()->isFocusable()) |
| 394 document->setFocusedNode(0); |
| 395 } |
| 396 }; |
| 397 |
| 373 Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentCla
sses) | 398 Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentCla
sses) |
| 374 : ContainerNode(0, CreateDocument) | 399 : ContainerNode(0, CreateDocument) |
| 375 , TreeScope(this) | 400 , TreeScope(this) |
| 376 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer
Fired) | 401 , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimer
Fired) |
| 377 , m_lastStyleResolverAccessTime(0) | 402 , m_lastStyleResolverAccessTime(0) |
| 378 , m_activeParserCount(0) | 403 , m_activeParserCount(0) |
| 379 , m_contextFeatures(ContextFeatures::defaultSwitch()) | 404 , m_contextFeatures(ContextFeatures::defaultSwitch()) |
| 380 , m_compatibilityMode(NoQuirksMode) | 405 , m_compatibilityMode(NoQuirksMode) |
| 381 , m_compatibilityModeLocked(false) | 406 , m_compatibilityModeLocked(false) |
| 407 , m_didPostCheckFocusedNodeTask(false) |
| 382 , m_domTreeVersion(++s_globalTreeVersion) | 408 , m_domTreeVersion(++s_globalTreeVersion) |
| 383 , m_mutationObserverTypes(0) | 409 , m_mutationObserverTypes(0) |
| 384 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this)) | 410 , m_styleSheetCollection(DocumentStyleSheetCollection::create(this)) |
| 385 , m_visitedLinkState(VisitedLinkState::create(this)) | 411 , m_visitedLinkState(VisitedLinkState::create(this)) |
| 386 , m_readyState(Complete) | 412 , m_readyState(Complete) |
| 387 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) | 413 , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) |
| 388 , m_pendingStyleRecalcShouldForce(false) | 414 , m_pendingStyleRecalcShouldForce(false) |
| 389 , m_frameElementsShouldIgnoreScrolling(false) | 415 , m_frameElementsShouldIgnoreScrolling(false) |
| 390 , m_containsValidityStyleRules(false) | 416 , m_containsValidityStyleRules(false) |
| 391 , m_updateFocusAppearanceRestoresSelection(false) | 417 , m_updateFocusAppearanceRestoresSelection(false) |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 if (Element* oe = ownerElement()) | 1726 if (Element* oe = ownerElement()) |
| 1701 oe->document()->updateLayout(); | 1727 oe->document()->updateLayout(); |
| 1702 | 1728 |
| 1703 updateStyleIfNeeded(); | 1729 updateStyleIfNeeded(); |
| 1704 | 1730 |
| 1705 StackStats::LayoutCheckPoint layoutCheckPoint; | 1731 StackStats::LayoutCheckPoint layoutCheckPoint; |
| 1706 | 1732 |
| 1707 // Only do a layout if changes have occurred that make it necessary. | 1733 // Only do a layout if changes have occurred that make it necessary. |
| 1708 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne
edsLayout())) | 1734 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne
edsLayout())) |
| 1709 frameView->layout(); | 1735 frameView->layout(); |
| 1736 |
| 1737 // FIXME: Using a Task doesn't look a good idea. |
| 1738 if (m_focusedNode && !m_didPostCheckFocusedNodeTask) { |
| 1739 postTask(CheckFocusedNodeTask::create()); |
| 1740 m_didPostCheckFocusedNodeTask = true; |
| 1741 } |
| 1710 } | 1742 } |
| 1711 | 1743 |
| 1712 // FIXME: This is a bad idea and needs to be removed eventually. | 1744 // FIXME: This is a bad idea and needs to be removed eventually. |
| 1713 // Other browsers load stylesheets before they continue parsing the web page. | 1745 // Other browsers load stylesheets before they continue parsing the web page. |
| 1714 // Since we don't, we can run JavaScript code that needs answers before the | 1746 // Since we don't, we can run JavaScript code that needs answers before the |
| 1715 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 1747 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
| 1716 // lets us get reasonable answers. The long term solution to this problem is | 1748 // lets us get reasonable answers. The long term solution to this problem is |
| 1717 // to instead suspend JavaScript execution. | 1749 // to instead suspend JavaScript execution. |
| 1718 void Document::updateLayoutIgnorePendingStylesheets() | 1750 void Document::updateLayoutIgnorePendingStylesheets() |
| 1719 { | 1751 { |
| (...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5588 return; | 5620 return; |
| 5589 | 5621 |
| 5590 Vector<RefPtr<Element> > associatedFormControls; | 5622 Vector<RefPtr<Element> > associatedFormControls; |
| 5591 copyToVector(m_associatedFormControls, associatedFormControls); | 5623 copyToVector(m_associatedFormControls, associatedFormControls); |
| 5592 | 5624 |
| 5593 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); | 5625 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); |
| 5594 m_associatedFormControls.clear(); | 5626 m_associatedFormControls.clear(); |
| 5595 } | 5627 } |
| 5596 | 5628 |
| 5597 } // namespace WebCore | 5629 } // namespace WebCore |
| OLD | NEW |