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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 #include "core/loader/ImageLoader.h" | 187 #include "core/loader/ImageLoader.h" |
188 #include "core/loader/NavigationScheduler.h" | 188 #include "core/loader/NavigationScheduler.h" |
189 #include "core/loader/appcache/ApplicationCacheHost.h" | 189 #include "core/loader/appcache/ApplicationCacheHost.h" |
190 #include "core/page/ChromeClient.h" | 190 #include "core/page/ChromeClient.h" |
191 #include "core/page/EventWithHitTestResults.h" | 191 #include "core/page/EventWithHitTestResults.h" |
192 #include "core/page/FocusController.h" | 192 #include "core/page/FocusController.h" |
193 #include "core/page/FrameTree.h" | 193 #include "core/page/FrameTree.h" |
194 #include "core/page/Page.h" | 194 #include "core/page/Page.h" |
195 #include "core/page/PointerLockController.h" | 195 #include "core/page/PointerLockController.h" |
196 #include "core/page/scrolling/ScrollingCoordinator.h" | 196 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 197 #include "core/page/scrolling/ViewportScrollCallback.h" |
197 #include "core/svg/SVGDocumentExtensions.h" | 198 #include "core/svg/SVGDocumentExtensions.h" |
198 #include "core/svg/SVGTitleElement.h" | 199 #include "core/svg/SVGTitleElement.h" |
199 #include "core/svg/SVGUseElement.h" | 200 #include "core/svg/SVGUseElement.h" |
200 #include "core/timing/DOMWindowPerformance.h" | 201 #include "core/timing/DOMWindowPerformance.h" |
201 #include "core/timing/Performance.h" | 202 #include "core/timing/Performance.h" |
202 #include "core/workers/SharedWorkerRepositoryClient.h" | 203 #include "core/workers/SharedWorkerRepositoryClient.h" |
203 #include "core/xml/parser/XMLDocumentParser.h" | 204 #include "core/xml/parser/XMLDocumentParser.h" |
204 #include "platform/DateComponents.h" | 205 #include "platform/DateComponents.h" |
205 #include "platform/EventDispatchForbiddenScope.h" | 206 #include "platform/EventDispatchForbiddenScope.h" |
206 #include "platform/Histogram.h" | 207 #include "platform/Histogram.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 695 |
695 return domWindow()->location(); | 696 return domWindow()->location(); |
696 } | 697 } |
697 | 698 |
698 void Document::childrenChanged(const ChildrenChange& change) | 699 void Document::childrenChanged(const ChildrenChange& change) |
699 { | 700 { |
700 ContainerNode::childrenChanged(change); | 701 ContainerNode::childrenChanged(change); |
701 m_documentElement = ElementTraversal::firstWithin(*this); | 702 m_documentElement = ElementTraversal::firstWithin(*this); |
702 } | 703 } |
703 | 704 |
| 705 void Document::updateViewportApplyScroll() |
| 706 { |
| 707 if (!m_documentElement |
| 708 || !m_documentElement->isHTMLElement() |
| 709 || ownerElement()) |
| 710 return; |
| 711 |
| 712 Element* newScrollingElement = scrollingElement(); |
| 713 |
| 714 // If there is no scrolling element (in QuirksMode and body is scrollable), |
| 715 // install the viewport scroll callback on the <HTML> element. |
| 716 if (!newScrollingElement) |
| 717 newScrollingElement = m_documentElement; |
| 718 |
| 719 if (newScrollingElement == m_oldScrollingElement) |
| 720 return; |
| 721 |
| 722 ScrollStateCallback* applyScroll = nullptr; |
| 723 |
| 724 // If the scrolling element changed, remove the apply scroll from the |
| 725 // old one and keep it to put on the new scrolling element. |
| 726 if (m_oldScrollingElement) { |
| 727 applyScroll = m_oldScrollingElement->getApplyScroll(); |
| 728 m_oldScrollingElement->removeApplyScroll(); |
| 729 } |
| 730 |
| 731 if (newScrollingElement) { |
| 732 if (!applyScroll) |
| 733 applyScroll = new ViewportScrollCallback(*this, *frameHost()); |
| 734 |
| 735 // Use disable-native-scroll since the ViewportScrollCallback needs to |
| 736 // apply scroll actions before (TopControls) and after (overscroll) |
| 737 // scrolling the element so it applies scroll to the element itself. |
| 738 newScrollingElement->setApplyScroll( |
| 739 applyScroll, |
| 740 "disable-native-scroll"); |
| 741 } |
| 742 |
| 743 m_oldScrollingElement = newScrollingElement; |
| 744 } |
| 745 |
704 AtomicString Document::convertLocalName(const AtomicString& name) | 746 AtomicString Document::convertLocalName(const AtomicString& name) |
705 { | 747 { |
706 return isHTMLDocument() ? name.lower() : name; | 748 return isHTMLDocument() ? name.lower() : name; |
707 } | 749 } |
708 | 750 |
709 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) | 751 Element* Document::createElement(const AtomicString& name, ExceptionState& excep
tionState) |
710 { | 752 { |
711 if (!isValidName(name)) { | 753 if (!isValidName(name)) { |
712 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 754 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
713 return nullptr; | 755 return nullptr; |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 | 2015 |
1974 if (frameView->needsLayout()) | 2016 if (frameView->needsLayout()) |
1975 frameView->layout(); | 2017 frameView->layout(); |
1976 | 2018 |
1977 if (lifecycle().state() < DocumentLifecycle::LayoutClean) | 2019 if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
1978 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); | 2020 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
1979 } | 2021 } |
1980 | 2022 |
1981 void Document::layoutUpdated() | 2023 void Document::layoutUpdated() |
1982 { | 2024 { |
| 2025 updateViewportApplyScroll(); |
| 2026 |
1983 // Plugins can run script inside layout which can detach the page. | 2027 // Plugins can run script inside layout which can detach the page. |
1984 // TODO(esprehn): Can this still happen now that all plugins are out of | 2028 // TODO(esprehn): Can this still happen now that all plugins are out of |
1985 // process? | 2029 // process? |
1986 if (frame() && frame()->page()) | 2030 if (frame() && frame()->page()) |
1987 frame()->page()->chromeClient().layoutUpdated(frame()); | 2031 frame()->page()->chromeClient().layoutUpdated(frame()); |
1988 | 2032 |
1989 markers().updateRenderedRectsForMarkers(); | 2033 markers().updateRenderedRectsForMarkers(); |
1990 | 2034 |
1991 // The layout system may perform layouts with pending stylesheets. When | 2035 // The layout system may perform layouts with pending stylesheets. When |
1992 // recording first layout time, we ignore these layouts, since painting is | 2036 // recording first layout time, we ignore these layouts, since painting is |
(...skipping 3991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5984 visitor->trace(m_styleEngine); | 6028 visitor->trace(m_styleEngine); |
5985 visitor->trace(m_formController); | 6029 visitor->trace(m_formController); |
5986 visitor->trace(m_visitedLinkState); | 6030 visitor->trace(m_visitedLinkState); |
5987 visitor->trace(m_frame); | 6031 visitor->trace(m_frame); |
5988 visitor->trace(m_domWindow); | 6032 visitor->trace(m_domWindow); |
5989 visitor->trace(m_fetcher); | 6033 visitor->trace(m_fetcher); |
5990 visitor->trace(m_parser); | 6034 visitor->trace(m_parser); |
5991 visitor->trace(m_contextFeatures); | 6035 visitor->trace(m_contextFeatures); |
5992 visitor->trace(m_styleSheetList); | 6036 visitor->trace(m_styleSheetList); |
5993 visitor->trace(m_documentTiming); | 6037 visitor->trace(m_documentTiming); |
| 6038 visitor->trace(m_oldScrollingElement); |
5994 visitor->trace(m_mediaQueryMatcher); | 6039 visitor->trace(m_mediaQueryMatcher); |
5995 visitor->trace(m_scriptedAnimationController); | 6040 visitor->trace(m_scriptedAnimationController); |
5996 visitor->trace(m_scriptedIdleTaskController); | 6041 visitor->trace(m_scriptedIdleTaskController); |
5997 visitor->trace(m_taskRunner); | 6042 visitor->trace(m_taskRunner); |
5998 visitor->trace(m_textAutosizer); | 6043 visitor->trace(m_textAutosizer); |
5999 visitor->trace(m_registrationContext); | 6044 visitor->trace(m_registrationContext); |
6000 visitor->trace(m_customElementMicrotaskRunQueue); | 6045 visitor->trace(m_customElementMicrotaskRunQueue); |
6001 visitor->trace(m_elementDataCache); | 6046 visitor->trace(m_elementDataCache); |
6002 visitor->trace(m_associatedFormControls); | 6047 visitor->trace(m_associatedFormControls); |
6003 visitor->trace(m_useElementsNeedingUpdate); | 6048 visitor->trace(m_useElementsNeedingUpdate); |
(...skipping 25 matching lines...) Expand all Loading... |
6029 #ifndef NDEBUG | 6074 #ifndef NDEBUG |
6030 using namespace blink; | 6075 using namespace blink; |
6031 void showLiveDocumentInstances() | 6076 void showLiveDocumentInstances() |
6032 { | 6077 { |
6033 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6078 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
6034 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6079 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6035 for (Document* document : set) | 6080 for (Document* document : set) |
6036 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6081 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
6037 } | 6082 } |
6038 #endif | 6083 #endif |
OLD | NEW |