Chromium Code Reviews| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (isOutOfFlowPositioned()) | 137 if (isOutOfFlowPositioned()) |
| 138 RenderBlock::removePositionedObject(this); | 138 RenderBlock::removePositionedObject(this); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e) | 141 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e) |
| 142 { | 142 { |
| 143 RenderStyle* oldStyle = style(); | 143 RenderStyle* oldStyle = style(); |
| 144 if (oldStyle) { | 144 if (oldStyle) { |
| 145 // The background of the root element or the body element could propagat e up to | 145 if ((diff.needsRepaint() || diff.needsLayout()) && backgroundCanBleedToC anvas()) { |
| 146 // the canvas. Just dirty the entire canvas when our style changes subs tantially. | |
| 147 if ((diff.needsRepaint() || diff.needsLayout()) && node() | |
| 148 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { | |
| 149 view()->paintInvalidationForWholeRenderer(); | |
| 150 | |
| 151 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground()) | 146 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground()) |
| 152 view()->compositor()->setNeedsUpdateFixedBackground(); | 147 view()->compositor()->setNeedsUpdateFixedBackground(); |
| 153 } | 148 } |
| 154 | 149 |
| 155 // When a layout hint happens and an object's position style changes, we have to do a layout | 150 // When a layout hint happens and an object's position style changes, we have to do a layout |
| 156 // to dirty the render tree using the old position value now. | 151 // to dirty the render tree using the old position value now. |
| 157 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { | 152 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { |
| 158 markContainingBlocksForLayout(); | 153 markContainingBlocksForLayout(); |
| 159 if (oldStyle->position() == StaticPosition) | 154 if (oldStyle->position() == StaticPosition) |
| 160 paintInvalidationForWholeRenderer(); | 155 paintInvalidationForWholeRenderer(); |
| 161 else if (newStyle.hasOutOfFlowPosition()) | 156 else if (newStyle.hasOutOfFlowPosition()) |
| 162 parent()->setChildNeedsLayout(); | 157 parent()->setChildNeedsLayout(); |
| 163 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) | 158 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) |
| 164 removeFloatingOrPositionedChildFromBlockLists(); | 159 removeFloatingOrPositionedChildFromBlockLists(); |
| 165 } | 160 } |
| 166 // FIXME: This branch runs when !oldStyle, which means that layout was never called | |
| 167 // so what's the point in invalidating the whole view that we never painted? | |
| 168 } else if (isBody()) { | |
| 169 view()->paintInvalidationForWholeRenderer(); | |
| 170 } | 161 } |
| 171 | 162 |
| 172 RenderBoxModelObject::styleWillChange(diff, newStyle); | 163 RenderBoxModelObject::styleWillChange(diff, newStyle); |
| 173 } | 164 } |
| 174 | 165 |
| 175 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle ) | 166 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle ) |
| 176 { | 167 { |
| 177 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle, | 168 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle, |
| 178 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal | 169 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal |
| 179 // writing mode value before style change here. | 170 // writing mode value before style change here. |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 ASSERT(m_rareData); | 1945 ASSERT(m_rareData); |
| 1955 m_rareData->m_inlineBoxWrapper = 0; | 1946 m_rareData->m_inlineBoxWrapper = 0; |
| 1956 } | 1947 } |
| 1957 } | 1948 } |
| 1958 | 1949 |
| 1959 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval idationState) const | 1950 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval idationState) const |
| 1960 { | 1951 { |
| 1961 if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible ()) | 1952 if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible ()) |
| 1962 return LayoutRect(); | 1953 return LayoutRect(); |
| 1963 | 1954 |
| 1955 // If we have a background that could bleed into the canvas, just return | |
| 1956 // the viewport's rectangle. This works as only body and the document | |
| 1957 // element's renderer can bleed into the viewport so we are guaranteed | |
| 1958 // to be in the RenderView's coordinate space. | |
| 1959 if (style()->hasBackground() && backgroundCanBleedToCanvas()) | |
| 1960 return view()->viewRect(); | |
|
dsinclair
2014/07/21 19:32:28
Should we add an ASSERT here just to be safe that
Julien - ping for review
2014/07/21 20:33:33
I don't think that would give us much as that's th
| |
| 1961 | |
| 1964 LayoutRect r = visualOverflowRect(); | 1962 LayoutRect r = visualOverflowRect(); |
| 1965 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, false /*fix ed*/, paintInvalidationState); | 1963 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, false /*fix ed*/, paintInvalidationState); |
| 1966 return r; | 1964 return r; |
| 1967 } | 1965 } |
| 1968 | 1966 |
| 1969 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidatio nState* paintInvalidationState) const | 1967 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidatio nState* paintInvalidationState) const |
| 1970 { | 1968 { |
| 1971 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. | 1969 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. |
| 1972 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate | 1970 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate |
| 1973 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint | 1971 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint |
| (...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4625 | 4623 |
| 4626 // We need the old border box size only when the box has background or b ox decorations. | 4624 // We need the old border box size only when the box has background or b ox decorations. |
| 4627 if (!style()->hasBackground() && !style()->hasBoxDecorations()) | 4625 if (!style()->hasBackground() && !style()->hasBoxDecorations()) |
| 4628 return; | 4626 return; |
| 4629 } | 4627 } |
| 4630 | 4628 |
| 4631 ensureRareData().m_previousBorderBoxSize = size(); | 4629 ensureRareData().m_previousBorderBoxSize = size(); |
| 4632 } | 4630 } |
| 4633 | 4631 |
| 4634 } // namespace WebCore | 4632 } // namespace WebCore |
| OLD | NEW |