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 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1894 // Text nodes share style with their parents but transforms don't apply to them, | 1894 // Text nodes share style with their parents but transforms don't apply to them, |
1895 // hence the !isText() check. | 1895 // hence the !isText() check. |
1896 // FIXME: when transforms are taken into account for overflow, we will n eed to do a layout. | 1896 // FIXME: when transforms are taken into account for overflow, we will n eed to do a layout. |
1897 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) { | 1897 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) { |
1898 // We need to set at least SimplifiedLayout, but if PositionedMoveme ntOnly is already set | 1898 // We need to set at least SimplifiedLayout, but if PositionedMoveme ntOnly is already set |
1899 // then we actually need SimplifiedLayoutAndPositionedMovement. | 1899 // then we actually need SimplifiedLayoutAndPositionedMovement. |
1900 if (!hasLayer()) | 1900 if (!hasLayer()) |
1901 diff.setNeedsFullLayout(); // FIXME: Do this for now since Simpl ifiedLayout cannot handle updating floating objects lists. | 1901 diff.setNeedsFullLayout(); // FIXME: Do this for now since Simpl ifiedLayout cannot handle updating floating objects lists. |
1902 else | 1902 else |
1903 diff.setNeedsSimplifiedLayout(); | 1903 diff.setNeedsSimplifiedLayout(); |
1904 diff.setNeedsRepaintLayer(); | |
Julien - ping for review
2014/04/25 15:43:04
Is this line always needed? Even when we trigger a
Xianzhu
2014/04/25 17:32:39
The above change will disappear if rebased on trch
Julien - ping for review
2014/04/28 17:40:28
I am still requesting a code comment or waiting on
Xianzhu
2014/04/28 18:11:50
Done.
| |
1904 } else { | 1905 } else { |
1905 diff.setNeedsRecompositeLayer(); | 1906 diff.setNeedsRecompositeLayer(); |
1906 } | 1907 } |
1907 } | 1908 } |
1908 | 1909 |
1909 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also | 1910 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also |
1910 // ignoring text nodes) | 1911 // ignoring text nodes) |
1911 if ((contextSensitiveProperties & (ContextSensitivePropertyOpacity | Context SensitivePropertyZIndex)) && !diff.needsLayout()) { | 1912 if (contextSensitiveProperties & (ContextSensitivePropertyOpacity | ContextS ensitivePropertyZIndex)) { |
1912 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) | 1913 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) |
1913 diff.setNeedsRepaintLayer(); | 1914 diff.setNeedsRepaintLayer(); |
1914 else | 1915 else |
1915 diff.setNeedsRecompositeLayer(); | 1916 diff.setNeedsRecompositeLayer(); |
1916 } | 1917 } |
1917 | 1918 |
1918 // If filter changed, and the layer does not paint into its own separate bac king or it paints with filters, then we need to repaint. | 1919 // If filter changed, and the layer does not paint into its own separate bac king or it paints with filters, then we need to repaint. |
1919 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye r() && !diff.needsLayout()) { | 1920 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye r()) { |
1920 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); | 1921 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); |
1921 if (!layer->hasDirectReasonsForCompositing() || layer->paintsWithFilters ()) | 1922 if (!layer->hasDirectReasonsForCompositing() || layer->paintsWithFilters ()) |
1922 diff.setNeedsRepaintLayer(); | 1923 diff.setNeedsRepaintLayer(); |
1923 else | 1924 else |
1924 diff.setNeedsRecompositeLayer(); | 1925 diff.setNeedsRecompositeLayer(); |
1925 } | 1926 } |
1926 | 1927 |
1927 if ((contextSensitiveProperties & ContextSensitivePropertyTextOrColor) && !d iff.needsRepaint() && !diff.needsLayout() | 1928 if ((contextSensitiveProperties & ContextSensitivePropertyTextOrColor) && !d iff.needsRepaint() |
1928 && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()) | 1929 && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()) |
1929 diff.setNeedsRepaintObject(); | 1930 diff.setNeedsRepaintObject(); |
1930 | 1931 |
1931 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual | 1932 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual |
1932 // style changing, since it depends on whether we decide to composite these elements. When the | 1933 // style changing, since it depends on whether we decide to composite these elements. When the |
1933 // layer status of one of these elements changes, we need to force a layout. | 1934 // layer status of one of these elements changes, we need to force a layout. |
1934 if (diff.hasNoChange() && style() && isLayerModelObject()) { | 1935 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { |
1935 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; | 1936 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; |
1936 if (hasLayer() != requiresLayer) | 1937 if (hasLayer() != requiresLayer) |
1937 diff.setNeedsFullLayout(); | 1938 diff.setNeedsFullLayout(); |
1938 } | 1939 } |
1939 | 1940 |
1940 // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint . | 1941 // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint . |
1941 if (diff.needsRepaintLayer() && !hasLayer()) { | 1942 if (diff.needsRepaintLayer() && !hasLayer()) { |
1942 diff.clearNeedsRepaint(); | 1943 diff.clearNeedsRepaint(); |
1943 diff.setNeedsRepaintObject(); | 1944 diff.setNeedsRepaintObject(); |
1944 } | 1945 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2032 if (updatedDiff.needsFullLayout()) { | 2033 if (updatedDiff.needsFullLayout()) { |
2033 setNeedsLayoutAndPrefWidthsRecalc(); | 2034 setNeedsLayoutAndPrefWidthsRecalc(); |
2034 } else { | 2035 } else { |
2035 if (updatedDiff.needsPositionedMovementLayout()) | 2036 if (updatedDiff.needsPositionedMovementLayout()) |
2036 setNeedsPositionedMovementLayout(); | 2037 setNeedsPositionedMovementLayout(); |
2037 if (updatedDiff.needsSimplifiedLayout()) | 2038 if (updatedDiff.needsSimplifiedLayout()) |
2038 setNeedsSimplifiedNormalFlowLayout(); | 2039 setNeedsSimplifiedNormalFlowLayout(); |
2039 } | 2040 } |
2040 } | 2041 } |
2041 | 2042 |
2042 if (updatedDiff.needsRepaint()) { | 2043 // FIXME: For now if needsFullLayout() or needsSimplifiedLayout(), repaint i s handled during layout(), |
Julien - ping for review
2014/04/25 15:43:04
What's the long term plan?
My view of the code is
Xianzhu
2014/04/25 17:32:39
Yes.
In this CL, repaint-only needs are always se
Julien - ping for review
2014/04/28 17:40:28
border-width is a bad example as we already keep t
Xianzhu
2014/04/28 18:11:50
How about the updated comments?
| |
2044 // so don't repaint here to avoid duplicate repaints. | |
2045 // Need to optimize repaint during layout() to reduce unnecessary repaints a nd duplicate code. | |
2046 if (updatedDiff.needsRepaint() && !updatedDiff.needsFullLayout() && !updated Diff.needsSimplifiedLayout()) { | |
2043 // Do a repaint with the new style now, e.g., for example if we go from | 2047 // Do a repaint with the new style now, e.g., for example if we go from |
2044 // not having an outline to having an outline. | 2048 // not having an outline to having an outline. |
2045 repaint(); | 2049 repaint(); |
2046 } | 2050 } |
2047 } | 2051 } |
2048 | 2052 |
2049 static inline bool rendererHasBackground(const RenderObject* renderer) | 2053 static inline bool rendererHasBackground(const RenderObject* renderer) |
2050 { | 2054 { |
2051 return renderer && renderer->hasBackground(); | 2055 return renderer && renderer->hasBackground(); |
2052 } | 2056 } |
(...skipping 19 matching lines...) Expand all Loading... | |
2072 if (newStyle.visibility() == VISIBLE) { | 2076 if (newStyle.visibility() == VISIBLE) { |
2073 layer->setHasVisibleContent(); | 2077 layer->setHasVisibleContent(); |
2074 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { | 2078 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { |
2075 layer->dirtyVisibleContentStatus(); | 2079 layer->dirtyVisibleContentStatus(); |
2076 if (diff.needsLayout()) | 2080 if (diff.needsLayout()) |
2077 repaint(); | 2081 repaint(); |
2078 } | 2082 } |
2079 } | 2083 } |
2080 } | 2084 } |
2081 | 2085 |
2082 if (m_parent && diff.needsRepaintObjectOnly()) | 2086 // FIXME: For now if needsFullLayout() or needsSimplifiedLayout(), repai nt is handled during layout(), |
2087 // so don't repaint here to avoid duplicate repaints. | |
2088 // Need to optimize repaint during layout() to reduce unnecessary repain ts and duplicate code. | |
2089 if (m_parent && diff.needsRepaintObject() && !diff.needsFullLayout() && !diff.needsSimplifiedLayout()) | |
2083 repaint(); | 2090 repaint(); |
2091 | |
2084 if (isFloating() && (m_style->floating() != newStyle.floating())) | 2092 if (isFloating() && (m_style->floating() != newStyle.floating())) |
2085 // For changes in float styles, we need to conceivably remove oursel ves | 2093 // For changes in float styles, we need to conceivably remove oursel ves |
2086 // from the floating objects list. | 2094 // from the floating objects list. |
2087 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2095 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
2088 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) | 2096 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) |
2089 // For changes in positioning styles, we need to conceivably remove ourselves | 2097 // For changes in positioning styles, we need to conceivably remove ourselves |
2090 // from the positioned objects list. | 2098 // from the positioned objects list. |
2091 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2099 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
2092 | 2100 |
2093 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned() | 2101 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned() |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3422 { | 3430 { |
3423 if (object1) { | 3431 if (object1) { |
3424 const WebCore::RenderObject* root = object1; | 3432 const WebCore::RenderObject* root = object1; |
3425 while (root->parent()) | 3433 while (root->parent()) |
3426 root = root->parent(); | 3434 root = root->parent(); |
3427 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3435 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3428 } | 3436 } |
3429 } | 3437 } |
3430 | 3438 |
3431 #endif | 3439 #endif |
OLD | NEW |