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

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

Issue 2774763003: needsPaintInvalidation() should not return true for selection. (Closed)
Patch Set: Created 3 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. 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 } 1522 }
1523 } 1523 }
1524 1524
1525 // TODO(wangxianzhu): We may avoid subtree paint invalidation on CSS clip 1525 // TODO(wangxianzhu): We may avoid subtree paint invalidation on CSS clip
1526 // change for SPv2. 1526 // change for SPv2.
1527 if (diff.cssClipChanged()) 1527 if (diff.cssClipChanged())
1528 diff.setNeedsPaintInvalidationSubtree(); 1528 diff.setNeedsPaintInvalidationSubtree();
1529 1529
1530 // Optimization: for decoration/color property changes, invalidation is only 1530 // Optimization: for decoration/color property changes, invalidation is only
1531 // needed if we have style or text affected by these properties. 1531 // needed if we have style or text affected by these properties.
1532 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) { 1532 if (diff.textDecorationOrColorChanged() &&
1533 !diff.needsFullPaintInvalidation()) {
1533 if (style()->hasBorder() || style()->hasOutline() || 1534 if (style()->hasBorder() || style()->hasOutline() ||
1534 style()->hasBackgroundRelatedColorReferencingCurrentColor() || 1535 style()->hasBackgroundRelatedColorReferencingCurrentColor() ||
1535 // Skip any text nodes that do not contain text boxes. Whitespace cannot 1536 // Skip any text nodes that do not contain text boxes. Whitespace cannot
1536 // be skipped or we will miss invalidating decorations (e.g., 1537 // be skipped or we will miss invalidating decorations (e.g.,
1537 // underlines). 1538 // underlines).
1538 (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) || 1539 (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) ||
1539 (isSVG() && style()->svgStyle().isFillColorCurrentColor()) || 1540 (isSVG() && style()->svgStyle().isFillColorCurrentColor()) ||
1540 (isSVG() && style()->svgStyle().isStrokeColorCurrentColor()) || 1541 (isSVG() && style()->svgStyle().isStrokeColorCurrentColor()) ||
1541 isListMarker()) 1542 isListMarker())
1542 diff.setNeedsPaintInvalidationObject(); 1543 diff.setNeedsPaintInvalidationObject();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 return; 1579 return;
1579 } 1580 }
1580 1581
1581 setStyle(std::move(pseudoStyle)); 1582 setStyle(std::move(pseudoStyle));
1582 } 1583 }
1583 1584
1584 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, 1585 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle,
1585 const ComputedStyle& newStyle) { 1586 const ComputedStyle& newStyle) {
1586 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); 1587 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle);
1587 1588
1588 if (diff.needsPaintInvalidation() || diff.textDecorationOrColorChanged()) { 1589 if (diff.needsFullPaintInvalidation() ||
1590 diff.textDecorationOrColorChanged()) {
1589 // We need to invalidate all inline boxes in the first line, because they 1591 // We need to invalidate all inline boxes in the first line, because they
1590 // need to be repainted with the new style, e.g. background, font style, 1592 // need to be repainted with the new style, e.g. background, font style,
1591 // etc. 1593 // etc.
1592 LayoutBlockFlow* firstLineContainer = nullptr; 1594 LayoutBlockFlow* firstLineContainer = nullptr;
1593 if (behavesLikeBlockContainer()) { 1595 if (behavesLikeBlockContainer()) {
1594 // This object is a LayoutBlock having PseudoIdFirstLine pseudo style 1596 // This object is a LayoutBlock having PseudoIdFirstLine pseudo style
1595 // changed. 1597 // changed.
1596 firstLineContainer = 1598 firstLineContainer =
1597 toLayoutBlock(this)->nearestInnerBlockWithFirstLine(); 1599 toLayoutBlock(this)->nearestInnerBlockWithFirstLine();
1598 } else if (isLayoutInline()) { 1600 } else if (isLayoutInline()) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 1919 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
1918 if (LocalFrame* frame = this->frame()) { 1920 if (LocalFrame* frame = this->frame()) {
1919 // Cursor update scheduling is done by the local root, which is the main 1921 // Cursor update scheduling is done by the local root, which is the main
1920 // frame if there are no RemoteFrame ancestors in the frame tree. Use of 1922 // frame if there are no RemoteFrame ancestors in the frame tree. Use of
1921 // localFrameRoot() is discouraged but will change when cursor update 1923 // localFrameRoot() is discouraged but will change when cursor update
1922 // scheduling is moved from EventHandler to PageEventHandler. 1924 // scheduling is moved from EventHandler to PageEventHandler.
1923 frame->localFrameRoot()->eventHandler().scheduleCursorUpdate(); 1925 frame->localFrameRoot()->eventHandler().scheduleCursorUpdate();
1924 } 1926 }
1925 } 1927 }
1926 1928
1927 if (diff.needsPaintInvalidation() && oldStyle) { 1929 if (diff.needsFullPaintInvalidation() && oldStyle) {
1928 if (resolveColor(*oldStyle, CSSPropertyBackgroundColor) != 1930 if (resolveColor(*oldStyle, CSSPropertyBackgroundColor) !=
1929 resolveColor(CSSPropertyBackgroundColor) || 1931 resolveColor(CSSPropertyBackgroundColor) ||
1930 oldStyle->backgroundLayers() != styleRef().backgroundLayers()) 1932 oldStyle->backgroundLayers() != styleRef().backgroundLayers())
1931 setBackgroundChangedSinceLastPaintInvalidation(); 1933 setBackgroundChangedSinceLastPaintInvalidation();
1932 } 1934 }
1933 } 1935 }
1934 1936
1935 void LayoutObject::propagateStyleToAnonymousChildren() { 1937 void LayoutObject::propagateStyleToAnonymousChildren() {
1936 // FIXME: We could save this call when the change only affected non-inherited 1938 // FIXME: We could save this call when the change only affected non-inherited
1937 // properties. 1939 // properties.
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 const blink::LayoutObject* root = object1; 3554 const blink::LayoutObject* root = object1;
3553 while (root->parent()) 3555 while (root->parent())
3554 root = root->parent(); 3556 root = root->parent();
3555 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3557 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3556 } else { 3558 } else {
3557 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3559 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3558 } 3560 }
3559 } 3561 }
3560 3562
3561 #endif 3563 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutScrollbarPart.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698