Subpixel Layout: SimpleLineLayout needs more position rounding to match InlineFlowBox layout.
https://bugs.webkit.org/show_bug.cgi?id=127404

Reviewed by Antti Koivisto.

In order to produce a CSS pixel perfect layout, SimpleLineLayout needs to
round line positions to CSS (integral) position similarly to InlineFlowBox.

Source/WebCore:

Existing tests cover it.

* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::Run::rect):
(WebCore::SimpleLineLayout::RunResolver::Run::baseline):

LayoutTests:

* platform/mac/css1/box_properties/padding-expected.txt:
* platform/mac/css1/box_properties/padding_top-expected.txt:
* platform/mac/css1/formatting_model/vertical_formatting-expected.txt:
* platform/mac/css2.1/t080301-c411-vt-mrgn-00-b-expected.txt:
* platform/mac/css2.1/t0804-c5510-padn-00-b-ag-expected.txt:
* platform/mac/css2.1/t0905-c414-flt-wrap-00-e-expected.txt:
* platform/mac/fast/css/empty-pseudo-class-expected.txt:
* platform/mac/fast/css/fieldset-display-row-expected.txt:
* platform/mac/fast/css/first-child-pseudo-class-expected.txt:
* platform/mac/fast/css/last-child-pseudo-class-expected.txt:
* platform/mac/fast/css/only-child-pseudo-class-expected.txt:
* platform/mac/fast/repaint/reflection-redraw-expected.txt:
* platform/mac/fast/shapes/shape-inside/shape-inside-subpixel-rectangle-top-expected.png: Removed.
* platform/mac/fast/table/dynamic-caption-add-remove-before-child-expected.txt:
* platform/mac/fast/table/multiple-captions-display-expected.txt:
* platform/mac/tables/mozilla/marvin/body_col-expected.txt:
* platform/mac/tables/mozilla/marvin/x_th_valign_baseline-expected.txt:
* platform/mac/tables/mozilla/other/body_col-expected.txt:
* platform/mac/tables/mozilla_expected_failures/bugs/bug10140-expected.txt:
* platform/mac/tables/mozilla_expected_failures/bugs/bug10216-expected.txt:
* platform/mac/tables/mozilla_expected_failures/core/captions3-expected.txt:
* platform/mac/tables/mozilla_expected_failures/other/test4-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add WKWebView class
https://bugs.webkit.org/show_bug.cgi?id=127444
<rdar://problem/15884418>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.h: Added.
* UIProcess/API/Cocoa/WKWebView.mm: Added.
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView configuration]):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add protocolIsInHTTPFamily for strings and use it where appropriate
https://bugs.webkit.org/show_bug.cgi?id=127336

Reviewed by Alexey Proskuryakov.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAttribute):
* page/ContentSecurityPolicy.cpp:
(WebCore::CSPSource::schemeMatches):
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::generateReferrerHeader):
* platform/URL.cpp:
(WebCore::protocolIsInHTTPFamily):
* platform/URL.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crashes in DrawingAreaProxy::setExposedRect (null DrawingAreaProxy)
https://bugs.webkit.org/show_bug.cgi?id=127445

Reviewed by Anders Carlsson.

* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _updateViewExposedRect]):
* UIProcess/API/mac/WKView.mm:
(-[WKView _updateViewExposedRect]):
Null-check.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162556 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes] shape-inside rectangle layout can fail
https://bugs.webkit.org/show_bug.cgi?id=124784

Reviewed by Darin Adler.

Early subpixel rounding/flooring/ceiling can have unwanted
side effect on the final pixel value. Delay pixel
conversions as much as possible.

Existing test is changed to reflect subpixel functionality.

Source/WebCore:

* rendering/shapes/RectangleShape.cpp:
(WebCore::RectangleShape::firstIncludedIntervalLogicalTop):

LayoutTests:

* fast/shapes/shape-inside/shape-inside-subpixel-rectangle-top-expected.html:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support collapsing call site records into the resource timeline.

Also fix some filtering and graph issues.

https://bugs.webkit.org/show_bug.cgi?id=127440

Reviewed by Joseph Pecoraro.

