Changeset 191017 in webkit


Ignore:
Timestamp:
Oct 13, 2015, 5:14:29 PM (10 years ago)
Author:
Simon Fraser
Message:

Add helper funtion for checking pointer equivalency and use it
https://bugs.webkit.org/show_bug.cgi?id=150022

Reviewed by Darin Adler.
Source/WebCore:

A common pattern in WebCore code is to check for equivalency of two pointers,
either both null, or both non-null and with equal values. This was written in
several different ways in different places.

Add arePointingToEqualData() to standardize this pattern.

This obviates the need for StyleImage::imagesEquivalent(), counterDataEquivalent()
etc.

Also change some comparisons of DataRef<> which checked the pointer and then the
values to use DataRef<>::operator== which does the same thing. Comparisons of
m_grid and m_gridItem only checked pointer equality, so this is probably a bug fix there.

page/animation/CSSPropertyAnimation.cpp: if ((!a && !b)
a == b) is redundant so fix,

and add checks for a and b RenderStyle* first.
(WebCore::PropertyWrapperGetter::equals):
(WebCore::StyleImagePropertyWrapper::equals):
(WebCore::PropertyWrapperShadow::equals):
(WebCore::PropertyWrapperMaybeInvalidColor::equals):
(WebCore::FillLayerPropertyWrapperGetter::equals):
(WebCore::FillLayerStyleImagePropertyWrapper::equals):
(WebCore::FillLayersPropertyWrapper::equals):
(WebCore::ShorthandPropertyWrapper::equals):
(WebCore::PropertyWrapperFlex::equals):
(WebCore::PropertyWrapperSVGPaint::equals):

  • platform/network/ResourceRequestBase.cpp:

(WebCore::equalIgnoringHeaderFields):

  • rendering/style/FillLayer.cpp:

(WebCore::FillLayer::operator==):

  • rendering/style/NinePieceImage.cpp:

(WebCore::NinePieceImageData::operator==):

  • rendering/style/RenderStyle.cpp: Some nullptr cleanup.

(WebCore::RenderStyle::getCachedPseudoStyle):
(WebCore::RenderStyle::addCachedPseudoStyle):
(WebCore::RenderStyle::changeAffectsVisualOverflow):
(WebCore::RenderStyle::changeRequiresLayout):
(WebCore::RenderStyle::changeRequiresLayerRepaint):
(WebCore::RenderStyle::setWillChange):

  • rendering/style/SVGRenderStyleDefs.cpp:

(WebCore::StyleShadowSVGData::operator==):

  • rendering/style/ShadowData.cpp:

(WebCore::ShadowData::operator==):

  • rendering/style/StyleImage.h:

(WebCore::StyleImage::imagesEquivalent): Deleted.

  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::operator==):
(WebCore::cursorDataEquivalent): Deleted.
(WebCore::quotesDataEquivalent): Deleted.
(WebCore::StyleRareInheritedData::shadowDataEquivalent): Deleted.

  • rendering/style/StyleRareInheritedData.h:
  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::operator==):
(WebCore::StyleRareNonInheritedData::counterDataEquivalent): Deleted.
(WebCore::StyleRareNonInheritedData::shadowDataEquivalent): Deleted.
(WebCore::StyleRareNonInheritedData::willChangeDataEquivalent): Deleted.
(WebCore::StyleRareNonInheritedData::reflectionDataEquivalent): Deleted.
(WebCore::StyleRareNonInheritedData::animationDataEquivalent): Deleted.
(WebCore::StyleRareNonInheritedData::transitionDataEquivalent): Deleted.

  • rendering/style/StyleRareNonInheritedData.h:

Source/WTF:

Add PointerComparison.h which contains the templated pointer comparison
function.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/PointerComparison.h: Added.

(WTF::arePointingToEqualData):

