| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 // than necessary (when a layer is made of disjoint objects) but in | 464 // than necessary (when a layer is made of disjoint objects) but in |
| 465 // practice is a significant performance savings. | 465 // practice is a significant performance savings. |
| 466 layer()->addLayerHitTestRects(rects); | 466 layer()->addLayerHitTestRects(rects); |
| 467 } | 467 } |
| 468 } else { | 468 } else { |
| 469 LayoutObject::addLayerHitTestRects(rects, currentLayer, layerOffset, | 469 LayoutObject::addLayerHitTestRects(rects, currentLayer, layerOffset, |
| 470 containerRect); | 470 containerRect); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 | 473 |
| 474 static bool hasPercentageTransform(const ComputedStyle& style) { | |
| 475 if (TransformOperation* translate = style.translate()) { | |
| 476 if (translate->dependsOnBoxSize()) | |
| 477 return true; | |
| 478 } | |
| 479 return style.transform().dependsOnBoxSize() || | |
| 480 (style.transformOriginX() != Length(50, Percent) && | |
| 481 style.transformOriginX().isPercentOrCalc()) || | |
| 482 (style.transformOriginY() != Length(50, Percent) && | |
| 483 style.transformOriginY().isPercentOrCalc()); | |
| 484 } | |
| 485 | |
| 486 DISABLE_CFI_PERF | 474 DISABLE_CFI_PERF |
| 487 void LayoutBoxModelObject::invalidateTreeIfNeeded( | 475 void LayoutBoxModelObject::invalidateTreeIfNeeded( |
| 488 const PaintInvalidationState& paintInvalidationState) { | 476 const PaintInvalidationState& paintInvalidationState) { |
| 489 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 477 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 490 ensureIsReadyForPaintInvalidation(); | 478 ensureIsReadyForPaintInvalidation(); |
| 491 | 479 |
| 492 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, | 480 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, |
| 493 *this); | 481 *this); |
| 494 if (!shouldCheckForPaintInvalidation(newPaintInvalidationState)) | 482 if (!shouldCheckForPaintInvalidation(newPaintInvalidationState)) |
| 495 return; | 483 return; |
| 496 | 484 |
| 497 if (mayNeedPaintInvalidationSubtree()) | 485 if (mayNeedPaintInvalidationSubtree()) |
| 498 newPaintInvalidationState | 486 newPaintInvalidationState |
| 499 .setForceSubtreeInvalidationCheckingWithinContainer(); | 487 .setForceSubtreeInvalidationCheckingWithinContainer(); |
| 500 | 488 |
| 501 ObjectPaintInvalidator paintInvalidator(*this); | 489 ObjectPaintInvalidator paintInvalidator(*this); |
| 502 LayoutRect previousVisualRect = this->previousVisualRect(); | 490 LayoutRect previousVisualRect = this->previousVisualRect(); |
| 503 LayoutPoint previousLocation = paintInvalidator.previousLocationInBacking(); | 491 LayoutPoint previousLocation = paintInvalidator.previousLocationInBacking(); |
| 504 PaintInvalidationReason reason = | 492 PaintInvalidationReason reason = |
| 505 invalidatePaintIfNeeded(newPaintInvalidationState); | 493 invalidatePaintIfNeeded(newPaintInvalidationState); |
| 506 clearPaintInvalidationFlags(); | 494 clearPaintInvalidationFlags(); |
| 507 | 495 |
| 508 if (previousLocation != paintInvalidator.previousLocationInBacking()) { | 496 if (previousLocation != paintInvalidator.previousLocationInBacking()) { |
| 509 newPaintInvalidationState | 497 newPaintInvalidationState |
| 510 .setForceSubtreeInvalidationCheckingWithinContainer(); | 498 .setForceSubtreeInvalidationCheckingWithinContainer(); |
| 511 } | 499 } |
| 512 | 500 |
| 513 // TODO(wangxianzhu): Combine this function into LayoutObject:: | |
| 514 // invalidateTreeIfNeeded() when removing the following workarounds. | |
| 515 | |
| 516 // TODO(wangxianzhu): This is a workaround for crbug.com/533277. Will remove | |
| 517 // when we enable paint offset caching. | |
| 518 if (reason != PaintInvalidationNone && hasPercentageTransform(styleRef())) { | |
| 519 newPaintInvalidationState | |
| 520 .setForceSubtreeInvalidationCheckingWithinContainer(); | |
| 521 } | |
| 522 | |
| 523 // TODO(wangxianzhu): This is a workaround for crbug.com/490725. We don't have | 501 // TODO(wangxianzhu): This is a workaround for crbug.com/490725. We don't have |
| 524 // enough saved information to do accurate check of clipping change. Will | 502 // enough saved information to do accurate check of clipping change. Will |
| 525 // remove when we remove rect-based paint invalidation. | 503 // remove when we remove rect-based paint invalidation. |
| 526 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 504 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 527 previousVisualRect != this->previousVisualRect() && | 505 previousVisualRect != this->previousVisualRect() && |
| 528 !usesCompositedScrolling() | 506 !usesCompositedScrolling() |
| 529 // Note that isLayoutView() below becomes unnecessary after the launch of | 507 // Note that isLayoutView() below becomes unnecessary after the launch of |
| 530 // root layer scrolling. | 508 // root layer scrolling. |
| 531 && (hasOverflowClip() || isLayoutView())) { | 509 && (hasOverflowClip() || isLayoutView())) { |
| 532 newPaintInvalidationState | 510 newPaintInvalidationState |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 if (rootElementStyle->hasBackground()) | 1318 if (rootElementStyle->hasBackground()) |
| 1341 return false; | 1319 return false; |
| 1342 | 1320 |
| 1343 if (node() != document().firstBodyElement()) | 1321 if (node() != document().firstBodyElement()) |
| 1344 return false; | 1322 return false; |
| 1345 | 1323 |
| 1346 return true; | 1324 return true; |
| 1347 } | 1325 } |
| 1348 | 1326 |
| 1349 } // namespace blink | 1327 } // namespace blink |
| OLD | NEW |