Clean up ScopedEventQueue
https://bugs.webkit.org/show_bug.cgi?id=123408

Reviewed by Darin Adler.

Clean up the ScopedEventQueue implementation. ScopedEventQueue::instance() should return a reference to a
NeverDestroyed<ScopedEventQueue> object. The static ScopedEventQueue::s_instance pointer is removed.

The ScopedEventQueue destructor, the dispatchAllEvents method and the scope level incrementation/decrementation
methods are made private. NeverDestroyed<ScopedEventQueue> and EventQueueScope are made friends of the
ScopedEventQueue class so they can access the constructor and the incrementation/decrementation methods, respectively.

ScopedEventQueue method definitions are reordered to follow the order of their declarations in the header file.
ScopedEventQueue::dispatchAllEvents() now uses std::move to efficiently dispatch and clear all currently queued events.

* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchScopedEvent):
* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::instance):
(WebCore::ScopedEventQueue::dispatchAllEvents):
* dom/ScopedEventQueue.h:
(WebCore::EventQueueScope::EventQueueScope):
(WebCore::EventQueueScope::~EventQueueScope):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move writeIndent, overloaded << operators from RenderTreeAsText to TextStream
https://bugs.webkit.org/show_bug.cgi?id=116012

Reviewed by Simon Fraser.

The writeIndent method and overloaded << operators for writing out vectors and points and rectangles
of various types are not specific to the render tree nor do they depend on any rendering-specific interface.

* page/scrolling/ScrollingStateNode.cpp:
* page/scrolling/ScrollingStateNode.h:
(ScrollingStateNode): Remove the writeIndent declaration, it's functionally the same as the TextStream method.
* platform/graphics/GraphicsLayer.cpp:
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer): Ditto.
* platform/graphics/filters/DistantLightSource.cpp: Remove the RenderTreeAsText.h inclusion or replace it with
the inclusion of the TextStream.h header where required. The writeIndent method is now declared there.
* platform/graphics/filters/FEBlend.cpp: Ditto.
* platform/graphics/filters/FEColorMatrix.cpp: Ditto.
* platform/graphics/filters/FEComponentTransfer.cpp: Ditto.
* platform/graphics/filters/FEComposite.cpp: Ditto.
* platform/graphics/filters/FEConvolveMatrix.cpp: Ditto.
* platform/graphics/filters/FECustomFilter.cpp: Ditto.
* platform/graphics/filters/FEDiffuseLighting.cpp: Ditto.
* platform/graphics/filters/FEDisplacementMap.cpp: Ditto.
* platform/graphics/filters/FEDropShadow.cpp: Ditto.
* platform/graphics/filters/FEFlood.cpp: Ditto.
* platform/graphics/filters/FEGaussianBlur.cpp: Ditto.
* platform/graphics/filters/FEMerge.cpp: Ditto.
* platform/graphics/filters/FEMorphology.cpp: Ditto.
* platform/graphics/filters/FEOffset.cpp: Ditto.
* platform/graphics/filters/FESpecularLighting.cpp: Ditto.
* platform/graphics/filters/FETurbulence.cpp: Ditto.
* platform/graphics/filters/SourceAlpha.cpp: Ditto.
* platform/graphics/filters/SourceGraphic.cpp: Ditto.
* platform/text/TextStream.cpp: Move the writeIndent and operators' definitions here.
(WebCore::operator<<):
(WebCore):
(WebCore::writeIndent):
* platform/text/TextStream.h: Move the writeIndent and operators' declarations here.
(WebCore):
(TextStream):
(WebCore::TextStream::operator<<):
* rendering/RenderTreeAsText.cpp: Move the writeIndent and operators' definitions into TextStream.
(WebCore):
* rendering/RenderTreeAsText.h: Move the writeIndent and operators' declarations into TextStream.
(WebCore):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158183 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSRegions] Display anonymous regions in DRT
https://bugs.webkit.org/show_bug.cgi?id=122963

Reviewed by Alexandru Chiculita.

After https://bugs.webkit.org/show_bug.cgi?id=119135, css regions are modelled using an anonymous
RenderNamedFlowFragment object inside the block having a valid -webkit-flow-from.
This patch changes the way elements | pseudo-elements with -webkit-flow-from are displayed
in test dumps.

Source/WebCore:

