| 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 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 markers().updateRenderedRectsForMarkers(); | 1928 markers().updateRenderedRectsForMarkers(); |
| 1929 | 1929 |
| 1930 // The layout system may perform layouts with pending stylesheets. When | 1930 // The layout system may perform layouts with pending stylesheets. When |
| 1931 // recording first layout time, we ignore these layouts, since painting is | 1931 // recording first layout time, we ignore these layouts, since painting is |
| 1932 // suppressed for them. We're interested in tracking the time of the | 1932 // suppressed for them. We're interested in tracking the time of the |
| 1933 // first real or 'paintable' layout. | 1933 // first real or 'paintable' layout. |
| 1934 // TODO(esprehn): This doesn't really make sense, why not track the first | 1934 // TODO(esprehn): This doesn't really make sense, why not track the first |
| 1935 // beginFrame? This will catch the first layout in a page that does lots | 1935 // beginFrame? This will catch the first layout in a page that does lots |
| 1936 // of layout thrashing even though that layout might not be followed by | 1936 // of layout thrashing even though that layout might not be followed by |
| 1937 // a paint for many seconds. | 1937 // a paint for many seconds. |
| 1938 if (isRenderingReady() && body() && !styleEngine().hasPendingSheets()) { | 1938 if (isRenderingReady() && body() && !styleEngine().hasPendingScriptBlockingS
heets()) { |
| 1939 if (!m_documentTiming.firstLayout()) | 1939 if (!m_documentTiming.firstLayout()) |
| 1940 m_documentTiming.markFirstLayout(); | 1940 m_documentTiming.markFirstLayout(); |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 // TODO(bokan): Not sure how rootScroller can be null here if we're in the | 1943 // TODO(bokan): Not sure how rootScroller can be null here if we're in the |
| 1944 // main frame. In any case, I'm moving rootScroller to be owned by Document | 1944 // main frame. In any case, I'm moving rootScroller to be owned by Document |
| 1945 // soon so this will go away: https://codereview.chromium.org/1970763002/ | 1945 // soon so this will go away: https://codereview.chromium.org/1970763002/ |
| 1946 if (isInMainFrame() && frameHost() && frameHost()->rootScroller()) | 1946 if (isInMainFrame() && frameHost() && frameHost()->rootScroller()) |
| 1947 frameHost()->rootScroller()->didUpdateTopDocumentLayout(); | 1947 frameHost()->rootScroller()->didUpdateTopDocumentLayout(); |
| 1948 } | 1948 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1970 // FIXME: This is a bad idea and needs to be removed eventually. | 1970 // FIXME: This is a bad idea and needs to be removed eventually. |
| 1971 // Other browsers load stylesheets before they continue parsing the web page. | 1971 // Other browsers load stylesheets before they continue parsing the web page. |
| 1972 // Since we don't, we can run JavaScript code that needs answers before the | 1972 // Since we don't, we can run JavaScript code that needs answers before the |
| 1973 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets | 1973 // stylesheets are loaded. Doing a layout ignoring the pending stylesheets |
| 1974 // lets us get reasonable answers. The long term solution to this problem is | 1974 // lets us get reasonable answers. The long term solution to this problem is |
| 1975 // to instead suspend JavaScript execution. | 1975 // to instead suspend JavaScript execution. |
| 1976 void Document::updateLayoutTreeIgnorePendingStylesheets() | 1976 void Document::updateLayoutTreeIgnorePendingStylesheets() |
| 1977 { | 1977 { |
| 1978 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); | 1978 StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine()); |
| 1979 | 1979 |
| 1980 if (styleEngine().hasPendingSheets()) { | 1980 if (styleEngine().hasPendingScriptBlockingSheets()) { |
| 1981 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. | 1981 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. |
| 1982 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page | 1982 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page |
| 1983 // content has already been loaded and displayed with accurate style inf
ormation. (Our | 1983 // content has already been loaded and displayed with accurate style inf
ormation. (Our |
| 1984 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we | 1984 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we |
| 1985 // might be able to do something better.) It's worth noting though that
this entire method | 1985 // might be able to do something better.) It's worth noting though that
this entire method |
| 1986 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with | 1986 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with |
| 1987 // inaccurate information. | 1987 // inaccurate information. |
| 1988 HTMLElement* bodyElement = body(); | 1988 HTMLElement* bodyElement = body(); |
| 1989 if (bodyElement && !bodyElement->layoutObject() && m_pendingSheetLayout
== NoLayoutWithPendingSheets) { | 1989 if (bodyElement && !bodyElement->layoutObject() && m_pendingSheetLayout
== NoLayoutWithPendingSheets) { |
| 1990 m_pendingSheetLayout = DidLayoutWithPendingSheets; | 1990 m_pendingSheetLayout = DidLayoutWithPendingSheets; |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3026 { | 3026 { |
| 3027 if (!frame()) | 3027 if (!frame()) |
| 3028 return; | 3028 return; |
| 3029 | 3029 |
| 3030 frame()->script().disableEval(errorMessage); | 3030 frame()->script().disableEval(errorMessage); |
| 3031 } | 3031 } |
| 3032 | 3032 |
| 3033 | 3033 |
| 3034 void Document::didLoadAllImports() | 3034 void Document::didLoadAllImports() |
| 3035 { | 3035 { |
| 3036 if (!haveStylesheetsLoaded()) | 3036 if (!haveScriptBlockingStylesheetsLoaded()) |
| 3037 return; | 3037 return; |
| 3038 if (!importLoader()) | 3038 if (!importLoader()) |
| 3039 styleResolverMayHaveChanged(); | 3039 styleResolverMayHaveChanged(); |
| 3040 didLoadAllScriptBlockingResources(); | 3040 didLoadAllScriptBlockingResources(); |
| 3041 } | 3041 } |
| 3042 | 3042 |
| 3043 void Document::didRemoveAllPendingStylesheet() | 3043 void Document::didRemoveAllPendingStylesheet() |
| 3044 { | 3044 { |
| 3045 styleResolverMayHaveChanged(); | 3045 styleResolverMayHaveChanged(); |
| 3046 | 3046 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3448 if (!hasViewportUnits()) | 3448 if (!hasViewportUnits()) |
| 3449 return; | 3449 return; |
| 3450 ensureStyleResolver().notifyResizeForViewportUnits(); | 3450 ensureStyleResolver().notifyResizeForViewportUnits(); |
| 3451 setNeedsStyleRecalcForViewportUnits(); | 3451 setNeedsStyleRecalcForViewportUnits(); |
| 3452 } | 3452 } |
| 3453 | 3453 |
| 3454 void Document::styleResolverMayHaveChanged() | 3454 void Document::styleResolverMayHaveChanged() |
| 3455 { | 3455 { |
| 3456 styleEngine().resolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpda
te : AnalyzedStyleUpdate); | 3456 styleEngine().resolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpda
te : AnalyzedStyleUpdate); |
| 3457 | 3457 |
| 3458 if (didLayoutWithPendingStylesheets() && !styleEngine().hasPendingSheets())
{ | 3458 if (didLayoutWithPendingStylesheets() && !styleEngine().hasPendingScriptBloc
kingSheets()) { |
| 3459 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3459 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
| 3460 // recalc while sheets are still loading to avoid FOUC. | 3460 // recalc while sheets are still loading to avoid FOUC. |
| 3461 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; | 3461 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; |
| 3462 | 3462 |
| 3463 DCHECK(layoutView() || importsController()); | 3463 DCHECK(layoutView() || importsController()); |
| 3464 if (layoutView()) | 3464 if (layoutView()) |
| 3465 layoutView()->invalidatePaintForViewAndCompositedLayers(); | 3465 layoutView()->invalidatePaintForViewAndCompositedLayers(); |
| 3466 } | 3466 } |
| 3467 } | 3467 } |
| 3468 | 3468 |
| (...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5665 if (ancestorNode && nodesToAddToChain[i] == ancestorNode) | 5665 if (ancestorNode && nodesToAddToChain[i] == ancestorNode) |
| 5666 sawCommonAncestor = true; | 5666 sawCommonAncestor = true; |
| 5667 if (allowActiveChanges) | 5667 if (allowActiveChanges) |
| 5668 nodesToAddToChain[i]->setActive(true); | 5668 nodesToAddToChain[i]->setActive(true); |
| 5669 if (!sawCommonAncestor || nodesToAddToChain[i] == m_hoverNode) { | 5669 if (!sawCommonAncestor || nodesToAddToChain[i] == m_hoverNode) { |
| 5670 nodesToAddToChain[i]->setHovered(true); | 5670 nodesToAddToChain[i]->setHovered(true); |
| 5671 } | 5671 } |
| 5672 } | 5672 } |
| 5673 } | 5673 } |
| 5674 | 5674 |
| 5675 bool Document::haveStylesheetsLoaded() const | 5675 bool Document::haveScriptBlockingStylesheetsLoaded() const |
| 5676 { | 5676 { |
| 5677 return m_styleEngine->haveStylesheetsLoaded(); | 5677 return m_styleEngine->haveScriptBlockingStylesheetsLoaded(); |
| 5678 } | 5678 } |
| 5679 | 5679 |
| 5680 bool Document::haveRenderBlockingStylesheetsLoaded() const | 5680 bool Document::haveRenderBlockingStylesheetsLoaded() const |
| 5681 { | 5681 { |
| 5682 if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled()) | 5682 if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled()) |
| 5683 return m_styleEngine->haveRenderBlockingStylesheetsLoaded(); | 5683 return m_styleEngine->haveRenderBlockingStylesheetsLoaded(); |
| 5684 return m_styleEngine->haveStylesheetsLoaded(); | 5684 return m_styleEngine->haveScriptBlockingStylesheetsLoaded(); |
| 5685 } | 5685 } |
| 5686 | 5686 |
| 5687 Locale& Document::getCachedLocale(const AtomicString& locale) | 5687 Locale& Document::getCachedLocale(const AtomicString& locale) |
| 5688 { | 5688 { |
| 5689 AtomicString localeKey = locale; | 5689 AtomicString localeKey = locale; |
| 5690 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr
olUIEnabled()) | 5690 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr
olUIEnabled()) |
| 5691 return Locale::defaultLocale(); | 5691 return Locale::defaultLocale(); |
| 5692 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey,
nullptr); | 5692 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey,
nullptr); |
| 5693 if (result.isNewEntry) | 5693 if (result.isNewEntry) |
| 5694 result.storedValue->value = Locale::create(localeKey); | 5694 result.storedValue->value = Locale::create(localeKey); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6012 #ifndef NDEBUG | 6012 #ifndef NDEBUG |
| 6013 using namespace blink; | 6013 using namespace blink; |
| 6014 void showLiveDocumentInstances() | 6014 void showLiveDocumentInstances() |
| 6015 { | 6015 { |
| 6016 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6016 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 6017 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6017 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6018 for (Document* document : set) | 6018 for (Document* document : set) |
| 6019 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6019 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 6020 } | 6020 } |
| 6021 #endif | 6021 #endif |
| OLD | NEW |