Web Inspector: [CSS Shapes] Highlight shape-outside when its element is selected in the Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=124071

Reviewed by Timothy Hatcher.

Source/WebCore:

Adding code to pass computed shape information (path and bounds) to the Inspector overlay
canvas, and the code to display it. The code creates a path based on ShapeInfo's computed
shape. The shape highlight draws whenever an element is highlighted, via selection in
the Inspector elements view.

Test: inspector-protocol/model/highlight-shape-outside.html

* inspector/InspectorOverlay.cpp:
(WebCore::localPointToRoot): Convert a local point to be relative to the root view.
(WebCore::appendPathCommandAndPoints): Helper for building a single segment's worth
of the overall path.
(WebCore::appendPathSegment): Build a single segment's worth of the overall path.
(WebCore::buildObjectForShapeOutside): Build an object to pass to the Inspector overlay
that represents the shape.
(WebCore::buildObjectForElementInfo): Call buildObjectForShapeOutside and pass the
resulting object along.
* inspector/InspectorOverlayPage.js:
(pathCommand): Draw a single path command.
(drawPath): Draw the overall path.
(_drawShapeHighlight): Draw the highlight for the given shapeInfo.
(drawNodeHighlight): Call _drawShapeHighlight.
* rendering/shapes/PolygonShape.h:
(WebCore::PolygonShape::polygon): Expose the underlying vertex information for a
PolygonShape.
* rendering/shapes/RasterShape.h:
* rendering/shapes/RectangleShape.h:
(WebCore::RectangleShape::logicalRx): Expose the logical radii for a shape.
(WebCore::RectangleShape::logicalRy): Ditto.
* rendering/shapes/Shape.h:
* rendering/shapes/ShapeInfo.h:
(WebCore::ShapeInfo::computedShapePhysicalBoundingBox): The physical bounds of a
shape in renderer coordinates.
(WebCore::ShapeInfo::shapeToRendererPoint): Convert shape coordinates to renderer
coordinates.
(WebCore::ShapeInfo::shapeToRendererSize): Ditto.
(WebCore::ShapeInfo::ShapeInfo):

LayoutTests:

Test that the information passed to the Inspector overlay properly corresponds to the
underlying shape. Retrieving the shape highlight information involves a series of
steps and has been abstracted into shape-info-helper.js, which supplies
Inspector.shapeOutsideInfo inside an Inspector test, and the ShapeInfoHelper.runShapesTest
method to begin a test.

* inspector-protocol/model/highlight-shape-outside-expected.txt: Added.
* inspector-protocol/model/highlight-shape-outside.html: Added.
* inspector-protocol/resources/shape-info-helper.js: Added.
(window.ShapeInfoHelper): Exposes ShapeInfoHelper.runShapesTest.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
End of line whitespace should collapse with white-space:pre-wrap; overflow-wrap:break-word in all cases
https://bugs.webkit.org/show_bug.cgi?id=124158

Source/WebCore: 

Reviewed by Dave Hyatt.
        
If a word just fits the line but the following space overflows we fail to collapse whitespaces 
at the end of the line. This happens because with break-word we end up taking word breaking
code path that does not have pre-wrap whitespace handling.
        
This patch makes the behavior consistent and also matches Firefox.

Test: fast/text/break-word-pre-wrap.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::BreakingContext::handleText):
        
    Don't take the word break code path if we are pre-wrap and the current character is space.
    Instead proceed to break the line normally as this is a valid break position.

LayoutTests: 

Reviewed by Dave Hyatt.
        
Added a specific test and updates the test results of some complex tests that demonstrate the same issue.

* fast/text/break-word-pre-wrap-expected.html: Added.
* fast/text/break-word-pre-wrap.html: Added.
* platform/mac/fast/forms/basic-textareas-expected.png:
* platform/mac/fast/forms/basic-textareas-expected.txt:
* platform/mac/fast/forms/basic-textareas-quirks-expected.png:
* platform/mac/fast/forms/basic-textareas-quirks-expected.txt:
* platform/mac-mountainlion/fast/forms/basic-textareas-expected.txt:
* platform/mac-mountainlion/fast/forms/basic-textareas-quirks-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make IDBBackingStoreTransaction be RefCounted
https://bugs.webkit.org/show_bug.cgi?id=124168

