[chromium] Use CCTexture/TextureAllocator and remove TextureManager
https://bugs.webkit.org/show_bug.cgi?id=91001

Patch by Eric Penner <epenner@google.com> on 2012-07-12
Reviewed by Adrienne Walker.

Source/WebCore:

Use CCTexture to clean up CCPrioritizedTexture::Backing.
Add TextureAllocator.h and remove remainder of TextureManager.h/cpp.
Minor move/refactoring of link/unlink in CCPrioritizedTexture.
Remove double initialization of the default memory limit.

Covered by existing tests (refactoring).

* WebCore.gypi:
* platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp:
* platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
(WebCore):
* platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:
* platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
(WebCore):
* platform/graphics/chromium/ImageLayerChromium.cpp:
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::initialize):
* platform/graphics/chromium/ManagedTexture.cpp: Removed.
* platform/graphics/chromium/ManagedTexture.h: Removed.
* platform/graphics/chromium/RenderSurfaceChromium.h:
(WebCore):
* platform/graphics/chromium/TextureAllocator.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h.
(WebCore):
(TextureAllocator):
(WebCore::TextureAllocator::~TextureAllocator):
* platform/graphics/chromium/TextureManager.cpp: Removed.
* platform/graphics/chromium/TextureManager.h: Removed.
* platform/graphics/chromium/TiledLayerChromium.cpp:
* platform/graphics/chromium/TrackingTextureAllocator.cpp:
(WebCore::TrackingTextureAllocator::createTexture):
(WebCore::TrackingTextureAllocator::deleteTexture):
* platform/graphics/chromium/TrackingTextureAllocator.h:
* platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::prioritizeTextures):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
* platform/graphics/chromium/cc/CCPrioritizedTexture.cpp:
(WebCore::CCPrioritizedTexture::CCPrioritizedTexture):
(WebCore::CCPrioritizedTexture::setDimensions):
(WebCore::CCPrioritizedTexture::textureId):
(WebCore::CCPrioritizedTexture::bindTexture):
(WebCore::CCPrioritizedTexture::framebufferTexture2D):
(WebCore::CCPrioritizedTexture::link):
(WebCore):
(WebCore::CCPrioritizedTexture::unlink):
* platform/graphics/chromium/cc/CCPrioritizedTexture.h:
(WebCore):
(WebCore::CCPrioritizedTexture::bytes):
(CCPrioritizedTexture):
(WebCore::CCPrioritizedTexture::haveBackingTexture):
(WebCore::CCPrioritizedTexture::Backing::Backing):
(WebCore::CCPrioritizedTexture::Backing::~Backing):
(WebCore::CCPrioritizedTexture::Backing::owner):
(Backing):
(WebCore::CCPrioritizedTexture::backing):
* platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp:
(WebCore::CCPrioritizedTextureManager::prioritizeTextures):
(WebCore::CCPrioritizedTextureManager::requestLate):
(WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded):
(WebCore::CCPrioritizedTextureManager::reduceMemory):
(WebCore::CCPrioritizedTextureManager::clearAllMemory):
(WebCore::CCPrioritizedTextureManager::registerTexture):
(WebCore::CCPrioritizedTextureManager::returnBackingTexture):
(WebCore::CCPrioritizedTextureManager::createBacking):
(WebCore::CCPrioritizedTextureManager::destroyBacking):
(WebCore::CCPrioritizedTextureManager::assertInvariants):
* platform/graphics/chromium/cc/CCPrioritizedTextureManager.h:
(CCPrioritizedTextureManager):
(WebCore::CCPrioritizedTextureManager::defaultMemoryAllocationLimit):
(WebCore::CCPrioritizedTextureManager::compareBackings):
* platform/graphics/chromium/cc/CCPriorityCalculator.h:
* platform/graphics/chromium/cc/CCScopedTexture.cpp:
* platform/graphics/chromium/cc/CCScopedTexture.h:
* platform/graphics/chromium/cc/CCTexture.h:
(WebCore::CCTexture::CCTexture):
* platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
(WebCore):
* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:

Source/WebKit/chromium:

Deleting old texture manager tests.

* WebKit.gypi:
* tests/CCLayerTreeHostImplTest.cpp:
* tests/CCPrioritizedTextureTest.cpp:
(WTF::CCPrioritizedTextureTest::texturesMemorySize):
* tests/CCThreadedTest.cpp:
* tests/CCTiledLayerTestCommon.h:
* tests/Canvas2DLayerBridgeTest.cpp:
* tests/TextureManagerTest.cpp: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Increase the drawing performance by merging dirty rects.
https://bugs.webkit.org/show_bug.cgi?id=91075

Patch by Huang Dongsung <luxtella@company100.net> on 2012-07-12
Reviewed by Noam Rosenthal.

QWebFramePrivate calls FrameView::paintContents as many as the number of dirty
rects, so it causes too many redundant render tree traversals.
I changed it to merge dirty rects and call FrameView::paintContents only once.
The algorithm to merge rects is copied from GTK.

