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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1809643008: Adding or changing any of box-shadow, outline, or border-image-outset does not need a layout.. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 9 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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 // The following is for rect invalidation. For slimming paint v2, we can invalidate the rects 1916 // The following is for rect invalidation. For slimming paint v2, we can invalidate the rects
1917 // of the first line display item clients instead of the whole rect of the container. 1917 // of the first line display item clients instead of the whole rect of the container.
1918 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 1918 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
1919 firstLineContainer->setShouldDoFullPaintInvalidation(); 1919 firstLineContainer->setShouldDoFullPaintInvalidation();
1920 } 1920 }
1921 } 1921 }
1922 if (diff.needsLayout()) 1922 if (diff.needsLayout())
1923 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ; 1923 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ;
1924 } 1924 }
1925 1925
1926 void LayoutObject::markContainingBlocksForOverflowRecalc() 1926 void LayoutObject::markAncestorsForOverflowRecalcIfNeeded()
1927 { 1927 {
1928 for (LayoutBlock* container = containingBlock(); container && !container->ch ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock ()) 1928 LayoutObject* object = this;
1929 container->setChildNeedsOverflowRecalcAfterStyleChange(); 1929 do {
1930 // Cell and row need to propagate the flag to their containing section a nd row as their containing block is the table wrapper.
1931 // This enables us to only recompute overflow the modified sections / ro ws.
1932 object = object->isTableCell() || object->isTableRow() ? object->parent( ) : object->containingBlock();
1933 if (object)
1934 object->setChildNeedsOverflowRecalcAfterStyleChange();
1935 } while (object);
1930 } 1936 }
1931 1937
1932 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() 1938 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange()
1933 { 1939 {
1934 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); 1940 bool neededRecalc = needsOverflowRecalcAfterStyleChange();
1935 setSelfNeedsOverflowRecalcAfterStyleChange(); 1941 setSelfNeedsOverflowRecalcAfterStyleChange();
1936 if (!neededRecalc) 1942 if (!neededRecalc)
1937 markContainingBlocksForOverflowRecalc(); 1943 markAncestorsForOverflowRecalcIfNeeded();
1938 } 1944 }
1939 1945
1940 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) 1946 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
1941 { 1947 {
1942 ASSERT(style); 1948 ASSERT(style);
1943 1949
1944 if (m_style == style) { 1950 if (m_style == style) {
1945 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so 1951 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
1946 // style sharing is disabled for them. That should ensure that we never hit this code path. 1952 // style sharing is disabled for them. That should ensure that we never hit this code path.
1947 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas()); 1953 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge); 2003 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge);
1998 else if (updatedDiff.needsPositionedMovementLayout()) 2004 else if (updatedDiff.needsPositionedMovementLayout())
1999 setNeedsPositionedMovementLayout(); 2005 setNeedsPositionedMovementLayout();
2000 } 2006 }
2001 2007
2002 if (diff.transformChanged() && !needsLayout()) { 2008 if (diff.transformChanged() && !needsLayout()) {
2003 if (LayoutBlock* container = containingBlock()) 2009 if (LayoutBlock* container = containingBlock())
2004 container->setNeedsOverflowRecalcAfterStyleChange(); 2010 container->setNeedsOverflowRecalcAfterStyleChange();
2005 } 2011 }
2006 2012
2013 if (diff.visualOverflowChanged() && !needsLayout()) {
2014 if (isLayoutBlock())
2015 setNeedsOverflowRecalcAfterStyleChange();
2016 else
2017 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge);
Xianzhu 2016/03/22 17:02:05 Nit: please add a TODO here and reference bug 4370
2018 }
2019
2007 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation Layer()) 2020 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation Layer())
2008 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 2021 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
2009 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject()) 2022 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject())
2010 setShouldDoFullPaintInvalidation(); 2023 setShouldDoFullPaintInvalidation();
2011 } 2024 }
2012 2025
2013 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne wStyle) 2026 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne wStyle)
2014 { 2027 {
2015 if (m_style) { 2028 if (m_style) {
2016 // If our z-index changes value or our visibility changes, 2029 // If our z-index changes value or our visibility changes,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 // If the object already needs layout, then setNeedsLayout won't do 2110 // If the object already needs layout, then setNeedsLayout won't do
2098 // any work. But if the containing block has changed, then we may need 2111 // any work. But if the containing block has changed, then we may need
2099 // to mark the new containing blocks for layout. The change that can 2112 // to mark the new containing blocks for layout. The change that can
2100 // directly affect the containing block of this object is a change to 2113 // directly affect the containing block of this object is a change to
2101 // the position style. 2114 // the position style.
2102 if (needsLayout() && oldStyle->position() != m_style->position()) 2115 if (needsLayout() && oldStyle->position() != m_style->position())
2103 markContainerChainForLayout(); 2116 markContainerChainForLayout();
2104 2117
2105 // Ditto. 2118 // Ditto.
2106 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) 2119 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position())
2107 markContainingBlocksForOverflowRecalc(); 2120 markAncestorsForOverflowRecalcIfNeeded();
2108 2121
2109 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ; 2122 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ;
2110 } else if (diff.needsPositionedMovementLayout()) { 2123 } else if (diff.needsPositionedMovementLayout()) {
2111 setNeedsPositionedMovementLayout(); 2124 setNeedsPositionedMovementLayout();
2112 } 2125 }
2113 2126
2114 // Don't check for paint invalidation here; we need to wait until the layer has been 2127 // Don't check for paint invalidation here; we need to wait until the layer has been
2115 // updated by subclasses before we know if we have to invalidate paints (in setStyle()). 2128 // updated by subclasses before we know if we have to invalidate paints (in setStyle()).
2116 2129
2117 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 2130 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 const blink::LayoutObject* root = object1; 3740 const blink::LayoutObject* root = object1;
3728 while (root->parent()) 3741 while (root->parent())
3729 root = root->parent(); 3742 root = root->parent();
3730 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3743 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3731 } else { 3744 } else {
3732 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3745 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3733 } 3746 }
3734 } 3747 }
3735 3748
3736 #endif 3749 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698