[BlackBerry] Removing the totalusage variable in ChromeClientBB::exceededDatabaseQuota
https://bugs.webkit.org/show_bug.cgi?id=106370

Patch by Otto Derek Cheung <otcheung@rim.com> on 2013-01-08
Reviewed by Yong Li.

Removing totalUsage in ChromeClientBlackBerry as we no longer use that variable.

* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::exceededDatabaseQuota):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Remove transitional #defines from WebKit API headers
https://bugs.webkit.org/show_bug.cgi?id=106381

Patch by James Robinson <jamesr@chromium.org> on 2013-01-08
Reviewed by Adam Barth.

Source/Platform:

* chromium/public/WebGraphicsContext3D.h:

Source/WebKit/chromium:

* public/WebWidget.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Shadow DOM] Distribution related code on ShadowRoot should be minimized.
https://bugs.webkit.org/show_bug.cgi?id=106282

Reviewed by Dimitri Glazkov.

.:

* Source/autotools/symbols.filter:

Source/WebCore:

ShadowRoot had a certain amount of logic which is dedicated for
node distribution computation.  These code is going to be compiled
out (Bug 103339) and better be part of the node distribution
algorithm, which is ScopeContentDistribution class.

This change

- Renames ShadowRootContentDistributionData to
  ScopeContentDistribution.  New name is concise and a bit more
  meaningful: It owns per TreeScope distribution state.
- Moves distribution related code from ShadowRoot to ScopeContentDistribution

No new tests. Refactoring.

* WebCore.exp.in:
* css/StyleScopeResolver.cpp:
(WebCore::StyleScopeResolver::styleSharingCandidateMatchesHostRules):
(WebCore::StyleScopeResolver::matchHostRules):
* dom/ComposedShadowTreeWalker.cpp:
(WebCore::nodeCanBeDistributed):
(WebCore::ComposedShadowTreeWalker::traverseBackToYoungerShadowRoot):
(WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost):
(WebCore::AncestorChainWalker::parent):
* dom/ElementShadow.cpp:
(WebCore::ElementShadow::collectSelectFeatureSetFrom):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::insertedInto):
(WebCore::ShadowRoot::removedFrom):
(WebCore::ShadowRoot::ensureScopeDistribution):
(WebCore::ShadowRoot::reportMemoryUsage):
* dom/ShadowRoot.h:
(WebCore):
(ShadowRoot):
(WebCore::ShadowRoot::scopeDistribution):
* html/shadow/ContentDistributor.cpp:
(WebCore::ScopeContentDistribution::ScopeContentDistribution):
(WebCore::ScopeContentDistribution::invalidateInsertionPointList):
(WebCore::ScopeContentDistribution::ensureInsertionPointList):
(WebCore::ScopeContentDistribution::registerInsertionPoint):
(WebCore::ScopeContentDistribution::unregisterInsertionPoint):
(WebCore::ScopeContentDistribution::hasShadowElement):
(WebCore):
(WebCore::ScopeContentDistribution::hasContentElement):
(WebCore::ScopeContentDistribution::countElementShadow):
(WebCore::ScopeContentDistribution::hasInsertionPoint):
(WebCore::ScopeContentDistribution::assignedTo):
(WebCore::ContentDistributor::distribute):
(WebCore::ContentDistributor::invalidate):
* html/shadow/ContentDistributor.h:
(ScopeContentDistribution):
(WebCore::ScopeContentDistribution::registerElementShadow):
(WebCore::ScopeContentDistribution::unregisterElementShadow):
(WebCore::ScopeContentDistribution::hasElementShadow):
* html/shadow/HTMLShadowElement.cpp:
(WebCore::HTMLShadowElement::olderShadowRoot):
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::insertedInto):
(WebCore::InsertionPoint::removedFrom):
(WebCore::InsertionPoint::contains):
(WebCore):
(WebCore::resolveReprojection):
* html/shadow/InsertionPoint.h:
(InsertionPoint):
(WebCore):
* testing/Internals.cpp:
(WebCore::Internals::hasShadowInsertionPoint):
(WebCore::Internals::hasContentElement):
(WebCore::Internals::countElementShadow):

Source/WebKit/win:

* WebKit.vcproj/WebKit.def.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add myself as a watcher for Web Geolocation

Unreviewed.

