Make calendar pickers testable
https://bugs.webkit.org/show_bug.cgi?id=84827

Reviewed by Hajime Morita.

Source/WebCore:

WebCore:
- Add PagePopupDriver, an interface to open/close a PagePopup.
- Add setPagePopupDriver() to ChromeClient in order to inject a
PagePopupDriver for testing.

Internals:
Add MockPagePopupDriver, which creates a MockPagePopup, which creates a
normal <iframe> in the top-level document, and load the popup content on
it. MockPagePopupDriver is enabled by
internals.settings.setEnableMockPagePopup(true).

Test: fast/forms/date/calendar-picker-appearance.html

* WebCore.gypi: Add new files.
* WebCore.xcodeproj/project.pbxproj: Add files to make this buildable.
* page/ChromeClient.h:
(ChromeClient): Add function for PagePopupDriver.
* loader/EmptyClients.h: Add empty implementations for PagePopupDriver functions.
* page/PagePopupDriver.h: Added.
(PagePopupDriver):
(WebCore::PagePopupDriver::~PagePopupDriver):

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::restoreTo): Reset the mock PagePopupDriver.
(WebCore::InternalSettings::setEnableMockPagePopup):
Register MockPagePopupDriver to ChromeClient.
* testing/InternalSettings.h:
(InternalSettings): Declare setEnableMockPagePopup().
* testing/InternalSettings.idl: ditto.
* testing/MockPagePopupDriver.cpp: Added.
(MockPagePopup): Pseudo PagePopup implementation with the standard <iframe>.
(WebCore::MockPagePopupDriver::MockPagePopupDriver): Added.
(WebCore::MockPagePopupDriver::create): Added.
(WebCore::MockPagePopupDriver::~MockPagePopupDriver): Added.
(WebCore::MockPagePopupDriver::openPagePopup):
Added. An override of PagePopupDriver function. This creates a MockPagePopup.
(WebCore::MockPagePopupDriver::closePagePopup):
Added. An override of PagePopupDriver function. This deletes the MockPagePopup.
* testing/MockPagePopupDriver.h:
(MockPagePopupDriver): Added.

* testing/v8/WebCoreTestSupport.cpp:
(WebCoreTestSupport::injectPagePopupController):
Added. Production code uses per-Page context feature framework. However
MockPagePopup uses the same page as the host page. So we can't use the
framework and need to inject window.pagePopupController manually.
* testing/v8/WebCoreTestSupport.h:
(WebCoreTestSupport): Add injectPagePopupController().

Source/WebKit/chromium:

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::ChromeClientImpl):
Initialize m_pagePopupDriver with the WebViewImpl.
(WebKit::ChromeClientImpl::openPagePopup):
Just calls PagePoupDriver::openPagePopup().
(WebKit::ChromeClientImpl::closePagePopup):
Just calls PagePoupDriver::closePagePopup().
(WebKit::ChromeClientImpl::setPagePopupDriver):
* src/ChromeClientImpl.h:
(ChromeClientImpl): Add setPagePopupDriver
* src/WebViewImpl.h:
(WebViewImpl):
WebViewImpl implements PagePopupDriver. openPagePopup() and
closePagePopup() override members of PagePopupDriver.

LayoutTests:

* fast/forms/date/calendar-picker-appearance-expected.txt: Added.
* fast/forms/date/calendar-picker-appearance.html: Added.
* platform/chromium-mac-snowleopard/fast/forms/date/calendar-picker-appearance-expected.png: Added.
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122558 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change the timing of form state restore
https://bugs.webkit.org/show_bug.cgi?id=89962

Reviewed by Hajime Morita.

For a preparation to fix a form identification problem (Bug 91209),
restore controls states when the parsing of their owner forms is
completed. For controls without owners, their states are restored when
their parsing is completed as ever.

No new tests. This doesn't change observable behavior.

* html/FormController.cpp:
(WebCore::ownerFormForState):
Added. This code was used in formKey(), and restoreControlState*() use it.
(WebCore::FormKeyGenerator::formKey): Use ownerFormForState(). No behavior change.
(WebCore::FormController::restoreControlStateFor):
Moved some code from HTMLFormControlElementWithState::finishParsingChildren().
The difference is we don't resotre state if this control is owned by a form.
(WebCore::FormController::restoreControlStateIn):
Restore states of associated controls. This is called from
finishParsingChildren() for <form>.
* html/FormController.h:
(FormController):
- Declare restoreControlStateFor() and restoreControlStateIn().
- Make takeStateForFormElement() private.

* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::isFormControlElementWithState):
Added. The default implementation returns false.
* html/FormAssociatedElement.h:
(FormAssociatedElement):
Added isFormControlElementWithState() for FormController::restoreControlStateIn().
* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::finishParsingChildren):
Some code was moved to FormController:restoreControlStateFor().
(WebCore::HTMLFormControlElementWithState::isFormControlElementWithState):
Added. Returns true.
* html/HTMLFormControlElementWithState.h:
(HTMLFormControlElementWithState): Declare isFormControlElementWithState().
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::finishParsingChildren):
Added. Calls FormController::restoreControlStateIn().
* html/HTMLFormElement.h:
(HTMLFormElement): Declare finishParsingChildren().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r122553.
http://trac.webkit.org/changeset/122553
https://bugs.webkit.org/show_bug.cgi?id=91198

We found that this was a wrong fix

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r122545.
http://trac.webkit.org/changeset/122545
https://bugs.webkit.org/show_bug.cgi?id=91185

We found that this was a wrong fix

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Fix bugs in HarfBuzzShaper
https://bugs.webkit.org/show_bug.cgi?id=90951

Reviewed by Tony Chang.

Source/WebCore:

The current implementation has following problems:
- Cannot render RTL text if the TextRun is divided into more than two
  HarfBuzzRun.
- Script handling in TextRun partitioning is incorrect.
- Inaccurate calculation of selection rect.
- Wrong rendering position when the first glyph of the TextRun have
  non-zero offsets in terms of HarfBuzz.

To fix these problems I rewrote HarfBuzzShaper class. Here is the summary:
- Divide the whole range of TextRun first, then shape them in visual
  order.
- Divide TextRun in the same way of old-harfbuzz's
  hb_utf16_script_run_next().
- Prefer float than int when calculating selection.
- Adjust the drawing point after shaping.

Added tests covers the fix except for the last problem. The last problem will be covered
by fast/text/international/complex-joining-using-gpos.html after chromium linux port switches
to use HarfBuzzShaper.

Tests: fast/text/shaping/shaping-script-order.html
       fast/text/shaping/shaping-selection-rect.html

* platform/graphics/harfbuzz/FontHarfBuzz.cpp:
(WebCore::Font::drawComplexText): Adjusts point after shaping.
* platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun):
(WebCore):
(WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Added.
(WebCore::HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance): Offsets are no longer needed.
(WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): Calculates character offset based on advance.
(WebCore::normalizeCharacters): Added.
(WebCore::HarfBuzzShaper::HarfBuzzShaper):
(WebCore::HarfBuzzShaper::~HarfBuzzShaper):
(WebCore::HarfBuzzShaper::shape): Divides TextRun first, then shapes them.
(WebCore::HarfBuzzShaper::adjustStartPoint): Added.
(WebCore::HarfBuzzShaper::collectHarfBuzzRuns): Added.
(WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): Added.
(WebCore::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun): Followed other changes.
(WebCore::HarfBuzzShaper::selectionRect): Use float for calculating selection.
* platform/graphics/harfbuzz/ng/HarfBuzzShaper.h:
(HarfBuzzShaper): Holds the start index of character. Removed unnecessary variables.
(WebCore::HarfBuzzShaper::HarfBuzzRun::create): Ditto.
(HarfBuzzRun):
(WebCore::HarfBuzzShaper::HarfBuzzRun::fontData): Added.
(WebCore::HarfBuzzShaper::HarfBuzzRun::startIndex): Ditto.
(WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Ditto.
(WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto.

LayoutTests:

Add tests for harfbuzz-ng shaper. I tried to use -expected.html style expectations,
but it didn't work because there are very slight difference between CoreText and HarfBuzz in
rendering result.

* fast/text/shaping/shaping-script-order.html: Added.
* fast/text/shaping/shaping-selection-rect.html: Added.
* platform/chromium/TestExpectations: Need rebaseline.
* platform/efl/TestExpectations: Skip added tests because the port doesn't use harfbuzz.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.
* platform/win/Skipped: Ditto.
* platform/wincairo/Skipped: Ditto.
* platform/wk2/Skipped: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Add *explicit* keyword to constructor which has a parameter
https://bugs.webkit.org/show_bug.cgi?id=91207

Reviewed by Zoltan Herczeg.

Add *explicit* keyword to contructor which has a parameter in order to avoid implicit type conversion.

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.h:
(EditorClientEfl):
* WebCoreSupport/InspectorClientEfl.h:
(InspectorClientEfl):
* WebCoreSupport/PageClientEfl.h:
(PageClientEfl):
* WebCoreSupport/VibrationClientEfl.h:
(VibrationClientEfl):

Source/WebKit2:

* WebProcess/WebCoreSupport/efl/WebFrameNetworkingContext.h:
(WebFrameNetworkingContext::WebFrameNetworkingContext):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122563 268f45cc-cd09-0410-ab3c-d52691b4dbfc