Reviewed by Tim Horton.

This is necessarily to safely add a fully asynchronous interface into the IDB mechanism.

* Modules/indexeddb/IDBBackingStoreInterface.h:
* Modules/indexeddb/IDBBackingStoreTransactionInterface.h:
* Modules/indexeddb/IDBTransactionBackend.h:

* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
(WebCore::IDBBackingStoreLevelDB::createBackingStoreTransaction):
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
* Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix for Win64.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
Fixed 64-bit linker symbols.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove ConstantFoldingPhase's weirdo compile-time optimization
https://bugs.webkit.org/show_bug.cgi?id=124169

Reviewed by Mark Hahnenberg.
        
It turns out that this compile-time optimization doesn't optimize compile times
anymore. Kill it with fire.

* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove #include from test input of the *Messages.in processing scripts.
https://bugs.webkit.org/show_bug.cgi?id=123563

Patch by Gergo Balogh <geryxyz@inf.u-szeged.hu> on 2013-11-11
Reviewed by Darin Adler.

* Scripts/webkit2/messages_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Characters too close together in complex Arabic text
https://bugs.webkit.org/show_bug.cgi?id=124057

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-11-11
Reviewed by Darin Adler.

Source/WebCore:

We weren't updating our total width variable with run's initial
advance information, leading to widths that were too narrow.

In addition, while initial advances for runs that aren't the first
run are accounted for by baking in the initial advances into the
previous character's advance, the initial advance for the first run
has to be accounted for in ComplexTextController::offsetForPosition.

Test: fast/text/complex-grapheme-cluster-with-initial-advance.html
Test: fast/text/selection-in-initial-advance-region.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances): Update
total width variable
(WebCore::ComplexTextController::offsetOfPosition): Account for
the first run's initial advance.

LayoutTests:

complex-grapheme-cluster-with-initial-advance adds a span around a word in some
complex Arabic text, and expects that the word spacing is the same as without the
span.

selection-in-initial-advance-region simulates a mouse drag across a complex text run
with an initial advance. This makes sure that ComplexTextController::offsetForPosition
doesn't crash when there is an initial advance.

* fast/text/complex-grapheme-cluster-with-initial-advance-expected.html: Added.
* fast/text/complex-grapheme-cluster-with-initial-advance.html: Added.
* fast/text/selection-in-initial-advance-region-expected.txt: added
* fast/text/selection-in-initial-advance-region.html: added

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a FrameLoadState object and begin moving loading related members from WebFrameProxy
https://bugs.webkit.org/show_bug.cgi?id=124163

Reviewed by Beth Dakin.

* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetFrameLoadState):
* UIProcess/FrameLoadState.cpp: Added.
(WebKit::FrameLoadState::FrameLoadState):
(WebKit::FrameLoadState::~FrameLoadState):
* UIProcess/FrameLoadState.h: Added.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::WebFrameProxy):
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameProxy::didFailProvisionalLoad):
(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::didFinishLoad):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::didSameDocumentNavigation):
(WebKit::WebFrameProxy::setUnreachableURL):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::frameLoadState):
(WebKit::WebFrameProxy::loadState):
(WebKit::WebFrameProxy::url):
(WebKit::WebFrameProxy::provisionalURL):
(WebKit::WebFrameProxy::unreachableURL):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::activeURL):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::loadStateAtProcessExit):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remote Layer Tree: Implement Page Overlays
https://bugs.webkit.org/show_bug.cgi?id=124165
<rdar://problem/15199056>

Reviewed by Anders Carlsson.

