|
|
Created:
5 years, 5 months ago by hyup Modified:
5 years, 5 months ago Reviewers:
yosin_UTC9 CC:
blink-reviews Base URL:
https://chromium.googlesource.com/chromium/blink.git@master Target Ref:
refs/heads/master Project:
blink Visibility:
Public. |
DescriptionThis CL adds equalSelectionsAlgorithm() which is called in
equalSelections() for both composed tree and DOM tree.
BUG=none
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=199195
Patch Set 1 #
Total comments: 3
Patch Set 2 : Make follow the same pattern for equalSelections() in visibleSelection. #Messages
Total messages: 14 (3 generated)
sh53.lee@samsung.com changed reviewers: + yosin@google.com
PTAL
yosin@chromium.org changed reviewers: + yosin@chromium.org - yosin@google.com
https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... File Source/core/editing/VisibleSelection.cpp (right): https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... Source/core/editing/VisibleSelection.cpp:1154: return a.startInComposedTree() == b.startInComposedTree() && a.endInComposedTree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst() && a.isDirectional() == b.isDirectional(); Could you get rid of duplicate conditions here too?
https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... File Source/core/editing/VisibleSelection.cpp (right): https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... Source/core/editing/VisibleSelection.cpp:1154: return a.startInComposedTree() == b.startInComposedTree() && a.endInComposedTree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst() && a.isDirectional() == b.isDirectional(); On 2015/07/16 07:24:20, Yosi_UTC9 wrote: > Could you get rid of duplicate conditions here too? I removed conditions about affinity and isDirectional in VisibleSelection::InDOMTree::equalSelections because of 1143 line. But I'm not sure in here. Could you explain which conditions should I remove here?
https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... File Source/core/editing/VisibleSelection.cpp (right): https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... Source/core/editing/VisibleSelection.cpp:1154: return a.startInComposedTree() == b.startInComposedTree() && a.endInComposedTree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst() && a.isDirectional() == b.isDirectional(); On 2015/07/16 09:41:02, hyup wrote: > On 2015/07/16 07:24:20, Yosi_UTC9 wrote: > > Could you get rid of duplicate conditions here too? > > I removed conditions about affinity and isDirectional in > VisibleSelection::InDOMTree::equalSelections because of 1143 line. But I'm not > sure in here. Could you explain which conditions should I remove here? Oops, composed tree version isn't matched DOM tree version. This is bad. We should follow the pattern using equalSelectionsAlgorithm. So, equalSelections should be: template <typename Strategy> static bool equalSelectionsAlgorithm(const VisbileSelection& selection1, const VisbileSelection& selection2) { if (selection1.affinity() != selection2.affinity() || selection1.isDirectional() != selection2.isDirectional()) return false; if (selection1.isNone()) return selection2.isNone(); return Strategy::selectionStart(selection1) == Strategy::selectionStart(selection2) && Strategy::selectionEnd(selection1) == Strategy::selectionEnd(selection2) && Strategy::selectionBase(selection1) == Strategy::selectionBase(selection2) && Strategy::selectionExtent(selection1) == Strategy::selectionExtent(selection2); } bool VisbileSelection::InDOMTree::equalSelections(const VisbileSelection& selection1, const VisbileSelection& selection2) { return equalSelectionsAlgorithm<InDOMTree>(selection1, selection2); } bool VisbileSelection::InComposedTree::equalSelections(const VisbileSelection& selection1, const VisbileSelection& selection2) { return equalSelectionsAlgorithm<InComposedTree>(selection1, selection2); }
On 2015/07/17 01:06:07, Yosi_UTC9 wrote: > https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... > File Source/core/editing/VisibleSelection.cpp (right): > > https://codereview.chromium.org/1234513004/diff/1/Source/core/editing/Visible... > Source/core/editing/VisibleSelection.cpp:1154: return a.startInComposedTree() == > b.startInComposedTree() && a.endInComposedTree() == b.endInComposedTree() && > a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst() && > a.isDirectional() == b.isDirectional(); > On 2015/07/16 09:41:02, hyup wrote: > > On 2015/07/16 07:24:20, Yosi_UTC9 wrote: > > > Could you get rid of duplicate conditions here too? > > > > I removed conditions about affinity and isDirectional in > > VisibleSelection::InDOMTree::equalSelections because of 1143 line. But I'm not > > sure in here. Could you explain which conditions should I remove here? > > Oops, composed tree version isn't matched DOM tree version. This is bad. > We should follow the pattern using equalSelectionsAlgorithm. > So, equalSelections should be: > > template <typename Strategy> > static bool equalSelectionsAlgorithm(const VisbileSelection& selection1, const > VisbileSelection& selection2) > { > if (selection1.affinity() != selection2.affinity() || > selection1.isDirectional() != selection2.isDirectional()) > return false; > if (selection1.isNone()) > return selection2.isNone(); > return Strategy::selectionStart(selection1) == > Strategy::selectionStart(selection2) && Strategy::selectionEnd(selection1) == > Strategy::selectionEnd(selection2) && Strategy::selectionBase(selection1) == > Strategy::selectionBase(selection2) && Strategy::selectionExtent(selection1) == > Strategy::selectionExtent(selection2); > } > > bool VisbileSelection::InDOMTree::equalSelections(const VisbileSelection& > selection1, const VisbileSelection& selection2) > { > return equalSelectionsAlgorithm<InDOMTree>(selection1, selection2); > } > > bool VisbileSelection::InComposedTree::equalSelections(const VisbileSelection& > selection1, const VisbileSelection& selection2) > { > return equalSelectionsAlgorithm<InComposedTree>(selection1, selection2); > } Thank you for your review. I uploaded patch. PTAL
lgtm Thanks!
The CQ bit was checked by yosin@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1234513004/20001
The author sh53.lee@samsung.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
The author sh53.lee@samsung.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
The author sh53.lee@samsung.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as https://src.chromium.org/viewvc/blink?view=rev&revision=199195 |