* UserInterface/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype.updateFilter):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.matchTextFilter):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.makeVisible):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement):
(WebInspector.NavigationSidebarPanel.prototype._updateFilter):
Tweak how filtering happens so custom filters never expand to reveal and auto expanded
tree elements will auto-collapse again later even with custom filters.

* UserInterface/OverviewTimelineView.css:
(.timeline-view.overview > .data-grid tr.parent:not(.expanded) td.graph-column .timeline-record-bar:not(.timeline-record-type-network) > .segment):
(.timeline-view.overview > .data-grid tr.parent:not(.expanded).selected td.graph-column .timeline-record-bar:not(.timeline-record-type-network) > .segment):
(.timeline-view.overview > .data-grid:focus tr.parent:not(.expanded).selected td.graph-column .timeline-record-bar:not(.timeline-record-type-network) > .segment):
Add a shadow to provide some negative space between juxtaposed records. Only needed when not expanded and not netwrok records.

* UserInterface/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype.updateLayout):
(WebInspector.OverviewTimelineView.prototype._addResourceToTreeIfNeeded):
Update the filter when current time changes and only auto expand the main resource.

* UserInterface/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode):
(WebInspector.ResourceTimelineDataGridNode.prototype._timelineRecordUpdated):
Don't schedule a refresh of the graph if the record isn't visible.

* UserInterface/SourceCodeTimelineTimelineDataGridNode.js:
(WebInspector.SourceCodeTimelineTimelineDataGridNode):
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype._timelineRecordAdded):
Don't schedule a refresh of the graph if the record isn't visible.

* UserInterface/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype._timeRangeSelectionChanged):
Remove the boolean for updateFilter.

* UserInterface/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype._refreshDirtyDataGridNodes):
(WebInspector.TimelineDataGrid.prototype._sort):
Keep the hidden state in-sync between node and element.

* UserInterface/TimelineDataGridNode.js:
(WebInspector.TimelineDataGridNode.prototype.collapse):
(WebInspector.TimelineDataGridNode.prototype.expand):
(WebInspector.TimelineDataGridNode.prototype.appendChild):
(WebInspector.TimelineDataGridNode.prototype.insertChild):
(WebInspector.TimelineDataGridNode.prototype.removeChild):
(WebInspector.TimelineDataGridNode.prototype.removeChildren):
(WebInspector.TimelineDataGridNode.prototype.removeChildrenRecursive):
(WebInspector.TimelineDataGridNode.prototype.refreshGraph.createBarsForRecords):
(WebInspector.TimelineDataGridNode.prototype.refreshGraph.else.collectRecordsByType.get if):
(WebInspector.TimelineDataGridNode.prototype.needsGraphRefresh):
(WebInspector.TimelineDataGridNode.prototype.isRecordVisible):
Support drawing the children records on the parent graph.

* UserInterface/TimelineRecordBar.css:
(.timeline-record-bar.unfinished > .segment):
(:focus .selected .timeline-record-bar > .segment):
(:focus .selected .timeline-record-bar > .segment.inactive):
(:focus .selected .timeline-record-bar.has-inactive-segment > .segment:not(.inactive)):
Tweaked styles to look bettwen when selected.

* UserInterface/TimelineRecordBar.js:
(WebInspector.TimelineRecordBar.recordsCannotBeCombined):
(WebInspector.TimelineRecordBar.prototype.set records):
(WebInspector.TimelineRecordBar.prototype.refresh):
Drive-by fixes for some bug with bars being reused.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't include a hidden Timeline selection in the navigation path components.

https://bugs.webkit.org/show_bug.cgi?id=127443

Reviewed by Joseph Pecoraro.

* UserInterface/GeneralTreeElementPathComponent.js:
(WebInspector.GeneralTreeElementPathComponent.prototype.get previousSibling):
(WebInspector.GeneralTreeElementPathComponent.prototype.get nextSibling):
Skip hidden siblings.

* UserInterface/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype.updateLayout):
(WebInspector.OverviewTimelineView.prototype.get selectionPathComponents):
Don't include hidden selection and dispatch SelectionPathComponentsDidChange event if hidden changes.

