Skip to content

Commit

Permalink
Fixes for C++20 support.
Browse files Browse the repository at this point in the history
* u8"" no longer produces const char*.  Switch to "", which also accepts
  UTF-8 literals.
* Structs with user-declared constructors are no longer aggregates.
  Either remove the declarations or add all-member constructors.
* Types on both sides of comparison operators should match.  In
  particular, this poses problems for polymorphic operator==(), which is
  changed to use the NVI pattern instead.

Bug: 1284275
Change-Id: I04d183175eaf800bb58cc0a358a7f63889dac7c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3630694
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1002715}
  • Loading branch information
pkasting authored and Chromium LUCI CQ committed May 12, 2022
1 parent 27a8c8d commit d7492c2
Show file tree
Hide file tree
Showing 45 changed files with 417 additions and 423 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class FontTableMatcherTest : public ::testing::Test {
kDummyAndroidBuildFingerPrint);
PopulateFontUniqueNameEntry(
&font_unique_name_table, kTestFilePath1, 0,
{u8"FONT NAME UPPERCASE", u8"எழுத்துரு பெயர்", u8"字體名稱",
u8"FONT-NAME-UPPERCASE", u8"எழுத்துரு-பெயர்", u8"字體名稱"});
{"FONT NAME UPPERCASE", "எழுத்துரு பெயர்", "字體名稱",
"FONT-NAME-UPPERCASE", "எழுத்துரு-பெயர்", "字體名稱"});
base::ReadOnlySharedMemoryMapping mapping =
FontTableMatcher::MemoryMappingFromFontUniqueNameTable(
std::move(font_unique_name_table));
Expand All @@ -72,8 +72,7 @@ TEST_F(FontTableMatcherTest, CaseInsensitiveMatchingBothNames) {

TEST_F(FontTableMatcherTest, MatchTamilChinese) {
ASSERT_EQ(matcher_->AvailableFonts(), 1u);
for (std::string font_name :
{u8"எழுத்துரு பெயர்", u8"எழுத்துரு-பெயர்", u8"字體名稱"}) {
for (std::string font_name : {"எழுத்துரு பெயர்", "எழுத்துரு-பெயர்", "字體名稱"}) {
absl::optional<FontTableMatcher::MatchResult> result =
matcher_->MatchName(font_name);
ASSERT_TRUE(result.has_value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ namespace blink {
// This structure contains extracted mobile friendliness metrics from the page.
// Used for UKM logging.
struct BLINK_COMMON_EXPORT MobileFriendliness {
MobileFriendliness() = default;
MobileFriendliness(const MobileFriendliness&) = default;
MobileFriendliness& operator=(const MobileFriendliness&) = default;

bool operator==(const MobileFriendliness& other) const;
bool operator!=(const MobileFriendliness& other) const {
return !(*this == other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "third_party/blink/renderer/platform/graphics/document_transition_shared_element_id.h"
#include "third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
#include "third_party/blink/renderer/platform/heap/heap_traits.h"
#include "third_party/blink/renderer/platform/transforms/transformation_matrix.h"

namespace blink {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ TEST_F(DeleteSelectionCommandTest, FixupWhitespace) {
.SetSanitizeMarkup(true)
.Build());
EXPECT_TRUE(command.Apply()) << "the delete command should have succeeded";
EXPECT_EQ(u8"<p contenteditable>a<b>\u00A0|</b>\u00A0<ruby></ruby></p>",
EXPECT_EQ("<p contenteditable>a<b>\u00A0|</b>\u00A0<ruby></ruby></p>",
GetSelectionTextFromBody());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST_F(ReplaceSelectionCommandTest, SmartPlainTextPaste) {

EXPECT_TRUE(command.Apply());
// Smart paste inserts a space before pasted text.
EXPECT_EQ(u8"<div contenteditable>abc<div>def XYZ|</div></div>",
EXPECT_EQ("<div contenteditable>abc<div>def XYZ|</div></div>",
GetSelectionTextFromBody());
}

Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/editing/finder/find_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class CORE_EXPORT FindBuffer {
TextSearcherICU* text_searcher,
const String& search_text);

bool operator==(const Iterator& other) {
bool operator==(const Iterator& other) const {
return has_match_ == other.has_match_;
}

bool operator!=(const Iterator& other) {
bool operator!=(const Iterator& other) const {
return has_match_ != other.has_match_;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3480,57 +3480,57 @@ TEST_F(InputMethodControllerTest, VirtualKeyboardPolicyOfFocusedElement) {

TEST_F(InputMethodControllerTest, SetCompositionInTibetan) {
GetFrame().Selection().SetSelectionAndEndTyping(
SetSelectionTextToBody(u8"<div id='sample' contenteditable>|</div>"));
SetSelectionTextToBody("<div id='sample' contenteditable>|</div>"));
Element* const div = GetDocument().getElementById("sample");
div->Focus();

Vector<ImeTextSpan> ime_text_spans;
Controller().SetComposition(String(Vector<UChar>{0xF56}), ime_text_spans, 1,
1);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0F56|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0F56|</div>",
GetSelectionTextFromBody());

Controller().CommitText(String(Vector<UChar>{0xF56}), ime_text_spans, 0);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0F56|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0F56|</div>",
GetSelectionTextFromBody());

Controller().SetComposition(String(Vector<UChar>{0xFB7}), ime_text_spans, 1,
1);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0F56\u0FB7|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0F56\u0FB7|</div>",
GetSelectionTextFromBody());

// Attempt to replace part of grapheme cluster "\u0FB7" in composition
Controller().CommitText(String(Vector<UChar>{0xFB7}), ime_text_spans, 0);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0F56\u0FB7|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0F56\u0FB7|</div>",
GetSelectionTextFromBody());

Controller().SetComposition(String(Vector<UChar>{0xF74}), ime_text_spans, 1,
1);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0F56\u0FB7\u0F74|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0F56\u0FB7\u0F74|</div>",
GetSelectionTextFromBody());
}

TEST_F(InputMethodControllerTest, SetCompositionInDevanagari) {
GetFrame().Selection().SetSelectionAndEndTyping(SetSelectionTextToBody(
u8"<div id='sample' contenteditable>\u0958|</div>"));
GetFrame().Selection().SetSelectionAndEndTyping(
SetSelectionTextToBody("<div id='sample' contenteditable>\u0958|</div>"));
Element* const div = GetDocument().getElementById("sample");
div->Focus();

Vector<ImeTextSpan> ime_text_spans;
Controller().SetComposition(String(Vector<UChar>{0x94D}), ime_text_spans, 1,
1);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0958\u094D|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0958\u094D|</div>",
GetSelectionTextFromBody());

Controller().CommitText(String(Vector<UChar>{0x94D, 0x930}), ime_text_spans,
0);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u0958\u094D\u0930|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u0958\u094D\u0930|</div>",
GetSelectionTextFromBody());
}

TEST_F(InputMethodControllerTest, SetCompositionTamil) {
GetFrame().Selection().SetSelectionAndEndTyping(
SetSelectionTextToBody(u8"<div id='sample' contenteditable>|</div>"));
SetSelectionTextToBody("<div id='sample' contenteditable>|</div>"));
Element* const div = GetDocument().getElementById("sample");
div->Focus();

Expand All @@ -3543,7 +3543,7 @@ TEST_F(InputMethodControllerTest, SetCompositionTamil) {
// Add character U+0BC7: 'TAMIL VOWEL SIGN EE'
Controller().CommitText(String(Vector<UChar>{0xBB5, 0xBC7}), ime_text_spans,
1);
EXPECT_EQ(u8"<div contenteditable id=\"sample\">\u00A0\u0BB5\u0BC7|</div>",
EXPECT_EQ("<div contenteditable id=\"sample\">\u00A0\u0BB5\u0BC7|</div>",
GetSelectionTextFromBody());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TEST(TextSearcherICUTest, FindSubstringWithOffset) {

TEST(TextSearcherICUTest, FindControlCharacter) {
TextSearcherICU searcher;
const String& pattern = MakeUTF16(u8"\u0080");
const String& pattern = MakeUTF16("\u0080");
searcher.SetPattern(pattern, 0);

const String& text = MakeUTF16("some text");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> {
: remaining_types_(marker_types) {}
MarkerTypesIterator(const MarkerTypesIterator& other) = default;

bool operator==(const MarkerTypesIterator& other) {
bool operator==(const MarkerTypesIterator& other) const {
return remaining_types_ == other.remaining_types_;
}
bool operator!=(const MarkerTypesIterator& other) {
bool operator!=(const MarkerTypesIterator& other) const {
return !operator==(other);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ TEST_P(ParameterizedVisibleUnitsLineTest, InSameLineWithZeroWidthSpace) {
"p { font: 10px/1 Ahem; }"
"p { width: 4ch; }");
const SelectionInDOMTree& selection =
SetSelectionTextToBody(u8"<p id=t>abcd^\u200B|wxyz</p>");
SetSelectionTextToBody("<p id=t>abcd^\u200B|wxyz</p>");

const Position& after_zws = selection.Extent();
const PositionWithAffinity after_zws_down =
Expand Down
53 changes: 26 additions & 27 deletions third_party/blink/renderer/core/editing/visible_units_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -842,47 +842,46 @@ TEST_F(VisibleUnitsTest, MostBackwardOrForwardCaretPositionWithBrInOptgroup) {
TEST_F(VisibleUnitsTest, SnapBackwardWithZeroWidthSpace) {
// Note: We should skip <wbr> otherwise caret stops before/after <wbr>.

EXPECT_EQ(u8"<p>ab|<wbr></p>", TestSnapBackward(u8"<p>ab<wbr>|</p>"));
EXPECT_EQ(u8"<p>ab\u200B|</p>", TestSnapBackward(u8"<p>ab\u200B|</p>"));
EXPECT_EQ(u8"<p>ab<!-- -->\u200B|</p>",
TestSnapBackward(u8"<p>ab<!-- -->\u200B|</p>"));
EXPECT_EQ("<p>ab|<wbr></p>", TestSnapBackward("<p>ab<wbr>|</p>"));
EXPECT_EQ("<p>ab\u200B|</p>", TestSnapBackward("<p>ab\u200B|</p>"));
EXPECT_EQ("<p>ab<!-- -->\u200B|</p>",
TestSnapBackward("<p>ab<!-- -->\u200B|</p>"));

EXPECT_EQ(u8"<p>ab|<wbr><wbr></p>",
TestSnapBackward(u8"<p>ab<wbr><wbr>|</p>"));
EXPECT_EQ(u8"<p>ab\u200B\u200B|</p>",
TestSnapBackward(u8"<p>ab\u200B\u200B|</p>"));
EXPECT_EQ("<p>ab|<wbr><wbr></p>", TestSnapBackward("<p>ab<wbr><wbr>|</p>"));
EXPECT_EQ("<p>ab\u200B\u200B|</p>",
TestSnapBackward("<p>ab\u200B\u200B|</p>"));

EXPECT_EQ(u8"<p>ab|<wbr>cd</p>", TestSnapBackward(u8"<p>ab<wbr>|cd</p>"));
EXPECT_EQ(u8"<p>ab\u200B|cd</p>", TestSnapBackward(u8"<p>ab\u200B|cd</p>"));
EXPECT_EQ("<p>ab|<wbr>cd</p>", TestSnapBackward("<p>ab<wbr>|cd</p>"));
EXPECT_EQ("<p>ab\u200B|cd</p>", TestSnapBackward("<p>ab\u200B|cd</p>"));

EXPECT_EQ(u8"<p>ab|<wbr><wbr>cd</p>",
TestSnapBackward(u8"<p>ab<wbr><wbr>|cd</p>"));
EXPECT_EQ(u8"<p>ab\u200B\u200B|cd</p>",
TestSnapBackward(u8"<p>ab\u200B\u200B|cd</p>"));
EXPECT_EQ("<p>ab|<wbr><wbr>cd</p>",
TestSnapBackward("<p>ab<wbr><wbr>|cd</p>"));
EXPECT_EQ("<p>ab\u200B\u200B|cd</p>",
TestSnapBackward("<p>ab\u200B\u200B|cd</p>"));
}

// http://crbug.com/1134470
TEST_F(VisibleUnitsTest, SnapForwardWithZeroWidthSpace) {
// Note: We should skip <wbr> otherwise caret stops before/after <wbr>.

EXPECT_EQ(u8"<p>ab<wbr></p>", TestSnapForward(u8"<p>ab|<wbr></p>"))
EXPECT_EQ("<p>ab<wbr></p>", TestSnapForward("<p>ab|<wbr></p>"))
<< "We get <wbr>@0";
EXPECT_EQ(u8"<p>ab|\u200B</p>", TestSnapForward(u8"<p>ab|\u200B</p>"));
EXPECT_EQ(u8"<p>ab<!-- -->|\u200B</p>",
TestSnapForward(u8"<p>ab<!-- -->|\u200B</p>"));
EXPECT_EQ("<p>ab|\u200B</p>", TestSnapForward("<p>ab|\u200B</p>"));
EXPECT_EQ("<p>ab<!-- -->|\u200B</p>",
TestSnapForward("<p>ab<!-- -->|\u200B</p>"));

EXPECT_EQ(u8"<p>ab<wbr><wbr></p>", TestSnapForward(u8"<p>ab|<wbr><wbr></p>"))
EXPECT_EQ("<p>ab<wbr><wbr></p>", TestSnapForward("<p>ab|<wbr><wbr></p>"))
<< "We get <wbr>@0";
EXPECT_EQ(u8"<p>ab|\u200B\u200B</p>",
TestSnapForward(u8"<p>ab|\u200B\u200B</p>"));
EXPECT_EQ("<p>ab|\u200B\u200B</p>",
TestSnapForward("<p>ab|\u200B\u200B</p>"));

EXPECT_EQ(u8"<p>ab<wbr>|cd</p>", TestSnapForward(u8"<p>ab|<wbr>cd</p>"));
EXPECT_EQ(u8"<p>ab|\u200Bcd</p>", TestSnapForward(u8"<p>ab|\u200Bcd</p>"));
EXPECT_EQ("<p>ab<wbr>|cd</p>", TestSnapForward("<p>ab|<wbr>cd</p>"));
EXPECT_EQ("<p>ab|\u200Bcd</p>", TestSnapForward("<p>ab|\u200Bcd</p>"));

EXPECT_EQ(u8"<p>ab<wbr><wbr>|cd</p>",
TestSnapForward(u8"<p>ab|<wbr><wbr>cd</p>"));
EXPECT_EQ(u8"<p>ab|\u200B\u200Bcd</p>",
TestSnapForward(u8"<p>ab|\u200B\u200Bcd</p>"));
EXPECT_EQ("<p>ab<wbr><wbr>|cd</p>",
TestSnapForward("<p>ab|<wbr><wbr>cd</p>"));
EXPECT_EQ("<p>ab|\u200B\u200Bcd</p>",
TestSnapForward("<p>ab|\u200B\u200Bcd</p>"));
}

} // namespace visible_units_test
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/renderer/core/frame/reporting_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace blink {

class ExecutionContext;
class Report;
class V8ReportingObserverCallback;

class CORE_EXPORT ReportingObserver final
: public ScriptWrappable,
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/inspector/inspected_frames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ InspectedFrames::Iterator InspectedFrames::Iterator::operator++(int) {
return Iterator(root_, old);
}

bool InspectedFrames::Iterator::operator==(const Iterator& other) {
bool InspectedFrames::Iterator::operator==(const Iterator& other) const {
return current_ == other.current_ && root_ == other.root_;
}

bool InspectedFrames::Iterator::operator!=(const Iterator& other) {
bool InspectedFrames::Iterator::operator!=(const Iterator& other) const {
return !(*this == other);
}

Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/inspector/inspected_frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class CORE_EXPORT InspectedFrames final
public:
Iterator operator++(int);
Iterator& operator++();
bool operator==(const Iterator& other);
bool operator!=(const Iterator& other);
bool operator==(const Iterator& other) const;
bool operator!=(const Iterator& other) const;
LocalFrame* operator*() { return current_; }
LocalFrame* operator->() { return current_; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ TEST_F(LayoutNGTextTest, SetTextWithOffsetAppendBidi) {
text.appendData(u"\u05D0\u05D1\u05BC\u05D2");

EXPECT_EQ(
u8"*{'\u05D0\u05D1\u05BC\u05D2\u05D0\u05D1\u05BC\u05D2', "
u8"ShapeResult=0+8 #glyphs=6}\n",
"*{'\u05D0\u05D1\u05BC\u05D2\u05D0\u05D1\u05BC\u05D2', "
"ShapeResult=0+8 #glyphs=6}\n",
GetItemsAsString(*text.GetLayoutObject(), 6));
}

Expand Down Expand Up @@ -127,17 +127,17 @@ TEST_F(LayoutNGTextTest, SetTextWithOffsetAppendEmojiWithZWJ) {
Text& text = To<Text>(*GetElementById("target")->firstChild());
UpdateAllLifecyclePhasesForTest();
text.appendData(u"\u200D");
EXPECT_EQ(u8"*{'\U0001F937\u200D', ShapeResult=0+3 #glyphs=2}\n",
EXPECT_EQ("*{'\U0001F937\u200D', ShapeResult=0+3 #glyphs=2}\n",
GetItemsAsString(*text.GetLayoutObject(), 2));

UpdateAllLifecyclePhasesForTest();
text.appendData(u"\u2640");
EXPECT_EQ(u8"*{'\U0001F937\u200D\u2640', ShapeResult=0+4 #glyphs=1}\n",
EXPECT_EQ("*{'\U0001F937\u200D\u2640', ShapeResult=0+4 #glyphs=1}\n",
GetItemsAsString(*text.GetLayoutObject(), 1));

UpdateAllLifecyclePhasesForTest();
text.appendData(u"\uFE0F");
EXPECT_EQ(u8"*{'\U0001F937\u200D\u2640\uFE0F', ShapeResult=0+5 #glyphs=1}\n",
EXPECT_EQ("*{'\U0001F937\u200D\u2640\uFE0F', ShapeResult=0+5 #glyphs=1}\n",
GetItemsAsString(*text.GetLayoutObject(), 1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ TEST_F(NGInlineNodeTest, CollectInlinesFloat) {
"</div>");
NGInlineNodeForTest node = CreateInlineNode();
node.CollectInlines();
EXPECT_EQ(u8"abc\uFFFCghi\uFFFCmno", node.Text())
EXPECT_EQ("abc\uFFFCghi\uFFFCmno", node.Text())
<< "floats are appeared as an object replacement character";
HeapVector<NGInlineItem>& items = node.Items();
ASSERT_EQ(5u, items.size());
Expand All @@ -235,7 +235,7 @@ TEST_F(NGInlineNodeTest, CollectInlinesInlineBlock) {
"</div>");
NGInlineNodeForTest node = CreateInlineNode();
node.CollectInlines();
EXPECT_EQ(u8"abc\uFFFCjkl", node.Text())
EXPECT_EQ("abc\uFFFCjkl", node.Text())
<< "inline-block is appeared as an object replacement character";
HeapVector<NGInlineItem>& items = node.Items();
ASSERT_EQ(3u, items.size());
Expand Down Expand Up @@ -345,7 +345,7 @@ TEST_F(NGInlineNodeTest, CollectInlinesTextCombineListItemMarker) {
NGInlineNodeForTest node = CreateInlineNode(
To<LayoutNGTextCombine>(layout_object_->SlowFirstChild()));
node.CollectInlines();
EXPECT_EQ(u8"\u2022", node.Text());
EXPECT_EQ("\u2022", node.Text());
HeapVector<NGInlineItem>& items = node.Items();
ASSERT_EQ(1u, items.size());
TEST_ITEM_TYPE_OFFSET(items[0], kText, 0u, 1u);
Expand Down Expand Up @@ -376,7 +376,7 @@ TEST_F(NGInlineNodeTest, CollectInlinesTextCombineWBR) {
NGInlineNodeForTest node =
CreateInlineNode(To<LayoutNGBlockFlow>(layout_object_.Get()));
node.CollectInlines();
EXPECT_EQ(u8"a\u200Bz", node.Text());
EXPECT_EQ("a\u200Bz", node.Text());
HeapVector<NGInlineItem>& items = node.Items();
ASSERT_EQ(3u, items.size());
TEST_ITEM_TYPE_OFFSET(items[0], kText, 0u, 1u);
Expand Down
16 changes: 4 additions & 12 deletions third_party/blink/renderer/core/style/basic_shapes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@

namespace blink {

bool BasicShapeCircle::operator==(const BasicShape& o) const {
if (!IsSameType(o))
return false;
bool BasicShapeCircle::IsEqualAssumingSameType(const BasicShape& o) const {
const BasicShapeCircle& other = To<BasicShapeCircle>(o);
return center_x_ == other.center_x_ && center_y_ == other.center_y_ &&
radius_ == other.radius_;
Expand Down Expand Up @@ -75,9 +73,7 @@ void BasicShapeCircle::GetPath(Path& path,
path.AddEllipse(center + bounding_box.OffsetFromOrigin(), radius, radius);
}

bool BasicShapeEllipse::operator==(const BasicShape& o) const {
if (!IsSameType(o))
return false;
bool BasicShapeEllipse::IsEqualAssumingSameType(const BasicShape& o) const {
const BasicShapeEllipse& other = To<BasicShapeEllipse>(o);
return center_x_ == other.center_x_ && center_y_ == other.center_y_ &&
radius_x_ == other.radius_x_ && radius_y_ == other.radius_y_;
Expand Down Expand Up @@ -136,9 +132,7 @@ void BasicShapePolygon::GetPath(Path& path,
path.CloseSubpath();
}

bool BasicShapePolygon::operator==(const BasicShape& o) const {
if (!IsSameType(o))
return false;
bool BasicShapePolygon::IsEqualAssumingSameType(const BasicShape& o) const {
const BasicShapePolygon& other = To<BasicShapePolygon>(o);
return wind_rule_ == other.wind_rule_ && values_ == other.values_;
}
Expand Down Expand Up @@ -169,9 +163,7 @@ void BasicShapeInset::GetPath(Path& path,
path.AddRoundedRect(final_rect);
}

bool BasicShapeInset::operator==(const BasicShape& o) const {
if (!IsSameType(o))
return false;
bool BasicShapeInset::IsEqualAssumingSameType(const BasicShape& o) const {
const BasicShapeInset& other = To<BasicShapeInset>(o);
return right_ == other.right_ && top_ == other.top_ &&
bottom_ == other.bottom_ && left_ == other.left_ &&
Expand Down

0 comments on commit d7492c2

Please sign in to comment.