[iOS][WebKit2] Provide generic software-snapshotting API
https://bugs.webkit.org/show_bug.cgi?id=130385
<rdar://problem/16005957>

Reviewed by Sam Weinig.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:WebKit::]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView initWithFrame:fromWKView:]):
(-[_WKThumbnailView _requestSnapshotIfNeeded]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::internalShowContextMenu):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::takeSnapshot):
(WebKit::WebPage::scaledSnapshotWithOptions):
(WebKit::WebPage::snapshotAtSize):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Rename TakeThumbnailSnapshot message to TakeSnapshot.

Fill the snapshot image with the FrameView's background color, to avoid
half-pixel alpha around the edges.

Factor snapshotAtSize out of scaledSnapshotWithOptions.

Don't apply both the custom and device scale factor to the base CTM,
only the device scale factor. Custom scale factor should only be
applied to the user CTM.

* Shared/ImageOptions.h:
Add a snapshot option, RespectDrawingAreaTransform, that maps
the rect through the drawing area's root layer transform.
Use this in place of the thumbnail-specific code in TakeThumbnailSnapshot.
Add a snapshot option, ExcludeDeviceScaleFactor, which means that
snapshotting will not factor the device scale in (useful for drawing
to a bitmap at an exact requested size).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Strange layout for content with region breaks
https://bugs.webkit.org/show_bug.cgi?id=121318

Reviewed by Mihnea Ovidenie.

Source/WebCore:

When break-inside: avoid is used on an element, the implementation tries to
force it inside a single fragmentation container even though the descendants
of the element specify forced breaks. This leads to unexpected results and
unstable layout.

The change extends the definition of unsplittable elements for flow threads
using the same conditions found inside RenderBlockFlow::adjustForUnsplittableChild.
This change forces elements that require break avoidance to have a single region
in the region range. As a result, forced breaks have no effect inside them.

It should be noted this may not the behavior defined by the CSS3 Fragmentation spec.
From my understanding of the text, forced breaks override any avoidance specified
by ancestor elements. However, implementing this is a larger change that will require
a fundamental new approach in handling break avoidance. This patch just brings
consistency to the API.

Test: fast/regions/forced-break-inside-avoid-break.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation):
(WebCore::RenderBlock::computeRegionRangeForBoxChild):
(WebCore::RenderBlock::estimateRegionRangeForBoxChild):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustForUnsplittableChild): Move the avoidance conditions inside
a helper method RenderBlock::childBoxIsUnsplittableForFragmentation.

LayoutTests:

The test verifies that elements specifying break-inside: avoid can't
be splitted by forced breaks applied inside of them.

* fast/regions/forced-break-inside-avoid-break-expected.txt: Added.
* fast/regions/forced-break-inside-avoid-break.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[l10n] Updated Polish translation of WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=130334

Patch by Piotr Drąg <piotrdrag@gmail.com> on 2014-03-19
Reviewed by Gustavo Noronha Silva.

* pl.po: updated.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rewrite WebHTMLConverter::_colorForNode in C++
https://bugs.webkit.org/show_bug.cgi?id=130443

Patch by Sam Weinig <sam@webkit.org> on 2014-03-19
Reviewed by Andreas Kling.

* platform/mac/HTMLConverter.mm:
(_platformColor):
Rename from _colorForRGBColor and simplify to just do the platform conversion.

(normalizedColor):
Extract normalization out of _colorForRGBColor and remove cases that are impossible to hit
due to us only ever using the device color space.

(HTMLConverterCaches::colorPropertyValueForNode):
(-[WebHTMLConverter _colorForNode:property:]):
Convert to C++.

(-[WebHTMLConverter dealloc]):
(-[WebHTMLConverter init]):
Remove caches, we already cache in ColorMac.

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