Location:
trunk/Source
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WTF/ChangeLog

    r190882 r191017  
     12015-10-13  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add helper funtion for checking pointer equivalency and use it
     4        https://bugs.webkit.org/show_bug.cgi?id=150022
     5
     6        Reviewed by Darin Adler.
     7       
     8        Add PointerComparison.h which contains the templated pointer comparison
     9        function.
     10
     11        * WTF.xcodeproj/project.pbxproj:
     12        * wtf/PointerComparison.h: Added.
     13        (WTF::arePointingToEqualData):
     14
    1152015-10-12  Andreas Kling  <akling@apple.com>
    216
  • TabularUnified trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r190310 r191017  
    5252                0FEB3DD11BB7366B009D7AAD /* ParallelVectorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEB3DD01BB7366B009D7AAD /* ParallelVectorIterator.h */; };
    5353                0FED67B61B22D4D80066CE15 /* TinyPtrSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FED67B51B22D4D80066CE15 /* TinyPtrSet.h */; };
     54                0FF860951BCCBD740045127F /* PointerComparison.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF860941BCCBD740045127F /* PointerComparison.h */; };
    5455                0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFF19DA1BB334EB00886D91 /* ParallelHelperPool.cpp */; };
    5556                0FFF19DD1BB334EB00886D91 /* ParallelHelperPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FFF19DB1BB334EB00886D91 /* ParallelHelperPool.h */; };
     
    345346                0FEB3DD01BB7366B009D7AAD /* ParallelVectorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelVectorIterator.h; sourceTree = "<group>"; };
    346347                0FED67B51B22D4D80066CE15 /* TinyPtrSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TinyPtrSet.h; sourceTree = "<group>"; };
     348                0FF860941BCCBD740045127F /* PointerComparison.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PointerComparison.h; sourceTree = "<group>"; };
    347349                0FFF19DA1BB334EB00886D91 /* ParallelHelperPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParallelHelperPool.cpp; sourceTree = "<group>"; };
    348350                0FFF19DB1BB334EB00886D91 /* ParallelHelperPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelHelperPool.h; sourceTree = "<group>"; };
     
    838840                                A8A472ED151A825B004123FF /* PassRefPtr.h */,
    839841                                A876DBD7151816E500DADB95 /* Platform.h */,
     842                                0FF860941BCCBD740045127F /* PointerComparison.h */,
    840843                                0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
    841844                                0F9D335E165DBA73005AD387 /* PrintStream.h */,
     
    12091212                                A8A47422151A825B004123FF /* SHA1.h in Headers */,
    12101213                                A8A47423151A825B004123FF /* SimpleStats.h in Headers */,
     1214                                0FF860951BCCBD740045127F /* PointerComparison.h in Headers */,
    12111215                                A8A47424151A825B004123FF /* SinglyLinkedList.h in Headers */,
    12121216                                A748745317A0BDAE00FA04CB /* SixCharacterHash.h in Headers */,
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r191014 r191017  
     12015-10-13  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add helper funtion for checking pointer equivalency and use it
     4        https://bugs.webkit.org/show_bug.cgi?id=150022
     5
     6        Reviewed by Darin Adler.
     7
     8        A common pattern in WebCore code is to check for equivalency of two pointers,
     9        either both null, or both non-null and with equal values. This was written in
     10        several different ways in different places.
     11       
     12        Add arePointingToEqualData() to standardize this pattern.
     13
     14        This obviates the need for StyleImage::imagesEquivalent(), counterDataEquivalent()
     15        etc.
     16       
     17        Also change some comparisons of DataRef<> which checked the pointer and then the
     18        values to use DataRef<>::operator== which does the same thing. Comparisons of
     19        m_grid and m_gridItem only checked pointer equality, so this is probably a bug fix there.
     20
     21        * page/animation/CSSPropertyAnimation.cpp: if ((!a && !b) || a == b) is redundant so fix,
     22        and add checks for a and b RenderStyle* first.
     23        (WebCore::PropertyWrapperGetter::equals):
     24        (WebCore::StyleImagePropertyWrapper::equals):
     25        (WebCore::PropertyWrapperShadow::equals):
     26        (WebCore::PropertyWrapperMaybeInvalidColor::equals):
     27        (WebCore::FillLayerPropertyWrapperGetter::equals):
     28        (WebCore::FillLayerStyleImagePropertyWrapper::equals):
     29        (WebCore::FillLayersPropertyWrapper::equals):
     30        (WebCore::ShorthandPropertyWrapper::equals):
     31        (WebCore::PropertyWrapperFlex::equals):
     32        (WebCore::PropertyWrapperSVGPaint::equals):
     33        * platform/network/ResourceRequestBase.cpp:
     34        (WebCore::equalIgnoringHeaderFields):
     35        * rendering/style/FillLayer.cpp:
     36        (WebCore::FillLayer::operator==):
     37        * rendering/style/NinePieceImage.cpp:
     38        (WebCore::NinePieceImageData::operator==):
     39        * rendering/style/RenderStyle.cpp: Some nullptr cleanup.
     40        (WebCore::RenderStyle::getCachedPseudoStyle):
     41        (WebCore::RenderStyle::addCachedPseudoStyle):
     42        (WebCore::RenderStyle::changeAffectsVisualOverflow):
     43        (WebCore::RenderStyle::changeRequiresLayout):
     44        (WebCore::RenderStyle::changeRequiresLayerRepaint):
     45        (WebCore::RenderStyle::setWillChange):
     46        * rendering/style/SVGRenderStyleDefs.cpp:
     47        (WebCore::StyleShadowSVGData::operator==):
     48        * rendering/style/ShadowData.cpp:
     49        (WebCore::ShadowData::operator==):
     50        * rendering/style/StyleImage.h:
     51        (WebCore::StyleImage::imagesEquivalent): Deleted.
     52        * rendering/style/StyleRareInheritedData.cpp:
     53        (WebCore::StyleRareInheritedData::operator==):
     54        (WebCore::cursorDataEquivalent): Deleted.
     55        (WebCore::quotesDataEquivalent): Deleted.
     56        (WebCore::StyleRareInheritedData::shadowDataEquivalent): Deleted.
     57        * rendering/style/StyleRareInheritedData.h:
     58        * rendering/style/StyleRareNonInheritedData.cpp:
     59        (WebCore::StyleRareNonInheritedData::operator==):
     60        (WebCore::StyleRareNonInheritedData::counterDataEquivalent): Deleted.
     61        (WebCore::StyleRareNonInheritedData::shadowDataEquivalent): Deleted.
     62        (WebCore::StyleRareNonInheritedData::willChangeDataEquivalent): Deleted.
     63        (WebCore::StyleRareNonInheritedData::reflectionDataEquivalent): Deleted.
     64        (WebCore::StyleRareNonInheritedData::animationDataEquivalent): Deleted.
     65        (WebCore::StyleRareNonInheritedData::transitionDataEquivalent): Deleted.
     66        * rendering/style/StyleRareNonInheritedData.h:
     67
    1682015-10-13  Myles C. Maxfield  <mmaxfield@apple.com>
    269
  • TabularUnified trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r190879 r191017  
    5555#include <wtf/MathExtras.h>
    5656#include <wtf/Noncopyable.h>
     57#include <wtf/PointerComparison.h>
    5758#include <wtf/RefCounted.h>
    5859
     
    401402    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    402403    {
    403         // If the style pointers are the same, don't bother doing the test.
    404         // If either is null, return false. If both are null, return true.
    405         if ((!a && !b) || a == b)
     404        if (a == b)
    406405            return true;
    407406        if (!a || !b)
     
    537536    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    538537    {
    539        // If the style pointers are the same, don't bother doing the test.
    540        // If either is null, return false. If both are null, return true.
    541538       if (a == b)
    542539           return true;
     
    546543        StyleImage* imageA = (a->*m_getter)();
    547544        StyleImage* imageB = (b->*m_getter)();
    548         return StyleImage::imagesEquivalent(imageA, imageB);
     545        return arePointingToEqualData(imageA, imageB);
    549546    }
    550547};
     
    675672    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    676673    {
     674        if (a == b)
     675            return true;
     676        if (!a || !b)
     677            return false;
     678
    677679        const ShadowData* shadowA = (a->*m_getter)();
    678680        const ShadowData* shadowB = (b->*m_getter)();
     
    791793    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    792794    {
     795        if (a == b)
     796            return true;
     797        if (!a || !b)
     798            return false;
     799
    793800        Color fromColor = (a->*m_getter)();
    794801        Color toColor = (b->*m_getter)();
     
    885892    virtual bool equals(const FillLayer* a, const FillLayer* b) const
    886893    {
    887        // If the style pointers are the same, don't bother doing the test.
    888        // If either is null, return false. If both are null, return true.
    889        if ((!a && !b) || a == b)
    890            return true;
    891        if (!a || !b)
     894        if (a == b)
     895            return true;
     896        if (!a || !b)
    892897            return false;
    893898        return (a->*m_getter)() == (b->*m_getter)();
     
    946951    virtual bool equals(const FillLayer* a, const FillLayer* b) const
    947952    {
    948        // If the style pointers are the same, don't bother doing the test.
    949        // If either is null, return false. If both are null, return true.
    950953       if (a == b)
    951954           return true;
     
    955958        StyleImage* imageA = (a->*m_getter)();
    956959        StyleImage* imageB = (b->*m_getter)();
    957         return StyleImage::imagesEquivalent(imageA, imageB);
     960        return arePointingToEqualData(imageA, imageB);
    958961    }
    959962};
     
    994997    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    995998    {
     999        if (a == b)
     1000            return true;
     1001        if (!a || !b)
     1002            return false;
     1003
    9961004        const FillLayer* fromLayer = (a->*m_layersGetter)();
    9971005        const FillLayer* toLayer = (b->*m_layersGetter)();
     
    10421050    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    10431051    {
     1052        if (a == b)
     1053            return true;
     1054        if (!a || !b)
     1055            return false;
     1056
    10441057        for (auto& wrapper : m_propertyWrappers) {
    10451058            if (!wrapper->equals(a, b))
     
    10711084    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    10721085    {
    1073         // If the style pointers are the same, don't bother doing the test.
    1074         // If either is null, return false. If both are null, return true.
    1075         if ((!a && !b) || a == b)
     1086        if (a == b)
    10761087            return true;
    10771088        if (!a || !b)
     
    11021113    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
    11031114    {
     1115        if (a == b)
     1116            return true;
     1117        if (!a || !b)
     1118            return false;
     1119
    11041120        if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
    11051121            return false;
  • TabularUnified trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp

    r183901 r191017  
    2929#include "HTTPHeaderNames.h"
    3030#include "ResourceRequest.h"
     31#include <wtf/PointerComparison.h>
    3132
    3233namespace WebCore {
     
    501502        return false;
    502503
    503     FormData* formDataA = a.httpBody();
    504     FormData* formDataB = b.httpBody();
    505    
    506     if (!formDataA)
    507         return !formDataB;
    508     if (!formDataB)
    509         return !formDataA;
    510    
    511     if (*formDataA != *formDataB)
    512         return false;
    513    
    514     return true;
     504    return arePointingToEqualData(a.httpBody(), b.httpBody());
    515505}
    516506
  • TabularUnified trunk/Source/WebCore/rendering/style/FillLayer.cpp

    r186392 r191017  
    2222#include "config.h"
    2323#include "FillLayer.h"
     24
     25#include <wtf/PointerComparison.h>
    2426
    2527namespace WebCore {
     
    153155    // We do not check the "isSet" booleans for each property, since those are only used during initial construction
    154156    // to propagate patterns into layers. All layer comparisons happen after values have all been filled in anyway.
    155     return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
     157    return arePointingToEqualData(m_image.get(), o.m_image.get()) && m_xPosition == o.m_xPosition && m_yPosition == o.m_yPosition
    156158        && m_backgroundXOrigin == o.m_backgroundXOrigin && m_backgroundYOrigin == o.m_backgroundYOrigin
    157159        && m_attachment == o.m_attachment && m_clip == o.m_clip && m_composite == o.m_composite
  • TabularUnified trunk/Source/WebCore/rendering/style/NinePieceImage.cpp

    r190883 r191017  
    2929#include "RenderStyle.h"
    3030#include <wtf/NeverDestroyed.h>
     31#include <wtf/PointerComparison.h>
    3132
    3233namespace WebCore {
     
    253254bool NinePieceImageData::operator==(const NinePieceImageData& other) const
    254255{
    255     return StyleImage::imagesEquivalent(image.get(), other.image.get())
     256    return arePointingToEqualData(image, other.image)
    256257        && imageSlices == other.imageSlices
    257258        && fill == other.fill
  • TabularUnified trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r190754 r191017  
    4343#include "WillChangeData.h"
    4444#include <wtf/MathExtras.h>
     45#include <wtf/PointerComparison.h>
    4546#include <wtf/StdLibExtras.h>
    4647#include <algorithm>
     
    311312{
    312313    if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
    313         return 0;
     314        return nullptr;
    314315
    315316    if (styleType() != NOPSEUDO)
    316         return 0;
     317        return nullptr;
    317318
    318319    for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
     
    322323    }
    323324
    324     return 0;
     325    return nullptr;
    325326}
    326327
     
    328329{
    329330    if (!pseudo)
    330         return 0;
     331        return nullptr;
    331332
    332333    ASSERT(pseudo->styleType() > NOPSEUDO);
     
    460461{
    461462    if (rareNonInheritedData.get() != other.rareNonInheritedData.get()
    462         && !rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedData.get()))
     463        && !arePointingToEqualData(rareNonInheritedData->m_boxShadow, other.rareNonInheritedData->m_boxShadow))
    463464        return true;
    464465
    465466    if (rareInheritedData.get() != other.rareInheritedData.get()
    466         && !rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.get()))
     467        && !arePointingToEqualData(rareInheritedData->textShadow, other.rareInheritedData->textShadow))
    467468        return true;
    468469
     
    524525#endif
    525526
    526         if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNonInheritedData->m_deprecatedFlexibleBox.get()
    527             && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.rareNonInheritedData->m_deprecatedFlexibleBox.get())
    528             return true;
    529 
    530         if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedData->m_flexibleBox.get()
    531             && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInheritedData->m_flexibleBox.get())
    532             return true;
     527        if (rareNonInheritedData->m_deprecatedFlexibleBox != other.rareNonInheritedData->m_deprecatedFlexibleBox)
     528            return true;
     529
     530        if (rareNonInheritedData->m_flexibleBox != other.rareNonInheritedData->m_flexibleBox)
     531            return true;
     532
    533533        if (rareNonInheritedData->m_order != other.rareNonInheritedData->m_order
    534534            || rareNonInheritedData->m_alignContent != other.rareNonInheritedData->m_alignContent
     
    540540            return true;
    541541
    542         if (!rareNonInheritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get()))
    543             return true;
    544 
    545         if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData->m_multiCol.get()
    546             && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInheritedData->m_multiCol.get())
     542        if (!arePointingToEqualData(rareNonInheritedData->m_boxReflect, other.rareNonInheritedData->m_boxReflect))
     543            return true;
     544
     545        if (rareNonInheritedData->m_multiCol != other.rareNonInheritedData->m_multiCol)
    547546            return true;
    548547
     
    557556
    558557#if ENABLE(CSS_GRID_LAYOUT)
    559         if (rareNonInheritedData->m_grid.get() != other.rareNonInheritedData->m_grid.get()
    560             || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedData->m_gridItem.get())
     558        if (rareNonInheritedData->m_grid != other.rareNonInheritedData->m_grid
     559            || rareNonInheritedData->m_gridItem != other.rareNonInheritedData->m_gridItem)
    561560            return true;
    562561#endif
     
    568567#endif
    569568
    570         if (!rareNonInheritedData->willChangeDataEquivalent(*other.rareNonInheritedData.get())) {
     569        if (!arePointingToEqualData(rareNonInheritedData->m_willChange, other.rareNonInheritedData->m_willChange)) {
    571570            changedContextSensitiveProperties |= ContextSensitivePropertyWillChange;
    572571            // Don't return; keep looking for another change
     
    617616            || rareInheritedData->useTouchOverflowScrolling != other.rareInheritedData->useTouchOverflowScrolling
    618617#endif
    619             || rareInheritedData->listStyleImage != other.rareInheritedData->listStyleImage)
     618            || rareInheritedData->listStyleImage != other.rareInheritedData->listStyleImage) // FIXME: needs arePointingToEqualData()?
    620619            return true;
    621620
     
    701700
    702701    // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
    703     const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get();
    704     const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterDirectives.get();
    705     if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
     702    if (!arePointingToEqualData(rareNonInheritedData->m_counterDirectives, other.rareNonInheritedData->m_counterDirectives))
    706703        return true;
    707704
     
    726723#endif
    727724
    728     const QuotesData* quotesDataA = rareInheritedData->quotes.get();
    729     const QuotesData* quotesDataB = other.rareInheritedData->quotes.get();
    730     if (!(quotesDataA == quotesDataB || (quotesDataA && quotesDataB && *quotesDataA == *quotesDataB)))
     725    if (!arePointingToEqualData(rareInheritedData->quotes, other.rareInheritedData->quotes))
    731726        return true;
    732727
     
    785780    }
    786781
    787     if (rareNonInheritedData->m_filter.get() != other.rareNonInheritedData->m_filter.get()
    788         && *rareNonInheritedData->m_filter.get() != *other.rareNonInheritedData->m_filter.get()) {
     782    if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filter) {
    789783        changedContextSensitiveProperties |= ContextSensitivePropertyFilter;
    790784        // Don't return; keep looking for another change.
     
    947941void RenderStyle::setWillChange(PassRefPtr<WillChangeData> willChangeData)
    948942{
    949     if (rareNonInheritedData->m_willChange == willChangeData
    950         || (rareNonInheritedData->m_willChange && willChangeData && *rareNonInheritedData->m_willChange == *willChangeData))
     943    if (arePointingToEqualData(rareNonInheritedData->m_willChange.get(), willChangeData.get()))
    951944        return;
    952945
  • TabularUnified trunk/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp

    r188647 r191017  
    3232#include "RenderStyle.h"
    3333#include "SVGRenderStyle.h"
     34#include <wtf/PointerComparison.h>
    3435
    3536namespace WebCore {
     
    217218bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const
    218219{
    219     if ((!shadow && other.shadow) || (shadow && !other.shadow))
    220         return false;
    221     if (shadow && other.shadow && (*shadow != *other.shadow))
    222         return false;
    223     return true;
     220    return arePointingToEqualData(shadow, other.shadow);
    224221}
    225222
  • TabularUnified trunk/Source/WebCore/rendering/style/ShadowData.cpp

    r163751 r191017  
    2424
    2525#include "LayoutRect.h"
     26#include <wtf/PointerComparison.h>
    2627
    2728namespace WebCore {
     
    4041bool ShadowData::operator==(const ShadowData& o) const
    4142{
    42     if ((m_next && !o.m_next) || (!m_next && o.m_next)
    43         || (m_next && o.m_next && *m_next != *o.m_next))
     43    if (!arePointingToEqualData(m_next, o.m_next))
    4444        return false;
    4545   
  • TabularUnified trunk/Source/WebCore/rendering/style/StyleImage.h

    r174836 r191017  
    7575    ALWAYS_INLINE bool isCachedImageSet() const { return m_isCachedImageSet; }
    7676   
    77     static bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
    78     {
    79         return image1 == image2 || (image1 && image2 && *image1 == *image2);
    80     }
    81 
    8277protected:
    8378    StyleImage()
  • TabularUnified trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r190754 r191017  
    3131#include "StyleCustomPropertyData.h"
    3232#include "StyleImage.h"
     33#include <wtf/PointerComparison.h>
    3334
    3435namespace WebCore {
     
    236237}
    237238
    238 static bool cursorDataEquivalent(const CursorList* c1, const CursorList* c2)
    239 {
    240     if (c1 == c2)
    241         return true;
    242     if ((!c1 && c2) || (c1 && !c2))
    243         return false;
    244     return (*c1 == *c2);
    245 }
    246 
    247 static bool quotesDataEquivalent(const QuotesData* q1, const QuotesData* q2)
    248 {
    249     if (q1 == q2)
    250         return true;
    251     if ((!q1 && q2) || (q1 && !q2))
    252         return false;
    253     return (*q1 == *q2);
    254 }
    255 
    256239bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
    257240{
     
    266249        && tapHighlightColor == o.tapHighlightColor
    267250#endif
    268         && shadowDataEquivalent(o)
    269         && cursorDataEquivalent(cursorData.get(), o.cursorData.get())
     251        && arePointingToEqualData(textShadow, o.textShadow)
     252        && arePointingToEqualData(cursorData, o.cursorData)
    270253        && indent == o.indent
    271254        && m_effectiveZoom == o.m_effectiveZoom
     
    308291        && locale == o.locale
    309292        && textEmphasisCustomMark == o.textEmphasisCustomMark
    310         && quotesDataEquivalent(quotes.get(), o.quotes.get())
     293        && arePointingToEqualData(quotes, o.quotes)
    311294        && m_tabSize == o.m_tabSize
    312295        && m_lineGrid == o.m_lineGrid
     
    334317#endif
    335318        && m_customProperties == o.m_customProperties
    336         && StyleImage::imagesEquivalent(listStyleImage.get(), o.listStyleImage.get());
    337 }
    338 
    339 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
    340 {
    341     if ((!textShadow && o.textShadow) || (textShadow && !o.textShadow))
    342         return false;
    343     if (textShadow && o.textShadow && (*textShadow != *o.textShadow))
    344         return false;
    345     return true;
     319        && arePointingToEqualData(listStyleImage, o.listStyleImage);
    346320}
    347321
  • TabularUnified trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r190754 r191017  
    5959        return !(*this == o);
    6060    }
    61     bool shadowDataEquivalent(const StyleRareInheritedData&) const;
    6261
    6362    RefPtr<StyleImage> listStyleImage;
  • TabularUnified trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r190879 r191017  
    3232#include "StyleResolver.h"
    3333#include "StyleScrollSnapPoints.h"
     34#include <wtf/PointerComparison.h>
     35#include <wtf/RefPtr.h>
    3436
    3537namespace WebCore {
     
    234236#endif
    235237        && contentDataEquivalent(o)
    236         && counterDataEquivalent(o)
    237         && shadowDataEquivalent(o)
    238         && willChangeDataEquivalent(o)
    239         && reflectionDataEquivalent(o)
    240         && animationDataEquivalent(o)
    241         && transitionDataEquivalent(o)
     238        && arePointingToEqualData(m_counterDirectives, o.m_counterDirectives)
     239        && arePointingToEqualData(m_boxShadow, o.m_boxShadow)
     240        && arePointingToEqualData(m_willChange, o.m_willChange)
     241        && arePointingToEqualData(m_boxReflect, o.m_boxReflect)
     242        && arePointingToEqualData(m_animations, o.m_animations)
     243        && arePointingToEqualData(m_transitions, o.m_transitions)
    242244        && m_mask == o.m_mask
    243245        && m_maskBoxImage == o.m_maskBoxImage
    244246        && m_pageSize == o.m_pageSize
    245247#if ENABLE(CSS_SHAPES)
    246         && shapeOutsideDataEquivalent(o)
     248        && arePointingToEqualData(m_shapeOutside, o.m_shapeOutside)
    247249        && m_shapeMargin == o.m_shapeMargin
    248250        && m_shapeImageThreshold == o.m_shapeImageThreshold
    249251#endif
    250         && clipPathOperationsEquivalent(o)
     252        && arePointingToEqualData(m_clipPath, o.m_clipPath)
    251253        && m_textDecorationColor == o.m_textDecorationColor
    252254        && m_visitedLinkTextDecorationColor == o.m_visitedLinkTextDecorationColor
     
    306308}
    307309
    308 bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const
    309 {
    310     if (m_counterDirectives.get() == o.m_counterDirectives.get())
    311         return true;
    312        
    313     if (m_counterDirectives && o.m_counterDirectives && *m_counterDirectives == *o.m_counterDirectives)
    314         return true;
    315 
    316     return false;
    317 }
    318 
    319 bool StyleRareNonInheritedData::shadowDataEquivalent(const StyleRareNonInheritedData& o) const
    320 {
    321     if ((!m_boxShadow && o.m_boxShadow) || (m_boxShadow && !o.m_boxShadow))
    322         return false;
    323     if (m_boxShadow && o.m_boxShadow && (*m_boxShadow != *o.m_boxShadow))
    324         return false;
    325     return true;
    326 }
    327 
    328 bool StyleRareNonInheritedData::willChangeDataEquivalent(const StyleRareNonInheritedData& o) const
    329 {
    330     if (m_willChange != o.m_willChange) {
    331         if (!m_willChange || !o.m_willChange)
    332             return false;
    333         return *m_willChange == *o.m_willChange;
    334     }
    335     return true;
    336 }
    337 
    338 bool StyleRareNonInheritedData::reflectionDataEquivalent(const StyleRareNonInheritedData& o) const
    339 {
    340     if (m_boxReflect != o.m_boxReflect) {
    341         if (!m_boxReflect || !o.m_boxReflect)
    342             return false;
    343         return *m_boxReflect == *o.m_boxReflect;
    344     }
    345     return true;
    346 }
    347 
    348 bool StyleRareNonInheritedData::animationDataEquivalent(const StyleRareNonInheritedData& o) const
    349 {
    350     if ((!m_animations && o.m_animations) || (m_animations && !o.m_animations))
    351         return false;
    352     if (m_animations && o.m_animations && (*m_animations != *o.m_animations))
    353         return false;
    354     return true;
    355 }
    356 
    357 bool StyleRareNonInheritedData::transitionDataEquivalent(const StyleRareNonInheritedData& o) const
    358 {
    359     if ((!m_transitions && o.m_transitions) || (m_transitions && !o.m_transitions))
    360         return false;
    361     if (m_transitions && o.m_transitions && (*m_transitions != *o.m_transitions))
    362         return false;
    363     return true;
    364 }
    365 
    366 bool StyleRareNonInheritedData::clipPathOperationsEquivalent(const StyleRareNonInheritedData& o) const
    367 {
    368     if ((!m_clipPath && o.m_clipPath) || (m_clipPath && !o.m_clipPath))
    369         return false;
    370     if (m_clipPath && o.m_clipPath && (*m_clipPath != *o.m_clipPath))
    371         return false;
    372     return true;
    373 }
    374 
    375 #if ENABLE(CSS_SHAPES)
    376 bool StyleRareNonInheritedData::shapeOutsideDataEquivalent(const StyleRareNonInheritedData& o) const
    377 {
    378     if ((!m_shapeOutside && o.m_shapeOutside) || (m_shapeOutside && !o.m_shapeOutside))
    379         return false;
    380     if (m_shapeOutside && o.m_shapeOutside && (*m_shapeOutside != *o.m_shapeOutside))
    381         return false;
    382     return true;
    383 }
    384 #endif
    385 
    386310bool StyleRareNonInheritedData::hasFilters() const
    387311{
  • TabularUnified trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h

    r190879 r191017  
    9393
    9494    bool contentDataEquivalent(const StyleRareNonInheritedData&) const;
    95     bool counterDataEquivalent(const StyleRareNonInheritedData&) const;
    96     bool shadowDataEquivalent(const StyleRareNonInheritedData&) const;
    97     bool willChangeDataEquivalent(const StyleRareNonInheritedData&) const;
    98     bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const;
    99     bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
    100     bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
    101     bool clipPathOperationsEquivalent(const StyleRareNonInheritedData&) const;
    102 #if ENABLE(CSS_SHAPES)
    103     bool shapeOutsideDataEquivalent(const StyleRareNonInheritedData&) const;
    104 #endif
     95
    10596    bool hasFilters() const;
    10697#if ENABLE(FILTERS_LEVEL_2)
Note: See TracChangeset for help on using the changeset viewer.