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

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, 8 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 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 // The following is for rect invalidation. For slimming paint v2, we can invalidate the rects 1886 // The following is for rect invalidation. For slimming paint v2, we can invalidate the rects
1887 // of the first line display item clients instead of the whole rect of the container. 1887 // of the first line display item clients instead of the whole rect of the container.
1888 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 1888 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled())
1889 firstLineContainer->setShouldDoFullPaintInvalidation(); 1889 firstLineContainer->setShouldDoFullPaintInvalidation();
1890 } 1890 }
1891 } 1891 }
1892 if (diff.needsLayout()) 1892 if (diff.needsLayout())
1893 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ; 1893 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ;
1894 } 1894 }
1895 1895
1896 void LayoutObject::markContainingBlocksForOverflowRecalc() 1896 void LayoutObject::markAncestorsForOverflowRecalcIfNeeded()
1897 { 1897 {
1898 for (LayoutBlock* container = containingBlock(); container && !container->ch ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock ()) 1898 LayoutObject* object = this;
1899 container->setChildNeedsOverflowRecalcAfterStyleChange(); 1899 do {
1900 // Cell and row need to propagate the flag to their containing section a nd row as their containing block is the table wrapper.
1901 // This enables us to only recompute overflow the modified sections / ro ws.
1902 object = object->isTableCell() || object->isTableRow() ? object->parent( ) : object->containingBlock();
1903 if (object)
1904 object->setChildNeedsOverflowRecalcAfterStyleChange();
1905 } while (object);
1900 } 1906 }
1901 1907
1902 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() 1908 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange()
1903 { 1909 {
1904 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); 1910 bool neededRecalc = needsOverflowRecalcAfterStyleChange();
1905 setSelfNeedsOverflowRecalcAfterStyleChange(); 1911 setSelfNeedsOverflowRecalcAfterStyleChange();
1906 if (!neededRecalc) 1912 if (!neededRecalc)
1907 markContainingBlocksForOverflowRecalc(); 1913 markAncestorsForOverflowRecalcIfNeeded();
1908 } 1914 }
1909 1915
1910 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) 1916 void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style)
1911 { 1917 {
1912 ASSERT(style); 1918 ASSERT(style);
1913 1919
1914 if (m_style == style) { 1920 if (m_style == style) {
1915 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so 1921 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
1916 // style sharing is disabled for them. That should ensure that we never hit this code path. 1922 // style sharing is disabled for them. That should ensure that we never hit this code path.
1917 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas()); 1923 ASSERT(!isLayoutIFrame() && !isEmbeddedObject() && !isCanvas());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge); 1973 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge);
1968 else if (updatedDiff.needsPositionedMovementLayout()) 1974 else if (updatedDiff.needsPositionedMovementLayout())
1969 setNeedsPositionedMovementLayout(); 1975 setNeedsPositionedMovementLayout();
1970 } 1976 }
1971 1977
1972 if (diff.transformChanged() && !needsLayout()) { 1978 if (diff.transformChanged() && !needsLayout()) {
1973 if (LayoutBlock* container = containingBlock()) 1979 if (LayoutBlock* container = containingBlock())
1974 container->setNeedsOverflowRecalcAfterStyleChange(); 1980 container->setNeedsOverflowRecalcAfterStyleChange();
1975 } 1981 }
1976 1982
1983 if (diff.needsRecomputeOverflow() && !needsLayout()) {
1984 // TODO(rhogan): Make inlines capable of recomputing overflow too.
1985 if (isLayoutBlock())
1986 setNeedsOverflowRecalcAfterStyleChange();
1987 else
1988 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleCha nge);
1989 }
1990
1977 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation Layer()) 1991 if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidation Layer())
1978 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 1992 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
1979 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject()) 1993 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali dationObject())
1980 setShouldDoFullPaintInvalidation(); 1994 setShouldDoFullPaintInvalidation();
1981 } 1995 }
1982 1996
1983 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne wStyle) 1997 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne wStyle)
1984 { 1998 {
1985 if (m_style) { 1999 if (m_style) {
1986 // If our z-index changes value or our visibility changes, 2000 // If our z-index changes value or our visibility changes,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 // If the object already needs layout, then setNeedsLayout won't do 2091 // If the object already needs layout, then setNeedsLayout won't do
2078 // any work. But if the containing block has changed, then we may need 2092 // any work. But if the containing block has changed, then we may need
2079 // to mark the new containing blocks for layout. The change that can 2093 // to mark the new containing blocks for layout. The change that can
2080 // directly affect the containing block of this object is a change to 2094 // directly affect the containing block of this object is a change to
2081 // the position style. 2095 // the position style.
2082 if (needsLayout() && oldStyle->position() != m_style->position()) 2096 if (needsLayout() && oldStyle->position() != m_style->position())
2083 markContainerChainForLayout(); 2097 markContainerChainForLayout();
2084 2098
2085 // Ditto. 2099 // Ditto.
2086 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) 2100 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position())
2087 markContainingBlocksForOverflowRecalc(); 2101 markAncestorsForOverflowRecalcIfNeeded();
2088 2102
2089 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ; 2103 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ;
2090 } else if (diff.needsPositionedMovementLayout()) { 2104 } else if (diff.needsPositionedMovementLayout()) {
2091 setNeedsPositionedMovementLayout(); 2105 setNeedsPositionedMovementLayout();
2092 } 2106 }
2093 2107
2094 // Don't check for paint invalidation here; we need to wait until the layer has been 2108 // Don't check for paint invalidation here; we need to wait until the layer has been
2095 // updated by subclasses before we know if we have to invalidate paints (in setStyle()). 2109 // updated by subclasses before we know if we have to invalidate paints (in setStyle()).
2096 2110
2097 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 2111 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 const blink::LayoutObject* root = object1; 3695 const blink::LayoutObject* root = object1;
3682 while (root->parent()) 3696 while (root->parent())
3683 root = root->parent(); 3697 root = root->parent();
3684 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3698 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3685 } else { 3699 } else {
3686 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3700 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3687 } 3701 }
3688 } 3702 }
3689 3703
3690 #endif 3704 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698