X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Frendering%2FRenderListItem.cpp;h=54d3d2d7e4b4eb227ca04b06c56e1f95b17f015d;hb=490a4587e7e356282cb1453efaf36de4acc9762f;hp=17c0cfcde3c193a5765690c01d82649a7292a0d8;hpb=3a51af92707b9c600d06a404c9db8f07fcd50959;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/rendering/RenderListItem.cpp b/src/third_party/WebKit/Source/core/rendering/RenderListItem.cpp index 17c0cfc..54d3d2d 100644 --- a/src/third_party/WebKit/Source/core/rendering/RenderListItem.cpp +++ b/src/third_party/WebKit/Source/core/rendering/RenderListItem.cpp @@ -269,64 +269,70 @@ static RenderObject* firstNonMarkerChild(RenderObject* parent) return result; } -void RenderListItem::updateMarkerLocation() +void RenderListItem::updateMarkerLocationAndInvalidateWidth() { - // Sanity check the location of our marker. - if (m_marker) { - RenderObject* markerParent = m_marker->parent(); - RenderObject* lineBoxParent = getParentOfFirstLineBox(this, m_marker); - if (!lineBoxParent) { - // If the marker is currently contained inside an anonymous box, - // then we are the only item in that anonymous box (since no line box - // parent was found). It's ok to just leave the marker where it is - // in this case. - if (markerParent && markerParent->isAnonymousBlock()) - lineBoxParent = markerParent; - else - lineBoxParent = this; - } + ASSERT(m_marker); + + // FIXME: We should not modify the structure of the render tree + // during layout. crbug.com/370461 + DeprecatedDisableModifyRenderTreeStructureAsserts disabler; + // Removing and adding the marker can trigger repainting in + // containers other than ourselves, so we need to disable LayoutState. + ForceHorriblySlowRectMapping slowRectMapping(*this); + if (updateMarkerLocation()) { + // If the marker is inside we need to redo the preferred width calculations + // as the size of the item now includes the size of the list marker. + if (m_marker->isInside()) + containingBlock()->updateLogicalWidth(); + } +} - if (markerParent != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) { - // FIXME: We should not modify the structure of the render tree - // during layout. crbug.com/370461 - DeprecatedDisableModifyRenderTreeStructureAsserts disabler; - - // Removing and adding the marker can trigger repainting in - // containers other than ourselves, so we need to disable LayoutState. - ForceHorriblySlowRectMapping slowRectMapping(*this); - updateFirstLetter(); - m_marker->remove(); - if (markerParent) - markerParent->dirtyLinesFromChangedChild(m_marker); - if (!lineBoxParent) - lineBoxParent = this; - lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent)); - m_marker->updateMarginsAndContent(); - // If markerParent is an anonymous block that has lost all its children, destroy it. - if (markerParent && markerParent->isAnonymousBlock() && !toRenderBlock(markerParent)->firstChild() && !toRenderBlock(markerParent)->continuation()) - markerParent->destroy(); - - // If the marker is inside we need to redo the preferred width calculations - // as the size of the item now includes the size of the list marker. - if (m_marker->isInside()) - containingBlock()->updateLogicalWidth(); - } +bool RenderListItem::updateMarkerLocation() +{ + ASSERT(m_marker); + RenderObject* markerParent = m_marker->parent(); + RenderObject* lineBoxParent = getParentOfFirstLineBox(this, m_marker); + if (!lineBoxParent) { + // If the marker is currently contained inside an anonymous box, then we + // are the only item in that anonymous box (since no line box parent was + // found). It's ok to just leave the marker where it is in this case. + if (markerParent && markerParent->isAnonymousBlock()) + lineBoxParent = markerParent; + else + lineBoxParent = this; + } + + if (markerParent != lineBoxParent) { + updateFirstLetter(); + m_marker->remove(); + // FIXME(crbug.com/391009): Investigate whether this call is needed. + if (markerParent) + markerParent->dirtyLinesFromChangedChild(m_marker); + lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent)); + m_marker->updateMarginsAndContent(); + // If markerParent is an anonymous block with no children, destroy it. + if (markerParent && markerParent->isAnonymousBlock() && !toRenderBlock(markerParent)->firstChild() && !toRenderBlock(markerParent)->continuation()) + markerParent->destroy(); + return true; } + + return false; } void RenderListItem::layout() { ASSERT(needsLayout()); - // The marker must be autosized before calling updateMarkerLocation. - // It cannot be done in the parent's beginLayout because it is not yet in the render tree. if (m_marker) { - FastTextAutosizer* textAutosizer = document().fastTextAutosizer(); - if (textAutosizer) + // The marker must be autosized before calling + // updateMarkerLocationAndInvalidateWidth. It cannot be done in the + // parent's beginLayout because it is not yet in the render tree. + if (FastTextAutosizer* textAutosizer = document().fastTextAutosizer()) textAutosizer->inflateListItem(this, m_marker); + + updateMarkerLocationAndInvalidateWidth(); } - updateMarkerLocation(); RenderBlockFlow::layout(); } @@ -477,6 +483,13 @@ void RenderListItem::clearExplicitValue() explicitValueChanged(); } +void RenderListItem::setNotInList(bool notInList) +{ + m_notInList = notInList; + if (m_marker) + updateMarkerLocation(); +} + static RenderListItem* previousOrNextItem(bool isListReversed, Node* list, RenderListItem* item) { return isListReversed ? previousListItem(list, item) : nextListItem(list, item);