Implement page overlays, very similar to how they work in TiledCoreAnimationDrawingArea,
but manipulating the PlatformCALayer tree instead of the CALayer tree directly.

* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::outOfTreeLayerWasAdded):
(WebKit::RemoteLayerTreeContext::outOfTreeLayerWillBeRemoved):
(WebKit::RemoteLayerTreeContext::flushLayers):
Add a list of out-of-tree GraphicsLayers which are flushed in addition
to the page's GraphicsLayer tree, and functions to manipulate this list.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
Make RemoteLayerTreeDrawingArea a GraphicsLayerClient, so we can get callbacks
from the GraphicsLayers that drive our page overlays.
Override the relevant page overlay functions.
Add storage for the root layer, view size, and a map of PageOverlay->GraphicsLayer.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
Store the root GraphicsLayer for later use.

(WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
Update the size of the page overlays when the DrawingArea's geometry changes.

(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
Update the page overlay settings when necessary.

(WebKit::RemoteLayerTreeDrawingArea::didInstallPageOverlay):
Create a GraphicsLayer for our page overlay, set it up, and parent it.
Inform the RemoteLayerTreeContext that it will need to flush this GraphicsLayer,
since it's not a part of the page's GraphicsLayer tree.

(WebKit::RemoteLayerTreeDrawingArea::didUninstallPageOverlay):
Tear down our page overlay's GraphicsLayer.

(WebKit::RemoteLayerTreeDrawingArea::setPageOverlayNeedsDisplay):
(WebKit::RemoteLayerTreeDrawingArea::setPageOverlayOpacity):
(WebKit::RemoteLayerTreeDrawingArea::paintContents):
(WebKit::RemoteLayerTreeDrawingArea::deviceScaleFactor):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Actually land a result for the test that I added (and make it a text test).

* compositing/tiling/tiled-in-iframe-expected.txt: Added.
* compositing/tiling/tiled-in-iframe.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] m_isCompositeFontReference is uninitialized.
https://bugs.webkit.org/show_bug.cgi?id=124170

Reviewed by Tim Horton.

Initialize value to false, as is done in the other constructors for this data type.

* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
* platform/graphics/win/FontPlatformDataCairoWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::FontPlatformData):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r155660): box-shadow causes overlay scrollbars to be in the wrong position when element is composited (85647)
https://bugs.webkit.org/show_bug.cgi?id=124090

Source/WebCore:

Reviewed by Beth Dakin.

After r155660 we did fewer layouts, so were left with overlay scrollbars in the
wrong locations because nothing would update them after RenderLayerBacking
computed a new offsetFromRenderer.

First part of the fix is to wean positionOverflowControlsLayers() off of
an absolute offset from the root. Do this by not using Widget::frameRect()
to position the layers, but instead RenderLayer::rectFor{Horizontal|Vertical}Scrollbar
which is what we used to position the scrollbars in the first place.

Second part of the fix is to call positionOverflowControlsLayers() from
RenderLayerBacking::updateGraphicsLayerGeometry() if the offsetFromRenderer
changed.

Test: compositing/overflow/overflow-scrollbar-layer-positions.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::positionOverflowControls):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::positionOverflowControlsLayers):
* rendering/RenderLayerBacking.h:

LayoutTests:

Reviewed by Beth Dakin.

Test, but it doesn't actually test the fix until we enable overlay scrollbars
in tests (bug 60716).

* compositing/overflow/overflow-scrollbar-layer-positions-expected.txt: Added.
* compositing/overflow/overflow-scrollbar-layer-positions.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix on CMake Based port since r159077.

* CMakeLists.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r158927): curly-braces-escaping.html is broken on Mac WebKit2
https://bugs.webkit.org/show_bug.cgi?id=124164

Reviewed by Alexey Proskuryakov.

Back out the change to use NSSecureCoding for encoding/decoding NSURLRequest and
NSURLResponse objects; turns out the NSURL encoding/decoding doesn't preserve the raw URL bytes.

