Make EventDispatcher::dispatch comprehensible
https://bugs.webkit.org/show_bug.cgi?id=122588

Reviewed by Andreas Kling.

Merged EventDispatcher::dispatchEventAtCapturing, EventDispatcher::dispatchEventAtTarget,
EventDispatcher::dispatchEventAtBubbling, and EventDispatcher::dispatchEventPostProcess into EventDispatcher::dispatch,
and extracted static local callDefaultEventHandlersInTheBubblingOrder and dispatchEventInDOM out of it.

Also made handleLocalEvents of subclasses of EventContext and Node take Event& instead of Event*.

* dom/EventContext.cpp: The following functions now take Event& instead of Event*.
(WebCore::EventContext::handleLocalEvents):
(WebCore::MouseOrFocusEventContext::handleLocalEvents):
(WebCore::TouchEventContext::handleLocalEvents):
* dom/EventContext.h:

* dom/EventDispatcher.cpp:
(WebCore::callDefaultEventHandlersInTheBubblingOrder): Extracted from EventDispatcher::dispatchEventPostProcess,
which is now merged into EventDispatcher::dispatch.
(WebCore::dispatchEventInDOM): Extracted out of EventDispatcher::dispatch, EventDispatcher::dispatchEventAtCapturing,
EventDispatcher::dispatchEventAtTarget and EventDispatcher::dispatchEventAtBubbling. This function is responsible for
dispatching the event for capturing, at the target, and then bubbling through the event path chain.
(WebCore::EventDispatcher::dispatch): EventDispatcher::dispatchEventPostProcess got merged into this. The calls to
dispatchEventAtCapturing, dispatchEventAtTarget, and dispatchEventAtBubbling are replaced by a single call to
dispatchEventInDOM.
* dom/EventDispatcher.h:

* dom/FocusEvent.h:
(WebCore::toFocusEvent): Added the version that takes a reference.
* dom/MouseEvent.h:
(WebCore::toMouseEvent): Ditto.
* dom/TouchEvent.h:
(WebCore::toTouchEvent): Ditto.
* dom/Node.cpp:
(WebCore::Node::handleLocalEvents): Now takes Event& instead of Event*.
* dom/Node.h:
* dom/WindowEventContext.cpp:
(WebCore::WindowEventContext::handleLocalEvents): Ditto.
* dom/WindowEventContext.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::handleLocalEvents): Ditto.
* html/HTMLFormElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Implement support for grid-template
https://bugs.webkit.org/show_bug.cgi?id=103313

Reviewed by Dean Jackson.

Source/WebCore:

Based on Blink r153427, r155199 and r155712 by <jchaffraix@chromium.org>

Test: fast/css-grid-layout/grid-template-get-set.html

Recognize, parse, store and return properly the value of
grid-template. It required some extra parsing code because the
specs mandates to check that the defined grid areas are indeed
rectangular. Named grid areas are still not fully supported, will
be done in a follow up patch.

As validating involves building the grid areas a new CSSValue was
added to hold the computed value. Note that we have to track the
explicit size of the named grid areas as the named grid areas
(".") are not tracked in our HashMap of grid areas.

This change also involves moving GridCoordinate and GridSpan to a
separate file in order to share the code that describes the grid
area coordinates.

* CMakeLists.txt: Added new files to the build.
* GNUmakefile.list.am: Ditto.
* WebCore.vcxproj/WebCore.vcxproj: Ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSGridTemplateValue.cpp: Added.
(WebCore::CSSGridTemplateValue::CSSGridTemplateValue):
(WebCore::stringForPosition):
(WebCore::CSSGridTemplateValue::customCSSText):
* css/CSSGridTemplateValue.h: Added.
(WebCore::CSSGridTemplateValue::create):
(WebCore::CSSGridTemplateValue::~CSSGridTemplateValue):
(WebCore::CSSGridTemplateValue::gridAreaMap):
(WebCore::CSSGridTemplateValue::rowCount):
(WebCore::CSSGridTemplateValue::columnCount):
(WebCore::toCSSGridTemplateValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseGridTemplate): create the grid areas and
validate that they define rectangular sections.
* css/CSSParser.h:
* css/CSSPropertyNames.in: Added -webkit-grid-template.
* css/CSSValue.cpp:
(WebCore::CSSValue::equals): add support for the new CSSGridTemplateValue.
(WebCore::CSSValue::cssText): Ditto.
(WebCore::CSSValue::destroy): Ditto.
* css/CSSValue.h:
(WebCore::CSSValue::isGridTemplateValue):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::cachedGridCoordinate): Replaced RenderGrid::GridSpan by WebCore::GridSpan.
(WebCore::RenderGrid::resolveGridPositionsFromAutoPlacementPosition): Ditto.
(WebCore::RenderGrid::resolveGridPositionsFromStyle): Ditto.
(WebCore::RenderGrid::resolveGridPositionAgainstOppositePosition): Ditto.
(WebCore::RenderGrid::resolveNamedGridLinePositionAgainstOppositePosition): Ditto.
(WebCore::RenderGrid::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition): Ditto.
(WebCore::RenderGrid::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition): Ditto.
* rendering/RenderGrid.h: Took GridSpan and GridCoordinate out.
* rendering/style/GridCoordinate.h: Added.
(WebCore::GridSpan::create):
(WebCore::GridSpan::GridSpan):
(WebCore::GridSpan::operator==):
(WebCore::GridCoordinate::GridCoordinate):
(WebCore::GridCoordinate::operator==):
(WebCore::GridCoordinate::operator!=):
* rendering/style/RenderStyle.h:
* rendering/style/StyleGridData.cpp:
(WebCore::StyleGridData::StyleGridData):
* rendering/style/StyleGridData.h:
(WebCore::StyleGridData::operator==):

LayoutTests:

From Blink r153427, r155199 and r155712  by <jchaffraix@chromium.org>

Added a test to verify that we properly recognize, parse, store
and return the value of grid-template.

* fast/css-grid-layout/grid-template-get-set-expected.txt: Added.
* fast/css-grid-layout/grid-template-get-set.html: Added.

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