| 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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 frameView->removeViewportConstrainedObject(this); | 121 frameView->removeViewportConstrainedObject(this); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 LayoutObject::willBeDestroyed(); | 126 LayoutObject::willBeDestroyed(); |
| 127 | 127 |
| 128 destroyLayer(); | 128 destroyLayer(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void LayoutBoxModelObject::styleWillChange(StyleDifference diff, const LayoutSty
le& newStyle) | 131 void LayoutBoxModelObject::styleWillChange(StyleDifference diff, const ComputedS
tyle& newStyle) |
| 132 { | 132 { |
| 133 // This object's layer may cease to be a stacking context, in which case the
paint | 133 // This object's layer may cease to be a stacking context, in which case the
paint |
| 134 // invalidation container of the children may change. Thus we need to invali
date paint | 134 // invalidation container of the children may change. Thus we need to invali
date paint |
| 135 // eagerly for all such children. | 135 // eagerly for all such children. |
| 136 if (hasLayer() | 136 if (hasLayer() |
| 137 && enclosingLayer()->stackingNode() | 137 && enclosingLayer()->stackingNode() |
| 138 && enclosingLayer()->stackingNode()->isStackingContext() | 138 && enclosingLayer()->stackingNode()->isStackingContext() |
| 139 && newStyle.hasAutoZIndex()) { | 139 && newStyle.hasAutoZIndex()) { |
| 140 // The following disablers are valid because we need to invalidate based
on the current | 140 // The following disablers are valid because we need to invalidate based
on the current |
| 141 // status. | 141 // status. |
| 142 DisableCompositingQueryAsserts compositingDisabler; | 142 DisableCompositingQueryAsserts compositingDisabler; |
| 143 DisablePaintInvalidationStateAsserts paintDisabler; | 143 DisablePaintInvalidationStateAsserts paintDisabler; |
| 144 invalidatePaintIncludingNonCompositingDescendants(); | 144 invalidatePaintIncludingNonCompositingDescendants(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 s_wasFloating = isFloating(); | 147 s_wasFloating = isFloating(); |
| 148 | 148 |
| 149 if (const LayoutStyle* oldStyle = style()) { | 149 if (const ComputedStyle* oldStyle = style()) { |
| 150 if (parent() && diff.needsPaintInvalidationLayer()) { | 150 if (parent() && diff.needsPaintInvalidationLayer()) { |
| 151 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() | 151 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() |
| 152 || oldStyle->clip() != newStyle.clip()) | 152 || oldStyle->clip() != newStyle.clip()) |
| 153 layer()->clipper().clearClipRectsIncludingDescendants(); | 153 layer()->clipper().clearClipRectsIncludingDescendants(); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 LayoutObject::styleWillChange(diff, newStyle); | 157 LayoutObject::styleWillChange(diff, newStyle); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void LayoutBoxModelObject::styleDidChange(StyleDifference diff, const LayoutStyl
e* oldStyle) | 160 void LayoutBoxModelObject::styleDidChange(StyleDifference diff, const ComputedSt
yle* oldStyle) |
| 161 { | 161 { |
| 162 bool hadTransform = hasTransformRelatedProperty(); | 162 bool hadTransform = hasTransformRelatedProperty(); |
| 163 bool hadLayer = hasLayer(); | 163 bool hadLayer = hasLayer(); |
| 164 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); | 164 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); |
| 165 | 165 |
| 166 LayoutObject::styleDidChange(diff, oldStyle); | 166 LayoutObject::styleDidChange(diff, oldStyle); |
| 167 updateFromStyle(); | 167 updateFromStyle(); |
| 168 | 168 |
| 169 DeprecatedPaintLayerType type = layerTypeRequired(); | 169 DeprecatedPaintLayerType type = layerTypeRequired(); |
| 170 if (type != NoDeprecatedPaintLayer) { | 170 if (type != NoDeprecatedPaintLayer) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 rect.moveBy(additionalOffset); | 331 rect.moveBy(additionalOffset); |
| 332 rects.append(rect); | 332 rects.append(rect); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 bool LayoutBoxModelObject::calculateHasBoxDecorations() const | 339 bool LayoutBoxModelObject::calculateHasBoxDecorations() const |
| 340 { | 340 { |
| 341 const LayoutStyle& styleToUse = styleRef(); | 341 const ComputedStyle& styleToUse = styleRef(); |
| 342 return hasBackground() || styleToUse.hasBorder() || styleToUse.hasAppearance
() || styleToUse.boxShadow(); | 342 return hasBackground() || styleToUse.hasBorder() || styleToUse.hasAppearance
() || styleToUse.boxShadow(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void LayoutBoxModelObject::updateFromStyle() | 345 void LayoutBoxModelObject::updateFromStyle() |
| 346 { | 346 { |
| 347 const LayoutStyle& styleToUse = styleRef(); | 347 const ComputedStyle& styleToUse = styleRef(); |
| 348 setHasBoxDecorationBackground(calculateHasBoxDecorations()); | 348 setHasBoxDecorationBackground(calculateHasBoxDecorations()); |
| 349 setInline(styleToUse.isDisplayInlineType()); | 349 setInline(styleToUse.isDisplayInlineType()); |
| 350 setPositionState(styleToUse.position()); | 350 setPositionState(styleToUse.position()); |
| 351 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); | 351 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); |
| 352 } | 352 } |
| 353 | 353 |
| 354 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child) | 354 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child) |
| 355 { | 355 { |
| 356 if (!child->isAnonymousBlock() || !child->isRelPositioned()) | 356 if (!child->isAnonymousBlock() || !child->isRelPositioned()) |
| 357 return LayoutSize(); | 357 return LayoutSize(); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 } | 715 } |
| 716 | 716 |
| 717 LayoutRect LayoutBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) | 717 LayoutRect LayoutBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) |
| 718 { | 718 { |
| 719 ASSERT(!slowFirstChild()); | 719 ASSERT(!slowFirstChild()); |
| 720 | 720 |
| 721 // FIXME: This does not take into account either :first-line or :first-lette
r | 721 // FIXME: This does not take into account either :first-line or :first-lette
r |
| 722 // However, as soon as some content is entered, the line boxes will be | 722 // However, as soon as some content is entered, the line boxes will be |
| 723 // constructed and this kludge is not called any more. So only the caret siz
e | 723 // constructed and this kludge is not called any more. So only the caret siz
e |
| 724 // of an empty :first-line'd block is wrong. I think we can live with that. | 724 // of an empty :first-line'd block is wrong. I think we can live with that. |
| 725 const LayoutStyle& currentStyle = firstLineStyleRef(); | 725 const ComputedStyle& currentStyle = firstLineStyleRef(); |
| 726 | 726 |
| 727 enum CaretAlignment { AlignLeft, AlignRight, AlignCenter }; | 727 enum CaretAlignment { AlignLeft, AlignRight, AlignCenter }; |
| 728 | 728 |
| 729 CaretAlignment alignment = AlignLeft; | 729 CaretAlignment alignment = AlignLeft; |
| 730 | 730 |
| 731 switch (currentStyle.textAlign()) { | 731 switch (currentStyle.textAlign()) { |
| 732 case LEFT: | 732 case LEFT: |
| 733 case WEBKIT_LEFT: | 733 case WEBKIT_LEFT: |
| 734 break; | 734 break; |
| 735 case CENTER: | 735 case CENTER: |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 886 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 887 for (LayoutObject* child = startChild; child && child != endChild; ) { | 887 for (LayoutObject* child = startChild; child && child != endChild; ) { |
| 888 // Save our next sibling as moveChildTo will clear it. | 888 // Save our next sibling as moveChildTo will clear it. |
| 889 LayoutObject* nextSibling = child->nextSibling(); | 889 LayoutObject* nextSibling = child->nextSibling(); |
| 890 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 890 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 891 child = nextSibling; | 891 child = nextSibling; |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 } // namespace blink | 895 } // namespace blink |
| OLD | NEW |