OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
nst | 369 StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
nst |
370 { | 370 { |
371 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep | 371 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep |
372 // compare, which is duplicate work when we're going to compare each propert
y inside | 372 // compare, which is duplicate work when we're going to compare each propert
y inside |
373 // this function anyway. | 373 // this function anyway. |
374 | 374 |
375 StyleDifference diff; | 375 StyleDifference diff; |
376 if (m_svgStyle.get() != other.m_svgStyle.get()) | 376 if (m_svgStyle.get() != other.m_svgStyle.get()) |
377 diff = m_svgStyle->diff(other.m_svgStyle.get()); | 377 diff = m_svgStyle->diff(other.m_svgStyle.get()); |
378 | 378 |
379 if ((!diff.needsFullLayout() || !diff.needsRepaint()) && diffNeedsFullLayout
AndRepaint(other)) { | 379 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && diffNeeds
FullLayoutAndPaintInvalidation(other)) { |
380 diff.setNeedsFullLayout(); | 380 diff.setNeedsFullLayout(); |
381 diff.setNeedsRepaintObject(); | 381 diff.setNeedsPaintInvalidationObject(); |
382 } | 382 } |
383 | 383 |
384 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) | 384 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) |
385 diff.setNeedsFullLayout(); | 385 diff.setNeedsFullLayout(); |
386 | 386 |
387 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { | 387 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { |
388 // Optimize for the case where a positioned layer is moving but not chan
ging size. | 388 // Optimize for the case where a positioned layer is moving but not chan
ging size. |
389 if ((position() == AbsolutePosition || position() == FixedPosition) | 389 if ((position() == AbsolutePosition || position() == FixedPosition) |
390 && positionedObjectMovedOnly(surround->offset, other.surround->offse
t, m_box->width())) { | 390 && positionedObjectMovedOnly(surround->offset, other.surround->offse
t, m_box->width())) { |
391 diff.setNeedsPositionedMovementLayout(); | 391 diff.setNeedsPositionedMovementLayout(); |
392 } else { | 392 } else { |
393 // FIXME: We would like to use SimplifiedLayout for relative positio
ning, but we can't quite do that yet. | 393 // FIXME: We would like to use SimplifiedLayout for relative positio
ning, but we can't quite do that yet. |
394 // We need to make sure SimplifiedLayout can operate correctly on Re
nderInlines (we will need | 394 // We need to make sure SimplifiedLayout can operate correctly on Re
nderInlines (we will need |
395 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). | 395 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). |
396 diff.setNeedsFullLayout(); | 396 diff.setNeedsFullLayout(); |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 if (diffNeedsRepaintLayer(other)) | 400 if (diffNeedsPaintInvalidationLayer(other)) |
401 diff.setNeedsRepaintLayer(); | 401 diff.setNeedsPaintInvalidationLayer(); |
402 else if (diffNeedsRepaintObject(other)) | 402 else if (diffNeedsPaintInvalidationObject(other)) |
403 diff.setNeedsRepaintObject(); | 403 diff.setNeedsPaintInvalidationObject(); |
404 | 404 |
405 updatePropertySpecificDifferences(other, diff); | 405 updatePropertySpecificDifferences(other, diff); |
406 | 406 |
407 // Cursors are not checked, since they will be set appropriately in response
to mouse events, | 407 // Cursors are not checked, since they will be set appropriately in response
to mouse events, |
408 // so they don't need to cause any repaint or layout. | 408 // so they don't need to cause any paint invalidation or layout. |
409 | 409 |
410 // Animations don't need to be checked either. We always set the new style o
n the RenderObject, so we will get a chance to fire off | 410 // Animations don't need to be checked either. We always set the new style o
n the RenderObject, so we will get a chance to fire off |
411 // the resulting transition properly. | 411 // the resulting transition properly. |
412 | 412 |
413 return diff; | 413 return diff; |
414 } | 414 } |
415 | 415 |
416 bool RenderStyle::diffNeedsFullLayoutAndRepaint(const RenderStyle& other) const | 416 bool RenderStyle::diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& oth
er) const |
417 { | 417 { |
418 // FIXME: Not all cases in this method need both full layout and repaint. | 418 // FIXME: Not all cases in this method need both full layout and paint inval
idation. |
419 // Should move cases into diffNeedsFullLayout() if | 419 // Should move cases into diffNeedsFullLayout() if |
420 // - don't need repaint at all; | 420 // - don't need paint invalidation at all; |
421 // - or the renderer knows how to exactly repaint caused by the layout chang
e | 421 // - or the renderer knows how to exactly invalidate paints caused by the la
yout change |
422 // instead of forced full repaint. | 422 // instead of forced full paint invalidation. |
423 | 423 |
424 if (surround.get() != other.surround.get()) { | 424 if (surround.get() != other.surround.get()) { |
425 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a repaint. | 425 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a paint invalidation. |
426 if (borderLeftWidth() != other.borderLeftWidth() | 426 if (borderLeftWidth() != other.borderLeftWidth() |
427 || borderTopWidth() != other.borderTopWidth() | 427 || borderTopWidth() != other.borderTopWidth() |
428 || borderBottomWidth() != other.borderBottomWidth() | 428 || borderBottomWidth() != other.borderBottomWidth() |
429 || borderRightWidth() != other.borderRightWidth()) | 429 || borderRightWidth() != other.borderRightWidth()) |
430 return true; | 430 return true; |
431 } | 431 } |
432 | 432 |
433 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 433 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
434 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance | 434 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance |
435 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse | 435 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 if (surround->margin != other.surround->margin) | 613 if (surround->margin != other.surround->margin) |
614 return true; | 614 return true; |
615 | 615 |
616 if (surround->padding != other.surround->padding) | 616 if (surround->padding != other.surround->padding) |
617 return true; | 617 return true; |
618 } | 618 } |
619 | 619 |
620 return false; | 620 return false; |
621 } | 621 } |
622 | 622 |
623 bool RenderStyle::diffNeedsRepaintLayer(const RenderStyle& other) const | 623 bool RenderStyle::diffNeedsPaintInvalidationLayer(const RenderStyle& other) cons
t |
624 { | 624 { |
625 if (position() != StaticPosition && (visual->clip != other.visual->clip || v
isual->hasClip != other.visual->hasClip)) | 625 if (position() != StaticPosition && (visual->clip != other.visual->clip || v
isual->hasClip != other.visual->hasClip)) |
626 return true; | 626 return true; |
627 | 627 |
628 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 628 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
629 if (RuntimeEnabledFeatures::cssCompositingEnabled() | 629 if (RuntimeEnabledFeatures::cssCompositingEnabled() |
630 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher
itedData->m_effectiveBlendMode | 630 && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInher
itedData->m_effectiveBlendMode |
631 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa
ta->m_isolation)) | 631 || rareNonInheritedData->m_isolation != other.rareNonInheritedDa
ta->m_isolation)) |
632 return true; | 632 return true; |
633 | 633 |
634 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask | 634 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask |
635 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedDat
a->m_maskBoxImage) | 635 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedDat
a->m_maskBoxImage) |
636 return true; | 636 return true; |
637 } | 637 } |
638 | 638 |
639 return false; | 639 return false; |
640 } | 640 } |
641 | 641 |
642 bool RenderStyle::diffNeedsRepaintObject(const RenderStyle& other) const | 642 bool RenderStyle::diffNeedsPaintInvalidationObject(const RenderStyle& other) con
st |
643 { | 643 { |
644 if (inherited_flags._visibility != other.inherited_flags._visibility | 644 if (inherited_flags._visibility != other.inherited_flags._visibility |
645 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo
lorAdjust | 645 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo
lorAdjust |
646 || inherited_flags._insideLink != other.inherited_flags._insideLink | 646 || inherited_flags._insideLink != other.inherited_flags._insideLink |
647 || !surround->border.visuallyEqual(other.surround->border) | 647 || !surround->border.visuallyEqual(other.surround->border) |
648 || !m_background->visuallyEqual(*other.m_background)) | 648 || !m_background->visuallyEqual(*other.m_background)) |
649 return true; | 649 return true; |
650 | 650 |
651 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 651 if (rareInheritedData.get() != other.rareInheritedData.get()) { |
652 if (rareInheritedData->userModify != other.rareInheritedData->userModify | 652 if (rareInheritedData->userModify != other.rareInheritedData->userModify |
(...skipping 25 matching lines...) Expand all Loading... |
678 if (!transformDataEquivalent(other)) | 678 if (!transformDataEquivalent(other)) |
679 diff.setTransformChanged(); | 679 diff.setTransformChanged(); |
680 | 680 |
681 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity
) | 681 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity
) |
682 diff.setOpacityChanged(); | 682 diff.setOpacityChanged(); |
683 | 683 |
684 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt
er) | 684 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt
er) |
685 diff.setFilterChanged(); | 685 diff.setFilterChanged(); |
686 } | 686 } |
687 | 687 |
688 if (!diff.needsRepaint()) { | 688 if (!diff.needsPaintInvalidation()) { |
689 if (inherited->color != other.inherited->color | 689 if (inherited->color != other.inherited->color |
690 || inherited_flags.m_textUnderline != other.inherited_flags.m_textUn
derline | 690 || inherited_flags.m_textUnderline != other.inherited_flags.m_textUn
derline |
691 || visual->textDecoration != other.visual->textDecoration) { | 691 || visual->textDecoration != other.visual->textDecoration) { |
692 diff.setTextOrColorChanged(); | 692 diff.setTextOrColorChanged(); |
693 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get(
)) { | 693 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get(
)) { |
694 if (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe
ritedData->m_textDecorationStyle | 694 if (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe
ritedData->m_textDecorationStyle |
695 || rareNonInheritedData->m_textDecorationColor != other.rareNonI
nheritedData->m_textDecorationColor) | 695 || rareNonInheritedData->m_textDecorationColor != other.rareNonI
nheritedData->m_textDecorationColor) |
696 diff.setTextOrColorChanged(); | 696 diff.setTextOrColorChanged(); |
697 } else if (rareInheritedData.get() != other.rareInheritedData.get()) { | 697 } else if (rareInheritedData.get() != other.rareInheritedData.get()) { |
698 if (rareInheritedData->textFillColor() != other.rareInheritedData->t
extFillColor() | 698 if (rareInheritedData->textFillColor() != other.rareInheritedData->t
extFillColor() |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 // right | 1699 // right |
1700 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1700 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1701 if (radiiSum > rect.height()) | 1701 if (radiiSum > rect.height()) |
1702 factor = std::min(rect.height() / radiiSum, factor); | 1702 factor = std::min(rect.height() / radiiSum, factor); |
1703 | 1703 |
1704 ASSERT(factor <= 1); | 1704 ASSERT(factor <= 1); |
1705 return factor; | 1705 return factor; |
1706 } | 1706 } |
1707 | 1707 |
1708 } // namespace blink | 1708 } // namespace blink |
OLD | NEW |