* Scripts/webkitpy/common/config/watchlist:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add an Autoconf macro that checks whether a given feature is enabled
https://bugs.webkit.org/show_bug.cgi?id=106380

Reviewed by Martin Robinson.

Add the AC_CHECK_WEBKIT_FEATURE_ENABLED macro. It checks the generated
Source/WebCore/GNUmakefile.features.am file to determine whether the
given feature is enabled or disabled in the build that's being configured.

* Source/autotools/webkitfeature.m4: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, marking drag-and-drop-autoscroll.html

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[HTMLTemplateElement] Allow <template> content to be inspected
https://bugs.webkit.org/show_bug.cgi?id=105839

Reviewed by Pavel Feldman.

In addition to the plumbing which allows template contents to be
displayed within the inspector, this patch adds a manually-managed
weakref from the template document back to its host document (typically
the creator). This is required so that the inspector agent can be found
for template elements.

* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::templateDocument):
* dom/Document.h:
(Document):
(WebCore::Document::setTemplateDocumentHost):
(WebCore::Document::templateDocumentHost):
* editing/markup.cpp:
(WebCore::createFragmentForInnerOuterHTML):
* html/HTMLTemplateElement.cpp:
(WebCore::HTMLTemplateElement::content):
* inspector/Inspector.json:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::instrumentingAgentsForDocument):
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode):
(WebInspector.DOMNode.prototype.hasChildNodes):
(WebInspector.DOMNode.prototype._insertChild):
(WebInspector.DOMNode.prototype._setChildrenPayload):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unbreak the world.

* WebProcess/com.apple.WebProcess.sb.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] WebGL test cases are sometimes crashing
https://bugs.webkit.org/show_bug.cgi?id=104506

Unreviewed gardening.

Enable webgl tests that are passing after recent changes.

Patch by Viatcheslav Ostapenko <sl.ostapenko@samsung.com> on 2013-01-08

* platform/efl/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Merge getLineAtIndex into RenderBlock::lineAtIndex
https://bugs.webkit.org/show_bug.cgi?id=106379

Reviewed by Eric Seidel.

getLineAtIndex can be merged into lineAtIndex, which was it's only caller.

No new tests, just refactoring.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::lineAtIndex):
(WebCore::RenderBlock::lineCount):
* rendering/RenderBlock.h:
(RenderBlock):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG shouldn't treat the 'this' argument as being captured if a code block uses arguments
https://bugs.webkit.org/show_bug.cgi?id=106398
<rdar://problem/12439776>

Source/JavaScriptCore: 

Reviewed by Mark Hahnenberg.
        
This is a possible optimization for inlined calls, and fixes crashes for inlined constructors, in the case
that the inlined code used arguments. The problem was that assuming that 'this' was captured implies the
assumption that it was initialized by the caller, which is wrong for constructors and this.
        
Also added a pretty essential DFG IR validation rule: we shouldn't have any live locals at the top of the
root block. This helps to catch this bug: our assumption that 'this' was captured in an inlined constructor
that used arguments led to liveness for the temporary that would have held 'this' in the caller being
propagated all the way up to the entrypoint of the function.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::isCaptured):
* dfg/DFGValidate.cpp:
(JSC::DFG::Validate::validate):
(JSC::DFG::Validate::reportValidationContext):
(Validate):
(JSC::DFG::Validate::dumpGraphIfAppropriate):

LayoutTests: 

Reviewed by Mark Hahnenberg.

* fast/js/dfg-inline-constructor-that-uses-arguments-expected.txt: Added.
* fast/js/dfg-inline-constructor-that-uses-arguments.html: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/dfg-inline-constructor-that-uses-arguments.js: Added.
(Foo):
(bar):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Color bleeding with rounded rectangles on high dpi displays
https://bugs.webkit.org/show_bug.cgi?id=106373

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/backgrounds/gradient-background-leakage-hidpi.html

Avoid using the BackgroundBleedShrinkBackground draw strategy for
RenderBox when border width is less than two layout units. This
is because rounded rectangles are always snapped to integer layout
coordinates, even with subpixel layout enabled.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::determineBackgroundBleedAvoidance):

LayoutTests:

New layout test to verify that rounded rectangle corners do not
produce color bleeding on high dpi devices.

