Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1949843004: Revert of Compute snap offsets (both repeat and element based) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: manual revert Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/RootScroller.h" 196 #include "core/page/scrolling/RootScroller.h"
197 #include "core/page/scrolling/ScrollingCoordinator.h" 197 #include "core/page/scrolling/ScrollingCoordinator.h"
198 #include "core/page/scrolling/SnapCoordinator.h"
199 #include "core/svg/SVGDocumentExtensions.h" 198 #include "core/svg/SVGDocumentExtensions.h"
200 #include "core/svg/SVGScriptElement.h" 199 #include "core/svg/SVGScriptElement.h"
201 #include "core/svg/SVGTitleElement.h" 200 #include "core/svg/SVGTitleElement.h"
202 #include "core/svg/SVGUseElement.h" 201 #include "core/svg/SVGUseElement.h"
203 #include "core/timing/DOMWindowPerformance.h" 202 #include "core/timing/DOMWindowPerformance.h"
204 #include "core/timing/Performance.h" 203 #include "core/timing/Performance.h"
205 #include "core/workers/SharedWorkerRepositoryClient.h" 204 #include "core/workers/SharedWorkerRepositoryClient.h"
206 #include "core/xml/parser/XMLDocumentParser.h" 205 #include "core/xml/parser/XMLDocumentParser.h"
207 #include "platform/DateComponents.h" 206 #include "platform/DateComponents.h"
208 #include "platform/EventDispatchForbiddenScope.h" 207 #include "platform/EventDispatchForbiddenScope.h"
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto': 1629 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto':
1631 if (overflowX == OverflowVisible) 1630 if (overflowX == OverflowVisible)
1632 overflowX = OverflowAuto; 1631 overflowX = OverflowAuto;
1633 if (overflowY == OverflowVisible) 1632 if (overflowY == OverflowVisible)
1634 overflowY = OverflowAuto; 1633 overflowY = OverflowAuto;
1635 // Column-gap is (ab)used by the current paged overflow implementation ( in lack of other 1634 // Column-gap is (ab)used by the current paged overflow implementation ( in lack of other
1636 // ways to specify gaps between pages), so we have to propagate it too. 1635 // ways to specify gaps between pages), so we have to propagate it too.
1637 columnGap = overflowStyle->columnGap(); 1636 columnGap = overflowStyle->columnGap();
1638 } 1637 }
1639 1638
1640 ScrollSnapType snapType = overflowStyle->getScrollSnapType();
1641 const LengthPoint& snapDestination = overflowStyle->scrollSnapDestination();
1642
1643 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle(); 1639 RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle();
1644 if (documentStyle->getWritingMode() != rootWritingMode 1640 if (documentStyle->getWritingMode() != rootWritingMode
1645 || documentStyle->direction() != rootDirection 1641 || documentStyle->direction() != rootDirection
1646 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b ackgroundColor 1642 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b ackgroundColor
1647 || documentStyle->backgroundLayers() != backgroundLayers 1643 || documentStyle->backgroundLayers() != backgroundLayers
1648 || documentStyle->imageRendering() != imageRendering 1644 || documentStyle->imageRendering() != imageRendering
1649 || documentStyle->overflowX() != overflowX 1645 || documentStyle->overflowX() != overflowX
1650 || documentStyle->overflowY() != overflowY 1646 || documentStyle->overflowY() != overflowY
1651 || documentStyle->columnGap() != columnGap 1647 || documentStyle->columnGap() != columnGap) {
1652 || documentStyle->getScrollSnapType() != snapType
1653 || documentStyle->scrollSnapDestination() != snapDestination) {
1654 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); 1648 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle);
1655 newStyle->setWritingMode(rootWritingMode); 1649 newStyle->setWritingMode(rootWritingMode);
1656 newStyle->setDirection(rootDirection); 1650 newStyle->setDirection(rootDirection);
1657 newStyle->setBackgroundColor(backgroundColor); 1651 newStyle->setBackgroundColor(backgroundColor);
1658 newStyle->accessBackgroundLayers() = backgroundLayers; 1652 newStyle->accessBackgroundLayers() = backgroundLayers;
1659 newStyle->setImageRendering(imageRendering); 1653 newStyle->setImageRendering(imageRendering);
1660 newStyle->setOverflowX(overflowX); 1654 newStyle->setOverflowX(overflowX);
1661 newStyle->setOverflowY(overflowY); 1655 newStyle->setOverflowY(overflowY);
1662 newStyle->setColumnGap(columnGap); 1656 newStyle->setColumnGap(columnGap);
1663 newStyle->setScrollSnapType(snapType);
1664 newStyle->setScrollSnapDestination(snapDestination);
1665 layoutView()->setStyle(newStyle); 1657 layoutView()->setStyle(newStyle);
1666 setupFontBuilder(*newStyle); 1658 setupFontBuilder(*newStyle);
1667 } 1659 }
1668 1660
1669 if (body) { 1661 if (body) {
1670 if (const ComputedStyle* style = body->computedStyle()) { 1662 if (const ComputedStyle* style = body->computedStyle()) {
1671 if (style->direction() != rootDirection || style->getWritingMode() ! = rootWritingMode) 1663 if (style->direction() != rootDirection || style->getWritingMode() ! = rootWritingMode)
1672 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::WritingModeChange)); 1664 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::WritingModeChange));
1673 } 1665 }
1674 } 1666 }
(...skipping 3856 matching lines...) Expand 10 before | Expand all | Expand 10 after
5531 void Document::setThreadedParsingEnabledForTesting(bool enabled) 5523 void Document::setThreadedParsingEnabledForTesting(bool enabled)
5532 { 5524 {
5533 s_threadedParsingEnabledForTesting = enabled; 5525 s_threadedParsingEnabledForTesting = enabled;
5534 } 5526 }
5535 5527
5536 bool Document::threadedParsingEnabledForTesting() 5528 bool Document::threadedParsingEnabledForTesting()
5537 { 5529 {
5538 return s_threadedParsingEnabledForTesting; 5530 return s_threadedParsingEnabledForTesting;
5539 } 5531 }
5540 5532
5541 SnapCoordinator* Document::snapCoordinator()
5542 {
5543 if (RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() && !m_snapCoordinat or)
5544 m_snapCoordinator = SnapCoordinator::create();
5545
5546 return m_snapCoordinator.get();
5547 }
5548
5549 void Document::setContextFeatures(ContextFeatures& features) 5533 void Document::setContextFeatures(ContextFeatures& features)
5550 { 5534 {
5551 m_contextFeatures = &features; 5535 m_contextFeatures = &features;
5552 } 5536 }
5553 5537
5554 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject * obj2) 5538 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject * obj2)
5555 { 5539 {
5556 if (!obj1 || !obj2) 5540 if (!obj1 || !obj2)
5557 return 0; 5541 return 0;
5558 5542
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
5980 visitor->trace(m_templateDocumentHost); 5964 visitor->trace(m_templateDocumentHost);
5981 visitor->trace(m_visibilityObservers); 5965 visitor->trace(m_visibilityObservers);
5982 visitor->trace(m_userActionElements); 5966 visitor->trace(m_userActionElements);
5983 visitor->trace(m_svgExtensions); 5967 visitor->trace(m_svgExtensions);
5984 visitor->trace(m_timeline); 5968 visitor->trace(m_timeline);
5985 visitor->trace(m_compositorPendingAnimations); 5969 visitor->trace(m_compositorPendingAnimations);
5986 visitor->trace(m_contextDocument); 5970 visitor->trace(m_contextDocument);
5987 visitor->trace(m_canvasFontCache); 5971 visitor->trace(m_canvasFontCache);
5988 visitor->trace(m_intersectionObserverController); 5972 visitor->trace(m_intersectionObserverController);
5989 visitor->trace(m_intersectionObserverData); 5973 visitor->trace(m_intersectionObserverData);
5990 visitor->trace(m_snapCoordinator);
5991 Supplementable<Document>::trace(visitor); 5974 Supplementable<Document>::trace(visitor);
5992 TreeScope::trace(visitor); 5975 TreeScope::trace(visitor);
5993 ContainerNode::trace(visitor); 5976 ContainerNode::trace(visitor);
5994 ExecutionContext::trace(visitor); 5977 ExecutionContext::trace(visitor);
5995 DocumentLifecycleNotifier::trace(visitor); 5978 DocumentLifecycleNotifier::trace(visitor);
5996 SecurityContext::trace(visitor); 5979 SecurityContext::trace(visitor);
5997 } 5980 }
5998 5981
5999 template class CORE_TEMPLATE_EXPORT Supplement<Document>; 5982 template class CORE_TEMPLATE_EXPORT Supplement<Document>;
6000 5983
6001 } // namespace blink 5984 } // namespace blink
6002 5985
6003 #ifndef NDEBUG 5986 #ifndef NDEBUG
6004 using namespace blink; 5987 using namespace blink;
6005 void showLiveDocumentInstances() 5988 void showLiveDocumentInstances()
6006 { 5989 {
6007 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5990 Document::WeakDocumentSet& set = Document::liveDocumentSet();
6008 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5991 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6009 for (Document* document : set) 5992 for (Document* document : set)
6010 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 5993 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6011 } 5994 }
6012 #endif 5995 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698