Ignore:
Timestamp:
Sep 26, 2013, 7:02:27 PM (12 years ago)
Author:
Antti Koivisto
Message:

Move m_style to RenderElement
https://bugs.webkit.org/show_bug.cgi?id=121936

Source/WebCore:

Reviewed by Andreas Kling.

Text renderers always have the same style as their parent. They can get their style via the parent pointer
rather than having a member of their own.

This shrinks RenderText by a pointer.

  • dom/PseudoElement.cpp:

(WebCore::PseudoElement::didRecalcStyle):

Text renderers have no independent style. No need to set it.

  • editing/ApplyBlockElementCommand.cpp:
  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::addChildToAnonymousColumnBlocks):

Avoid getting style from text child before it is added to tree.

(WebCore::RenderBlock::updateFirstLetterStyle):
(WebCore::RenderBlock::createFirstLetterRenderer):

  • rendering/RenderButton.cpp:

(WebCore::RenderButton::styleDidChange):
(WebCore::RenderButton::setText):

  • rendering/RenderCombineText.cpp:

(WebCore::RenderCombineText::styleDidChange):

Don't set text style anymore.

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::RenderElement):
(WebCore::RenderElement::setStyle):

Notify child text renderers of style change.

(WebCore::RenderElement::setAnimatableStyle):
(WebCore::RenderElement::setPseudoStyle):

Push down to RenderElement, remove text branches.

(WebCore::RenderElement::addChild):

Notify text renderers of style change when added to tree.

(WebCore::RenderElement::propagateStyleToAnonymousChildren):

  • rendering/RenderElement.h:

(WebCore::RenderElement::style):
(WebCore::RenderElement::setStyleInternal):

Move m_style from RenderObject.

(WebCore::RenderObject::style):

Inline this in RenderElement.h instead of making it virtual.

  • rendering/RenderInline.cpp:

(WebCore::updateStyleOfAnonymousBlockContinuations):
(WebCore::RenderInline::styleDidChange):

Tighten typing to call RenderElement::setStyle.

(WebCore::RenderInline::clippedOverflowRectForRepaint):

Change assert. This can get legitimately called during layout for the first letter renderers.
This was previously avoided by luck.

  • rendering/RenderMenuList.cpp:

(WebCore::RenderMenuList::styleDidChange):
(WebCore::RenderMenuList::setText):

Don't set text style anymore.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::RenderObject):
(WebCore::RenderObject::containingBlock):
(WebCore::RenderObject::drawLineForBoxSide):
(WebCore::RenderObject::hasEntirelyFixedBackground):
(WebCore::RenderObject::container):
(WebCore::RenderObject::cachedFirstLineStyle):

Switch to style(), avoid unnecessary repetition.
Move code out.

  • rendering/RenderObject.h:


Move functions to RenderElement.

(WebCore::RenderObject::isBeforeContent):
(WebCore::RenderObject::isAfterContent):

Avoid accessing style for text renderers as these are called before the renderer
is added to tree.

(WebCore::RenderObject::setNeedsPositionedMovementLayout):

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::restoreRegionObjectsOriginalStyle):
(WebCore::RenderRegion::setObjectStyleInRegion):

  • rendering/RenderSearchField.cpp:

(WebCore::RenderSearchField::updateCancelButtonVisibility):

  • rendering/RenderText.cpp:
  • rendering/RenderText.h:


Remove setStyle.

(WebCore::RenderText::style):

Get style from parent.

  • rendering/mathml/RenderMathMLOperator.cpp:

(WebCore::RenderMathMLOperator::updateFromElement):
(WebCore::RenderMathMLOperator::createGlyph):

  • rendering/style/ContentData.cpp:

(WebCore::TextContentData::createRenderer):
(WebCore::CounterContentData::createRenderer):
(WebCore::QuoteContentData::createRenderer):

Pseudo style for RenderText subclasses comes from parent without any explicit setting.

  • style/StyleResolveTree.cpp:

(WebCore::Style::createTextRendererIfNeeded):
(WebCore::Style::resolveLocal):
(WebCore::Style::updateTextStyle):
(WebCore::Style::resolveShadowTree):
(WebCore::Style::resolveTree):

No need to set or update text renderer style separately.

LayoutTests:

Reviewed by Andreas Kling.

Progressions from text style updating correctly in all cases.

  • compositing/contents-opaque/hidden-with-visible-text-expected.txt:
  • compositing/contents-opaque/visibility-hidden-expected.txt:


Can't figure out why these progress but they do. The new rendering (showing nothing)
is correct and matches Firefox.

  • platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt:
  • platform/mac/svg/custom/getTransformToElement-expected.txt:
  • platform/mac/svg/custom/text-ctm-expected.txt:
  • platform/mac/svg/custom/text-hit-test-expected.txt:
  • platform/mac/svg/text/append-text-node-to-tspan-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r156422 r156527  
    149149}
    150150
    151 static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const RenderStyle* newStyle, const RenderStyle* oldStyle)
    152 {
    153     for (;block && block->isAnonymousBlock(); block = block->nextSibling()) {
    154         if (!toRenderBlock(block)->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position())
     151static void updateStyleOfAnonymousBlockContinuations(RenderBlock* block, const RenderStyle* newStyle, const RenderStyle* oldStyle)
     152{
     153    for (;block && block->isAnonymousBlock(); block = toRenderBlock(block->nextSibling())) {
     154        if (!block->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position())
    155155            continue;
    156156        // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then
    157157        // their containing anonymous block should keep its in-flow positioning.
    158         RenderInline* cont = toRenderBlock(block)->inlineElementContinuation();
     158        RenderInline* cont = block->inlineElementContinuation();
    159159        if (oldStyle->hasInFlowPosition() && inFlowPositionedInlineAncestor(cont))
    160160            continue;
     
    191191        RenderObject* block = containingBlock()->nextSibling();
    192192        ASSERT(block && block->isAnonymousBlock());
    193         updateStyleOfAnonymousBlockContinuations(block, newStyle, oldStyle);
     193        updateStyleOfAnonymousBlockContinuations(toRenderBlock(block), newStyle, oldStyle);
    194194    }
    195195
     
    10301030LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
    10311031{
    1032     // Only run-ins are allowed in here during layout.
    1033     ASSERT(!view().layoutStateEnabled() || isRunIn());
     1032    // Only run-ins and first-letter renderers are allowed in here during layout. They mutate the tree triggering repaints.
     1033    ASSERT(!view().layoutStateEnabled() || isRunIn() || style()->styleType() == FIRST_LETTER);
    10341034
    10351035    if (!firstLineBoxIncludingCulling() && !continuation())
Note: See TracChangeset for help on using the changeset viewer.