[CSS Regions] The regionLayoutUpdate event should be dispatched on the NamedFlow object
https://bugs.webkit.org/show_bug.cgi?id=88778

Patch by Andrei Bucur <abucur@adobe.com> on 2012-08-01
Reviewed by Adam Barth.

Spec: http://www.w3.org/TR/css3-regions/#region-flow-layout-events

Source/WebCore:

This patch implements the regionLayoutUpdate event per May 3rd CSS Regions spec recommendation.
Before this patch the event was dispatched individually on each region whenever its overflow state changed. The trigger conditions are preserved with the following additions:
- the event is dispatched when the last region is removed
- the event is not dispatched when the named flow switches to the NULL state
Also, the NamedFlow objects are not deleted if they switch to the NULL state and have listeners attached. In that scenario the JS wrapper will not release the reference
until the parent Document is destroyed.

Tests: The old tests have been modified to use the event on the NamedFlow object rather the one on the Region. New tests have been added to verify the
correct behavior in the special states of the NamedFlow (no region chain, NULL state).

* dom/Document.cpp:
(WebCore::Document::addListenerTypeIfNeeded): Listeners are not added on Nodes any more so the regionLayoutUpdate type was removed from the list.
* dom/Document.h:
* dom/EventTarget.h:
(WebCore):
* dom/EventTargetFactory.in:
* dom/Node.cpp:
* dom/Node.h:
(Node):
* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::eventTargetData):
(WebCore):
(WebCore::WebKitNamedFlow::ensureEventTargetData):
(WebCore::WebKitNamedFlow::dispatchRegionLayoutUpdateEvent): The 3rd May WD says the event is bubbling. However this doesn't make sense as this object doesn't belong to the DOM tree. This was fixed in the ED.
(WebCore::WebKitNamedFlow::interfaceName):
(WebCore::WebKitNamedFlow::scriptExecutionContext):
(WebCore::WebKitNamedFlow::base): Getter for the owner Document used by the wrapper to determine if the object is reachable.
* dom/WebKitNamedFlow.h:
(WebCore):
(WebKitNamedFlow):
(WebCore::WebKitNamedFlow::refEventTarget):
(WebCore::WebKitNamedFlow::derefEventTarget):
* dom/WebKitNamedFlow.idl:
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::RenderFlowThread):
(WebCore::RenderFlowThread::layout): The event dispatching is now handled by the implementation of RenderFlowThread.
(WebCore::RenderFlowThread::computeOverflowStateForRegions):
* rendering/RenderFlowThread.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::RenderNamedFlowThread):
(WebCore::RenderNamedFlowThread::removeRegionFromThread): The layout doesn't detect changes caused by removing the last region. This case is handled separately.
(WebCore::RenderNamedFlowThread::dispatchRegionLayoutUpdateEvent):
(WebCore):
(WebCore::RenderNamedFlowThread::regionLayoutUpdateEventTimerFired):
* rendering/RenderNamedFlowThread.h:
(RenderNamedFlowThread):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::RenderRegion):
* rendering/RenderRegion.h:
(RenderRegion):

LayoutTests:

The existing tests have been adapted to match the transition of the event on the NamedFlow interface. Also there are three more tests for the case
the region chain is removed, the flow goes in the NULL state and for the event target to match the NamedFlow object.

* fast/regions/webkit-named-flow-event-add-to-flow-expected.txt: Renamed from LayoutTests/fast/regions/region-event-add-to-flow-expected.txt.
* fast/regions/webkit-named-flow-event-add-to-flow.html: Renamed from LayoutTests/fast/regions/region-event-add-to-flow.html.
* fast/regions/webkit-named-flow-event-expected.txt: Renamed from LayoutTests/fast/regions/region-event-expected.txt.
* fast/regions/webkit-named-flow-event-no-regions-expected.txt: Added.
* fast/regions/webkit-named-flow-event-no-regions.html: Added.
* fast/regions/webkit-named-flow-event-remove-from-dom-expected.txt: Renamed from LayoutTests/fast/regions/region-event-remove-from-dom-expected.txt.
* fast/regions/webkit-named-flow-event-remove-from-dom.html: Renamed from LayoutTests/fast/regions/region-event-remove-from-dom.html.
* fast/regions/webkit-named-flow-event-remove-from-flow-expected.txt: Renamed from LayoutTests/fast/regions/region-event-remove-from-flow-expected.txt.
* fast/regions/webkit-named-flow-event-remove-from-flow.html: Renamed from LayoutTests/fast/regions/region-event-remove-from-flow.html.
* fast/regions/webkit-named-flow-event-target-expected.txt: Added.
* fast/regions/webkit-named-flow-event-target.html: Added.
* fast/regions/webkit-named-flow-event-to-null-expected.txt: Added.
* fast/regions/webkit-named-flow-event-to-null.html: Added.
* fast/regions/webkit-named-flow-event.html: Renamed from LayoutTests/fast/regions/region-event.html.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean-up touchadjustment tests.
https://bugs.webkit.org/show_bug.cgi?id=92869

