| 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 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 } | 2425 } |
| 2426 | 2426 |
| 2427 // Make sure both the initial layout and reflow happen after the onload | 2427 // Make sure both the initial layout and reflow happen after the onload |
| 2428 // fires. This will improve onload scores, and other browsers do it. | 2428 // fires. This will improve onload scores, and other browsers do it. |
| 2429 // If they wanna cheat, we can too. -dwh | 2429 // If they wanna cheat, we can too. -dwh |
| 2430 | 2430 |
| 2431 if (frame()->navigationScheduler().locationChangePending() && elapsedTime()
< cLayoutScheduleThreshold) { | 2431 if (frame()->navigationScheduler().locationChangePending() && elapsedTime()
< cLayoutScheduleThreshold) { |
| 2432 // Just bail out. Before or during the onload we were shifted to another
page. | 2432 // Just bail out. Before or during the onload we were shifted to another
page. |
| 2433 // The old i-Bench suite does this. When this happens don't bother paint
ing or laying out. | 2433 // The old i-Bench suite does this. When this happens don't bother paint
ing or laying out. |
| 2434 m_loadEventProgress = LoadEventCompleted; | 2434 m_loadEventProgress = LoadEventCompleted; |
| 2435 view()->unscheduleRelayout(); | |
| 2436 return; | 2435 return; |
| 2437 } | 2436 } |
| 2438 | 2437 |
| 2439 // We used to force a synchronous display and flush here. This really isn't | 2438 // We used to force a synchronous display and flush here. This really isn't |
| 2440 // necessary and can in fact be actively harmful if pages are loading at a r
ate of > 60fps | 2439 // necessary and can in fact be actively harmful if pages are loading at a r
ate of > 60fps |
| 2441 // (if your platform is syncing flushes and limiting them to 60fps). | 2440 // (if your platform is syncing flushes and limiting them to 60fps). |
| 2442 m_overMinimumLayoutThreshold = true; | 2441 m_overMinimumLayoutThreshold = true; |
| 2443 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende
rer()->needsLayout())) { | 2442 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende
rer()->needsLayout())) { |
| 2444 updateStyleIfNeeded(); | 2443 updateStyleIfNeeded(); |
| 2445 | 2444 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 // | 2577 // |
| 2579 // (a) Only schedule a layout once the stylesheets are loaded. | 2578 // (a) Only schedule a layout once the stylesheets are loaded. |
| 2580 // (b) Only schedule layout once we have a body element. | 2579 // (b) Only schedule layout once we have a body element. |
| 2581 | 2580 |
| 2582 return (haveStylesheetsLoaded() && body()) | 2581 return (haveStylesheetsLoaded() && body()) |
| 2583 || (documentElement() && !documentElement()->hasTagName(htmlTag)); | 2582 || (documentElement() && !documentElement()->hasTagName(htmlTag)); |
| 2584 } | 2583 } |
| 2585 | 2584 |
| 2586 bool Document::shouldParserYieldAgressivelyBeforeScriptExecution() | 2585 bool Document::shouldParserYieldAgressivelyBeforeScriptExecution() |
| 2587 { | 2586 { |
| 2588 return view() && view()->layoutPending() && !minimumLayoutDelay(); | 2587 return view() && view()->layoutPending(); |
| 2589 } | |
| 2590 | |
| 2591 int Document::minimumLayoutDelay() | |
| 2592 { | |
| 2593 if (m_overMinimumLayoutThreshold) | |
| 2594 return 0; | |
| 2595 | |
| 2596 int elapsed = elapsedTime(); | |
| 2597 m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold; | |
| 2598 | |
| 2599 // We'll want to schedule the timer to fire at the minimum layout threshold. | |
| 2600 return max(0, cLayoutScheduleThreshold - elapsed); | |
| 2601 } | 2588 } |
| 2602 | 2589 |
| 2603 int Document::elapsedTime() const | 2590 int Document::elapsedTime() const |
| 2604 { | 2591 { |
| 2605 return static_cast<int>((currentTime() - m_startTime) * 1000); | 2592 return static_cast<int>((currentTime() - m_startTime) * 1000); |
| 2606 } | 2593 } |
| 2607 | 2594 |
| 2608 void Document::write(const SegmentedString& text, Document* ownerDocument) | 2595 void Document::write(const SegmentedString& text, Document* ownerDocument) |
| 2609 { | 2596 { |
| 2610 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth); | 2597 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth); |
| (...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5419 void Document::defaultEventHandler(Event* event) | 5406 void Document::defaultEventHandler(Event* event) |
| 5420 { | 5407 { |
| 5421 if (frame() && frame()->remotePlatformLayer()) { | 5408 if (frame() && frame()->remotePlatformLayer()) { |
| 5422 frame()->chromeClient().forwardInputEvent(this, event); | 5409 frame()->chromeClient().forwardInputEvent(this, event); |
| 5423 return; | 5410 return; |
| 5424 } | 5411 } |
| 5425 Node::defaultEventHandler(event); | 5412 Node::defaultEventHandler(event); |
| 5426 } | 5413 } |
| 5427 | 5414 |
| 5428 } // namespace WebCore | 5415 } // namespace WebCore |
| OLD | NEW |