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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1871 | 1871 |
1872 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign ed contextSensitiveProperties) const | 1872 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign ed contextSensitiveProperties) const |
1873 { | 1873 { |
1874 // FIXME: The calls to hasDirectReasonsForCompositing are using state that m ay not be up to date. | 1874 // FIXME: The calls to hasDirectReasonsForCompositing are using state that m ay not be up to date. |
1875 DisableCompositingQueryAsserts disabler; | 1875 DisableCompositingQueryAsserts disabler; |
1876 | 1876 |
1877 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG( )) | 1877 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG( )) |
1878 diff.setNeedsFullLayout(); | 1878 diff.setNeedsFullLayout(); |
1879 | 1879 |
1880 // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint. | 1880 // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint. |
1881 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !diff .needsLayout()) { | 1881 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { |
1882 // Text nodes share style with their parents but transforms don't apply to them, | 1882 // Text nodes share style with their parents but transforms don't apply to them, |
1883 // hence the !isText() check. | 1883 // hence the !isText() check. |
1884 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) | 1884 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) |
1885 diff.setNeedsRepaintLayer(); | 1885 diff.setNeedsRepaintLayer(); |
1886 else | 1886 else |
1887 diff.setNeedsRecompositeLayer(); | 1887 diff.setNeedsRecompositeLayer(); |
1888 } | 1888 } |
1889 | 1889 |
1890 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also | 1890 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also |
1891 // ignoring text nodes) | 1891 // ignoring text nodes) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2018 // in the future as we move renderer changes out of layout and into style ch anges. | 2018 // in the future as we move renderer changes out of layout and into style ch anges. |
2019 if (doesNotNeedLayout) | 2019 if (doesNotNeedLayout) |
2020 return; | 2020 return; |
2021 | 2021 |
2022 // Now that the layer (if any) has been updated, we need to adjust the diff again, | 2022 // Now that the layer (if any) has been updated, we need to adjust the diff again, |
2023 // check whether we should layout now, and decide if we need to repaint. | 2023 // check whether we should layout now, and decide if we need to repaint. |
2024 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr operties); | 2024 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr operties); |
2025 | 2025 |
2026 if (!diff.needsFullLayout()) { | 2026 if (!diff.needsFullLayout()) { |
2027 if (updatedDiff.needsFullLayout()) | 2027 if (updatedDiff.needsFullLayout()) |
2028 setNeedsLayoutAndPrefWidthsRecalc(); | 2028 setNeedsLayoutAndPrefWidthsRecalcWithoutForcingFullRepaint(); |
2029 else if (updatedDiff.needsPositionedMovementLayout()) | 2029 else if (updatedDiff.needsPositionedMovementLayout()) |
2030 setNeedsPositionedMovementLayout(); | 2030 setNeedsPositionedMovementLayout(); |
2031 } | 2031 } |
2032 | 2032 |
2033 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs Layout()) { | 2033 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs Layout()) { |
2034 if (RenderBlock* container = containingBlock()) | 2034 if (RenderBlock* container = containingBlock()) |
2035 container->setNeedsOverflowRecalcAfterStyleChange(); | 2035 container->setNeedsOverflowRecalcAfterStyleChange(); |
2036 if (isBox()) | 2036 if (isBox()) |
2037 toRenderBox(this)->updateLayerTransform(); | 2037 toRenderBox(this)->updateLayerTransform(); |
2038 } | 2038 } |
2039 | 2039 |
2040 // FIXME: The !needsFullLayout() check is temporary to keep the original Sty leDifference | 2040 if (updatedDiff.needsRepaint()) { |
2041 // behavior that we did't repaint here on StyleDifferenceLayout. | 2041 // Repaint with the new style, e.g., for example if we go from not havin g |
2042 // In the next steps we will not always repaint on selfNeedsLayout(), and sh ould force | 2042 // an outline to having an outline. |
2043 // repaint here if needsRepaint is set. | 2043 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && needsLayout() ) |
Julien - ping for review
2014/05/12 15:08:46
Ideally we would want any direct repaint calls to
Xianzhu
2014/05/12 21:31:51
Don't we still need repaint() on repaint-only (no
Julien - ping for review
2014/05/20 16:33:30
We do indeed. However we could make those use repa
| |
2044 if (updatedDiff.needsRepaint() && !updatedDiff.needsFullLayout()) { | 2044 setShouldDoFullRepaintAfterLayout(true); |
2045 // Do a repaint with the new style now, e.g., for example if we go from | 2045 else |
2046 // not having an outline to having an outline. | 2046 repaint(); |
2047 repaint(); | |
2048 } | 2047 } |
2049 } | 2048 } |
2050 | 2049 |
2051 static inline bool rendererHasBackground(const RenderObject* renderer) | 2050 static inline bool rendererHasBackground(const RenderObject* renderer) |
2052 { | 2051 { |
2053 return renderer && renderer->hasBackground(); | 2052 return renderer && renderer->hasBackground(); |
2054 } | 2053 } |
2055 | 2054 |
2056 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) | 2055 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) |
2057 { | 2056 { |
(...skipping 16 matching lines...) Expand all Loading... | |
2074 if (newStyle.visibility() == VISIBLE) { | 2073 if (newStyle.visibility() == VISIBLE) { |
2075 layer->setHasVisibleContent(); | 2074 layer->setHasVisibleContent(); |
2076 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { | 2075 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { |
2077 layer->dirtyVisibleContentStatus(); | 2076 layer->dirtyVisibleContentStatus(); |
2078 if (diff.needsLayout()) | 2077 if (diff.needsLayout()) |
2079 repaint(); | 2078 repaint(); |
2080 } | 2079 } |
2081 } | 2080 } |
2082 } | 2081 } |
2083 | 2082 |
2084 // FIXME: The !needsFullLayout() check is temporary to keep the original StyleDifference | 2083 if (m_parent && diff.needsRepaintObject()) { |
2085 // behavior that we did't repaint here on StyleDifferenceLayout. | 2084 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && diff.need sLayout()) |
Julien - ping for review
2014/05/12 15:08:46
Same comment.
| |
2086 // In the next steps we will not always repaint on selfNeedsLayout(), an d should force | 2085 setShouldDoFullRepaintAfterLayout(true); |
2087 // repaint here if needsRepaintObject is set. | 2086 else |
2088 if (m_parent && diff.needsRepaintObject() && !diff.needsFullLayout()) | 2087 repaint(); |
2089 repaint(); | 2088 } |
2090 | 2089 |
2091 if (isFloating() && (m_style->floating() != newStyle.floating())) | 2090 if (isFloating() && (m_style->floating() != newStyle.floating())) |
2092 // For changes in float styles, we need to conceivably remove oursel ves | 2091 // For changes in float styles, we need to conceivably remove oursel ves |
2093 // from the floating objects list. | 2092 // from the floating objects list. |
2094 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2093 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
2095 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) | 2094 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) |
2096 // For changes in positioning styles, we need to conceivably remove ourselves | 2095 // For changes in positioning styles, we need to conceivably remove ourselves |
2097 // from the positioned objects list. | 2096 // from the positioned objects list. |
2098 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2097 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
2099 | 2098 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2186 // directly affect the containing block of this object is a change to | 2185 // directly affect the containing block of this object is a change to |
2187 // the position style. | 2186 // the position style. |
2188 if (needsLayout() && oldStyle->position() != m_style->position()) | 2187 if (needsLayout() && oldStyle->position() != m_style->position()) |
2189 markContainingBlocksForLayout(); | 2188 markContainingBlocksForLayout(); |
2190 | 2189 |
2191 // Ditto. | 2190 // Ditto. |
2192 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) | 2191 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) |
2193 markContainingBlocksForOverflowRecalc(); | 2192 markContainingBlocksForOverflowRecalc(); |
2194 | 2193 |
2195 if (diff.needsFullLayout()) | 2194 if (diff.needsFullLayout()) |
2196 setNeedsLayoutAndPrefWidthsRecalc(); | 2195 setNeedsLayoutAndPrefWidthsRecalcWithoutForcingFullRepaint(); |
2197 } else if (diff.needsPositionedMovementLayout()) | 2196 } else if (diff.needsPositionedMovementLayout()) |
2198 setNeedsPositionedMovementLayout(); | 2197 setNeedsPositionedMovementLayout(); |
2199 | 2198 |
2200 // Don't check for repaint here; we need to wait until the layer has been | 2199 // Don't check for repaint here; we need to wait until the layer has been |
2201 // updated by subclasses before we know if we have to repaint (in setStyle() ). | 2200 // updated by subclasses before we know if we have to repaint (in setStyle() ). |
2202 | 2201 |
2203 if (oldStyle && !areCursorsEqual(oldStyle, style())) { | 2202 if (oldStyle && !areCursorsEqual(oldStyle, style())) { |
2204 if (LocalFrame* frame = this->frame()) | 2203 if (LocalFrame* frame = this->frame()) |
2205 frame->eventHandler().scheduleCursorUpdate(); | 2204 frame->eventHandler().scheduleCursorUpdate(); |
2206 } | 2205 } |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3426 { | 3425 { |
3427 if (object1) { | 3426 if (object1) { |
3428 const WebCore::RenderObject* root = object1; | 3427 const WebCore::RenderObject* root = object1; |
3429 while (root->parent()) | 3428 while (root->parent()) |
3430 root = root->parent(); | 3429 root = root->parent(); |
3431 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3430 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3432 } | 3431 } |
3433 } | 3432 } |
3434 | 3433 |
3435 #endif | 3434 #endif |
OLD | NEW |