Chromium Code Reviews| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2283 | 2283 |
| 2284 // The layout system may perform layouts with pending stylesheets. When | 2284 // The layout system may perform layouts with pending stylesheets. When |
| 2285 // recording first layout time, we ignore these layouts, since painting is | 2285 // recording first layout time, we ignore these layouts, since painting is |
| 2286 // suppressed for them. We're interested in tracking the time of the | 2286 // suppressed for them. We're interested in tracking the time of the |
| 2287 // first real or 'paintable' layout. | 2287 // first real or 'paintable' layout. |
| 2288 // TODO(esprehn): This doesn't really make sense, why not track the first | 2288 // TODO(esprehn): This doesn't really make sense, why not track the first |
| 2289 // beginFrame? This will catch the first layout in a page that does lots | 2289 // beginFrame? This will catch the first layout in a page that does lots |
| 2290 // of layout thrashing even though that layout might not be followed by | 2290 // of layout thrashing even though that layout might not be followed by |
| 2291 // a paint for many seconds. | 2291 // a paint for many seconds. |
| 2292 if (IsRenderingReady() && body() && | 2292 if (IsRenderingReady() && body() && |
| 2293 !GetStyleEngine().HasPendingScriptBlockingSheets()) { | 2293 !GetStyleEngine().HasPendingRenderBlockingSheets()) { |
|
rune
2017/05/11 19:40:53
Not sure if I fully wrapped my head around the com
Pat Meenan
2017/05/11 20:25:29
Good point. The main issue with IsRenderingReady
rune
2017/05/11 22:06:10
Thanks for the clarification. Don't you also need
Pat Meenan
2017/05/12 13:24:08
I was largely trying to carry-over the existing be
| |
| 2294 if (!document_timing_.FirstLayout()) | 2294 if (!document_timing_.FirstLayout()) |
| 2295 document_timing_.MarkFirstLayout(); | 2295 document_timing_.MarkFirstLayout(); |
| 2296 } | 2296 } |
| 2297 | 2297 |
| 2298 root_scroller_controller_->DidUpdateLayout(); | 2298 root_scroller_controller_->DidUpdateLayout(); |
| 2299 } | 2299 } |
| 2300 | 2300 |
| 2301 void Document::ClearFocusedElementSoon() { | 2301 void Document::ClearFocusedElementSoon() { |
| 2302 if (!clear_focused_element_timer_.IsActive()) | 2302 if (!clear_focused_element_timer_.IsActive()) |
| 2303 clear_focused_element_timer_.StartOneShot(0, BLINK_FROM_HERE); | 2303 clear_focused_element_timer_.StartOneShot(0, BLINK_FROM_HERE); |
| 2304 } | 2304 } |
| 2305 | 2305 |
| 2306 void Document::ClearFocusedElementTimerFired(TimerBase*) { | 2306 void Document::ClearFocusedElementTimerFired(TimerBase*) { |
| 2307 UpdateStyleAndLayoutTree(); | 2307 UpdateStyleAndLayoutTree(); |
| 2308 | 2308 |
| 2309 if (focused_element_ && !focused_element_->IsFocusable()) | 2309 if (focused_element_ && !focused_element_->IsFocusable()) |
| 2310 focused_element_->blur(); | 2310 focused_element_->blur(); |
| 2311 } | 2311 } |
| 2312 | 2312 |
| 2313 // FIXME: This is a bad idea and needs to be removed eventually. | 2313 // FIXME: This is a bad idea and needs to be removed eventually. |
| 2314 // Other browsers load stylesheets before they continue parsing the web page. | 2314 // Other browsers load stylesheets before they continue parsing the web page. |
| 2315 // Since we don't, we can run JavaScript code that needs answers before the | 2315 // Since we don't, we can run JavaScript code that needs answers before the |
| 2316 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 2316 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
| 2317 // lets us get reasonable answers. The long term solution to this problem is | 2317 // lets us get reasonable answers. The long term solution to this problem is |
| 2318 // to instead suspend JavaScript execution. | 2318 // to instead suspend JavaScript execution. |
| 2319 void Document::UpdateStyleAndLayoutTreeIgnorePendingStylesheets() { | 2319 void Document::UpdateStyleAndLayoutTreeIgnorePendingStylesheets() { |
| 2320 StyleEngine::IgnoringPendingStylesheet ignoring(GetStyleEngine()); | 2320 StyleEngine::IgnoringPendingStylesheet ignoring(GetStyleEngine()); |
| 2321 | 2321 |
| 2322 if (GetStyleEngine().HasPendingScriptBlockingSheets()) { | 2322 if (GetStyleEngine().HasPendingRenderBlockingSheets()) { |
| 2323 // FIXME: We are willing to attempt to suppress painting with outdated style | 2323 // FIXME: We are willing to attempt to suppress painting with outdated style |
| 2324 // info only once. Our assumption is that it would be dangerous to try to | 2324 // info only once. Our assumption is that it would be dangerous to try to |
| 2325 // stop it a second time, after page content has already been loaded and | 2325 // stop it a second time, after page content has already been loaded and |
| 2326 // displayed with accurate style information. (Our suppression involves | 2326 // displayed with accurate style information. (Our suppression involves |
| 2327 // blanking the whole page at the moment. If it were more refined, we might | 2327 // blanking the whole page at the moment. If it were more refined, we might |
| 2328 // be able to do something better.) It's worth noting though that this | 2328 // be able to do something better.) It's worth noting though that this |
| 2329 // entire method is a hack, since what we really want to do is suspend JS | 2329 // entire method is a hack, since what we really want to do is suspend JS |
| 2330 // instead of doing a layout with inaccurate information. | 2330 // instead of doing a layout with inaccurate information. |
| 2331 HTMLElement* body_element = body(); | 2331 HTMLElement* body_element = body(); |
| 2332 if (body_element && !body_element->GetLayoutObject() && | 2332 if (body_element && !body_element->GetLayoutObject() && |
| (...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4049 } | 4049 } |
| 4050 | 4050 |
| 4051 void Document::StyleResolverMayHaveChanged() { | 4051 void Document::StyleResolverMayHaveChanged() { |
| 4052 if (HasNodesWithPlaceholderStyle()) { | 4052 if (HasNodesWithPlaceholderStyle()) { |
| 4053 SetNeedsStyleRecalc(kSubtreeStyleChange, | 4053 SetNeedsStyleRecalc(kSubtreeStyleChange, |
| 4054 StyleChangeReasonForTracing::Create( | 4054 StyleChangeReasonForTracing::Create( |
| 4055 StyleChangeReason::kCleanupPlaceholderStyles)); | 4055 StyleChangeReason::kCleanupPlaceholderStyles)); |
| 4056 } | 4056 } |
| 4057 | 4057 |
| 4058 if (DidLayoutWithPendingStylesheets() && | 4058 if (DidLayoutWithPendingStylesheets() && |
| 4059 !GetStyleEngine().HasPendingScriptBlockingSheets()) { | 4059 !GetStyleEngine().HasPendingRenderBlockingSheets()) { |
| 4060 // We need to manually repaint because we avoid doing all repaints in layout | 4060 // We need to manually repaint because we avoid doing all repaints in layout |
| 4061 // or style recalc while sheets are still loading to avoid FOUC. | 4061 // or style recalc while sheets are still loading to avoid FOUC. |
| 4062 pending_sheet_layout_ = kIgnoreLayoutWithPendingSheets; | 4062 pending_sheet_layout_ = kIgnoreLayoutWithPendingSheets; |
| 4063 | 4063 |
| 4064 DCHECK(!GetLayoutViewItem().IsNull() || ImportsController()); | 4064 DCHECK(!GetLayoutViewItem().IsNull() || ImportsController()); |
| 4065 if (!GetLayoutViewItem().IsNull()) | 4065 if (!GetLayoutViewItem().IsNull()) |
| 4066 GetLayoutViewItem().InvalidatePaintForViewAndCompositedLayers(); | 4066 GetLayoutViewItem().InvalidatePaintForViewAndCompositedLayers(); |
| 4067 } | 4067 } |
| 4068 } | 4068 } |
| 4069 | 4069 |
| (...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6790 } | 6790 } |
| 6791 | 6791 |
| 6792 void showLiveDocumentInstances() { | 6792 void showLiveDocumentInstances() { |
| 6793 WeakDocumentSet& set = liveDocumentSet(); | 6793 WeakDocumentSet& set = liveDocumentSet(); |
| 6794 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6794 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6795 for (blink::Document* document : set) | 6795 for (blink::Document* document : set) |
| 6796 fprintf(stderr, "- Document %p URL: %s\n", document, | 6796 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6797 document->Url().GetString().Utf8().data()); | 6797 document->Url().GetString().Utf8().data()); |
| 6798 } | 6798 } |
| 6799 #endif | 6799 #endif |
| OLD | NEW |