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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 | 259 |
260 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() | 260 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() |
261 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() | 261 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() |
262 || oldStyle.paddingTop() != newStyle.paddingTop() | 262 || oldStyle.paddingTop() != newStyle.paddingTop() |
263 || oldStyle.paddingBottom() != newStyle.paddingBottom(); | 263 || oldStyle.paddingBottom() != newStyle.paddingBottom(); |
264 } | 264 } |
265 | 265 |
266 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) | 266 void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
tyle) |
267 { | 267 { |
| 268 // Horizontal writing mode definition is updated in LayoutBoxModelObject::up
dateFromStyle, |
| 269 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we
can safely cache the horizontal |
| 270 // writing mode value before style change here. |
| 271 bool oldHorizontalWritingMode = isHorizontalWritingMode(); |
| 272 |
268 LayoutBox::styleDidChange(diff, oldStyle); | 273 LayoutBox::styleDidChange(diff, oldStyle); |
269 | 274 |
270 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isLayoutBlockFlow
()) { | 275 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isLayoutBlockFlow
()) { |
271 toLayoutBlock(parent())->makeChildrenInlineIfPossible(); | 276 toLayoutBlock(parent())->makeChildrenInlineIfPossible(); |
272 // Reparent to an adjacent anonymous block if one is available. | 277 // Reparent to an adjacent anonymous block if one is available. |
273 if (previousSibling() && previousSibling()->isAnonymousBlock()) | 278 if (previousSibling() && previousSibling()->isAnonymousBlock()) |
274 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(previousSibling()
), this, nullptr, false); | 279 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(previousSibling()
), this, nullptr, false); |
275 else if (nextSibling() && nextSibling()->isAnonymousBlock()) | 280 else if (nextSibling() && nextSibling()->isAnonymousBlock()) |
276 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), t
his, nextSibling()->slowFirstChild(), false); | 281 toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), t
his, nextSibling()->slowFirstChild(), false); |
277 } | 282 } |
278 | 283 |
279 const ComputedStyle& newStyle = styleRef(); | 284 const ComputedStyle& newStyle = styleRef(); |
280 | 285 |
281 if (oldStyle && parent()) { | 286 if (oldStyle && parent()) { |
282 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { | 287 if (oldStyle->position() != newStyle.position() && newStyle.position() !
= StaticPosition) { |
283 // Remove our absolute and fixed positioned descendants from their n
ew containing block, | 288 // Remove our absolute and fixed positioned descendants from their n
ew containing block, |
284 // in case containingBlock() changes by the change to the position p
roperty. | 289 // in case containingBlock() changes by the change to the position p
roperty. |
285 // See styleWillChange() for other cases. | 290 // See styleWillChange() for other cases. |
286 if (LayoutBlock* cb = containingBlock()) | 291 if (LayoutBlock* cb = containingBlock()) |
287 cb->removePositionedObjects(this, NewContainingBlock); | 292 cb->removePositionedObjects(this, NewContainingBlock); |
288 } | 293 } |
| 294 |
| 295 // Changing the writingMode() may change isOrthogonalWritingModeRoot() |
| 296 // of children. Make sure all children are marked/unmarked as orthogonal |
| 297 // writing-mode roots. |
| 298 bool newHorizontalWritingMode = isHorizontalWritingMode(); |
| 299 if (oldHorizontalWritingMode != newHorizontalWritingMode) { |
| 300 for (LayoutObject* child = firstChild(); child; child = child->nextS
ibling()) { |
| 301 if (!child->isBox()) |
| 302 continue; |
| 303 if (newHorizontalWritingMode != child->isHorizontalWritingMode()
) |
| 304 toLayoutBox(child)->markOrthogonalWritingModeRoot(); |
| 305 else |
| 306 toLayoutBox(child)->unmarkOrthogonalWritingModeRoot(); |
| 307 } |
| 308 } |
289 } | 309 } |
290 | 310 |
291 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 311 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
292 textAutosizer->record(this); | 312 textAutosizer->record(this); |
293 | 313 |
294 propagateStyleToAnonymousChildren(true); | 314 propagateStyleToAnonymousChildren(true); |
295 | 315 |
296 // It's possible for our border/padding to change, but for the overall logic
al width of the block to | 316 // It's possible for our border/padding to change, but for the overall logic
al width of the block to |
297 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. | 317 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. |
298 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n
eedsLayout() && borderOrPaddingLogicalWidthChanged(*oldStyle, newStyle); | 318 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n
eedsLayout() && borderOrPaddingLogicalWidthChanged(*oldStyle, newStyle); |
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2885 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2866 { | 2886 { |
2867 showLayoutObject(); | 2887 showLayoutObject(); |
2868 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2888 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2869 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2889 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2870 } | 2890 } |
2871 | 2891 |
2872 #endif | 2892 #endif |
2873 | 2893 |
2874 } // namespace blink | 2894 } // namespace blink |
OLD | NEW |