Changeset 217610 in webkit


Ignore:
Timestamp:
May 31, 2017 10:49:04 AM (7 years ago)
Author:
fred.wang@free.fr
Message:

ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits is wrongly set
https://bugs.webkit.org/show_bug.cgi?id=172349

Patch by Frederic Wang <fwang@igalia.com> on 2017-05-31
Reviewed by Simon Fraser.

ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits was introduced in
r133022 so that ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode
know the number of bits use for properties in their parent class.

In r172649, r210560, r185762 and r183702 new properties were added to
ScrollingStateScrollingNode but NumScrollingStateNodeBits was not increased accordingly. This
means that there are potential conflicts between these new properties and those of derived
classes ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode. It is not
clear how to write a test case reproducing such conflict, though.

No new tests, this is a coding mistake but its effect is unclear.

  • page/scrolling/ScrollingStateNode.cpp:

(WebCore::ScrollingStateNode::setPropertyChanged): Use hasChangedProperty and cast to
64-bits integer before shifting.

  • page/scrolling/ScrollingStateNode.h: Add a comment to make clear NumStateNodeBits must

remain at the last position. Ensure we have enough bits available.
(WebCore::ScrollingStateNode::hasChangedProperty): Cast to 64-bits integer before shifting.

  • page/scrolling/ScrollingStateScrollingNode.h: Fix position of NumScrollingStateNodeBits and

also add a similar comment.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r217607 r217610  
     12017-05-31  Frederic Wang  <fwang@igalia.com>
     2
     3        ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits is wrongly set
     4        https://bugs.webkit.org/show_bug.cgi?id=172349
     5
     6        Reviewed by Simon Fraser.
     7
     8        ScrollingStateScrollingNode::ChangedProperty::NumScrollingStateNodeBits was introduced in
     9        r133022 so that ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode
     10        know the number of bits use for properties in their parent class.
     11
     12        In r172649, r210560, r185762 and r183702 new properties were added to
     13        ScrollingStateScrollingNode but NumScrollingStateNodeBits was not increased accordingly. This
     14        means that there are potential conflicts between these new properties and those of derived
     15        classes ScrollingStateFrameScrollingNode and ScrollingStateOverflowScrollingNode. It is not
     16        clear how to write a test case reproducing such conflict, though.
     17
     18        No new tests, this is a coding mistake but its effect is unclear.
     19
     20        * page/scrolling/ScrollingStateNode.cpp:
     21        (WebCore::ScrollingStateNode::setPropertyChanged): Use hasChangedProperty and cast to
     22        64-bits integer before shifting.
     23        * page/scrolling/ScrollingStateNode.h: Add a comment to make clear NumStateNodeBits must
     24        remain at the last position. Ensure we have enough bits available.
     25        (WebCore::ScrollingStateNode::hasChangedProperty): Cast to 64-bits integer before shifting.
     26        * page/scrolling/ScrollingStateScrollingNode.h: Fix position of NumScrollingStateNodeBits and
     27        also add a similar comment.
     28
    1292017-05-31  Matt Lewis  <jlewis3@apple.com>
    230
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp

    r216478 r217610  
    6666void ScrollingStateNode::setPropertyChanged(unsigned propertyBit)
    6767{
    68     if (m_changedProperties & (1 << propertyBit))
     68    if (hasChangedProperty(propertyBit))
    6969        return;
    7070
    71     m_changedProperties |= (1 << propertyBit);
     71    m_changedProperties |= (static_cast<ChangedProperties>(1) << propertyBit);
    7272    m_scrollingStateTree.setHasChangedProperties();
    7373}
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h

    r216478 r217610  
    3030#include "GraphicsLayer.h"
    3131#include "ScrollingCoordinator.h"
     32#include <stdint.h>
    3233#include <wtf/RefCounted.h>
    3334#include <wtf/TypeCasts.h>
     
    203204    enum {
    204205        ScrollLayer = 0,
    205         NumStateNodeBits = 1
     206        NumStateNodeBits // This must remain at the last position.
    206207    };
    207     typedef unsigned ChangedProperties;
     208    typedef uint64_t ChangedProperties;
    208209
    209210    bool hasChangedProperties() const { return m_changedProperties; }
    210     bool hasChangedProperty(unsigned propertyBit) const { return m_changedProperties & (1 << propertyBit); }
     211    bool hasChangedProperty(unsigned propertyBit) const { return m_changedProperties & (static_cast<ChangedProperties>(1) << propertyBit); }
    211212    void resetChangedProperties() { m_changedProperties = 0; }
    212213    void setPropertyChanged(unsigned propertyBit);
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h

    r216478 r217610  
    4747        ScrollableAreaParams,
    4848        RequestedScrollPosition,
    49         NumScrollingStateNodeBits,
    5049#if ENABLE(CSS_SCROLL_SNAP)
    5150        HorizontalSnapOffsets,
     
    5756#endif
    5857        ExpectsWheelEventTestTrigger,
     58        NumScrollingStateNodeBits // This must remain at the last position.
    5959    };
    6060
Note: See TracChangeset for help on using the changeset viewer.