Changeset 148965 in webkit


Ignore:
Timestamp:
Apr 23, 2013 7:55:17 AM (11 years ago)
Author:
akling@apple.com
Message:

Clear StyleResolver state before returning from styleForElement().
<http://webkit.org/b/115035>

Reviewed by Antti Koivisto.

From Blink r148687 by <inferno@chromium.org>.

Source/WebCore:

A cached element pointer in the resolver state was causing confusion because
in some cases a subsequent call to styleForElement() would use a pointer to
a different object that is at the same memory address as the previous one.

Test: fast/css/reload-non-styled-element-crash.html

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::styleForElement):

LayoutTests:

  • fast/css/reload-non-styled-element-crash-expected.txt: Added.
  • fast/css/reload-non-styled-element-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148960 r148965  
     12013-04-23  Andreas Kling  <akling@apple.com>
     2
     3        Clear StyleResolver state before returning from styleForElement().
     4        <http://webkit.org/b/115035>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        From Blink r148687 by <inferno@chromium.org>.
     9
     10        * fast/css/reload-non-styled-element-crash-expected.txt: Added.
     11        * fast/css/reload-non-styled-element-crash.html: Added.
     12
    1132013-04-23  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r148964 r148965  
     12013-04-23  Andreas Kling  <akling@apple.com>
     2
     3        Clear StyleResolver state before returning from styleForElement().
     4        <http://webkit.org/b/115035>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        From Blink r148687 by <inferno@chromium.org>.
     9
     10        A cached element pointer in the resolver state was causing confusion because
     11        in some cases a subsequent call to styleForElement() would use a pointer to
     12        a different object that is at the same memory address as the previous one.
     13
     14        Test: fast/css/reload-non-styled-element-crash.html
     15
     16        * css/StyleResolver.cpp:
     17        (WebCore::StyleResolver::styleForElement):
     18
    1192013-04-23  Andreas Kling  <akling@apple.com>
    220
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r148921 r148965  
    972972    if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint()) {
    973973        RenderStyle* sharedStyle = locateSharedStyle();
    974         if (sharedStyle)
     974        if (sharedStyle) {
     975            state.clear();
    975976            return sharedStyle;
     977        }
    976978    }
    977979
Note: See TracChangeset for help on using the changeset viewer.