Changeset 90691 in webkit


Ignore:
Timestamp:
Jul 10, 2011 8:37:30 AM (13 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/9750062> REGRESSION: Button text missing in many iTunes Store pages
https://bugs.webkit.org/show_bug.cgi?id=64236

Reviewed by Maciej Stachowiak.

Source/WebCore:

Test: fast/css/empty-display-none.html

When an :empty selector caused an element to not have a renderer, the check for empty style
change when finishing parsing the elemenet did nothing, because it could not check if the
element’s current style was affected by :empty. The fix is to record the fact that the style
was affected by :empty in ElementRareData in the no-renderer case.

  • dom/Element.cpp:

(WebCore::Element::recalcStyle): Clear the m_styleAffectedByEmpty flag.
(WebCore::checkForEmptyStyleChange): If the style is null (meaning there is no renderer), check
Element::styleAffectedByEmpty().
(WebCore::Element::setStyleAffectedByEmpty): Added. Sets the flag in rare data.
(WebCore::Element::styleAffectedByEmpty): Added. Checks for the flag in rare data.

  • dom/Element.h:
  • dom/ElementRareData.h:

(WebCore::ElementRareData::ElementRareData): Added m_styleAffectedByEmpty and initialized it
to false.

  • dom/NodeRenderingContext.cpp:

(WebCore::NodeRendererFactory::createRendererAndStyle): If an element doesn’t need a renderer
and its style is affected by :empty, record this fact in the element by calling setStyleAffectedByEmpty().

LayoutTests:

  • fast/css/empty-display-none-expected.txt: Added.
  • fast/css/empty-display-none.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90666 r90691  
     12011-07-10  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9750062> REGRESSION: Button text missing in many iTunes Store pages
     4        https://bugs.webkit.org/show_bug.cgi?id=64236
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        * fast/css/empty-display-none-expected.txt: Added.
     9        * fast/css/empty-display-none.html: Added.
     10
    1112011-07-08  Stephen White  <senorblanco@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r90690 r90691  
     12011-07-10  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/9750062> REGRESSION: Button text missing in many iTunes Store pages
     4        https://bugs.webkit.org/show_bug.cgi?id=64236
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        Test: fast/css/empty-display-none.html
     9
     10        When an :empty selector caused an element to not have a renderer, the check for empty style
     11        change when finishing parsing the elemenet did nothing, because it could not check if the
     12        element’s current style was affected by :empty. The fix is to record the fact that the style
     13        was affected by :empty in ElementRareData in the no-renderer case.
     14
     15        * dom/Element.cpp:
     16        (WebCore::Element::recalcStyle): Clear the m_styleAffectedByEmpty flag.
     17        (WebCore::checkForEmptyStyleChange): If the style is null (meaning there is no renderer), check
     18        Element::styleAffectedByEmpty().
     19        (WebCore::Element::setStyleAffectedByEmpty): Added. Sets the flag in rare data.
     20        (WebCore::Element::styleAffectedByEmpty): Added. Checks for the flag in rare data.
     21        * dom/Element.h:
     22        * dom/ElementRareData.h:
     23        (WebCore::ElementRareData::ElementRareData): Added m_styleAffectedByEmpty and initialized it
     24        to false.
     25        * dom/NodeRenderingContext.cpp:
     26        (WebCore::NodeRendererFactory::createRendererAndStyle): If an element doesn’t need a renderer
     27        and its style is affected by :empty, record this fact in the element by calling setStyleAffectedByEmpty().
     28
    1292011-07-10  Mark Rowe  <mrowe@apple.com>
    230
  • trunk/Source/WebCore/dom/Element.cpp

    r90094 r90691  
    11031103
    11041104    if ((change > NoChange || needsStyleRecalc())) {
    1105         if (hasRareData())
    1106             rareData()->resetComputedStyle();
     1105        if (hasRareData()) {
     1106            ElementRareData* data = rareData();
     1107            data->resetComputedStyle();
     1108            data->m_styleAffectedByEmpty = false;
     1109        }
    11071110    }
    11081111    if (hasParentStyle && (change >= Inherit || needsStyleRecalc())) {
     
    13021305static void checkForEmptyStyleChange(Element* element, RenderStyle* style)
    13031306{
    1304     if (!style)
    1305         return;
    1306 
    1307     if (style->affectedByEmpty() && (!style->emptyState() || element->hasChildNodes()))
     1307    if (!style && !element->styleAffectedByEmpty())
     1308        return;
     1309
     1310    if (!style || (style->affectedByEmpty() && (!style->emptyState() || element->hasChildNodes())))
    13081311        element->setNeedsStyleRecalc();
    13091312}
     
    17511754}
    17521755
     1756void Element::setStyleAffectedByEmpty()
     1757{
     1758    ElementRareData* data = ensureRareData();
     1759    data->m_styleAffectedByEmpty = true;
     1760}
     1761
     1762bool Element::styleAffectedByEmpty() const
     1763{
     1764    return hasRareData() && rareData()->m_styleAffectedByEmpty;
     1765}
     1766
    17531767AtomicString Element::computeInheritedLanguage() const
    17541768{
  • trunk/Source/WebCore/dom/Element.h

    r90026 r90691  
    241241    RenderStyle* computedStyle(PseudoId = NOPSEUDO);
    242242
     243    void setStyleAffectedByEmpty();
     244    bool styleAffectedByEmpty() const;
     245
    243246    AtomicString computeInheritedLanguage() const;
    244247
  • trunk/Source/WebCore/dom/ElementRareData.h

    r89989 r90691  
    5151    OwnPtr<ClassList> m_classList;
    5252
     53    bool m_styleAffectedByEmpty;
     54
    5355#if ENABLE(FULLSCREEN_API)
    5456    bool m_containsFullScreenElement;
     
    6466    : m_minimumSizeForResizing(defaultMinimumSizeForResizing())
    6567    , m_shadowRoot(0)
     68    , m_styleAffectedByEmpty(false)
    6669#if ENABLE(FULLSCREEN_API)
    6770    , m_containsFullScreenElement(false)
  • trunk/Source/WebCore/dom/NodeRenderingContext.cpp

    r90536 r90691  
    272272
    273273    m_context.setStyle(node->styleForRenderer(m_context));
    274     if (!node->rendererIsNeeded(m_context))
    275         return 0;
     274    if (!node->rendererIsNeeded(m_context)) {
     275        if (node->isElementNode()) {
     276            Element* element = toElement(node);
     277            if (m_context.style()->affectedByEmpty())
     278                element->setStyleAffectedByEmpty();
     279        }
     280        return 0;
     281    }
    276282
    277283    RenderObject* newRenderer = node->createRenderer(document->renderArena(), m_context.style());
Note: See TracChangeset for help on using the changeset viewer.