* Shared/mac/WebCoreArgumentCodersMac.mm:
(CoreIPC::encodePlatformData):
(CoreIPC::decodePlatformData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unused Qt cruft
https://bugs.webkit.org/show_bug.cgi?id=124174

Reviewed by Tim Horton.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159088 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FrameFilter can just be an std::function instead
https://bugs.webkit.org/show_bug.cgi?id=124176

Reviewed by Tim Horton.

Source/WebCore:

* WebCore.exp.in:
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* loader/archive/cf/LegacyWebArchive.h:

Source/WebKit/mac:

* DOM/WebDOMOperations.mm:
(-[DOMNode webArchiveByFilteringSubframes:]):

Source/WebKit2:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::webArchiveData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r158976): Web Inspector: unable to start docked or dock
https://bugs.webkit.org/show_bug.cgi?id=124148

Reviewed by Timothy Hatcher.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::canAttach): check for a level that is greater than 1 rather than 0
to deny attachment, since 1 is the first level of inspectors.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of the lastResultRegister optimization in the baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=124171

Rubber stamped by Mark Hahnenberg.
        
The baseline JIT no longer needs amazing throughput. And this optimization has caused
way too many OSR exit bugs. And it constrains how much we can do in the DFG/FTL. So,
I'm getting rid of it.

* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::OSRExit):
(JSC::DFG::OSRExit::convertToForward):
* dfg/DFGOSRExit.h:
* dfg/DFGOSRExitCompiler32_64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGOSRExitCompiler64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::compileMovHint):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
* dfg/DFGSpeculativeJIT.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::compileZombieHint):
(JSC::FTL::LowerDFGToLLVM::compileInvalidationPoint):
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(JSC::FTL::LowerDFGToLLVM::observeMovHint):
* ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExit::OSRExit):
(JSC::FTL::OSRExit::convertToForward):
* ftl/FTLOSRExit.h:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* jit/JIT.cpp:
(JSC::JIT::JIT):
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
(JSC::JIT::appendCall):
* jit/JITArithmetic32_64.cpp:
(JSC::JIT::emit_op_lshift):
(JSC::JIT::emitRightShift):
(JSC::JIT::emit_op_bitand):
(JSC::JIT::emit_op_bitor):
(JSC::JIT::emit_op_bitxor):
(JSC::JIT::emit_op_inc):
(JSC::JIT::emit_op_dec):
* jit/JITCall.cpp:
(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileLoadVarargs):
* jit/JITInlines.h:
(JSC::JIT::emitGetFromCallFrameHeaderPtr):
(JSC::JIT::emitGetFromCallFrameHeader32):
(JSC::JIT::emitGetFromCallFrameHeader64):
(JSC::JIT::emitLoadTag):
(JSC::JIT::emitLoadPayload):
(JSC::JIT::emitLoad2):
(JSC::JIT::emitGetVirtualRegister):
(JSC::JIT::emitGetVirtualRegisters):
(JSC::JIT::emitPutVirtualRegister):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_mov):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_new_func):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_mov):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_catch):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emit_op_get_by_pname):
(JSC::JIT::emitResolveClosure):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emit_op_init_global_const):
* jit/SlowPathCall.h:
(JSC::JITSlowPathCall::call):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up static_cast<Element*> usage
https://bugs.webkit.org/show_bug.cgi?id=124133

Reviewed by Andreas Kling.

We need to use toFoo cast function instead of static_cast<>. Though there is toElement(),
static_cast<Element*> is still being used.

No new tests, no behavior changes.

* bindings/gobject/WebKitDOMPrivate.cpp:
(WebKit::wrap):
* dom/ElementTraversal.h:
(WebCore::::lastWithinTemplate):
(WebCore::::nextTemplate):
(WebCore::::previousTemplate):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Remove some unused generated code
https://bugs.webkit.org/show_bug.cgi?id=124179

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-11-11
Reviewed by Timothy Hatcher.

* inspector/CodeGeneratorInspectorStrings.py:

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