| 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 LayoutBlockFlow* firstLineContainer = nullptr; |
| 1843 // in LayoutObject::setStyle would need to be factored out so that it co
uld be reused. | 1838 if (canHaveFirstLineOrFirstLetterStyle()) { |
| 1844 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalida
tionReason::StyleChange); | 1839 firstLineContainer = toLayoutBlock(this)->firstLineContainer(); |
| 1840 } else if (isLayoutInline()) { |
| 1841 if (InlineBox* firstLineBox = toLayoutInline(this)->firstLineBoxIncl
udingCulling()) { |
| 1842 if (firstLineBox->isFirstLineStyle()) |
| 1843 firstLineContainer = toLayoutBlockFlow(containingBlock()); |
| 1844 } |
| 1845 } |
| 1846 if (firstLineContainer) { |
| 1847 firstLineContainer->invalidateDisplayItemClientsOfFirstLine(); |
| 1848 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 1849 firstLineContainer->setShouldDoFullPaintInvalidation(); |
| 1850 } |
| 1845 } | 1851 } |
| 1852 if (diff.needsLayout()) |
| 1853 setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange)
; |
| 1846 } | 1854 } |
| 1847 | 1855 |
| 1848 void LayoutObject::markContainingBlocksForOverflowRecalc() | 1856 void LayoutObject::markContainingBlocksForOverflowRecalc() |
| 1849 { | 1857 { |
| 1850 for (LayoutBlock* container = containingBlock(); container && !container->ch
ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock
()) | 1858 for (LayoutBlock* container = containingBlock(); container && !container->ch
ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock
()) |
| 1851 container->setChildNeedsOverflowRecalcAfterStyleChange(); | 1859 container->setChildNeedsOverflowRecalcAfterStyleChange(); |
| 1852 } | 1860 } |
| 1853 | 1861 |
| 1854 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() | 1862 void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() |
| 1855 { | 1863 { |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 Cached, | 2803 Cached, |
| 2796 Uncached | 2804 Uncached |
| 2797 }; | 2805 }; |
| 2798 | 2806 |
| 2799 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS
tate type, const LayoutObject* layoutObject, ComputedStyle* style) | 2807 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS
tate type, const LayoutObject* layoutObject, ComputedStyle* style) |
| 2800 { | 2808 { |
| 2801 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; | 2809 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; |
| 2802 if (layoutObject->isBeforeOrAfterContent()) | 2810 if (layoutObject->isBeforeOrAfterContent()) |
| 2803 layoutObjectForFirstLineStyle = layoutObject->parent(); | 2811 layoutObjectForFirstLineStyle = layoutObject->parent(); |
| 2804 | 2812 |
| 2805 if (layoutObjectForFirstLineStyle->isLayoutBlockFlow() || layoutObjectForFir
stLineStyle->isLayoutButton()) { | 2813 if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) { |
| 2806 if (LayoutBlock* firstLineBlock = layoutObjectForFirstLineStyle->firstLi
neBlock()) { | 2814 if (LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFirstLine
Style)->firstLineStyleBlock()) { |
| 2807 if (type == Cached) | 2815 if (type == Cached) |
| 2808 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); | 2816 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); |
| 2809 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR
ST_LINE), style, firstLineBlock == layoutObject ? style : 0); | 2817 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIR
ST_LINE), style, firstLineBlock == layoutObject ? style : 0); |
| 2810 } | 2818 } |
| 2811 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF
irstLineStyle->isLayoutInline() | 2819 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF
irstLineStyle->isLayoutInline() |
| 2812 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement())
{ | 2820 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement())
{ |
| 2813 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent
()->firstLineStyle(); | 2821 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent
()->firstLineStyle(); |
| 2814 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { | 2822 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { |
| 2815 if (type == Cached) { | 2823 if (type == Cached) { |
| 2816 // A first-line style is in effect. Cache a first-line style for
ourselves. | 2824 // 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; | 3507 const blink::LayoutObject* root = object1; |
| 3500 while (root->parent()) | 3508 while (root->parent()) |
| 3501 root = root->parent(); | 3509 root = root->parent(); |
| 3502 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3510 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3503 } else { | 3511 } else { |
| 3504 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3512 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3505 } | 3513 } |
| 3506 } | 3514 } |
| 3507 | 3515 |
| 3508 #endif | 3516 #endif |
| OLD | NEW |