When parallel image decoders are in use, each image is independently repainted
when decoding is finished. This creates a lot by repaint requests. So by merging
these repaint requests, I could improve rendering performance.

For example, I tested parallel image decoders on the locally mirrored Pinterest site.
QWebFramePrivate called FrameView::paintContents 165 times after parallel image
decoders decoded all the images. It took about 120ms on my six-core Intel Xeon machine.
This patch decreases painting time from 120ms to 30ms.

* Api/qwebframe.cpp:
(coalesceRectsIfPossible):
(QWebFramePrivate::renderRelativeCoords):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122507 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implied minimum size of flex items is min-content
https://bugs.webkit.org/show_bug.cgi?id=87546

Reviewed by Tony Chang.

Source/WebCore:

http://dev.w3.org/csswg/css3-flexbox/#min-size-auto
In the main axis direction, min-size of auto means min-content.

Test: css3/flexbox/flex-item-min-size.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegionUsing):
(WebCore::RenderBox::computeContentLogicalHeightUsing):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::RenderBox::computePositionedLogicalHeightUsing):
It turned out that these FIXMEs are all unnecessary with the changes to RenderFlexibleBox.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
(WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):

LayoutTests:

Mostly just set min-height/min-width:0 as appropriate to keep the tests testing
what the used to be testing. I made sure that each rendering was correct before
making the changes. In a couple cases, I changed expectations where I thought
the test was still testing was it was intending to test.

* css3/flexbox/child-overflow.html:
* css3/flexbox/columns-auto-size.html:
* css3/flexbox/cross-axis-scrollbar.html:
* css3/flexbox/flex-item-min-size-expected.txt: Added.
* css3/flexbox/flex-item-min-size.html: Added.
* css3/flexbox/flexitem.html:
* css3/flexbox/line-wrapping.html:
* css3/flexbox/perpendicular-writing-modes-inside-flex-item.html:
* css3/flexbox/repaint-rtl-column.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122508 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Regression (r122359) Layout Test html5lib/runner.html is failing
https://bugs.webkit.org/show_bug.cgi?id=91047

Reviewed by Tony Chang.

Source/WebCore: 

This ASSERT is bogus because doctypes can be removed from the DOM and
then re-added.

Test: fast/viewport/viewport-legacy-xhtmlmp-remove-and-add.html

* dom/Document.cpp:
(WebCore::Document::setDocType):

LayoutTests: 

Add a test that shows what happens when a doctype gets added and
removed.

* fast/viewport/viewport-legacy-xhtmlmp-remove-and-add-expected.txt: Added.
* fast/viewport/viewport-legacy-xhtmlmp-remove-and-add.html: Added.
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Delete another empty directory.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122510 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] The root layer should not try create a second RenderSurface for itself
https://bugs.webkit.org/show_bug.cgi?id=91124

Reviewed by Adrienne Walker.

Source/WebCore:

Tests: CCLayerTreeHostImplTest.rootLayerDoesntCreateExtraSurface

* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::subtreeShouldRenderToSeparateSurface):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Port the test framework to WebKit 2
https://bugs.webkit.org/show_bug.cgi?id=90606

Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-07-12
Reviewed by Kenneth Rohde Christiansen.

This port of EFL's WebKit 1 test framework uses a more gtest-ish
way of writing tests and it is based on a test fixture that loads a
page synchronously as convenience (if needed). This base fixture can be
easily extended by just inheriting from it.

