OLD | NEW |
---|---|
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1362 OwnPtr<TracedValue> value = TracedValue::create(); | 1362 OwnPtr<TracedValue> value = TracedValue::create(); |
1363 addJsonObjectForRect(value.get(), "oldRect", oldRect); | 1363 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
1364 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); | 1364 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
1365 addJsonObjectForRect(value.get(), "newRect", newRect); | 1365 addJsonObjectForRect(value.get(), "newRect", newRect); |
1366 addJsonObjectForPoint(value.get(), "newLocation", newLocation); | 1366 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
1367 return value.release(); | 1367 return value.release(); |
1368 } | 1368 } |
1369 | 1369 |
1370 LayoutRect LayoutObject::selectionRectInViewCoordinates() const | 1370 LayoutRect LayoutObject::selectionRectInViewCoordinates() const |
1371 { | 1371 { |
1372 return selectionRectForPaintInvalidation(view()); | 1372 LayoutRect selectionRect = localSelectionRect(); |
1373 if (!selectionRect.isEmpty()) | |
1374 mapToVisibleRectInAncestorSpace(view(), selectionRect, nullptr); | |
1375 return selectionRect; | |
1373 } | 1376 } |
1374 | 1377 |
1375 LayoutRect LayoutObject::previousSelectionRectForPaintInvalidation() const | 1378 LayoutRect LayoutObject::previousSelectionRectForPaintInvalidation() const |
1376 { | 1379 { |
1377 if (!selectionPaintInvalidationMap) | 1380 if (!selectionPaintInvalidationMap) |
1378 return LayoutRect(); | 1381 return LayoutRect(); |
1379 | 1382 |
1380 return selectionPaintInvalidationMap->get(this); | 1383 return selectionPaintInvalidationMap->get(this); |
1381 } | 1384 } |
1382 | 1385 |
(...skipping 14 matching lines...) Expand all Loading... | |
1397 // TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care ab out paint invalidation rects. | 1400 // TODO(wangxianzhu): Remove this for slimming paint v2 because we won't care ab out paint invalidation rects. |
1398 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, const PaintInvalidationState& paintInvalidationSta te, PaintInvalidationReason invalidationReason) | 1401 inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject & paintInvalidationContainer, const PaintInvalidationState& paintInvalidationSta te, PaintInvalidationReason invalidationReason) |
1399 { | 1402 { |
1400 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.) | 1403 // Update selection rect when we are doing full invalidation (in case that t he object is moved, composite status changed, etc.) |
1401 // or shouldInvalidationSelection is set (in case that the selection itself changed). | 1404 // or shouldInvalidationSelection is set (in case that the selection itself changed). |
1402 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason); | 1405 bool fullInvalidation = view()->doingFullPaintInvalidation() || isFullPaintI nvalidationReason(invalidationReason); |
1403 if (!fullInvalidation && !shouldInvalidateSelection()) | 1406 if (!fullInvalidation && !shouldInvalidateSelection()) |
1404 return; | 1407 return; |
1405 | 1408 |
1406 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); | 1409 LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation(); |
1407 LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvali dationContainer); | 1410 LayoutRect newSelectionRect = localSelectionRect(); |
1411 if (!newSelectionRect.isEmpty()) { | |
1412 PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationCo ntainer, newSelectionRect, &paintInvalidationState); | |
1408 | 1413 |
1409 // Composited scrolling should not be included in the bounds and position tr acking, because the graphics layer backing the scroller | 1414 // Composited scrolling should not be included in the bounds and positio n tracking, because the graphics layer backing the scroller |
1410 // does not move on scroll. | 1415 // does not move on scroll. |
1411 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { | 1416 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvali dationContainer != this) { |
1412 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrol ledContentOffset()); | 1417 LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->s crolledContentOffset()); |
1413 newSelectionRect.move(inverseOffset); | 1418 newSelectionRect.move(inverseOffset); |
1419 } | |
1414 } | 1420 } |
1415 | 1421 |
1416 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); | 1422 setPreviousSelectionRectForPaintInvalidation(newSelectionRect); |
1417 | 1423 |
1418 if (shouldInvalidateSelection()) | 1424 if (shouldInvalidateSelection()) |
1419 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection); | 1425 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidation Container, paintInvalidationState, PaintInvalidationSelection); |
1420 | 1426 |
1421 if (fullInvalidation) | 1427 if (fullInvalidation) |
1422 return; | 1428 return; |
1423 | 1429 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1625 { | 1631 { |
1626 if (shouldInvalidateOverflowForPaint()) | 1632 if (shouldInvalidateOverflowForPaint()) |
1627 invalidatePaintForOverflow(); | 1633 invalidatePaintForOverflow(); |
1628 } | 1634 } |
1629 | 1635 |
1630 LayoutRect LayoutObject::absoluteClippedOverflowRect() const | 1636 LayoutRect LayoutObject::absoluteClippedOverflowRect() const |
1631 { | 1637 { |
1632 return clippedOverflowRectForPaintInvalidation(view()); | 1638 return clippedOverflowRectForPaintInvalidation(view()); |
1633 } | 1639 } |
1634 | 1640 |
1635 LayoutRect LayoutObject::clippedOverflowRectForPaintInvalidation(const LayoutBox ModelObject*, const PaintInvalidationState*) const | 1641 LayoutRect LayoutObject::clippedOverflowRectForPaintInvalidation(const LayoutBox ModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInva lidationState) const |
chrishtr
2016/03/25 20:20:14
Make this non-virtual?
chrishtr
2016/03/25 20:21:08
IOW: what subclasses still override it?
Xianzhu
2016/03/25 20:24:20
SVG objects still need to override. This function
| |
1642 { | |
1643 LayoutRect rect = localOverflowRectForPaintInvalidation(); | |
1644 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInval idationState); | |
1645 return rect; | |
1646 } | |
1647 | |
1648 LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const | |
1636 { | 1649 { |
1637 ASSERT_NOT_REACHED(); | 1650 ASSERT_NOT_REACHED(); |
1638 return LayoutRect(); | 1651 return LayoutRect(); |
1639 } | 1652 } |
1640 | 1653 |
1641 bool LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags) const | 1654 bool LayoutObject::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* a ncestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags) const |
1642 { | 1655 { |
1643 // For any layout object that doesn't override this method (the main example is LayoutText), | 1656 // For any layout object that doesn't override this method (the main example is LayoutText), |
1644 // the rect is assumed to be in the coordinate space of the object's parent. | 1657 // the rect is assumed to be in the coordinate space of the object's parent. |
1645 | 1658 |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |