| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 parentToInvalidate = parentToInvalidate->parent(); | 245 parentToInvalidate = parentToInvalidate->parent(); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (isDocumentElement() || isBody()) { | 249 if (isDocumentElement() || isBody()) { |
| 250 document().view()->recalculateScrollbarOverlayStyle(); | 250 document().view()->recalculateScrollbarOverlayStyle(); |
| 251 document().view()->recalculateCustomScrollbarStyle(); | 251 document().view()->recalculateCustomScrollbarStyle(); |
| 252 } | 252 } |
| 253 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle); | 253 updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle); |
| 254 updateGridPositionAfterStyleChange(oldStyle); | 254 updateGridPositionAfterStyleChange(oldStyle); |
| 255 updateAlignmentAfterStyleChange(oldStyle); |
| 255 | 256 |
| 256 if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlacehol
der()) | 257 if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlacehol
der()) |
| 257 placeholder->updateMarginProperties(); | 258 placeholder->updateMarginProperties(); |
| 258 } | 259 } |
| 259 | 260 |
| 260 void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& styl
e, const ComputedStyle* oldStyle) | 261 void LayoutBox::updateShapeOutsideInfoAfterStyleChange(const ComputedStyle& styl
e, const ComputedStyle* oldStyle) |
| 261 { | 262 { |
| 262 const ShapeValue* shapeOutside = style.shapeOutside(); | 263 const ShapeValue* shapeOutside = style.shapeOutside(); |
| 263 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Co
mputedStyle::initialShapeOutside(); | 264 const ShapeValue* oldShapeOutside = oldStyle ? oldStyle->shapeOutside() : Co
mputedStyle::initialShapeOutside(); |
| 264 | 265 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 292 && oldStyle->gridRowEnd() == style()->gridRowEnd() | 293 && oldStyle->gridRowEnd() == style()->gridRowEnd() |
| 293 && oldStyle->order() == style()->order() | 294 && oldStyle->order() == style()->order() |
| 294 && oldStyle->hasOutOfFlowPosition() == style()->hasOutOfFlowPosition()) | 295 && oldStyle->hasOutOfFlowPosition() == style()->hasOutOfFlowPosition()) |
| 295 return; | 296 return; |
| 296 | 297 |
| 297 // It should be possible to not dirty the grid in some cases (like moving an
explicitly placed grid item). | 298 // It should be possible to not dirty the grid in some cases (like moving an
explicitly placed grid item). |
| 298 // For now, it's more simple to just always recompute the grid. | 299 // For now, it's more simple to just always recompute the grid. |
| 299 toLayoutGrid(parent())->dirtyGrid(); | 300 toLayoutGrid(parent())->dirtyGrid(); |
| 300 } | 301 } |
| 301 | 302 |
| 303 void LayoutBox::updateAlignmentAfterStyleChange(const ComputedStyle* oldStyle) |
| 304 { |
| 305 if (!oldStyle) |
| 306 return; |
| 307 |
| 308 // When container's justify-items value changes and the new value containes
the 'legacy' |
| 309 // keyword, it will affect children's justify-item 'auto' value resolution. |
| 310 if (oldStyle->justifyItemsPositionType() != styleRef().justifyItemsPositionT
ype() |
| 311 || (styleRef().justifyItemsPositionType() == LegacyPosition && oldStyle-
>justifyItemsPosition() != styleRef().justifyItemsPosition())) { |
| 312 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli
ngBox()) { |
| 313 if ((styleRef().justifyItemsPositionType() == LegacyPosition) && (ch
ild->styleRef().justifyItemsPosition() == ItemPositionAuto)) |
| 314 child->mutableStyleRef().setJustifyItemsPosition(styleRef().just
ifyItemsPosition()); |
| 315 child->setNeedsLayout(LayoutInvalidationReason::GridChanged); |
| 316 } |
| 317 } |
| 318 } |
| 319 |
| 302 void LayoutBox::updateFromStyle() | 320 void LayoutBox::updateFromStyle() |
| 303 { | 321 { |
| 304 LayoutBoxModelObject::updateFromStyle(); | 322 LayoutBoxModelObject::updateFromStyle(); |
| 305 | 323 |
| 306 const ComputedStyle& styleToUse = styleRef(); | 324 const ComputedStyle& styleToUse = styleRef(); |
| 307 bool isRootObject = isDocumentElement(); | 325 bool isRootObject = isDocumentElement(); |
| 308 bool isViewObject = isLayoutView(); | 326 bool isViewObject = isLayoutView(); |
| 309 bool rootLayerScrolls = document().settings() && document().settings()->root
LayerScrolls(); | 327 bool rootLayerScrolls = document().settings() && document().settings()->root
LayerScrolls(); |
| 310 | 328 |
| 311 // The root and the LayoutView always paint their backgrounds/borders. | 329 // The root and the LayoutView always paint their backgrounds/borders. |
| (...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 } | 2151 } |
| 2134 | 2152 |
| 2135 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) | 2153 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) |
| 2136 { | 2154 { |
| 2137 LayoutObject* parent = flexitem->parent(); | 2155 LayoutObject* parent = flexitem->parent(); |
| 2138 // auto margins mean we don't stretch. Note that this function will only be
used for | 2156 // auto margins mean we don't stretch. Note that this function will only be
used for |
| 2139 // widths, so we don't have to check marginBefore/marginAfter. | 2157 // widths, so we don't have to check marginBefore/marginAfter. |
| 2140 ASSERT(parent->style()->isColumnFlexDirection()); | 2158 ASSERT(parent->style()->isColumnFlexDirection()); |
| 2141 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) | 2159 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
| 2142 return false; | 2160 return false; |
| 2143 return flexitem->style()->alignSelfPosition() == ItemPositionStretch || (fle
xitem->style()->alignSelfPosition() == ItemPositionAuto && parent->style()->alig
nItemsPosition() == ItemPositionStretch); | 2161 return ComputedStyle::resolvedAlignSelfPosition(parent->styleRef(), flexitem
->styleRef(), ItemPositionStretch) == ItemPositionStretch; |
| 2144 } | 2162 } |
| 2145 | 2163 |
| 2146 static bool isStretchingColumnFlexItem(const LayoutObject* flexitem) | 2164 static bool isStretchingColumnFlexItem(const LayoutObject* flexitem) |
| 2147 { | 2165 { |
| 2148 LayoutObject* parent = flexitem->parent(); | 2166 LayoutObject* parent = flexitem->parent(); |
| 2149 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) | 2167 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) |
| 2150 return true; | 2168 return true; |
| 2151 | 2169 |
| 2152 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. | 2170 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. |
| 2153 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) | 2171 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) |
| (...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4801 bool LayoutBox::canRenderBorderImage() const | 4819 bool LayoutBox::canRenderBorderImage() const |
| 4802 { | 4820 { |
| 4803 if (!style()->hasBorder()) | 4821 if (!style()->hasBorder()) |
| 4804 return false; | 4822 return false; |
| 4805 | 4823 |
| 4806 StyleImage* borderImage = style()->borderImage().image(); | 4824 StyleImage* borderImage = style()->borderImage().image(); |
| 4807 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4825 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
| 4808 } | 4826 } |
| 4809 | 4827 |
| 4810 } // namespace blink | 4828 } // namespace blink |
| OLD | NEW |