Reviewed by Jocelyn Turcotte.

Review and cleanup the touchadjustment tests, so they are more consistent,
uses best practices and are good examples for future touchadjustment tests.

Gather commonly used functions in touchadjustment.js.
Add HTML5 doctype to ensure strict parsing rules.
Remove redundant testRunner calls, and use js-test-post.js instead.
Fix XHTMLisms in small-target-test.html
Fix ignored offset mistake in nested-touch.html that resulted in three identical tests.

* touchadjustment/big-div-expected.txt:
* touchadjustment/big-div.html:
* touchadjustment/block-testing-expected.txt:
* touchadjustment/block-testing.html:
* touchadjustment/disabled-formelements-expected.txt:
* touchadjustment/disabled-formelements.html:
* touchadjustment/event-triggered-widgets-expected.txt:
* touchadjustment/event-triggered-widgets.html:
* touchadjustment/html-label-expected.txt:
* touchadjustment/html-label.html:
* touchadjustment/iframe.html:
* touchadjustment/nested-shadow-node.html:
* touchadjustment/nested-touch-expected.txt:
* touchadjustment/nested-touch.html:
* touchadjustment/resources/inner-frame.html:
* touchadjustment/resources/touchadjustment.js: Added.
(findAbsoluteBounds):
(nodeToString):
(touchPoint):
(offsetTouchPoint):
* touchadjustment/rotated-node-expected.txt:
* touchadjustment/rotated-node.html:
* touchadjustment/scroll-offset-expected.txt:
* touchadjustment/scroll-offset.html:
* touchadjustment/search-cancel.html:
* touchadjustment/small-target-test-expected.txt:
* touchadjustment/small-target-test.html:
* touchadjustment/touch-inlines-expected.txt:
* touchadjustment/touch-inlines.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MarkedBlock::sweep() should sweep another block if it can't sweep a Structure block
https://bugs.webkit.org/show_bug.cgi?id=92819

Reviewed by Geoffrey Garen.

If we are forced to allocate a new block for Structures because we are unable to safely 
sweep our pre-existing Structure blocks, we should sweep another random block so that we 
can start sweeping Structure blocks sooner.

* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::doSweep): Change to use sweepNextBlock.
(JSC):
(JSC::IncrementalSweeper::sweepNextBlock): 
* heap/IncrementalSweeper.h:
(IncrementalSweeper):
* heap/MarkedAllocator.cpp:
(JSC::MarkedAllocator::tryAllocateHelper): When we can't safely sweep 
our Structure blocks, call sweepNextBlock instead.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLTreeBuilder passes a wrong token when pushing the head element
https://bugs.webkit.org/show_bug.cgi?id=92838

Patch by Kwang Yul Seo <skyul@company100.net> on 2012-08-01
Reviewed by Adam Barth.

When the tree builder pushes the head element in the "after head" insertion mode,
it creates a HTMLStackItem from a wrong token.

Added HTMLConstructionSite::headStackItem() to retrieve the stack item for the head
element. Modified the tree builder to pass the correct stack item when pushing the head
element in the "after head" insertion mode.

No new tests, covered by existing tests.

* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertHTMLHeadElement):
* html/parser/HTMLConstructionSite.h:
(WebCore::HTMLConstructionSite::head):
(WebCore::HTMLConstructionSite::headStackItem):
(HTMLConstructionSite):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTag):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r123865.
http://trac.webkit.org/changeset/123865
https://bugs.webkit.org/show_bug.cgi?id=92891

This patch is causing the style-queue to fall behind
(Requested by abarth on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-08-01

* Scripts/webkitpy/tool/commands/queues.py:
(AbstractReviewQueue.begin_work_queue):
(StyleQueue.__init__):
* Scripts/webkitpy/tool/commands/queues_unittest.py:
(StyleQueueTest.test_style_queue_with_style_exception):
(test_style_queue_with_watch_list_exception):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
C++ code should get ClassInfo from the Structure
https://bugs.webkit.org/show_bug.cgi?id=92892

Reviewed by Geoffrey Garen.

In our march to remove ClassInfo from our JSCell object headers, we can switch 
C++ code over to grabbing the ClassInfo from the Structure since it is finally 
safe to do so now that Structure access is safe during finalization/destruction. 
The remaining JIT code changes can be done in a separate patch.

* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::callDestructor): We don't want to clear the Structure any more 
since the Structure should still be valid at this point.
* heap/WeakSetInlines.h:
(JSC::WeakBlock::finalize): Ditto.
* runtime/JSCell.h:
(JSC):
* runtime/Structure.h:
(JSC::JSCell::classInfo): Move JSCell's classInfo() to Structure.h so it can be 
inline. Use a different method of getting the JSCell's Structure based on 
whether we're in GC_VALIDATION mode or not, since always using get() will cause 
infinite recursion in GC_VALIDATION mode.
(JSC):


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