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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 if (hasNonCompositedScrollbars()) | 718 if (hasNonCompositedScrollbars()) |
719 return false; | 719 return false; |
720 | 720 |
721 // We can't detect whether a plugin has box effects, so disable this optimiz
ation for that case. | 721 // We can't detect whether a plugin has box effects, so disable this optimiz
ation for that case. |
722 if (isEmbeddedObject()) | 722 if (isEmbeddedObject()) |
723 return false; | 723 return false; |
724 | 724 |
725 return !hasBoxEffect(); | 725 return !hasBoxEffect(); |
726 } | 726 } |
727 | 727 |
728 LayoutBlock* LayoutObject::firstLineBlock() const | |
729 { | |
730 return nullptr; | |
731 } | |
732 | |
733 static inline bool objectIsRelayoutBoundary(const LayoutObject* object) | 728 static inline bool objectIsRelayoutBoundary(const LayoutObject* object) |
734 { | 729 { |
735 // FIXME: In future it may be possible to broaden these conditions in order
to improve performance. | 730 // FIXME: In future it may be possible to broaden these conditions in order
to improve performance. |
736 if (object->isTextControl()) | 731 if (object->isTextControl()) |
737 return true; | 732 return true; |
738 | 733 |
739 if (object->isSVGRoot()) | 734 if (object->isSVGRoot()) |
740 return true; | 735 return true; |
741 | 736 |
742 if (!object->hasOverflowClip()) | 737 if (!object->hasOverflowClip()) |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 setStyle(style.release()); | 1825 setStyle(style.release()); |
1831 return; | 1826 return; |
1832 } | 1827 } |
1833 | 1828 |
1834 setStyle(pseudoStyle); | 1829 setStyle(pseudoStyle); |
1835 } | 1830 } |
1836 | 1831 |
1837 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, const
ComputedStyle& newStyle) | 1832 void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, const
ComputedStyle& newStyle) |
1838 { | 1833 { |
1839 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); | 1834 StyleDifference diff = oldStyle.visualInvalidationDiff(newStyle); |
1840 if (diff.hasDifference()) { | 1835 |
1841 // TODO(rune@opera.com): We should use the diff to determine whether a r
epaint vs. layout | 1836 if (diff.needsPaintInvalidation() || diff.textDecorationOrColorChanged()) { |
1842 // is needed, but for now just assume a layout will be required. The dif
f code | 1837 // We need to invalidate all inline boxes in the first line, because the
y need to be |
1843 // in LayoutObject::setStyle would need to be factored out so that it co
uld be reused. | 1838 // repainted with the new style, e.g. background, font style, etc. |
1844 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalida
tionReason::StyleChange); | 1839 LayoutBlockFlow* firstLineContainer = nullptr; |
| 1840 if (canHaveFirstLineOrFirstLetterStyle()) { |
| 1841 // This object is a LayoutBlock having FIRST_LINE pseudo style chang
ed. |
| 1842 firstLineContainer = toLayoutBlock(this)->nearestInnerBlockWithFirst
Line(); |
| 1843 } else if (isLayoutInline()) { |
| 1844 // This object is a LayoutInline having FIRST_LINE_INHERITED pesudo
style changed. |
| 1845 // This method can be called even if the LayoutInline doesn't inters
ect the first line, |
| 1846 // but we only need to invalidate if it does. |
| 1847 if (InlineBox* firstLineBox = toLayoutInline(this)->firstLineBoxIncl
udingCulling()) { |
| 1848 if (firstLineBox->isFirstLineStyle()) |
| 1849 firstLineContainer = toLayoutBlockFlow(containingBlock()); |
| 1850 } |
| 1851 } |
| 1852 if (firstLineContainer) { |
| 1853 firstLineContainer->invalidateDisplayItemClientsOfFirstLine(); |
| 1854 // The following is for rect invalidation. For slimming paint v2, we
can invalidate the rects |
| 1855 // of the first line display item clients instead of the whole rect
of the container. |
| 1856 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 1857 firstLineContainer->setShouldDoFullPaintInvalidation(); |
| 1858 } |
1845 } | 1859 } |
| 1860 if (diff.needsLayout()) |
| 1861 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange)
; |
1846 } | 1862 } |
1847 | 1863 |
1848 void LayoutObject::markContainingBlocksForOverflowRecalc() | 1864 void LayoutObject::markContainingBlocksForOverflowRecalc() |
1849 { | 1865 { |
1850 for (LayoutBlock* container = containingBlock(); container && !container->ch
ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock
()) | 1866 for (LayoutBlock* container = containingBlock(); container && !container->ch
ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock
()) |
1851 container->setChildNeedsOverflowRecalcAfterStyleChange(); | 1867 container->setChildNeedsOverflowRecalcAfterStyleChange(); |
1852 } | 1868 } |
1853 | 1869 |
1854 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() | 1870 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() |
1855 { | 1871 { |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 Cached, | 2811 Cached, |
2796 Uncached | 2812 Uncached |
2797 }; | 2813 }; |
2798 | 2814 |
2799 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS
tate type, const LayoutObject* layoutObject, ComputedStyle* style) | 2815 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS
tate type, const LayoutObject* layoutObject, ComputedStyle* style) |
2800 { | 2816 { |
2801 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; | 2817 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; |
2802 if (layoutObject->isBeforeOrAfterContent()) | 2818 if (layoutObject->isBeforeOrAfterContent()) |
2803 layoutObjectForFirstLineStyle = layoutObject->parent(); | 2819 layoutObjectForFirstLineStyle = layoutObject->parent(); |
2804 | 2820 |
2805 if (layoutObjectForFirstLineStyle->isLayoutBlockFlow() || layoutObjectForFir
stLineStyle->isLayoutButton()) { | 2821 if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) { |
2806 if (LayoutBlock* firstLineBlock = layoutObjectForFirstLineStyle->firstLi
neBlock()) { | 2822 if (LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFirstLine
Style)->enclosingFirstLineStyleBlock()) { |
2807 if (type == Cached) | 2823 if (type == Cached) |
2808 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); | 2824 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); |
2809 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR
ST_LINE), style, firstLineBlock == layoutObject ? style : 0); | 2825 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR
ST_LINE), style, firstLineBlock == layoutObject ? style : 0); |
2810 } | 2826 } |
2811 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF
irstLineStyle->isLayoutInline() | 2827 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF
irstLineStyle->isLayoutInline() |
2812 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement())
{ | 2828 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement())
{ |
2813 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent
()->firstLineStyle(); | 2829 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent
()->firstLineStyle(); |
2814 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { | 2830 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { |
2815 if (type == Cached) { | 2831 if (type == Cached) { |
2816 // A first-line style is in effect. Cache a first-line style for
ourselves. | 2832 // A first-line style is in effect. Cache a first-line style for
ourselves. |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 const blink::LayoutObject* root = object1; | 3515 const blink::LayoutObject* root = object1; |
3500 while (root->parent()) | 3516 while (root->parent()) |
3501 root = root->parent(); | 3517 root = root->parent(); |
3502 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3518 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3503 } else { | 3519 } else { |
3504 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3520 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3505 } | 3521 } |
3506 } | 3522 } |
3507 | 3523 |
3508 #endif | 3524 #endif |
OLD | NEW |