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 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 if (LayoutBlock* container = containingBlock()) | 1829 if (LayoutBlock* container = containingBlock()) |
1830 container->setNeedsOverflowRecalcAfterStyleChange(); | 1830 container->setNeedsOverflowRecalcAfterStyleChange(); |
1831 } | 1831 } |
1832 | 1832 |
1833 if (updatedDiff.needsPaintInvalidationLayer()) | 1833 if (updatedDiff.needsPaintInvalidationLayer()) |
1834 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 1834 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
1835 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) | 1835 else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvali
dationObject()) |
1836 setShouldDoFullPaintInvalidation(); | 1836 setShouldDoFullPaintInvalidation(); |
1837 } | 1837 } |
1838 | 1838 |
| 1839 static inline bool layoutObjectHasBackground(const LayoutObject* layoutObject) |
| 1840 { |
| 1841 return layoutObject && layoutObject->hasBackground(); |
| 1842 } |
| 1843 |
1839 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) | 1844 void LayoutObject::styleWillChange(StyleDifference diff, const ComputedStyle& ne
wStyle) |
1840 { | 1845 { |
1841 if (m_style) { | 1846 if (m_style) { |
1842 // If our z-index changes value or our visibility changes, | 1847 // If our z-index changes value or our visibility changes, |
1843 // we need to dirty our stacking context's z-order list. | 1848 // we need to dirty our stacking context's z-order list. |
1844 bool visibilityChanged = m_style->visibility() != newStyle.visibility() | 1849 bool visibilityChanged = m_style->visibility() != newStyle.visibility() |
1845 || m_style->zIndex() != newStyle.zIndex() | 1850 || m_style->zIndex() != newStyle.zIndex() |
1846 || m_style->hasAutoZIndex() != newStyle.hasAutoZIndex(); | 1851 || m_style->hasAutoZIndex() != newStyle.hasAutoZIndex(); |
1847 if (visibilityChanged) { | 1852 if (visibilityChanged) { |
1848 document().setAnnotatedRegionsDirty(true); | 1853 document().setAnnotatedRegionsDirty(true); |
(...skipping 25 matching lines...) Expand all Loading... |
1874 // Clearing these bits is required to avoid leaving stale layoutObjects. | 1879 // Clearing these bits is required to avoid leaving stale layoutObjects. |
1875 // FIXME: We shouldn't need that hack if our logic was totally correct. | 1880 // FIXME: We shouldn't need that hack if our logic was totally correct. |
1876 if (diff.needsLayout()) { | 1881 if (diff.needsLayout()) { |
1877 setFloating(false); | 1882 setFloating(false); |
1878 clearPositionedState(); | 1883 clearPositionedState(); |
1879 } | 1884 } |
1880 } else { | 1885 } else { |
1881 s_affectsParentBlock = false; | 1886 s_affectsParentBlock = false; |
1882 } | 1887 } |
1883 | 1888 |
| 1889 if (view()->frameView()) { |
| 1890 bool shouldBlitOnFixedBackgroundImage = false; |
| 1891 if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) { |
| 1892 // On low-powered/mobile devices, preventing blitting on a scroll ca
n cause noticeable delays |
| 1893 // when scrolling a page with a fixed background image. As an optimi
zation, assuming there are |
| 1894 // no fixed positoned elements on the page, we can acclerate scrolli
ng (via blitting) if we |
| 1895 // ignore the CSS property "background-attachment: fixed". |
| 1896 shouldBlitOnFixedBackgroundImage = true; |
| 1897 } |
| 1898 bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle.
hasFixedBackgroundImage(); |
| 1899 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage &
& m_style->hasFixedBackgroundImage(); |
| 1900 |
| 1901 bool drawsRootBackground = isDocumentElement() || (isBody() && !layoutOb
jectHasBackground(document().documentElement()->layoutObject())); |
| 1902 if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) { |
| 1903 if (view()->compositor()->supportsFixedRootBackgroundCompositing())
{ |
| 1904 if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground()) |
| 1905 newStyleSlowScroll = false; |
| 1906 |
| 1907 if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground()) |
| 1908 oldStyleSlowScroll = false; |
| 1909 } |
| 1910 } |
| 1911 |
| 1912 if (oldStyleSlowScroll != newStyleSlowScroll) { |
| 1913 if (oldStyleSlowScroll) |
| 1914 view()->frameView()->removeSlowRepaintObject(); |
| 1915 if (newStyleSlowScroll) |
| 1916 view()->frameView()->addSlowRepaintObject(); |
| 1917 } |
| 1918 } |
| 1919 |
1884 // Elements with non-auto touch-action will send a SetTouchAction message | 1920 // Elements with non-auto touch-action will send a SetTouchAction message |
1885 // on touchstart in EventHandler::handleTouchEvent, and so effectively have | 1921 // on touchstart in EventHandler::handleTouchEvent, and so effectively have |
1886 // a touchstart handler that must be reported. | 1922 // a touchstart handler that must be reported. |
1887 // | 1923 // |
1888 // Since a CSS property cannot be applied directly to a text node, a | 1924 // Since a CSS property cannot be applied directly to a text node, a |
1889 // handler will have already been added for its parent so ignore it. | 1925 // handler will have already been added for its parent so ignore it. |
1890 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA
uto; | 1926 TouchAction oldTouchAction = m_style ? m_style->touchAction() : TouchActionA
uto; |
1891 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) !
= (newStyle.touchAction() == TouchActionAuto)) { | 1927 if (node() && !node()->isTextNode() && (oldTouchAction == TouchActionAuto) !
= (newStyle.touchAction() == TouchActionAuto)) { |
1892 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); | 1928 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg
istry(); |
1893 if (newStyle.touchAction() != TouchActionAuto) | 1929 if (newStyle.touchAction() != TouchActionAuto) |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 | 2466 |
2431 if (StyleImage* borderImage = m_style->borderImage().image()) | 2467 if (StyleImage* borderImage = m_style->borderImage().image()) |
2432 borderImage->removeClient(this); | 2468 borderImage->removeClient(this); |
2433 | 2469 |
2434 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) | 2470 if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) |
2435 maskBoxImage->removeClient(this); | 2471 maskBoxImage->removeClient(this); |
2436 | 2472 |
2437 removeShapeImageClient(m_style->shapeOutside()); | 2473 removeShapeImageClient(m_style->shapeOutside()); |
2438 } | 2474 } |
2439 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout
Object(this); | 2475 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLayout
Object(this); |
2440 | |
2441 if (frameView()) | |
2442 setIsSlowRepaintObject(false); | |
2443 } | 2476 } |
2444 | 2477 |
2445 void LayoutObject::insertedIntoTree() | 2478 void LayoutObject::insertedIntoTree() |
2446 { | 2479 { |
2447 // FIXME: We should ASSERT(isRooted()) here but generated content makes some
out-of-order insertion. | 2480 // FIXME: We should ASSERT(isRooted()) here but generated content makes some
out-of-order insertion. |
2448 | 2481 |
2449 // Keep our layer hierarchy updated. Optimize for the common case where we d
on't have any children | 2482 // Keep our layer hierarchy updated. Optimize for the common case where we d
on't have any children |
2450 // and don't have a layer attached to ourselves. | 2483 // and don't have a layer attached to ourselves. |
2451 DeprecatedPaintLayer* layer = nullptr; | 2484 DeprecatedPaintLayer* layer = nullptr; |
2452 if (slowFirstChild() || hasLayer()) { | 2485 if (slowFirstChild() || hasLayer()) { |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 } | 3263 } |
3231 | 3264 |
3232 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g
et rid of this function (crbug.com/410097). | 3265 // FIXME: If we had a flag to force invalidations in a whole subtree, we could g
et rid of this function (crbug.com/410097). |
3233 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() | 3266 void LayoutObject::setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants() |
3234 { | 3267 { |
3235 // Need to access the current compositing status. | 3268 // Need to access the current compositing status. |
3236 DisableCompositingQueryAsserts disabler; | 3269 DisableCompositingQueryAsserts disabler; |
3237 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendantsInternal(t
his); | 3270 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendantsInternal(t
his); |
3238 } | 3271 } |
3239 | 3272 |
3240 void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject) | |
3241 { | |
3242 ASSERT(frameView()); | |
3243 if (m_bitfields.isSlowRepaintObject() == isSlowRepaintObject) | |
3244 return; | |
3245 m_bitfields.setIsSlowRepaintObject(isSlowRepaintObject); | |
3246 if (isSlowRepaintObject) | |
3247 frameView()->addSlowRepaintObject(); | |
3248 else | |
3249 frameView()->removeSlowRepaintObject(); | |
3250 } | |
3251 | |
3252 } // namespace blink | 3273 } // namespace blink |
3253 | 3274 |
3254 #ifndef NDEBUG | 3275 #ifndef NDEBUG |
3255 | 3276 |
3256 void showTree(const blink::LayoutObject* object) | 3277 void showTree(const blink::LayoutObject* object) |
3257 { | 3278 { |
3258 if (object) | 3279 if (object) |
3259 object->showTreeForThis(); | 3280 object->showTreeForThis(); |
3260 else | 3281 else |
3261 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); | 3282 fprintf(stderr, "Cannot showTree. Root is (nil)\n"); |
(...skipping 18 matching lines...) Expand all Loading... |
3280 const blink::LayoutObject* root = object1; | 3301 const blink::LayoutObject* root = object1; |
3281 while (root->parent()) | 3302 while (root->parent()) |
3282 root = root->parent(); | 3303 root = root->parent(); |
3283 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3304 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3284 } else { | 3305 } else { |
3285 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3306 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3286 } | 3307 } |
3287 } | 3308 } |
3288 | 3309 |
3289 #endif | 3310 #endif |
OLD | NEW |