[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