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

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

Issue 2019583002: Don't include scroll offset in offsetFromLayoutObject for scrolling contents layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer)); 1216 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer));
1217 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", 1217 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()",
1218 "object", this->debugName().ascii(), 1218 "object", this->debugName().ascii(),
1219 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason))); 1219 "info", jsonObjectForPaintInvalidationInfo(dirtyRect, paintInvalidationR easonToString(invalidationReason)));
1220 1220
1221 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are 1221 // This conditional handles situations where non-rooted (and hence non-compo sited) frames are
1222 // painted, such as SVG images. 1222 // painted, such as SVG images.
1223 if (!paintInvalidationContainer.isPaintInvalidationContainer()) 1223 if (!paintInvalidationContainer.isPaintInvalidationContainer())
1224 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect)); 1224 invalidatePaintRectangleOnWindow(paintInvalidationContainer, enclosingIn tRect(dirtyRect));
1225 1225
1226 bool compositedScrolling = paintInvalidationContainer.usesCompositedScrollin g() && &paintInvalidationContainer != this;
Xianzhu 2016/05/31 16:06:20 You can move this into LayoutBoxModelObject::setBa
chrishtr 2016/05/31 16:36:43 Done.
1226 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer()) 1227 if (paintInvalidationContainer.view()->usesCompositing() && paintInvalidatio nContainer.isPaintInvalidationContainer())
1227 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason, *this); 1228 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(dirtyR ect, invalidationReason, *this, compositedScrolling);
1228 } 1229 }
1229 1230
1230 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI temClient) const 1231 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClient& displayI temClient) const
1231 { 1232 {
1232 if (PaintLayer* paintingLayer = this->paintingLayer()) { 1233 if (PaintLayer* paintingLayer = this->paintingLayer()) {
1233 paintingLayer->setNeedsRepaint(); 1234 paintingLayer->setNeedsRepaint();
1234 1235
1235 #if !ENABLE(ASSERT) 1236 #if !ENABLE(ASSERT)
1236 // This is a fast path when we don't need to inform the GraphicsLayer ab out this paint invalidation. 1237 // This is a fast path when we don't need to inform the GraphicsLayer ab out this paint invalidation.
1237 FrameView* frameView = this->frameView(); 1238 FrameView* frameView = this->frameView();
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 setPreviousPaintInvalidationRect(LayoutRect()); 1554 setPreviousPaintInvalidationRect(LayoutRect());
1554 } 1555 }
1555 1556
1556 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking) 1557 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking)
1557 { 1558 {
1558 ASSERT(oldBounds.location() == newBounds.location()); 1559 ASSERT(oldBounds.location() == newBounds.location());
1559 1560
1560 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1561 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
1561 if (deltaRight > 0) { 1562 if (deltaRight > 0) {
1562 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()); 1563 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height());
1563 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1564 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental); 1564 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental);
1565 } else if (deltaRight < 0) { 1565 } else if (deltaRight < 0) {
1566 LayoutRect invalidationRect(newBounds.maxX(), oldBounds.y(), -deltaRight , oldBounds.height()); 1566 LayoutRect invalidationRect(newBounds.maxX(), oldBounds.y(), -deltaRight , oldBounds.height());
1567 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1568 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental); 1567 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental);
1569 } 1568 }
1570 1569
1571 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1570 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
1572 if (deltaBottom > 0) { 1571 if (deltaBottom > 0) {
1573 LayoutRect invalidationRect(newBounds.x(), oldBounds.maxY(), newBounds.w idth(), deltaBottom); 1572 LayoutRect invalidationRect(newBounds.x(), oldBounds.maxY(), newBounds.w idth(), deltaBottom);
1574 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1575 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental); 1573 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental);
1576 } else if (deltaBottom < 0) { 1574 } else if (deltaBottom < 0) {
1577 LayoutRect invalidationRect(oldBounds.x(), newBounds.maxY(), oldBounds.w idth(), -deltaBottom); 1575 LayoutRect invalidationRect(oldBounds.x(), newBounds.maxY(), oldBounds.w idth(), -deltaBottom);
1578 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1579 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental); 1576 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental);
1580 } 1577 }
1581 } 1578 }
1582 1579
1583 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds) 1580 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds)
1584 { 1581 {
1585 // The following logic avoids invalidating twice if one set of bounds contai ns the other. 1582 // The following logic avoids invalidating twice if one set of bounds contai ns the other.
1586 if (!newBounds.contains(oldBounds)) { 1583 if (!newBounds.contains(oldBounds)) {
1587 LayoutRect invalidationRect = oldBounds; 1584 LayoutRect invalidationRect = oldBounds;
1588 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1589 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, invalidationReason); 1585 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, invalidationReason);
1590 1586
1591 if (oldBounds.contains(newBounds)) 1587 if (oldBounds.contains(newBounds))
1592 return; 1588 return;
1593 } 1589 }
1594 1590
1595 LayoutRect invalidationRect = newBounds; 1591 LayoutRect invalidationRect = newBounds;
1596 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
1597 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, invalidationReason); 1592 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, invalidationReason);
1598 } 1593 }
1599 1594
1600 void LayoutObject::invalidatePaintForOverflow() 1595 void LayoutObject::invalidatePaintForOverflow()
1601 { 1596 {
1602 } 1597 }
1603 1598
1604 void LayoutObject::invalidatePaintForOverflowIfNeeded() 1599 void LayoutObject::invalidatePaintForOverflowIfNeeded()
1605 { 1600 {
1606 if (shouldInvalidateOverflowForPaint()) 1601 if (shouldInvalidateOverflowForPaint())
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs Repaint is set. 3572 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs Repaint is set.
3578 // Don't set the flag here because getting enclosingSelfPaintLayer has cost and the caller can use 3573 // Don't set the flag here because getting enclosingSelfPaintLayer has cost and the caller can use
3579 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t o reduce the cost. 3574 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t o reduce the cost.
3580 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); 3575 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint());
3581 3576
3582 // These disablers are valid because we want to use the current compositing/ invalidation status. 3577 // These disablers are valid because we want to use the current compositing/ invalidation status.
3583 DisablePaintInvalidationStateAsserts invalidationDisabler; 3578 DisablePaintInvalidationStateAsserts invalidationDisabler;
3584 DisableCompositingQueryAsserts compositingDisabler; 3579 DisableCompositingQueryAsserts compositingDisabler;
3585 3580
3586 LayoutRect invalidationRect = previousPaintInvalidationRect(); 3581 LayoutRect invalidationRect = previousPaintInvalidationRect();
3587 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida tionContainer);
3588 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, reason); 3582 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, reason);
3589 invalidateDisplayItemClients(paintInvalidationContainer, reason); 3583 invalidateDisplayItemClients(paintInvalidationContainer, reason);
3590 3584
3591 // This method may be used to invalidate paint of an object changing paint i nvalidation container. 3585 // This method may be used to invalidate paint of an object changing paint i nvalidation container.
3592 // Clear previous paint invalidation rect on the original paint invalidation container to avoid 3586 // Clear previous paint invalidation rect on the original paint invalidation container to avoid
3593 // under-invalidation if the new paint invalidation rect on the new paint in validation container 3587 // under-invalidation if the new paint invalidation rect on the new paint in validation container
3594 // happens to be the same as the old one. 3588 // happens to be the same as the old one.
3595 clearPreviousPaintInvalidationRects(); 3589 clearPreviousPaintInvalidationRects();
3596 } 3590 }
3597 3591
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3694 const blink::LayoutObject* root = object1; 3688 const blink::LayoutObject* root = object1;
3695 while (root->parent()) 3689 while (root->parent())
3696 root = root->parent(); 3690 root = root->parent();
3697 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3691 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3698 } else { 3692 } else {
3699 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3693 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3700 } 3694 }
3701 } 3695 }
3702 3696
3703 #endif 3697 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698