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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_offset.cc

Issue 2739683006: Use Opportunity Iterator to position text fragments in NGLineBuilder (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/geometry/ng_logical_offset.h" 5 #include "core/layout/ng/geometry/ng_logical_offset.h"
6 6
7 #include "core/layout/ng/geometry/ng_physical_offset.h" 7 #include "core/layout/ng/geometry/ng_physical_offset.h"
8 #include "core/layout/ng/geometry/ng_physical_size.h" 8 #include "core/layout/ng/geometry/ng_physical_size.h"
9 #include "wtf/text/WTFString.h" 9 #include "wtf/text/WTFString.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ASSERT_NOT_REACHED(); 49 ASSERT_NOT_REACHED();
50 return NGPhysicalOffset(); 50 return NGPhysicalOffset();
51 } 51 }
52 } 52 }
53 53
54 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const { 54 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const {
55 return std::tie(other.inline_offset, other.block_offset) == 55 return std::tie(other.inline_offset, other.block_offset) ==
56 std::tie(inline_offset, block_offset); 56 std::tie(inline_offset, block_offset);
57 } 57 }
58 58
59 bool NGLogicalOffset::operator!=(const NGLogicalOffset& other) const {
60 return std::tie(other.inline_offset, other.block_offset) !=
ikilpatrick 2017/03/09 22:00:51 just "return !operator==(other);" ?
Gleb Lanbin 2017/03/09 22:26:44 nice, thanks!
61 std::tie(inline_offset, block_offset);
62 }
63
59 NGLogicalOffset NGLogicalOffset::operator+(const NGLogicalOffset& other) const { 64 NGLogicalOffset NGLogicalOffset::operator+(const NGLogicalOffset& other) const {
60 NGLogicalOffset result; 65 NGLogicalOffset result;
61 result.inline_offset = this->inline_offset + other.inline_offset; 66 result.inline_offset = this->inline_offset + other.inline_offset;
62 result.block_offset = this->block_offset + other.block_offset; 67 result.block_offset = this->block_offset + other.block_offset;
63 return result; 68 return result;
64 } 69 }
65 70
66 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { 71 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) {
67 *this = *this + other; 72 *this = *this + other;
68 return *this; 73 return *this;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 105
101 String NGLogicalOffset::ToString() const { 106 String NGLogicalOffset::ToString() const {
102 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt()); 107 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt());
103 } 108 }
104 109
105 std::ostream& operator<<(std::ostream& os, const NGLogicalOffset& value) { 110 std::ostream& operator<<(std::ostream& os, const NGLogicalOffset& value) {
106 return os << value.ToString(); 111 return os << value.ToString();
107 } 112 }
108 113
109 } // namespace blink 114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698