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 only if it does. | |
chrishtr
2015/12/07 18:06:03
Nit: remove second "only"
Xianzhu
2015/12/07 20:42:48
Done.
| |
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 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
chrishtr
2015/12/07 18:06:03
Add a comment explaining why this is conditional o
Xianzhu
2015/12/07 20:42:48
Done.
| |
1855 firstLineContainer->setShouldDoFullPaintInvalidation(); | |
1856 } | |
1845 } | 1857 } |
1858 if (diff.needsLayout()) | |
1859 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange) ; | |
1846 } | 1860 } |
1847 | 1861 |
1848 void LayoutObject::markContainingBlocksForOverflowRecalc() | 1862 void LayoutObject::markContainingBlocksForOverflowRecalc() |
1849 { | 1863 { |
1850 for (LayoutBlock* container = containingBlock(); container && !container->ch ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock ()) | 1864 for (LayoutBlock* container = containingBlock(); container && !container->ch ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock ()) |
1851 container->setChildNeedsOverflowRecalcAfterStyleChange(); | 1865 container->setChildNeedsOverflowRecalcAfterStyleChange(); |
1852 } | 1866 } |
1853 | 1867 |
1854 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() | 1868 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() |
1855 { | 1869 { |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2795 Cached, | 2809 Cached, |
2796 Uncached | 2810 Uncached |
2797 }; | 2811 }; |
2798 | 2812 |
2799 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS tate type, const LayoutObject* layoutObject, ComputedStyle* style) | 2813 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS tate type, const LayoutObject* layoutObject, ComputedStyle* style) |
2800 { | 2814 { |
2801 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; | 2815 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; |
2802 if (layoutObject->isBeforeOrAfterContent()) | 2816 if (layoutObject->isBeforeOrAfterContent()) |
2803 layoutObjectForFirstLineStyle = layoutObject->parent(); | 2817 layoutObjectForFirstLineStyle = layoutObject->parent(); |
2804 | 2818 |
2805 if (layoutObjectForFirstLineStyle->isLayoutBlockFlow() || layoutObjectForFir stLineStyle->isLayoutButton()) { | 2819 if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) { |
2806 if (LayoutBlock* firstLineBlock = layoutObjectForFirstLineStyle->firstLi neBlock()) { | 2820 if (LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFirstLine Style)->enclosingFirstLineStyleBlock()) { |
2807 if (type == Cached) | 2821 if (type == Cached) |
2808 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); | 2822 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); |
2809 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == layoutObject ? style : 0); | 2823 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR ST_LINE), style, firstLineBlock == layoutObject ? style : 0); |
2810 } | 2824 } |
2811 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF irstLineStyle->isLayoutInline() | 2825 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF irstLineStyle->isLayoutInline() |
2812 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement()) { | 2826 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement()) { |
2813 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent ()->firstLineStyle(); | 2827 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent ()->firstLineStyle(); |
2814 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { | 2828 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { |
2815 if (type == Cached) { | 2829 if (type == Cached) { |
2816 // A first-line style is in effect. Cache a first-line style for ourselves. | 2830 // 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; | 3513 const blink::LayoutObject* root = object1; |
3500 while (root->parent()) | 3514 while (root->parent()) |
3501 root = root->parent(); | 3515 root = root->parent(); |
3502 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3516 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3503 } else { | 3517 } else { |
3504 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3518 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3505 } | 3519 } |
3506 } | 3520 } |
3507 | 3521 |
3508 #endif | 3522 #endif |
OLD | NEW |