* UserInterface/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype._timeRangeSelectionChanged):
Dispatch SelectionPathComponentsDidChange event if hidden changes on the selected tree element.

* UserInterface/TimelineView.js:
(WebInspector.TimelineView.prototype.get selectionPathComponents):
Don't include hidden selection.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WKProcessClass should create a WebContext
https://bugs.webkit.org/show_bug.cgi?id=127449
<rdar://problem/15885582>

Reviewed by Dan Bernstein.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/Cocoa/WKBrowsingContextController.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKProcessClass.mm:
(-[WKProcessClass initWithConfiguration:]):
(-[WKProcessClass dealloc]):
(-[WKProcessClass API::]):
* UIProcess/API/Cocoa/WKProcessClassInternal.h: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroupInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed Apple Windows port gardering after r162553.

* platform/win/fast/repaint/reflection-redraw-expected.txt: Added.
* platform/win/fast/table/dynamic-caption-add-remove-before-child-expected.txt: Added.
* platform/win/fast/table/multiple-captions-display-expected.txt: Added.
* platform/win/tables/mozilla/marvin/body_col-a-expected.txt: Added.
* platform/win/tables/mozilla/marvin/x_th_valign_baseline-expected.txt: Added.
* platform/win/tables/mozilla/other/body_col-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improve collapsing of TimelineDataGridNode graphs up to ancestors.

https://bugs.webkit.org/show_bug.cgi?id=127440

Reviewed by Joseph Pecoraro.

* UserInterface/TimelineDataGridNode.js:
(WebInspector.TimelineDataGridNode.prototype.collapse):
(WebInspector.TimelineDataGridNode.prototype.createCellContent):
(WebInspector.TimelineDataGridNode.prototype.refresh):
(WebInspector.TimelineDataGridNode.prototype.needsGraphRefresh):
Notify the next visible ancestor it needs to refresh. Use needsGraphRefresh so ancestors
are notified instead of directly calling refreshGraph in some places.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: [WebGL] Implement ANGLE_instanced_arrays
https://bugs.webkit.org/show_bug.cgi?id=127257

Reviewed by Brent Fulgham.

Implement the instanced drawing WebGL extension,
ANGLE_instanced_arrays. This is currently Mac-only,
but should be portable to other platforms if their
OpenGL exposes the functions. It's also done in a way
that will make exposing it to WebGL2 simple.

Test: fast/canvas/webgl/angle-instanced-arrays.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
Add the new files to all the build systems.

* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::toJS): Link JS side to C++ side.

* html/canvas/ANGLEInstancedArrays.cpp: Added.
(WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
* html/canvas/ANGLEInstancedArrays.h: Added.
* html/canvas/ANGLEInstancedArrays.idl: Added.
New boilerplate files that expose the extension methods.

* html/canvas/WebGLExtension.h: New extension enum.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::validateVertexAttributes): Add an optional
parameter representing the number of instance primitives we are asked
to draw. Use that for the draw count if looking at an instanced attribute.
Also make sure we see at least one non-instanced attribute.
(WebCore::WebGLRenderingContext::validateDrawArrays): Update this so it could
be used from either drawArrays or drawArraysInstanced.
(WebCore::WebGLRenderingContext::drawArrays):
(WebCore::WebGLRenderingContext::validateDrawElements): Same here, now can be
used by the instanced and non-instanced versions.
(WebCore::WebGLRenderingContext::drawElements):
(WebCore::WebGLRenderingContext::getExtension): Create and return the new extension.
(WebCore::WebGLRenderingContext::getSupportedExtensions): Add new extension to the list.
(WebCore::WebGLRenderingContext::getVertexAttrib): Intercept a query to the divisor
attribute and return the value we kept in the state.
(WebCore::WebGLRenderingContext::drawArraysInstanced): Call the GC3D method.
(WebCore::WebGLRenderingContext::drawElementsInstanced): Ditto.
(WebCore::WebGLRenderingContext::vertexAttribDivisor): Ditto.

* html/canvas/WebGLRenderingContext.h: Define the new methods and parameters.

