| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (isOutOfFlowPositioned()) | 146 if (isOutOfFlowPositioned()) |
| 147 RenderBlock::removePositionedObject(this); | 147 RenderBlock::removePositionedObject(this); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl
e) | 150 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl
e) |
| 151 { | 151 { |
| 152 RenderStyle* oldStyle = style(); | 152 RenderStyle* oldStyle = style(); |
| 153 if (oldStyle) { | 153 if (oldStyle) { |
| 154 // The background of the root element or the body element could propagat
e up to | 154 // The background of the root element or the body element could propagat
e up to |
| 155 // the canvas. Just dirty the entire canvas when our style changes subs
tantially. | 155 // the canvas. Just dirty the entire canvas when our style changes subs
tantially. |
| 156 if (diff >= StyleDifferenceRepaint && node() && | 156 if (diff.needsRepaint() && node() |
| 157 (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { | 157 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { |
| 158 | 158 |
| 159 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || diff !=
StyleDifferenceLayout) | 159 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || !diff.ne
edsFullLayout()) |
| 160 view()->repaint(); | 160 view()->repaint(); |
| 161 | 161 |
| 162 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi
xedBackground()) | 162 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi
xedBackground()) |
| 163 view()->compositor()->setNeedsUpdateFixedBackground(); | 163 view()->compositor()->setNeedsUpdateFixedBackground(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // When a layout hint happens and an object's position style changes, we
have to do a layout | 166 // When a layout hint happens and an object's position style changes, we
have to do a layout |
| 167 // to dirty the render tree using the old position value now. | 167 // to dirty the render tree using the old position value now. |
| 168 if (diff == StyleDifferenceLayout && parent() && oldStyle->position() !=
newStyle.position()) { | 168 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty
le.position()) { |
| 169 markContainingBlocksForLayout(); | 169 markContainingBlocksForLayout(); |
| 170 if (oldStyle->position() == StaticPosition) | 170 if (oldStyle->position() == StaticPosition) |
| 171 repaint(); | 171 repaint(); |
| 172 else if (newStyle.hasOutOfFlowPosition()) | 172 else if (newStyle.hasOutOfFlowPosition()) |
| 173 parent()->setChildNeedsLayout(); | 173 parent()->setChildNeedsLayout(); |
| 174 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo
wPosition()) | 174 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo
wPosition()) |
| 175 removeFloatingOrPositionedChildFromBlockLists(); | 175 removeFloatingOrPositionedChildFromBlockLists(); |
| 176 } | 176 } |
| 177 // FIXME: This branch runs when !oldStyle, which means that layout was never
called | 177 // FIXME: This branch runs when !oldStyle, which means that layout was never
called |
| 178 // so what's the point in invalidating the whole view that we never painted? | 178 // so what's the point in invalidating the whole view that we never painted? |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); | 214 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(
); |
| 215 layer()->scrollableArea()->scrollToXOffset(left); | 215 layer()->scrollableArea()->scrollToXOffset(left); |
| 216 } | 216 } |
| 217 if (int top = layer()->scrollableArea()->scrollYOffset()) { | 217 if (int top = layer()->scrollableArea()->scrollYOffset()) { |
| 218 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); | 218 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); |
| 219 layer()->scrollableArea()->scrollToYOffset(top); | 219 layer()->scrollableArea()->scrollToYOffset(top); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Our opaqueness might have changed without triggering layout. | 223 // Our opaqueness might have changed without triggering layout. |
| 224 if (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintLayer) { | 224 if (diff.needsRepaint()) { |
| 225 RenderObject* parentToInvalidate = parent(); | 225 RenderObject* parentToInvalidate = parent(); |
| 226 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn
validate; ++i) { | 226 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn
validate; ++i) { |
| 227 parentToInvalidate->invalidateBackgroundObscurationStatus(); | 227 parentToInvalidate->invalidateBackgroundObscurationStatus(); |
| 228 parentToInvalidate = parentToInvalidate->parent(); | 228 parentToInvalidate = parentToInvalidate->parent(); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (isDocumentElement() || isBody()) | 232 if (isDocumentElement() || isBody()) |
| 233 document().view()->recalculateScrollbarOverlayStyle(); | 233 document().view()->recalculateScrollbarOverlayStyle(); |
| 234 | 234 |
| (...skipping 4513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4748 return 0; | 4748 return 0; |
| 4749 | 4749 |
| 4750 if (!layoutState && !flowThreadContainingBlock()) | 4750 if (!layoutState && !flowThreadContainingBlock()) |
| 4751 return 0; | 4751 return 0; |
| 4752 | 4752 |
| 4753 RenderBlock* containerBlock = containingBlock(); | 4753 RenderBlock* containerBlock = containingBlock(); |
| 4754 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4754 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4755 } | 4755 } |
| 4756 | 4756 |
| 4757 } // namespace WebCore | 4757 } // namespace WebCore |
| OLD | NEW |