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

Issue 3142008: Model, View and Controller for a Gap Buffer based one line text field in view... (Closed)

Created:
10 years, 4 months ago by varunjain
Modified:
9 years, 7 months ago
CC:
chromium-reviews, ben+cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Model, View and Controller for a Gap Buffer based one line text field in views. BUG=none TEST=unittests added for new textfield

Patch Set 1 #

Total comments: 10

Patch Set 2 : '' #

Total comments: 19

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 52

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : seperated gap buffer into another CL #

Patch Set 8 : added files that were missed in the last patch #

Total comments: 37
Unified diffs Side-by-side diffs Delta from patch set Stats (+850 lines, -0 lines) Patch
M chrome/chrome_tests.gypi View 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A views/controls/textfield/textfield_model.h View 2 3 4 5 6 1 chunk +78 lines, -0 lines 10 comments Download
A views/controls/textfield/textfield_model.cc View 2 3 4 5 6 1 chunk +84 lines, -0 lines 6 comments Download
A views/controls/textfield/textfield_view.h View 2 3 4 5 6 1 chunk +88 lines, -0 lines 10 comments Download
A views/controls/textfield/textfield_view.cc View 2 3 4 5 6 1 chunk +492 lines, -0 lines 9 comments Download
A views/controls/textfield/textfield_view_unittest.cc View 2 3 4 5 6 1 chunk +103 lines, -0 lines 1 comment Download
M views/views.gyp View 2 3 4 5 6 1 chunk +4 lines, -0 lines 1 comment Download

Messages

Total messages: 12 (0 generated)
rjkroege
I need some explanation I think. http://codereview.chromium.org/3142008/diff/1/2 File base/gap_buffer.h (right): http://codereview.chromium.org/3142008/diff/1/2#newcode19 base/gap_buffer.h:19: template<class T> why ...
10 years, 4 months ago (2010-08-12 16:36:49 UTC) #1
varunjain
Hi Rob, updated the changelist. Please have a look again. -V. On 2010/08/12 16:36:49, rjkroege ...
10 years, 3 months ago (2010-08-30 08:27:32 UTC) #2
rjkroege
I'd make some minor fixes and try to get this upstreamed. You'll want sky to ...
10 years, 3 months ago (2010-08-30 17:26:24 UTC) #3
varunjain
Added sky as reviewer Also addressed all of Rob's comments http://codereview.chromium.org/3142008/diff/8001/9003 File base/gap_buffer.h (right): http://codereview.chromium.org/3142008/diff/8001/9003#newcode9 ...
10 years, 3 months ago (2010-08-31 22:37:30 UTC) #4
sky
I focused on just the GapBuffer. It would be better if you separate that out ...
10 years, 3 months ago (2010-08-31 23:19:47 UTC) #5
sky
I have a meta question about this patch. Should we look at making it easy ...
10 years, 3 months ago (2010-08-31 23:22:54 UTC) #6
Ben Goodger (Google)
Similarly, I'd like to see a proof of concept wrapping a WebKit text control... since ...
10 years, 3 months ago (2010-08-31 23:26:51 UTC) #7
rjkroege
On 2010/08/31 23:26:51, Ben Goodger wrote: > Similarly, I'd like to see a proof of ...
10 years, 3 months ago (2010-09-01 14:12:00 UTC) #8
varunjain
Hi Scott and others, As suggested by Scott, I have moved the gap buffer into ...
10 years, 1 month ago (2010-11-18 03:45:57 UTC) #9
tfarina
http://codereview.chromium.org/3142008/diff/64001/views/controls/textfield/textfield_model.cc File views/controls/textfield/textfield_model.cc (right): http://codereview.chromium.org/3142008/diff/64001/views/controls/textfield/textfield_model.cc#newcode12 views/controls/textfield/textfield_model.cc:12: this->buffer_.reset(new base::GapBuffer<wchar_t>(50)); Please, remove all the usages of |this->| ...
10 years, 1 month ago (2010-11-18 11:55:31 UTC) #10
Ben Goodger (Google)
http://codereview.chromium.org/3142008/diff/64001/views/controls/textfield/textfield_model.h File views/controls/textfield/textfield_model.h (right): http://codereview.chromium.org/3142008/diff/64001/views/controls/textfield/textfield_model.h#newcode72 views/controls/textfield/textfield_model.h:72: class TextfieldController { TextfieldDelegate doesn't make sense... it's not ...
10 years, 1 month ago (2010-11-18 15:52:45 UTC) #11
sky
10 years, 1 month ago (2010-11-18 18:27:39 UTC) #12
On Wed, Nov 17, 2010 at 7:45 PM,  <varunjain@chromium.org> wrote:
> Hi Scott and others,
> As suggested by Scott, I have moved the gap buffer into a separate CL:
> http://codereview.chromium.org/5158004

I'll review this patch after 5158004 is done.

  -Scott

