https://bugs.webkit.org/show_bug.cgi?id=65944
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Aug 2011 19:22:57 +0000 (19:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Aug 2011 19:22:57 +0000 (19:22 +0000)
Replace QuotesData::operator==() with QuotesData::equal(const QuotesData*
, const QuotesData*) because QuotesData::operator==() were using non-standard
C++ code that is not supported by all compilers.

Patch by Yong Li <yoli@rim.com> on 2011-08-11
Reviewed by Alexey Proskuryakov.

No new tests because some existing test cases can show the issue,
for example, fast/css/content/content-quotes-01.html.

* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::styleDidChange):
* rendering/style/QuotesData.cpp:
(WebCore::QuotesData::equal):
* rendering/style/QuotesData.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setQuotes):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::operator==):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@92871 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderQuote.cpp
Source/WebCore/rendering/style/QuotesData.cpp
Source/WebCore/rendering/style/QuotesData.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.cpp

index 22bbf29..9422668 100644 (file)
@@ -1,3 +1,25 @@
+2011-08-11  Yong Li  <yoli@rim.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=65944
+        Replace QuotesData::operator==() with QuotesData::equal(const QuotesData*
+        , const QuotesData*) because QuotesData::operator==() were using non-standard
+        C++ code that is not supported by all compilers.
+
+        Reviewed by Alexey Proskuryakov.
+
+        No new tests because some existing test cases can show the issue,
+        for example, fast/css/content/content-quotes-01.html.
+
+        * rendering/RenderQuote.cpp:
+        (WebCore::RenderQuote::styleDidChange):
+        * rendering/style/QuotesData.cpp:
+        (WebCore::QuotesData::equal):
+        * rendering/style/QuotesData.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::setQuotes):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::operator==):
+
 2011-08-11  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=66075
index 4523df8..45e5991 100644 (file)
@@ -323,7 +323,7 @@ void RenderQuote::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
 {
     const QuotesData* newQuotes = style()->quotes();
     const QuotesData* oldQuotes = oldStyle ? oldStyle->quotes() : 0;
-    if (!((newQuotes && oldQuotes && (*newQuotes == *oldQuotes)) || (!newQuotes && !oldQuotes)))
+    if (!QuotesData::equal(newQuotes, oldQuotes))
         setNeedsLayoutAndPrefWidthsRecalc();
     RenderText::styleDidChange(diff, oldStyle);
 }
index 829fe3f..03a2554 100644 (file)
@@ -34,18 +34,18 @@ QuotesData* QuotesData::create(int stringCount)
     return reinterpret_cast<QuotesData*>(tmp);
 }
 
-bool QuotesData::operator==(const QuotesData& other) const
+bool QuotesData::equal(const QuotesData* quotesData1, const QuotesData* quotesData2)
 {
-    if (this == &other)
+    if (quotesData1 == quotesData2)
         return true;
-    if (!&other || !this)
+    if (!quotesData1 || !quotesData2)
         return false;
-    if (length != other.length)
+    if (quotesData1->length != quotesData2->length)
         return false;
-    const String* myData = data();
-    const String* otherData = other.data();
-    for (int i = length-1; i >= 0; --i)
-        if (myData[i] != otherData[i])
+    const String* data1 = quotesData1->data();
+    const String* data2 = quotesData2->data();
+    for (int i = quotesData1->length - 1; i >= 0; --i)
+        if (data1[i] != data2[i])
             return false;
     return true;
 }
index df8a6dd..574470c 100644 (file)
@@ -33,8 +33,8 @@ public:
     String* data() { return reinterpret_cast<String*>(this+1); }
     const String* data() const { return reinterpret_cast<const String*>(this+1); }
     int length;
-    bool operator==(const QuotesData&) const;
     void operator delete(void* p) { delete[] static_cast<char*>(p); }
+    static bool equal(const QuotesData*, const QuotesData*);
 private:
     QuotesData(int stringCount) : length(stringCount) {}
 };
index 1b4ccd8..dc6c356 100644 (file)
@@ -627,7 +627,7 @@ void RenderStyle::setCursorList(PassRefPtr<CursorList> other)
 
 void RenderStyle::setQuotes(PassRefPtr<QuotesData> q)
 {
-    if (*rareInheritedData->quotes.get() == *q.get())
+    if (QuotesData::equal(rareInheritedData->quotes.get(), q.get()))
         return;
     rareInheritedData.access()->quotes = q;
 }
index 11606b1..fa09a86 100644 (file)
@@ -143,7 +143,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && hyphenationString == o.hyphenationString
         && locale == o.locale
         && textEmphasisCustomMark == o.textEmphasisCustomMark
-        && *quotes == *o.quotes
+        && QuotesData::equal(quotes.get(), o.quotes.get())
         && m_imageRendering == o.m_imageRendering;
 }