* PlatformEfl.cmake:
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: Added.
(EWK2UnitTest):
(EWK2UnitTest::onLoadProgress):
(EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase):
(EWK2UnitTest::EWK2UnitTestBase::SetUp):
(EWK2UnitTest::EWK2UnitTestBase::TearDown):
(EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: Added.
(EWK2UnitTest):
(EWK2UnitTestBase):
(EWK2UnitTest::EWK2UnitTestBase::setLoadProgress):
(EWK2UnitTest::EWK2UnitTestBase::webView):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.cpp: Added.
(EWK2UnitTest):
(EWK2UnitTest::EWK2UnitTestEnvironment::EWK2UnitTestEnvironment):
(EWK2UnitTest::EWK2UnitTestEnvironment::defaultTestPageUrl):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h: Added.
(EWK2UnitTest):
(EWK2UnitTestEnvironment):
(EWK2UnitTest::EWK2UnitTestEnvironment::useX11Window):
(EWK2UnitTest::EWK2UnitTestEnvironment::defaultWidth):
(EWK2UnitTest::EWK2UnitTestEnvironment::defaultHeight):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp: Added.
(parseArguments):
(main):
* UIProcess/API/efl/tests/resources/default_test_page.html: Added.
* UIProcess/API/efl/tests/test_ewk2_view.cpp: Added.
(TEST_F):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
webkitpy: rename manager_worker_broker to message_pool
https://bugs.webkit.org/show_bug.cgi?id=91145

Reviewed by Ojan Vafai.

Since the MessagePool interface is more generic (and simpler)
now and will be reused by test-webkitpy, I'm renaming it and
moving it to webkitpy.common.

* Scripts/webkitpy/common/message_pool.py: Renamed from Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py.
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(TestRunInterruptedException.__reduce__):
(Manager._run_tests.worker_factory):
(Manager._run_tests):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
rebaseline fast/harness/results.html after r122505.

Unreviewed, expectations change.

* fast/harness/results-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers
https://bugs.webkit.org/show_bug.cgi?id=90310

Reviewed by Tony Chang.

Source/WebCore:

Simplify Document vs. Worker logic for IDBFactory::open() and hook up the
other two IDBFactory methods for use by workers as well.

Test: storage/indexeddb/factory-basics-workers.html

* Modules/indexeddb/IDBFactory.cpp:
(isContextValid): Helper function consolidating checks that context is usable.
(getIndexedDBDatabasePath): Helper function for accessing group settings.
(WebCore::IDBFactory::getDatabaseNames): Simplify - just pass context through to back end.
(WebCore::IDBFactory::open): Ditto.
(WebCore::IDBFactory::deleteDatabase): Ditto.
(WebCore::IDBFactory::cmp): Whitespace.
* Modules/indexeddb/IDBFactoryBackendImpl.cpp: Obsolete openFromWorker() removed.
(WebCore::IDBFactoryBackendImpl::getDatabaseNames): Signature updated.
(WebCore::IDBFactoryBackendImpl::deleteDatabase): Signature updated.
(WebCore::IDBFactoryBackendImpl::open): Signature updated.
* Modules/indexeddb/IDBFactoryBackendImpl.h:
(IDBFactoryBackendImpl):
* Modules/indexeddb/IDBFactoryBackendInterface.h: Interface methods now take both SecurityOrigin
and ScriptExecutionContext, but not Frame. In the proxy, SecurityOrigin is redundant (can be
accessed from context) but on the real back end the context is null (as Frame was previously).
(IDBFactoryBackendInterface):
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore):
(WebCore::InspectorIndexedDBAgent::requestDatabaseNamesForFrame):
(WebCore::InspectorIndexedDBAgent::requestDatabase):
(WebCore::InspectorIndexedDBAgent::requestData):

Source/WebKit/chromium:

* src/IDBFactoryBackendProxy.cpp:
(WebKit::IDBFactoryBackendProxy::allowIndexedDB): Consolidates user-prompting logic.
(WebKit::getWebFrame): Helper to dig out frame from Document, or null for Worker.
(WebKit::IDBFactoryBackendProxy::getDatabaseNames):
(WebKit):
(WebKit::IDBFactoryBackendProxy::open):
(WebKit::IDBFactoryBackendProxy::deleteDatabase):
* src/IDBFactoryBackendProxy.h: Update method signatures to match interface.
(WebCore):
(IDBFactoryBackendProxy):

LayoutTests:

* storage/indexeddb/factory-basics-workers-expected.txt: Added.
* storage/indexeddb/factory-basics-workers.html: Added.
* storage/indexeddb/resources/factory-basics.js: Allow use by Worker as well as Window.
(getDatabaseNamesSuccess1):
(openSuccess):
(getDatabaseNamesSuccess2):
(getDatabaseNamesSuccess3):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Row size/position is wrongly calculated when table having overlapping rowspan cell and colspan cell
https://bugs.webkit.org/show_bug.cgi?id=16811

Patch by Pravin D <pravind.2k4@gmail.com> on 2012-07-12
Reviewed by Julien Chaffraix.

Source/WebCore:

The height of a row is calculated by taking the max height of the cells contained in it. When a row contains
a rowSpan cell and if this row is not the last row of the cell, then its height is max height of other non
rowSpan cells. If the row is the last row of the rowSpan cell, then using the contraint laid by CSS2.1 spec
"For a rowSpan cell, the sum of the row heights involved must be great enough to encompass the cell spanning the rows",
the last remaining height of the rowSpan(cell height minus heights of other involved rows) is taken into consideration
while calculating the height of this row.
Currently when calculating the height of the row we are only using the height of the primary cell at position (row, col).
However when a row has colSpan cell and rowSpan, they might overlap. In such a sitution as only the primary cells height
is considered, the height of the row will be calculated worngly if the other overlapping cell has greater height.
Thus all the overlapping cell at position (row, col) must be considered while calculating the height of a row.

Test: fast/table/last-cell-of-rowspan-overlapping-colspan-cell.html

* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):
Fixed function to use all the overlapping cells at position(row, col) to calculate the height/position of rows.

LayoutTests:

* fast/table/last-cell-of-rowspan-overlapping-colspan-cell-expected.html: Added.
* fast/table/last-cell-of-rowspan-overlapping-colspan-cell.html: Added.

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