>
> Also addressed all of Scott's comments. Please have a look at the other CL
> and
> also this one for the views textfield.
>
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h
> File base/gap_buffer.h (right):
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode5
> base/gap_buffer.h:5: // This class implements a standard GapBuffer
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Put the comment above the class name.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode14
> base/gap_buffer.h:14: #include <string>
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Do you need this include?
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode16
> base/gap_buffer.h:16: #include "base/basictypes.h"
> On 2010/08/31 23:19:47, sky wrote:
>>
>> newline between 15 and 16.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode22
> base/gap_buffer.h:22: template<class T>
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Is it really worth parameterizing the type? At some point we want to
>
> move views
>>
>> off of wstring, and at that point we would presumably convert this
>
> too.
>
> my intention was exactly to avoid changes to this class when changing
> string implementations. This is fairly small class and should not bloat
> too much due to parameterization.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode25
> base/gap_buffer.h:25:
> On 2010/08/31 23:19:47, sky wrote:
>>
>> no newline here.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode35
> base/gap_buffer.h:35: if (buffer_.get()) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> We don't do checks like this. OOM triggers a crash.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode49
> base/gap_buffer.h:49: if (buffer_.get()) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Same comment as on line 35.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode61
> base/gap_buffer.h:61: void MoveGapLeft(int count) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Do we really need all these MoveGapFoo methods? Can't we just have
>
> MoveGapTo ?
>
> Since gap buffers are really only used in text editing, I meant to
> provide the api to reflect the actions one might do in a text editor.
>
>> Also, shouldn't these DCHECK if attempted to move to an invalid
>
> location?
>
> As in a text editor if you try to move the cursor (gap) out of bounds,
> say to a position after the end of text then we simply move it to the
> end of text.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode62
> base/gap_buffer.h:62: if (buffer_.get() && gap_start_ > 0) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Don't check buffer_.get() at all in this class.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode116
> base/gap_buffer.h:116: buffer_.get()[gap_start_] = object;
> On 2010/08/31 23:19:47, sky wrote:
>>
>> buffer_[gap_start]
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode157
> base/gap_buffer.h:157: (*contents).clear();
> On 2010/08/31 23:19:47, sky wrote:
>>
>> contents->
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode176
> base/gap_buffer.h:176: int GetBufferSize() {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Is there a case where someone cares about GetBufferSize()? Seems like
>
> an
>>
>> implementation detail, and if you keep public it's easy to mistake it
>
> for
>>
>> GetCurrentSize.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode196
> base/gap_buffer.h:196: for (i = 0; i < gap_start_; i++) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> How come you don't memmove these two blocks?
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode230
> base/gap_buffer.h:230: const int kMinResizeAmount;
> On 2010/08/31 23:19:47, sky wrote:
>>
>> This should be static.
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer.h#newcode231
> base/gap_buffer.h:231: };
> On 2010/08/31 23:19:47, sky wrote:
>>
>> DISALLOW_COPY_AND_ASSIGN
>
> Done.
>
> http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc
> File base/gap_buffer_unittest.cc (right):
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:6: #include "base/gap_buffer.h"
> On 2010/08/31 23:19:47, sky wrote:
>>
>> newline between 5 and 6.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:13: GapBufferTester(int a = 1, char b = 'a')
> On 2010/08/31 23:19:47, sky wrote:
>>
>> no default params.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:14: : a_(a), b_(b) { }
> On 2010/08/31 23:19:47, sky wrote:
>>
>> each member on its own line.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:15: bool operator!=(const GapBufferTester&
> that) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Style guides says you should use explicit methods for this.
>
> these operators are no longer required. However, I have added == because
> it is required by the matcher. Added commetn to explain this.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:30: bool CompareVectorWithArray(const T*
> array, int size, std::vector<T> vect) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> const std::vector<T>&
>> But I believe you can use EXPECT_THAT(.., ElementsAre()) here, but I
>
> haven't
>>
>> tried it. If that doesn't work, you should make sure your failing is
>
> more
>>
>> descriptive.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:31: if ((size_t) size == vect.size()) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> Use C++ style casts.
>
> removed
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:45: void Expectations(int current_size, int
> buffer_size, int contents_size,
> On 2010/08/31 23:19:47, sky wrote:
>>
>> each param on its own line.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:46: int gap_start, const T* contents_array,
> GapBuffer<T>& gap_buffer) {
> On 2010/08/31 23:19:47, sky wrote:
>>
>> const GapBuffer&. If it can't be const&, then it should be a pointer.
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:48: gap_buffer.GetContents(&(contents));
> On 2010/08/31 23:19:47, sky wrote:
>>
>> No parens around contents, just &contents
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:52: EXPECT_EQ((size_t) contents_size,
> contents.size());
> On 2010/08/31 23:19:47, sky wrote:
>>
>> C++ style casts
>
> Done.
>
>
http://codereview.chromium.org/3142008/diff/30001/base/gap_buffer_unittest.cc...
> base/gap_buffer_unittest.cc:53:
> EXPECT_TRUE(CompareVectorWithArray(contents_array, contents_size,
> contents));
> On 2010/08/31 23:19:47, sky wrote:
>>
>> If this test fails the generated failure isn't going to be particular
>
> helpful.
>>
>> It would be much more readable if you generated a string description
>
> and
>>
>> compared that.
>
> converted to ExpectThat
>
> http://codereview.chromium.org/3142008/
>

Powered by Google App Engine
This is Rietveld 408576698