* fast/backgrounds/gradient-background-leakage-hidpi-expected.txt: Added.
* fast/backgrounds/gradient-background-leakage-hidpi.html: Added.
* platform/chromium-linux/fast/backgrounds/gradient-background-leakage-hidpi-expected.png: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139137 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unused GraphicsContext::addInnerRoundedRectClip()
https://bugs.webkit.org/show_bug.cgi?id=106376

Reviewed by Andreas Kling.

Since there don't seem to be any users left for it, remove addInnerRoundedRectClip().

No new tests: no functional changes.

* platform/graphics/GraphicsContext.h:
(GraphicsContext):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
* platform/graphics/cg/GraphicsContextCG.cpp:
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
* platform/graphics/qt/GraphicsContextQt.cpp:
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
* platform/graphics/wx/GraphicsContextWx.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Hiding popups on mouse wheel should be handled by WebViewImpl
https://bugs.webkit.org/show_bug.cgi?id=106312

Reviewed by Kent Tamura.

We had to removed the code that closed popups on mouse wheel events from
content::RenderWidgetHostViewMac because it no longer had access to
child popups. WebViewImpl will hide the popups on mouse wheel events so
we can maintain the same behavior.

https://src.chromium.org/viewvc/chrome?view=rev&revision=175488

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleMouseWheel): Overriding so we can hide popups.
(WebKit):
* src/WebViewImpl.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139139 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKitTestRunner needs support for setHandlesAuthenticationChallenges
https://bugs.webkit.org/show_bug.cgi?id=103653

Reviewed by Anders Carlsson.

Tools:

Implement setHandlesAuthenticationChallenges in the UIProcess by sending credentials
and the enabled boolean to the UIProcess and then implementing the didReceiveAuthenticationChallengeInFrame
client callback.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Exposed the new TestRunner
methods to the JavaScript API.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setHandlesAuthenticationChallenges): Added this callback for the JavaScript API.
(WTR::TestRunner::setAuthenticationUsername): Ditto.
(WTR::TestRunner::setAuthenticationPassword): Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner): Added new declarations for the above.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions): Hook up the new didReceiveSynchronousMessageFromInjectedBundle
callback.
(WTR::TestController::resetStateToConsistentValues): Reset the credentials and enabled boolean between tests.
(WTR::TestController::didReceiveAuthenticationChallengeInFrame): Handle the callback by using
the authentication information passed from the InjectedBundle.
* WebKitTestRunner/TestController.h:
(WTR::TestController::setHandlesAuthenticationChallenges): Added setter to allow TestInvocation
to communicate with the TestController.
(WTR::TestController::setAuthenticationUsername): Ditto.
(WTR::TestController::setAuthenticationPassword): Ditto.
(TestController):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Handle the messages sending authentication
information from the InjectedBundle.
(WTR::TestInvocation::outputText): Added this method so that the TestController can output
text to the TestInvocation text output.
* WebKitTestRunner/TestInvocation.h:
(TestInvocation): Added declaration for new method.

LayoutTests:

Unskip authentication tests which are now passing.

* platform/wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove dependency on Document from HTMLConstructionSite::inQuirksMode()
https://bugs.webkit.org/show_bug.cgi?id=106375

Reviewed by Adam Barth.

This is another step towards removing main thread object dependencies
from the parser.

No new tests because no new functionality.

* dom/Document.h:
* html/HTMLDocument.cpp:
* html/HTMLDocument.h:
(HTMLDocument):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::HTMLConstructionSite):
(WebCore::HTMLConstructionSite::setDefaultCompatibilityMode):
(WebCore):
(WebCore::HTMLConstructionSite::setCompatibilityMode):
(WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype):
(WebCore::HTMLConstructionSite::insertDoctype):
(WebCore::HTMLConstructionSite::inQuirksMode):
* html/parser/HTMLConstructionSite.h:
(HTMLConstructionSite):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make WebGLRenderingContext inherit from ActiveDOMObject
https://bugs.webkit.org/show_bug.cgi?id=104733

Patch by Brandon Jones <bajones@chromium.org> on 2013-01-08
Reviewed by Adam Barth.

Source/WebCore:

When ActiveDOMObject::stop is called on the WebGLRenderingContext the
DrawingBuffer and GraphicsContext3D instances are forcibly released in
order to keep GPU memory utilization to a minimum.

Incorporated new layout test based on one just added to the WebGL
conformance suite. Also tested manually by reloading and
navigating between many WebGL apps.