* html/canvas/WebGLVertexArrayObjectOES.cpp:
(WebCore::WebGLVertexArrayObjectOES::setVertexAttribDivisor): Keep a record of the
divisor if we set it.
* html/canvas/WebGLVertexArrayObjectOES.h:
(WebCore::WebGLVertexArrayObjectOES::VertexAttribState::VertexAttribState):

* platform/graphics/GraphicsContext3D.h: New enum.
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::drawArraysInstanced): The actual calls into OpenGL.
(WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
(WebCore::GraphicsContext3D::vertexAttribDivisor): Ditto.

* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Empty implementations
for non-mac platforms.

* platform/graphics/ios/GraphicsContext3DIOS.h: Define the iOS names for the
functions.

LayoutTests: Implement ANGLE_instanced_arrays
https://bugs.webkit.org/show_bug.cgi?id=127257

Reviewed by Brent Fulgham.

Copied a slightly modified version of the Khronos instanced
arrays test (mostly modified due to the fact this comes from
an in-progress update to the test suite).

* fast/canvas/webgl/angle-instanced-arrays-expected.txt: Added.
* fast/canvas/webgl/angle-instanced-arrays.html: Added.
* fast/canvas/webgl/resources/webgl-test-utils.js:
(WebGLTestUtils): Added some new functions that were missing, and
some output to a checkColor test.
* platform/efl/TestExpectations: Skip this for EFL.
* platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt: Not
supported on Mountain Lion.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: "Put" support
<rdar://problem/15779643> and https://bugs.webkit.org/show_bug.cgi?id=127401

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Add persistent encode/decode for storage to the database:
* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::encode):
(WebCore::IDBKey::decode):
* Modules/indexeddb/IDBKey.h:

Add a data class to represent IDBKey suitable for crossing IPC:
* Modules/indexeddb/IDBKeyData.cpp: Added.
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::maybeCreateIDBKey):
(WebCore::IDBKeyData::isolatedCopy):
* Modules/indexeddb/IDBKeyData.h: Added.
(WebCore::IDBKeyData::IDBKeyData):

* platform/CrossThreadCopier.cpp:
(WebCore::IDBKeyData>::copy):
* platform/CrossThreadCopier.h:

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

Ship putRecord requests over to the DatabaseProcess, and listen for completion from the DatabaseProcess:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::put):
(WebKit::WebIDBServerConnection::didPutRecord):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in:

Pass off the putRecord request to the Unique IDBDatabase:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::putRecord):
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in:

Pass off the putRecord request to the backing store:
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::putRecord):
(WebKit::UniqueIDBDatabase::putRecordInBackingStore):
(WebKit::UniqueIDBDatabase::didPutRecordInBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:

Add backing store methods related to putRecord, though only one is critical right now:
* DatabaseProcess/IndexedDB/UniqueIDBDatabaseBackingStore.h:
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createAndPopulateInitialMetadata):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::generateKey):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::keyExistsInObjectStore):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::putRecord):
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::updateKeyGenerator):
* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.h:

Add the IDBKeyData type to IPC:
* Scripts/webkit2/messages.py:
(struct_or_class):

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<IDBKeyData>::encode):
(IPC::ArgumentCoder<IDBKeyData>::decode):
* Shared/WebCoreArgumentCoders.h:

* DatabaseProcess/IndexedDB/IDBSerialization.cpp:
(WebKit::serializeIDBKey):
* DatabaseProcess/IndexedDB/IDBSerialization.h:

Implement more cross-thread copying:
* Shared/WebCrossThreadCopier.cpp:
(WebCore::Vector<uint8_t>>::copy):
(WebCore::Vector<Vector<IDBKeyData>>>::copy):
(WebCore::ASCIILiteral>::copy):
* Shared/WebCrossThreadCopier.h:

Implement more numbers of generic AsyncTask templates:
* Shared/AsyncTask.h:
(WebKit::createAsyncTask):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed attempt to fix 32-bit builds.

Use long long rather than GC3Dintptr.

* html/canvas/ANGLEInstancedArrays.cpp:
(WebCore::ANGLEInstancedArrays::drawElementsInstancedANGLE):
* html/canvas/ANGLEInstancedArrays.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::drawElementsInstanced):
* html/canvas/WebGLRenderingContext.h:

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