Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Issue 52923003: Fixing reflectivity of operator== for timing functions. (Closed)

Created:
7 years, 1 month ago by mithro-old
Modified:
7 years, 1 month ago
Reviewers:
Steve Block
CC:
blink-reviews, shans, rjwright, alancutter (OOO until 2018), Mike Lawther (Google), dstockwell, Timothy Loh, darktears, dino_apple.com, Eric Willigers
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Fixing reflectivity of operator== for timing functions. (Also added a bunch of equality tests to make sure no other bugs exist.) Previously, ((A == B) == (B == A)) was not true in all cases. If A was a preset and B was a Custom with identical internal values to the preset, then the reflectivity would not hold. Before this patch, the test output looked like the following: ---- TEST_F(TimingFunctionTest, CubicOperatorEqReflectivityBug) { RefPtr<TimingFunction> cubicA = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn); RefPtr<TimingFunction> cubicB = CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0); EXPECT_REFV_NE(cubicA, cubicB); EXPECT_REFV_NE(cubicB, cubicA); } [ RUN ] TimingFunctionTest.CubicOperatorEqReflectivityBug ../../third_party/WebKit/Source/core/platform/animation/TimingFunctionTest.cpp:111: Failure Expected: (*(cubicB.get())) != (*(cubicA.get())), actual: CubicBezierTimingFunction@0x16d1b01f2ec0(Custom, 0.42, 0, 1, 1) vs CubicBezierTimingFunction@0x16d1b01f2020(EaseIn, 0.42, 0, 1, 1) [ FAILED ] TimingFunctionTest.CubicOperatorEqReflectivityBug (0 ms) ---- TEST_F(TimingFunctionTest, StepsOperatorEqReflectivityBug) { RefPtr<TimingFunction> stepsA = StepsTimingFunction::preset(StepsTimingFunction::Start); RefPtr<TimingFunction> stepsB = StepsTimingFunction::create(1, true); EXPECT_REFV_NE(stepsA, stepsB); EXPECT_REFV_NE(stepsB, stepsA); } [ RUN ] TimingFunctionTest.StepsOperatorEqReflectivityBug ../../third_party/WebKit/Source/core/platform/animation/TimingFunctionTest.cpp:180: Failure Expected: (*(stepsB.get())) != (*(stepsA.get())), actual: StepsTimingFunction@0x16d1b01ea800(Custom, 1, true) vs StepsTimingFunction@0x16d1b01e9f20(Start, 1, true) [ FAILED ] TimingFunctionTest.StepsOperatorEqReflectivityBug (0 ms) ---- DEPENDS=https://codereview.chromium.org/39223002/ BUG=

Patch Set 1 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+197 lines, -13 lines) Patch
M Source/core/core.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/platform/animation/TimingFunction.h View 5 chunks +15 lines, -13 lines 0 comments Download
A Source/core/platform/animation/TimingFunctionTest.cpp View 1 chunk +181 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
mithro-old
Hi Steve, I finally figured out exactly what was going on last week and have ...
7 years, 1 month ago (2013-11-04 12:05:03 UTC) #1
Steve Block
Makes sense, but what's the impact on web content? Can you add a LayoutTest to ...
7 years, 1 month ago (2013-11-04 23:19:23 UTC) #2
mithro-old
On 2013/11/04 23:19:23, Steve Block wrote: > Makes sense, but what's the impact on web ...
7 years, 1 month ago (2013-11-05 01:23:20 UTC) #3
mithro-old
On 2013/11/05 01:23:20, mithro wrote: > On 2013/11/04 23:19:23, Steve Block wrote: > > Makes ...
7 years, 1 month ago (2013-11-05 11:42:29 UTC) #4
Steve Block
> * The CSSAnimationDataList::operator== is only used by > CompositeAnimation::updateKeyframeAnimations It's also used by StyleRareNonInheritedData::operator==(), ...
7 years, 1 month ago (2013-11-06 00:31:48 UTC) #5
mithro-old
7 years, 1 month ago (2013-11-06 01:09:20 UTC) #6
On 2013/11/06 00:31:48, Steve Block wrote:
> >  * The CSSAnimationDataList::operator== is only used by
> > CompositeAnimation::updateKeyframeAnimations
> 
> It's also used by StyleRareNonInheritedData::operator==(), which is used by
> RenderStyle::operator==().
> 
> However, I think that in both of these cases, we shouldn't be comparing timing
> functions at all. See https://codereview.chromium.org/60033004. So you could
> modify TimingFunction::operator==() as you see fit for testing.

After https://codereview.chromium.org/60033004 lands, I will move all operator==
stuff to the test helper, this making this CL obsolete. Closing.

Powered by Google App Engine
This is Rietveld 408576698