Test: fast/canvas/webgl/context-release-upon-reload.html

* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::getContextCallback):
    Removed garbage collection hack added in Bug 76255.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::create):
    Call suspendIfNeeded per ActiveDOMObject contract.
(WebCore::WebGLRenderingContext::WebGLRenderingContext):
    Call ActiveDOMObject constructor.
(WebCore::WebGLRenderingContext::~WebGLRenderingContext):
    Call destroyGraphicsContext3D.
(WebCore::WebGLRenderingContext::destroyGraphicsContext3D):
    Drop DrawingBuffer backing store and delete GraphicsContext3D.
(WebCore::WebGLRenderingContext::hasPendingActivity):
    Always return false.
(WebCore::WebGLRenderingContext::stop):
    Force lost context upon page reload or navigation.
* html/canvas/WebGLRenderingContext.h:
(WebGLRenderingContext):
    Inherit from ActiveDOMObject and override notifications.
* platform/graphics/blackberry/DrawingBufferBlackBerry.cpp:
(WebCore):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Add currently no-op implementation.
* platform/graphics/cairo/DrawingBufferCairo.cpp:
(WebCore):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Add currently no-op implementation.
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBufferPrivate::clearTextureId):
    Clear texture ID from compositor's layer.
(DrawingBufferPrivate):
(WebCore::DrawingBuffer::framebuffer):
    Moved around to reduce number of #ifdefs.
(WebCore):
(WebCore::DrawingBuffer::platformLayer):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Tell compositor to stop referencing DrawingBuffer's texture.
* platform/graphics/clutter/DrawingBufferClutter.cpp:
(WebCore):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Add currently no-op implementation.
* platform/graphics/gpu/DrawingBuffer.cpp:
(WebCore::DrawingBuffer::clear):
    Call clearPlatformLayer before deleting OpenGL resources.
* platform/graphics/gpu/DrawingBuffer.h:
(DrawingBuffer):
    Add clearPlatformLayer.
* platform/graphics/gpu/mac/DrawingBufferMac.mm:
(WebCore):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Add currently no-op implementation.
* platform/graphics/gpu/qt/DrawingBufferQt.cpp:
(WebCore):
(WebCore::DrawingBuffer::clearPlatformLayer):
    Add currently no-op implementation.

LayoutTests:

* fast/canvas/webgl/context-release-upon-reload-expected.txt: Added.
* fast/canvas/webgl/context-release-upon-reload.html: Added.
* fast/canvas/webgl/resources/context-release-upon-reload-child.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Provide LevelDB with IDBEnv instead of Env::Default
https://bugs.webkit.org/show_bug.cgi?id=106135

Reviewed by Tony Chang.

IDBEnv only changes the name of the histogram where errors are logged.

* platform/leveldb/LevelDBDatabase.cpp:
(WebCore::LevelDBDatabase::open):
(WebCore::LevelDBDatabase::openInMemory):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CanvasRenderingContext2D::setFont argument may reference destroyed object
https://bugs.webkit.org/show_bug.cgi?id=106385

Reviewed by Abhishek Arya.

No new tests: covered by fast/canvas/canvas-measureText.html

This is a re-write of r138994.  Fixing bug in setFont instead of
workaround at call site.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
(WebCore::CanvasRenderingContext2D::accessFont):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support op_typeof in the DFG
https://bugs.webkit.org/show_bug.cgi?id=98898

Reviewed by Filip Pizlo.

Adds a TypeOf node to the DFG to support op_typeof.

To avoid adding too much GC horror, this also makes the
common strings portion of the SmallString cache strongly
referenced.

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):
  We try to determine the result early here, and substitute in a constant.
  Otherwise we leave the node intact, and set the result type to SpecString.
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
  Parse op_typeof
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):
  TypeOf nodes can be subjected to pure CSE
* dfg/DFGCapabilities.h:
(JSC::DFG::canCompileOpcode):
  We can handle typeof.
* dfg/DFGNodeType.h:
(DFG):
  Define the node.
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
  Add operationTypeOf to support the non-trivial cases.
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
  Actual codegen
* runtime/Operations.cpp:
(JSC::jsTypeStringForValue):
(JSC):
* runtime/Operations.h:
(JSC):
  Some refactoring to allow us to get the type string for an
  object without needing a callframe.

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