Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index a5dddea9ff27a0d1ab8a4d19beb42ad0897e3fd2..5e0cb8ac994377e500eb8571d4c0b588555c7b2b 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -152,6 +152,7 @@ |
#include "core/platform/DateComponents.h" |
#include "core/platform/HistogramSupport.h" |
#include "core/platform/Language.h" |
+#include "core/platform/ScrollbarTheme.h" |
#include "core/platform/Timer.h" |
#include "core/platform/chromium/TraceEvent.h" |
#include "core/platform/network/HTTPParsers.h" |
@@ -1747,6 +1748,9 @@ void Document::updateLayout() |
if (frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout())) |
frameView->layout(); |
+ if (frameView) |
+ frameView->resetPartialLayoutState(); |
+ |
setNeedsFocusedElementCheck(); |
} |
@@ -1759,37 +1763,69 @@ void Document::setNeedsFocusedElementCheck() |
m_didPostCheckFocusedElementTask = true; |
} |
-// FIXME: This is a bad idea and needs to be removed eventually. |
-// Other browsers load stylesheets before they continue parsing the web page. |
-// Since we don't, we can run JavaScript code that needs answers before the |
-// stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
-// lets us get reasonable answers. The long term solution to this problem is |
-// to instead suspend JavaScript execution. |
-void Document::updateLayoutIgnorePendingStylesheets() |
+void Document::recalcStyleForLayoutIgnoringPendingStylesheets() |
{ |
- bool oldIgnore = m_ignorePendingStylesheets; |
- |
if (!haveStylesheetsLoaded()) { |
m_ignorePendingStylesheets = true; |
- // FIXME: We are willing to attempt to suppress painting with outdated style info only once. Our assumption is that it would be |
- // dangerous to try to stop it a second time, after page content has already been loaded and displayed |
- // with accurate style information. (Our suppression involves blanking the whole page at the |
- // moment. If it were more refined, we might be able to do something better.) |
- // It's worth noting though that this entire method is a hack, since what we really want to do is |
- // suspend JS instead of doing a layout with inaccurate information. |
+ // FIXME: We are willing to attempt to suppress painting with outdated style info only once. |
+ // Our assumption is that it would be dangerous to try to stop it a second time, after page |
+ // content has already been loaded and displayed with accurate style information. (Our |
+ // suppression involves blanking the whole page at the moment. If it were more refined, we |
+ // might be able to do something better.) It's worth noting though that this entire method |
+ // is a hack, since what we really want to do is suspend JS instead of doing a layout with |
+ // inaccurate information. |
HTMLElement* bodyElement = body(); |
if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) { |
m_pendingSheetLayout = DidLayoutWithPendingSheets; |
styleResolverChanged(RecalcStyleImmediately); |
} else if (m_hasNodesWithPlaceholderStyle) |
- // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes |
- // may not have had their real style calculated yet. Normally this gets cleaned when style sheets arrive |
- // but here we need up-to-date style immediately. |
+ // If new nodes have been added or style recalc has been done with style sheets still |
+ // pending, some nodes may not have had their real style calculated yet. Normally this |
+ // gets cleaned when style sheets arrive but here we need up-to-date style immediately. |
recalcStyle(Force); |
} |
+} |
+// FIXME: This is a bad idea and needs to be removed eventually. |
+// Other browsers load stylesheets before they continue parsing the web page. |
+// Since we don't, we can run JavaScript code that needs answers before the |
+// stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
+// lets us get reasonable answers. The long term solution to this problem is |
+// to instead suspend JavaScript execution. |
+void Document::updateLayoutIgnorePendingStylesheets() |
+{ |
+ bool oldIgnore = m_ignorePendingStylesheets; |
esprehn
2013/08/23 20:47:27
You should switch this to a TemporaryChange<bool>
pdr.
2013/08/26 05:50:40
Done
|
+ recalcStyleForLayoutIgnoringPendingStylesheets(); |
updateLayout(); |
+ m_ignorePendingStylesheets = oldIgnore; |
+} |
+void Document::partialUpdateLayoutIgnorePendingStylesheets(Node* stopLayoutAtNode) |
+{ |
+ bool oldIgnore = m_ignorePendingStylesheets; |
esprehn
2013/08/23 20:47:27
Ditto
pdr.
2013/08/26 05:50:40
Done.
|
+ recalcStyleForLayoutIgnoringPendingStylesheets(); |
+ |
+ if (stopLayoutAtNode) { |
+ // Non-overlay scrollbars can cause layout during layout. |
+ // FIXME: REMOVE THIS 'true' BEFORE LANDING. This allows linux to run partiallayout |
+ // performance tests, even though it's only valid for OSX and Android. |
+ if (true || ScrollbarTheme::theme()->usesOverlayScrollbars()) { |
+ // FIXME: Text autosizing will not work with partial layout. |
+ bool canPartialLayout = true; |
+ RenderObject* renderer = stopLayoutAtNode->renderer(); |
+ while (renderer) { |
+ if (!renderer->supportsPartialLayout()) { |
+ canPartialLayout = false; |
+ break; |
+ } |
+ renderer = renderer->parent(); |
+ } |
+ if (canPartialLayout) |
+ view()->setStopLayoutAtRenderer(stopLayoutAtNode->renderer()); |
+ } |
+ } |
+ |
+ updateLayout(); |
m_ignorePendingStylesheets = oldIgnore; |
} |