Before:
    RenderRegion {DIV} at (200,200) size 52x52 [border: (1px solid #000000)]
After:
    RenderBlock (positioned) {DIV} at (200,200) size 52x52 [border: (1px solid #000000)]
        RenderNamedFlowFragment at (1,1) size 50x50

Before:
    Flow Threads
        Thread with flow-name 'article'
        Regions for flow 'article'
            RenderRegion {DIV} #region_1
            RenderRegion {DIV} #region_2
After:
    Named flows
        Named flow 'article'
        Regions for named flow 'article'
            RenderNamedFlowFragment (anonymous child of {DIV::before} #region_1)
            RenderNamedFlowFragment (anonymous child of {DIV} #region_2)

Changed existing tests based on the new dumps.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::renderName):
* rendering/RenderNamedFlowFragment.h: Add a comment explaining the purpose of the class.
* rendering/RenderRegion.h:
* rendering/RenderTreeAsText.cpp:
(WebCore::write):
(WebCore::writeRenderRegionList): Adjust function to display info for anonymous regions too.
(WebCore::writeRenderNamedFlowThreads): Separate dump of valid and invalid regions for a named flow.

LayoutTests:

Changed expected files for mac port, removed expectations for gtk | efl and added [Missing]
in TestExpectations for these platforms. Results need to be generated again for the [Missing] lines.

* fast/regions/auto-size/autoheight-regions-mark-expected.txt: Removed.
* fast/regions/flows-dependency-dynamic-remove-expected.txt: Removed.
* fast/regions/flows-dependency-same-flow-expected.txt: Removed.
* platform/efl/TestExpectations:
* platform/efl/fast/regions/multiple-directionality-changes-in-variable-width-regions-expected.txt: Removed.
* platform/efl/fast/regions/region-dynamic-after-before-expected.txt: Removed.
* platform/efl/fast/regions/region-generated-content-before-after-expected.txt: Removed.
* platform/efl/fast/regions/text-region-split-small-pagination-expected.txt: Removed.
* platform/efl/fast/regions/top-overflow-out-of-second-region-expected.txt: Removed.
* platform/efl/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.txt: Removed.
* platform/efl/fast/repaint/line-flow-with-floats-in-regions-expected.png: Removed.
* platform/efl/fast/repaint/line-flow-with-floats-in-regions-expected.txt: Removed.
* platform/efl/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png: Removed.
* platform/efl/fast/repaint/region-painting-invalidation-expected.txt: Removed.
* platform/gtk/TestExpectations:
* platform/gtk/fast/regions/flows-dependency-same-flow-expected.png: Removed.
* platform/gtk/fast/regions/multiple-directionality-changes-in-variable-width-regions-expected.txt: Removed.
* platform/gtk/fast/regions/region-dynamic-after-before-expected.txt: Removed.
* platform/gtk/fast/regions/region-generated-content-before-after-expected.txt: Removed.
* platform/gtk/fast/regions/text-region-split-small-pagination-expected.txt: Removed.
* platform/gtk/fast/regions/top-overflow-out-of-second-region-expected.txt: Removed.
* platform/gtk/fast/repaint/line-flow-with-floats-in-regions-expected.png: Removed.
* platform/gtk/fast/repaint/line-flow-with-floats-in-regions-expected.txt: Removed.
* platform/gtk/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.png: Removed.
* platform/mac/fast/regions/auto-size/autoheight-regions-mark-expected.png: Copied from LayoutTests/fast/regions/flows-dependency-same-flow-expected.png.
* platform/mac/fast/regions/auto-size/autoheight-regions-mark-expected.txt: Added.
* platform/mac/fast/regions/autoheight-regions-mark-expected.png: Removed.
* platform/mac/fast/regions/flows-dependency-dynamic-remove-expected.txt: Added.
* platform/mac/fast/regions/flows-dependency-same-flow-expected.png: Copied from LayoutTests/fast/regions/flows-dependency-same-flow-expected.png.
* platform/mac/fast/regions/flows-dependency-same-flow-expected.txt: Added.
* platform/mac/fast/regions/iframe-html-collected-expected.png: Renamed from LayoutTests/fast/regions/flows-dependency-same-flow-expected.png.
* platform/mac/fast/regions/iframe-html-collected-expected.txt: Renamed from LayoutTests/fast/regions/iframe-html-collected-expected.txt.
* platform/mac/fast/regions/multiple-directionality-changes-in-variable-width-regions-expected.txt:
* platform/mac/fast/regions/region-dynamic-after-before-expected.txt:
* platform/mac/fast/regions/region-generated-content-before-after-expected.txt:
* platform/mac/fast/regions/text-region-split-small-pagination-expected.txt:
* platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt:
* platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.png: Added.
* platform/mac/fast/repaint/japanese-rl-selection-repaint-in-regions-expected.txt:
* platform/mac/fast/repaint/line-flow-with-floats-in-regions-expected.txt:
* platform/mac/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.txt: Renamed from LayoutTests/fast/repaint/overflow-flipped-writing-mode-block-in-regions-expected.txt.
* platform/mac/fast/repaint/region-painting-invalidation-expected.txt:
* platform/mac/fast/repaint/region-painting-via-layout-expected.txt: Renamed from LayoutTests/fast/repaint/region-painting-via-layout-expected.txt.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed Mac debug build fix after r158183.
Remove the duplicated << overloaded operator from RemoteLayerTreeTransaction for printing out
a given FloatSize object. The RemoteLayerTreeTransaction inherits from TextStream, which already
provides that overloaded operator. Format of the output is a bit different so hopefully nothing
breaks further.

* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTextStream::operator<<):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Text selected with double-click gets unselected after DOM modification
https://bugs.webkit.org/show_bug.cgi?id=114227

Patch by Santosh Mahto <santosh.ma@samsung.com> on 2013-10-29
Reviewed by Ryosuke Niwa.

Source/WebCore:

Before this patch when selection is done by double-click (start and base remain
same) and DOM is modified then selection gets vanished. This does not
happen when selection is done by dragging mouse. This happens because
on double-click base and extent remain the same and on DOM
modification we update the selection with base and extent, so we loose
the selection. Since in double-click case start/end contain the
correct selection, same should be used after dom modification to
update selection.

Test: editing/selection/double-click-selection-with-dom-mutation.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::textWasReplaced): use start/end to update
selection in case double click selection. Added a check for base !=
extent, if base != extent use base/extent to update the selection
otherwise use start/end with directionality check.

LayoutTests:

New Testcase to test that selection remain intact when selection is
created by double-click and then dom is modified.

* editing/selection/double-click-selection-with-dom-mutation-expected.txt: Added.
* editing/selection/double-click-selection-with-dom-mutation.html: Added.

Rebaselined the below test cases.
* platform/mac/editing/deleting/smart-delete-003-expected.txt:
* platform/mac/editing/deleting/smart-delete-004-expected.txt:

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