FeatureObserver: Input types are counted unexpectedly in a page with Modernizr
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2013 10:01:24 +0000 (10:01 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2013 10:01:24 +0000 (10:01 +0000)
commitefe899d39ec3da352d7a5adf638b07e295b8651d
treec1dd69265925f8f77af5834701a78ce6a4f3666a
parentcdb5a5607aab6382814b20d179237375f9e0b13a
FeatureObserver: Input types are counted unexpectedly in a page with Modernizr
https://bugs.webkit.org/show_bug.cgi?id=108141

Reviewed by Kentaro Hara.

We don't want to record input type instantiation by Modernizr. Modernizr
creates input elements with these types, append it to document.body, and
render it with visibility:hidden. So, we record input types only when
they are attached without visibility:hidden.

No new tests. FeatureObserver is not testable by layout test.

* html/InputType.cpp:
(WebCore::InputType::create): Remove FeatureObserver::observe
callsites. They are moved to TextInputType::attach.
(WebCore::InputType::observeFeatureIfVisible):
Added. A helper for attach().
* html/InputType.h:
(InputType): Add observeFeatureIfVisible.

* html/ColorInputType.cpp:
(WebCore::ColorInputType::create):
Remove a FeatureObserver::observe callsite.
(WebCore::ColorInputType::attach):
Calls FetureObserver through InputType::observeFeatureIfVisible.
* html/ColorInputType.h:
(ColorInputType): Declare attach.
* html/DateInputType.cpp: Ditto.
* html/DateInputType.h: Ditto.
* html/DateTimeInputType.cpp: Ditto.
* html/DateTimeInputType.h: Ditto.
* html/DateTimeLocalInputType.cpp: Ditto.
* html/DateTimeLocalInputType.h: Ditto.
* html/MonthInputType.cpp: Ditto.
* html/MonthInputType.h: Ditto.
* html/RangeInputType.cpp: Ditt
* html/RangeInputType.h: Ditto.
* html/TimeInputType.cpp: Ditto.
* html/TimeInputType.h: Ditto.
* html/WeekInputType.cpp: Ditto.
* html/WeekInputType.h: Ditto.

* html/TextFieldInputType.h:
(TextFieldInputType):
Make attach protected in order that sub classes can call it.
* html/EmailInputType.cpp:
(WebCore::EmailInputType::create):
Remove a FeatureObserver::observe callsite.
(WebCore::EmailInputType::attach): Calls FetureObserver through
InputType::observeFeatureIfVisible after TextFieldInptuType::attach.
* html/EmailInputType.h:
(EmailInputType):Declare attach.
* html/NumberInputType.cpp: Ditto.
* html/NumberInputType.h: Ditto.
* html/SearchInputType.cpp: Ditto.
* html/SearchInputType.h: Ditto.
* html/TelephoneInputType.cpp: Ditto.
* html/TelephoneInputType.h: Ditto.
* html/URLInputType.cpp: Ditto.
* html/URLInputType.h: Ditto.

* html/TextInputType.cpp:
(WebCore::TextInputType::attach):
Move the code for type fallback from InputType::create.
* html/TextInputType.h:
(TextInputType): Declare attach.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/ColorInputType.h
Source/WebCore/html/DateInputType.cpp
Source/WebCore/html/DateInputType.h
Source/WebCore/html/DateTimeInputType.cpp
Source/WebCore/html/DateTimeInputType.h
Source/WebCore/html/DateTimeLocalInputType.cpp
Source/WebCore/html/DateTimeLocalInputType.h
Source/WebCore/html/EmailInputType.cpp
Source/WebCore/html/EmailInputType.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/MonthInputType.cpp
Source/WebCore/html/MonthInputType.h
Source/WebCore/html/NumberInputType.cpp
Source/WebCore/html/NumberInputType.h
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/html/RangeInputType.h
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/html/SearchInputType.h
Source/WebCore/html/TelephoneInputType.cpp
Source/WebCore/html/TelephoneInputType.h
Source/WebCore/html/TextFieldInputType.h
Source/WebCore/html/TextInputType.cpp
Source/WebCore/html/TextInputType.h
Source/WebCore/html/TimeInputType.cpp
Source/WebCore/html/TimeInputType.h
Source/WebCore/html/URLInputType.cpp
Source/WebCore/html/URLInputType.h
Source/WebCore/html/WeekInputType.cpp
Source/WebCore/html/WeekInputType.h