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

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

Issue 2728383002: Make ::first-line invalidation work when added or removed. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 frame->localFrameRoot()->eventHandler().scheduleCursorUpdate(); 1923 frame->localFrameRoot()->eventHandler().scheduleCursorUpdate();
1924 } 1924 }
1925 } 1925 }
1926 1926
1927 if (diff.needsFullPaintInvalidation() && oldStyle) { 1927 if (diff.needsFullPaintInvalidation() && oldStyle) {
1928 if (resolveColor(*oldStyle, CSSPropertyBackgroundColor) != 1928 if (resolveColor(*oldStyle, CSSPropertyBackgroundColor) !=
1929 resolveColor(CSSPropertyBackgroundColor) || 1929 resolveColor(CSSPropertyBackgroundColor) ||
1930 oldStyle->backgroundLayers() != styleRef().backgroundLayers()) 1930 oldStyle->backgroundLayers() != styleRef().backgroundLayers())
1931 setBackgroundChangedSinceLastPaintInvalidation(); 1931 setBackgroundChangedSinceLastPaintInvalidation();
1932 } 1932 }
1933
1934 if (oldStyle && oldStyle->styleType() == PseudoIdNone)
1935 applyPseudoStyleChanges(*oldStyle);
1936 }
1937
1938 void LayoutObject::applyPseudoStyleChanges(const ComputedStyle& oldStyle) {
1939 if (oldStyle.hasPseudoStyle(PseudoIdFirstLine) ||
1940 styleRef().hasPseudoStyle(PseudoIdFirstLine))
1941 applyFirstLineChanges(oldStyle);
1942
1943 // TODO(rune@opera.com): Move the invalidation for ::selection here.
1944 // Instead of having a PaintInvalidationSelectionOnly PaintInvalidationType
1945 // used for the element diff, we should use PaintInvalidationObject diff on
1946 // the pseudo element style here instead.
1947 }
1948
1949 void LayoutObject::applyFirstLineChanges(const ComputedStyle& oldStyle) {
1950 RefPtr<ComputedStyle> oldPseudoStyle;
1951 RefPtr<ComputedStyle> newPseudoStyle;
1952 if (oldStyle.hasPseudoStyle(PseudoIdFirstLine))
1953 oldPseudoStyle = oldStyle.getCachedPseudoStyle(PseudoIdFirstLine);
1954 if (styleRef().hasPseudoStyle(PseudoIdFirstLine) && oldPseudoStyle)
mstensho (USE GERRIT) 2017/03/07 10:04:26 This will never be true if oldStyle.hasPseudoStyle
rune 2017/03/07 10:42:54 Done.
1955 newPseudoStyle = uncachedFirstLineStyle(mutableStyle());
1956 if (oldPseudoStyle && newPseudoStyle)
mstensho (USE GERRIT) 2017/03/07 10:04:26 Ditto - if you just return after the firstLineStyl
rune 2017/03/07 10:42:54 Done.
1957 firstLineStyleDidChange(*oldPseudoStyle, *newPseudoStyle);
1958 else
1959 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange);
1933 } 1960 }
1934 1961
1935 void LayoutObject::propagateStyleToAnonymousChildren() { 1962 void LayoutObject::propagateStyleToAnonymousChildren() {
1936 // FIXME: We could save this call when the change only affected non-inherited 1963 // FIXME: We could save this call when the change only affected non-inherited
1937 // properties. 1964 // properties.
1938 for (LayoutObject* child = slowFirstChild(); child; 1965 for (LayoutObject* child = slowFirstChild(); child;
1939 child = child->nextSibling()) { 1966 child = child->nextSibling()) {
1940 if (!child->isAnonymous() || child->style()->styleType() != PseudoIdNone) 1967 if (!child->isAnonymous() || child->style()->styleType() != PseudoIdNone)
1941 continue; 1968 continue;
1942 1969
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
3569 const blink::LayoutObject* root = object1; 3596 const blink::LayoutObject* root = object1;
3570 while (root->parent()) 3597 while (root->parent())
3571 root = root->parent(); 3598 root = root->parent();
3572 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3599 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3573 } else { 3600 } else {
3574 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3601 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3575 } 3602 }
3576 } 3603 }
3577 3604
3578 #endif 3605 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698