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

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

Issue 2145823002: Implement the overflow-anchor CSS property as an opt-out for ScrollAnchoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put opt-out behind RuntimeEnabledFeature and update tests Created 4 years, 5 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 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 // and then trigger a full document recalc. We also need to clear it here si nce the 1571 // and then trigger a full document recalc. We also need to clear it here si nce the
1572 // call to styleForElement on the body above can cache bad values for rem un its if the 1572 // call to styleForElement on the body above can cache bad values for rem un its if the
1573 // documentElement's style was dirty. We could keep track of which elements depend on 1573 // documentElement's style was dirty. We could keep track of which elements depend on
1574 // rem units like we do for viewport styles, but we assume root font size ch anges are 1574 // rem units like we do for viewport styles, but we assume root font size ch anges are
1575 // rare and just invalidate the cache for now. 1575 // rare and just invalidate the cache for now.
1576 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || !do cumentElement()->computedStyle() || documentElement()->computedStyle()->fontSize () != documentElementStyle->fontSize())) { 1576 if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || !do cumentElement()->computedStyle() || documentElement()->computedStyle()->fontSize () != documentElementStyle->fontSize())) {
1577 ensureStyleResolver().invalidateMatchedPropertiesCache(); 1577 ensureStyleResolver().invalidateMatchedPropertiesCache();
1578 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe asonForTracing::create(StyleChangeReason::FontSizeChange)); 1578 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe asonForTracing::create(StyleChangeReason::FontSizeChange));
1579 } 1579 }
1580 1580
1581 EOverflowAnchor overflowAnchor = AnchorAuto;
1581 EOverflow overflowX = OverflowAuto; 1582 EOverflow overflowX = OverflowAuto;
1582 EOverflow overflowY = OverflowAuto; 1583 EOverflow overflowY = OverflowAuto;
1583 float columnGap = 0; 1584 float columnGap = 0;
1584 if (overflowStyle) { 1585 if (overflowStyle) {
1586 overflowAnchor = overflowStyle->overflowAnchor();
1585 overflowX = overflowStyle->overflowX(); 1587 overflowX = overflowStyle->overflowX();
1586 overflowY = overflowStyle->overflowY(); 1588 overflowY = overflowStyle->overflowY();
1587 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto': 1589 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto':
1588 if (overflowX == OverflowVisible) 1590 if (overflowX == OverflowVisible)
1589 overflowX = OverflowAuto; 1591 overflowX = OverflowAuto;
1590 if (overflowY == OverflowVisible) 1592 if (overflowY == OverflowVisible)
1591 overflowY = OverflowAuto; 1593 overflowY = OverflowAuto;
1594 if (overflowAnchor == AnchorVisible)
1595 overflowAnchor = AnchorAuto;
1592 // Column-gap is (ab)used by the current paged overflow implementation ( in lack of other 1596 // Column-gap is (ab)used by the current paged overflow implementation ( in lack of other
1593 // ways to specify gaps between pages), so we have to propagate it too. 1597 // ways to specify gaps between pages), so we have to propagate it too.
1594 columnGap = overflowStyle->columnGap(); 1598 columnGap = overflowStyle->columnGap();
1595 } 1599 }
1596 1600
1597 ScrollSnapType snapType = overflowStyle->getScrollSnapType(); 1601 ScrollSnapType snapType = overflowStyle->getScrollSnapType();
1598 const LengthPoint& snapDestination = overflowStyle->scrollSnapDestination(); 1602 const LengthPoint& snapDestination = overflowStyle->scrollSnapDestination();
1599 1603
1600 RefPtr<ComputedStyle> documentStyle = layoutViewItem().mutableStyle(); 1604 RefPtr<ComputedStyle> documentStyle = layoutViewItem().mutableStyle();
1601 if (documentStyle->getWritingMode() != rootWritingMode 1605 if (documentStyle->getWritingMode() != rootWritingMode
1602 || documentStyle->direction() != rootDirection 1606 || documentStyle->direction() != rootDirection
1603 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b ackgroundColor 1607 || documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != b ackgroundColor
1604 || documentStyle->backgroundLayers() != backgroundLayers 1608 || documentStyle->backgroundLayers() != backgroundLayers
1605 || documentStyle->imageRendering() != imageRendering 1609 || documentStyle->imageRendering() != imageRendering
1610 || documentStyle->overflowAnchor() != overflowAnchor
1606 || documentStyle->overflowX() != overflowX 1611 || documentStyle->overflowX() != overflowX
1607 || documentStyle->overflowY() != overflowY 1612 || documentStyle->overflowY() != overflowY
1608 || documentStyle->columnGap() != columnGap 1613 || documentStyle->columnGap() != columnGap
1609 || documentStyle->getScrollSnapType() != snapType 1614 || documentStyle->getScrollSnapType() != snapType
1610 || documentStyle->scrollSnapDestination() != snapDestination) { 1615 || documentStyle->scrollSnapDestination() != snapDestination) {
1611 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle); 1616 RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle);
1612 newStyle->setWritingMode(rootWritingMode); 1617 newStyle->setWritingMode(rootWritingMode);
1613 newStyle->setDirection(rootDirection); 1618 newStyle->setDirection(rootDirection);
1614 newStyle->setBackgroundColor(backgroundColor); 1619 newStyle->setBackgroundColor(backgroundColor);
1615 newStyle->accessBackgroundLayers() = backgroundLayers; 1620 newStyle->accessBackgroundLayers() = backgroundLayers;
1616 newStyle->setImageRendering(imageRendering); 1621 newStyle->setImageRendering(imageRendering);
1622 newStyle->setOverflowAnchor(overflowAnchor);
1617 newStyle->setOverflowX(overflowX); 1623 newStyle->setOverflowX(overflowX);
1618 newStyle->setOverflowY(overflowY); 1624 newStyle->setOverflowY(overflowY);
1619 newStyle->setColumnGap(columnGap); 1625 newStyle->setColumnGap(columnGap);
1620 newStyle->setScrollSnapType(snapType); 1626 newStyle->setScrollSnapType(snapType);
1621 newStyle->setScrollSnapDestination(snapDestination); 1627 newStyle->setScrollSnapDestination(snapDestination);
1622 layoutViewItem().setStyle(newStyle); 1628 layoutViewItem().setStyle(newStyle);
1623 setupFontBuilder(*newStyle); 1629 setupFontBuilder(*newStyle);
1624 } 1630 }
1625 1631
1626 if (body) { 1632 if (body) {
(...skipping 4383 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 } 6016 }
6011 6017
6012 void showLiveDocumentInstances() 6018 void showLiveDocumentInstances()
6013 { 6019 {
6014 WeakDocumentSet& set = liveDocumentSet(); 6020 WeakDocumentSet& set = liveDocumentSet();
6015 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6021 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6016 for (Document* document : set) 6022 for (Document* document : set)
6017 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6023 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6018 } 6024 }
6019 #endif 6025 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698