[BlackBerry] Change the call to setUserScalable to use the setting.
https://bugs.webkit.org/show_bug.cgi?id=93974

Reviewed by Rob Buis.

We should be using the WebSetting and not the current value of m_userScalable.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::recomputeVirtualViewportFromViewportArguments):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Double-tap zoom on blocks on cnn.com desktop page doesn't work
https://bugs.webkit.org/show_bug.cgi?id=93895

Reviewed by Antonio Gomes.
Patch by Jacky Jiang  <zhajiang@rim.com>

PR: 188232
When adjusting block zoom node, don't choose a node if the width of the
node size is very close to the width of the actual visible size as
block zoom can do nothing on such kind of node. This condition is more
restrictive than the one based on area and can bail out early.
In this way, we can get a better node for double-tap zoom.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::bestNodeForZoomUnderPoint):
(BlackBerry::WebKit::WebPagePrivate::adjustedBlockZoomNodeForZoomAndExpandingRatioLimits):
* Api/WebPage_p.h:
(WebPagePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix  LayoutTests/canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html
https://bugs.webkit.org/show_bug.cgi?id=92974

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-08-14
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Replace space characters by U+0020 SPACE characters in
CanvasRenderingContext2D::drawTextInternal() in order to
comply with the HTML Canvas 2D Context specification:
- http://www.w3.org/TR/2dcontext/#drawing-text-to-the-canvas

No new tests, already tested by canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::replaceCharacterInString):
(WebCore):
(WebCore::CanvasRenderingContext2D::drawTextInternal):

LayoutTests:

Unskip canvas/philip/tests/2d.text.draw.space.collapse.nonspace.html for
all the ports now that space characters are correctly replaced in
the text passed to fillText() and strokeText().

* platform/chromium/TestExpectations:
* platform/efl/Skipped:
* platform/gtk/TestExpectations:
* platform/mac/canvas/philip/tests/2d.text.draw.space.collapse.nonspace-expected.txt: Removed.
* platform/qt/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Pass URL String's 8-bit buffer directly to platform layer when possible
https://bugs.webkit.org/show_bug.cgi?id=93861

Patch by Yong Li <yoli@rim.com> on 2012-08-14
Reviewed by Rob Buis.

PR# 187605.
URL strings and HTTP header strings usually use 8-bit buffers internally. We can
just pass the buffers to platform calls when only Latin1 strings are needed.

* platform/blackberry/ReadOnlyLatin1String.h: Added.
(WebCore):
(ReadOnlyLatin1String): A utility class that uses either WTF::CString or WTF::String's 8-bit buffer.
(WebCore::ReadOnlyLatin1String::ReadOnlyLatin1String): Can only be constructed with WTF::String for now.
(WebCore::ReadOnlyLatin1String::data):
(WebCore::ReadOnlyLatin1String::length):
* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):
* platform/network/blackberry/SocketStreamHandleBlackBerry.cpp:
(WebCore::SocketStreamHandle::SocketStreamHandle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] race between CCLayerTreeHostImpl::releaseContentsTextures and CCThreadProxy::beginFrameCompleteOnImplThread
https://bugs.webkit.org/show_bug.cgi?id=93684

Reviewed by James Robinson.

This keeps track of whether we're between the beginFrame post and the
commit when releaseContentsTextures comes, and if that is the case, we
prune the texture uploads, keep the "textures purged" flag on and kick a
new commit.

Added CCLayerTreeHostTestEvictTextures test.

* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::beginFramePosted):
(WebCore):
(WebCore::CCLayerTreeHostImpl::commitComplete):
(WebCore::CCLayerTreeHostImpl::canDraw):
(WebCore::CCLayerTreeHostImpl::releaseContentsTextures):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::contentsTexturesPurged):
(WebCore::CCLayerTreeHostImpl::contentsTexturesWerePurgedSinceLastBeginFrame):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::stop):
(WebCore::CCSingleThreadProxy::commitAndComposite):
* platform/graphics/chromium/cc/CCTextureUpdateController.h:
(CCTextureUpdateController):
* platform/graphics/chromium/cc/CCTextureUpdateQueue.cpp:
(WebCore::CCTextureUpdateQueue::clearUploads):
(WebCore):
* platform/graphics/chromium/cc/CCTextureUpdateQueue.h:
(CCTextureUpdateQueue):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::scheduledActionBeginFrame):
(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
(WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSS 2.1 failure: Word-spacing affects each space and non-breaking space
https://bugs.webkit.org/show_bug.cgi?id=89826

Reviewed by Eric Seidel.

Source/WebCore:

Add word spacing to consecutive spaces in a run per http://www.w3.org/TR/CSS21/text.html#spacing-props.

Test: fast/css/word-spacing-characters.html
      fast/css/word-spacing-characters-complex-text.html
      fast/css/word-spacing-characters-linebreak.html
      css2.1/20110323/word-spacing-characters-002.htm
      css2.1/20110323/word-spacing-characters-003.htm
      css2.1/20110323/word-spacing-remove-space-001.htm
      css2.1/20110323/word-spacing-remove-space-002.htm
      css2.1/20110323/word-spacing-remove-space-003.htm
      css2.1/20110323/word-spacing-remove-space-004.htm
      css2.1/20110323/word-spacing-remove-space-005.htm
      css2.1/20110323/word-spacing-remove-space-006.htm
      css2.1/20110323/c541-word-sp-001.htm
      css2.1/20110323/c541-word-sp-000.htm

* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advance): All spaces (ordinary space or &nbsp;) get word-spacing added, even
  if they are consecutive.
* platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp:
(WebCore::HarfBuzzShaperBase::isWordEnd): ditto, but for the complex text case on Chromium. Had to use
  m_run rather than m_normalizedBuffer here as m_normalizedBuffer turns tabs into spaces! Unlike the simple
  text path, '\n' gets word-spacing - I observed this from fast/text/atsui-spacing-features.html but can't
  find it specified anywhere.
* platform/graphics/harfbuzz/HarfBuzzShaperBase.h:
(WebCore::HarfBuzzShaperBase::isCodepointSpace):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Tested by word-spacing-linebreak.html

LayoutTests:

* css2.1/20110323/c541-word-sp-000-expected.html: Added.
* css2.1/20110323/c541-word-sp-000.htm: Renamed from LayoutTests/css2.1/t1604-c541-word-sp-00-b-a.html.
* css2.1/20110323/c541-word-sp-001-expected.html: Added.
* css2.1/20110323/c541-word-sp-001.htm: Added.
  Replaces t1604-c541-word-sp-01-b-a.html below.
* css2.1/20110323/word-spacing-characters-002-expected.html: Added.
* css2.1/20110323/word-spacing-characters-002.htm: Added.
* css2.1/20110323/word-spacing-characters-003-expected.html: Added.
* css2.1/20110323/word-spacing-characters-003.htm: Added.
  These passed already.
* css2.1/20110323/word-spacing-remove-space-001-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-001.htm: Added.
* css2.1/20110323/word-spacing-remove-space-002-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-002.htm: Added.
* css2.1/20110323/word-spacing-remove-space-003-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-003.htm: Added.
* css2.1/20110323/word-spacing-remove-space-004-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-004.htm: Added.
* css2.1/20110323/word-spacing-remove-space-005-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-005.htm: Added.
* css2.1/20110323/word-spacing-remove-space-006-expected.html: Added.
* css2.1/20110323/word-spacing-remove-space-006.htm: Added.
  These 6 tests are fixed by this patch.
* css2.1/t1604-c541-word-sp-01-b-a.html: Removed.
  Per http://lists.w3.org/Archives/Public/public-css-testsuite/2010Jan/0029.html t1604-c541-word-sp-01-b-a.htm is
  now invalid and has been replaced by c541-word-sp-001.htm above.
* fast/css/word-spacing-characters-complex-text-expected.html: Added.
* fast/css/word-spacing-characters-complex-text.html: Added.
  This is a complex text version of word-spacing-characters-001.htm
* fast/css/word-spacing-characters-expected.html: Added.
* fast/css/word-spacing-characters.html: Added.
  The original test (word-spacing-characters-001.htm) has two spaces between the non-breaking spaces in the second last case.
  This causes WebKit to split the text into two-runs and drop the second of the two spaces. This entire test can be replaced
  with word-spacing-characters-001.htm from the css test suite when https://bugs.webkit.org/show_bug.cgi?id=89827 is fixed.
* fast/css/word-spacing-linebreak-expected.html: Added.
* fast/css/word-spacing-linebreak.html: Added.
* platform/chromium-linux/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/chromium-linux/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/chromium-linux/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/chromium-linux/fast/css/word-space-extra-expected.png:
* platform/chromium-mac-snowleopard/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/chromium-mac-snowleopard/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/chromium-mac/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/chromium-mac/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/chromium-win/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/chromium-win/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/chromium-win/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/chromium-win/css2.1/t1604-c541-word-sp-01-b-a-expected.txt: Removed.
* platform/chromium-win/fast/css/word-space-extra-expected.txt:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/efl/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/efl/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/efl/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/efl/css2.1/t1604-c541-word-sp-01-b-a-expected.txt: Removed.
* platform/gtk/TestExpectations:
* platform/gtk/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/gtk/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/gtk/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/gtk/css2.1/t1604-c541-word-sp-01-b-a-expected.txt: Removed.
* platform/mac/TestExpectations:
* platform/mac/css2.1/t1604-c541-word-sp-00-b-a-expected.png: Removed.
* platform/mac/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/mac/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/mac/css2.1/t1604-c541-word-sp-01-b-a-expected.txt: Removed.
* platform/qt/TestExpectations:
* platform/qt/css2.1/t1604-c541-word-sp-00-b-a-expected.txt: Removed.
* platform/qt/css2.1/t1604-c541-word-sp-01-b-a-expected.png: Removed.
* platform/qt/css2.1/t1604-c541-word-sp-01-b-a-expected.txt: Removed.
* platform/win/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Plumb through EXT_debug_marker entry points
https://bugs.webkit.org/show_bug.cgi?id=93860

Patch by Gregg Tavares <gman@google.com> on 2012-08-14
Reviewed by Kenneth Russell.

Source/Platform:

insertEventMarkerEXT, pushGroupMarkerEXT, popGroupMarkerEXT are
all entry points exposed by the OpenGL ES EXT_debug_marker
extension.

* chromium/public/WebGraphicsContext3D.h:
(WebGraphicsContext3D):
(WebKit::WebGraphicsContext3D::insertEventMarkerEXT):
(WebKit::WebGraphicsContext3D::pushGroupMarkerEXT):
(WebKit::WebGraphicsContext3D::popGroupMarkerEXT):

Source/WebCore:

insertEventMarkerEXT, pushGroupMarkerEXT, popGroupMarkerEXT,
are all entry points exposed by the OpenGL ES
EXT_debug_marker extension

No new tests as no new functionality exposed to web.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::create):
* platform/chromium/support/Extensions3DChromium.cpp:
(WebCore::Extensions3DChromium::insertEventMarkerEXT):
(WebCore):
(WebCore::Extensions3DChromium::pushGroupMarkerEXT):
(WebCore::Extensions3DChromium::popGroupMarkerEXT):
* platform/graphics/Extensions3D.h:
(Extensions3D):
* platform/graphics/chromium/Extensions3DChromium.h:
(Extensions3DChromium):
* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::insertEventMarkerEXT):
(WebCore):
(WebCore::Extensions3DOpenGL::pushGroupMarkerEXT):
(WebCore::Extensions3DOpenGL::popGroupMarkerEXT):
* platform/graphics/opengl/Extensions3DOpenGL.h:
(Extensions3DOpenGL):
* platform/graphics/opengl/Extensions3DOpenGLES.cpp:
(WebCore::Extensions3DOpenGLES::insertEventMarkerEXT):
(WebCore):
(WebCore::Extensions3DOpenGLES::pushGroupMarkerEXT):
(WebCore::Extensions3DOpenGLES::popGroupMarkerEXT):
* platform/graphics/opengl/Extensions3DOpenGLES.h:
(Extensions3DOpenGLES):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Add a test to WebFrameTest for selectRange and visiblePositionForWindowPoint.
https://bugs.webkit.org/show_bug.cgi?id=93108

Patch by Iain Merrick <husky@chromium.org> on 2012-08-14
Reviewed by Adam Barth.

Adds a new test WebFrameTest.SelectRange. This tests WebFrameImpl::selectRange,
and also serves to test WebFrameImpl::visiblePositionForWindowPoint as it is
used by selectRange.

The test uses sample files that contain selected text on load. The test uses
WebViewImpl::selectionBounds to get the coordinates, deselects all, then
calls WebFrameImpl::selectRange to attempt to reselect the same text.

Four cases are tested:
- the basic case
- the case where the selected text is offscreen due to a scroll
- the case where the selected text is in an iframe
- the case where the selected text is in an editable element

* tests/WebFrameTest.cpp:
* tests/data/select_range_basic.html: Added.
* tests/data/select_range_editable.html: Added.
* tests/data/select_range_iframe.html: Added.
* tests/data/select_range_scroll.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Mark inspector/debugger tests as flaky timeout on Win7
https://bugs.webkit.org/show_bug.cgi?id=94002

Unreviewed gardening. Update expectations.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Gtk] Include all files guarded by ENABLE_* guards in Source/WebCore/GNUmakefile.list.am into the build
https://bugs.webkit.org/show_bug.cgi?id=90696

Reviewed by Philippe Normand.

Include all files in the Autotools build that are currently guarded by ENABLE_* guards in
the WebCore GNUmakefile.list.am, regardless of the feature being enabled. Compilation should
rely on proper use of guards inside source files and preprocessor work to keep the disabled
features out.

The only exception left is the ENABLE_WEBGL guard that includes the ANGLE into compilation
only if WebGL feature is enabled.

No new tests - no new functionality.

* GNUmakefile.am:
* GNUmakefile.list.am:
* bindings/gobject/GNUmakefile.am: Add StorageInfo to the DOM bindings, despite
the feature being currently disabled.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Fix use of endsWith to use string instead of char.
https://bugs.webkit.org/show_bug.cgi?id=93994

Reviewed by Antonio Gomes.

Regex comparison should use string instead of char comparison.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::elementPatternMatches):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Use constructor to initialize rect in TouchEventHandler::drawTapHighlight()
https://bugs.webkit.org/show_bug.cgi?id=93988

Reviewed by Antonio Gomes.

Use constructor to initialize rect in TouchEventHandler::drawTapHighlight()

* WebKitSupport/TouchEventHandler.cpp:
(BlackBerry::WebKit::TouchEventHandler::drawTapHighlight):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update Test Expectations after r125578

Unreviewed gardening.

* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/qt/Skipped:
* platform/qt/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Mark fast/regex/unicodeCaseInsensitive.html expectation as crashing
https://bugs.webkit.org/show_bug.cgi?id=94010

Unreviewed gardening. Update expectations.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Use Form helper functions to determine state in DOMSupport::isTextBasedContentEditableElement
https://bugs.webkit.org/show_bug.cgi?id=93992

Reviewed by Antonio Gomes.

Use form control helper functions to determine the editable state
of the input field.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::isTextBasedContentEditableElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unused yyparse method in CSSParser
https://bugs.webkit.org/show_bug.cgi?id=93986

Patch by Olivier Blin <olivier.blin@softathome.com> on 2012-08-14
Reviewed by Darin Adler.

This method is unused and not even declared.

No new tests, it just removes unused code.

* css/CSSParser.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fullscreen/normal volume sliders don't stay in sync
https://bugs.webkit.org/show_bug.cgi?id=93867

Reviewed by Eric Carlson.

Source/WebCore:

Change the full screen volume slider, if present, when the media element's volume
changes.

Test: media/video-controls-fullscreen-volume.html

* html/shadow/MediaControlRootElement.cpp:
(WebCore::MediaControlRootElement::changedVolume):

LayoutTests:

New test checking that volume changes in the media element are reflected in the full
screen volume slider.

* media/video-controls-fullscreen-volume-expected.txt: Added.
* media/video-controls-fullscreen-volume.html: Added.
* platform/chromium/TestExpectations: Skip this test on chromium.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Accumulating LayoutUnits with floats for determining block preferred width can lead to wrapping
https://bugs.webkit.org/show_bug.cgi?id=93513

Reviewed by Eric Seidel.

Source/WebCore:

Sub-pixel values from floats are subject to small losses in precision when accumulated with
floating point values, as we do in RenderBlock. This patch adds a new method to FractionalLayoutUnit --
ceilToFloat -- which guarantees us a floating point value at least as big as our original LayoutUnit
value, and uses it along with ceiledLayoutUnit to avoid underprovisioning RenderBlock's preferred
widths due to lost precision.

Test: fast/sub-pixel/block-preferred-widths-with-sub-pixel-floats.html

* platform/FractionalLayoutUnit.h:
(WebCore::FractionalLayoutUnit::ceilToFloat): Returns a float value the same or larger than the
FractionalLayoutUnit value.
(FractionalLayoutUnit):
(WebCore::FractionalLayoutUnit::epsilon): Now returns 0 when sub-pixel is disabled.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeLogicalLocationForFloat): Adding a LayoutUnit::epsilon fudge factor
for fitting floats. This is probably necessary due to precision being lost elsewhere.
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths): Ensure no precision is lost due to conversion
when accumulating our min/max width with floats.

LayoutTests:

Ensuring floats with sub-pixel values don't unnecessarily wrap.

* fast/sub-pixel/block-preferred-widths-with-sub-pixel-floats-expected.txt: Added.
* fast/sub-pixel/block-preferred-widths-with-sub-pixel-floats.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DOMWindow::document() should not reach through Frame
https://bugs.webkit.org/show_bug.cgi?id=27640

Reviewed by Eric Seidel.

Source/WebCore:

Originally, the lifetime of DOMWindow was similar to that of Frame in
that it was reused for each document that was displayed in the Frame.
To fix some tricky security issues, all modern browsers use a "split
window" architecture whereby the DOMWindow is not reused by each
Document in a Frame. Instead a JavaScript "window shell" object
redirects JavaScript references to the active Document's DOMWindow.

When we implemented split windows, we left DOMWindow attached to the
Frame and attempted to keep it in sync with the Document via a lot of
delicate code. One of the main problems with this approach is that
finding the DOMWindow associated with a Document or the Document
associated with a DOMWindow required traversing through the Frame.
Because there is a many-to-one relationship between both Documents and
Frames (as well as DOMWindows and Frames), this traversal is error
prone and not always available (e.g., for inactive documents).

This patch moves the "owning" reference for DOMWindow to Document so
that we can directly traverse from Document to DOMWindow. For
traversing from DOMWindow to Document, each DOMWindow keeps a Document
pointer via a ContextDestructionObserver base class.

The main sublties in this patch are related to situations in which
there isn't precisely a one-to-one relationship between Documents and
DOMWindows. Previously, these situations were handled implicitly by the
"flex and slop" of having separate Document and DOMWindow pointers in
Frame. In this patch, these sublties are made explicit via
Document::takeDOMWindowFrom, which explicitly transfers the DOMWindow
(as well as ASSERTs that all the relevant objects exist in a sensible
constellation).

* WebCore.exp.in:
    - These functions are no longer exported because they're inline.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::clearWindowShell):
* bindings/js/ScriptController.h:
(ScriptController):
    - clearWindowShell now explicitly takes the new DOMWindow that will
      be pointed to by the WindowShell. Previously, clearWindowShell
      would implicitly create the new DOMWindow by accessing
      Frame::domWindow (which used to lazily create the DOMWindow).
* bindings/v8/BindingState.cpp:
(WebCore::currentDocument):
* bindings/v8/BindingState.h:
(WebCore):
    - currentDocument provides a directly path from the current
      v8::Context to the Document (by way of DOMWindow). Previously,
      code transited via the Frame using currentFrame.
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::clearWindowShell):
* bindings/v8/ScriptController.h:
(ScriptController):
    - Mirror JSC changes to clearWindowShell.
* bindings/v8/V8Utilities.cpp:
(WebCore::getScriptExecutionContext):
    - Update getScriptExecutionContext to transit directly from the
      DOMWindow to the Document rather than detouring via the Frame.
* dom/ContextDestructionObserver.cpp:
(WebCore::ContextDestructionObserver::ContextDestructionObserver):
(WebCore::ContextDestructionObserver::~ContextDestructionObserver):
(WebCore):
(WebCore::ContextDestructionObserver::observeContext):
* dom/ContextDestructionObserver.h:
(ContextDestructionObserver):
    - When we transfer a DOMWindow from one Document to another, we
      need to update the Document pointer in the DOMWindow to point to
      the new Document. The DOMWindow holds the Document pointer via
      ContextDestructionObserver, so this patch teaches
      ContextDestructionObserver how to change which
      ScriptExecutionContext it is observing. This code mirrors similar
      code in FrameDestructionObserver.
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::detach):
(WebCore::Document::createDOMWindow):
    - createDOMWindow now explicitly creates the DOMWindow. Previously,
      we created the DOMWindow implicitly in Frame::domWindow when it
      was first accessed.
(WebCore::Document::takeDOMWindowFrom):
    - takeDOMWindowFrom explicitly transfers the DOMWindow from one
      Document to another. The main benefit of this function is the
      ASSERTs that ensure that the Document, DOMWindow, and Frame all
      point to each other the correct configuration.
(WebCore::Document::didUpdateSecurityOrigin):
    - We no longer need to keep the SecurityOrigin pointer in DOMWindow
      in sync with the Document because DOMWindow no longer has a
      SecurityOrigin object.
* dom/Document.h:
(Document):
(WebCore::Document::domWindow):
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
(WebCore::CachedFrame::destroy):
* history/CachedFrame.h:
(CachedFrameBase):
    - Previously, CachedFrame held the Document and the DOMWindow with
      separate pointers. Now, the CachedFrame holds the DOMWnidow via
      the Document, which makes adding and removing Documents from the
      PageCache simpler because we don't need to keep the Frame's
      DOMWindow pointer synchronized.
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::begin):
    - begin now explicitly creates the DOMWindow and transfers
      DOMWindow when performing a "secure transition." Previously, both
      of these processes were handled implicitly: the DOMWindow was
      created implicitly by Frame::domWindow, and the DOMWindow was
      reused during navigation by not clearing Frame::m_domWindow.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::cancelAndClear):
(WebCore::FrameLoader::clear):
    - These functions now pass the new Document so that we have access
      to the new DOMWindow in clearDOMWindowShell.
(WebCore::FrameLoader::setOpener):
    - We no longer need to keep the DOMWindow's SecurityOrigin in sync
      with the Document's SecurityOrigin because DOMWindow no longer
      has a duplicate SecurityOrigin pointer.
(WebCore::FrameLoader::open):
    - We no longer need to keep the Frame::m_domWindow in sync with the
      Document because the Document carries its own DOMWindow.
* loader/FrameLoader.h:
(FrameLoader):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::DOMWindow):
    - DOMWindow now uses Document as its primary context object. In a
      future patch, we should remove the FrameDestructionObserver base
      class and instead access the frame via DOMWindow::document().
(WebCore::DOMWindow::didSecureTransitionTo):
    - Notify the DOMWindow that it is now associated with a new
      Document.
(WebCore::DOMWindow::scriptExecutionContext):
(WebCore::DOMWindow::document):
(WebCore::DOMWindow::securityOrigin):
    - These functions now retrieve the Document directly rather than
      transiting via the Frame.
* page/DOMWindow.h:
(WebCore::DOMWindow::create):
(DOMWindow):
* page/Frame.cpp:
(WebCore::Frame::setDocument):
    - Add more ASSERTs that the Document and its DOMWindow are properly
      wired up to this Frame.
(WebCore::Frame::domWindow):
    - Rather than lazily creating the DOMWindow, this function now just
      accesses the already-created DOMWindow on Document. Eventually,
      all callers should retreive the DOMWindow from the Document
      directly.
* page/Frame.h:
(WebCore::Frame::existingDOMWindow):
    - The DOMWindow always exists, so there is no distinction between
      domWindow() and existingDOMWindow().
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open):
    - Previously, open would exit early if it was unable to find its
      ScriptExecutionContext (e.g., if the ScriptExecutionContext was
      inactive). Now we can always locate the ScriptExecutionContext
      and so we need to test whether the ScriptExecutionContext is
      still attached to the Page before accessing Settings. Tests
      verify that the platform-visible behaviors of XMLHttpRequest are
      unchanged, even for XMLHttpRequest constructors associated with
      inactive Documents.
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):
    - Make it explicit that XSLT re-uses the DOMWindow from the source
      Document in the transformed Document.

LayoutTests:

* fast/dom/Window/timer-null-script-execution-context.html:
    - This test was assuming that we'd throw an exception when we
      failed to find the script execution context. Now that we are
      always able to find the script execution context, we never throw
      that exception, even after GC. As far as I can tell, the original
      intent of the test was to make sure we don't crash in that case,
      which of course we don't.
* fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt:
    - Remove warning message about not being able to find the script
      execution context. We can now always find the script execution
      context.
* http/tests/security/MessagePort/event-listener-context-expected.txt:
* http/tests/security/MessagePort/event-listener-context.html:
    - This test is attempting to check that MessagePorts behave in a
      reasonable way when created in inactive documents. The test
      relies on us throwing an exception in the inactive case because
      we're unable to find the script execution context. We are now
      able to find the script execution context (as above), so we no
      longer throw the exception. It's not clear whether this test is
      valuable any more, but I've converted it to be a test that we
      don't crash in this situation.
* platform/chromium/fast/dom/xmlhttprequest-constructor-in-detached-document-expected.txt: Removed.
    - Remove platform-specific result as it now matches the cross-platform result.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKitTestRunner needs layoutTestController.dumpResourceLoadCallbacks
https://bugs.webkit.org/show_bug.cgi?id=42332

Patch by Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> on 2012-08-14
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Provide build for mac.

* WebCore.exp.in: Added __ZNK7WebCore19ResourceRequestBase20firstPartyForCookiesEv.

Source/WebKit2:

Added new getters to WKURL, WKURLRequest, WKURLResponse so that it is possible
to dump information necessary for the tests passing.

* Shared/API/c/WKURL.cpp:
(WKURLCopyPath):
* Shared/API/c/WKURL.h:
* Shared/API/c/WKURLRequest.cpp:
(WKURLRequestCopyFirstPartyForCookies):
(WKURLRequestCopyHTTPMethod):
* Shared/API/c/WKURLRequest.h:
* Shared/API/c/WKURLResponse.cpp:
(WKURLResponseHTTPStatusCode):
* Shared/API/c/WKURLResponse.h:
* Shared/WebURL.h:
(WebKit::WebURL::path):
(WebURL):

Tools:

Added Resource Callbacks logging. Several aux dumping functions are added.

* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::isFileScheme):
(WTR):
(WTR::pathSuitableForTestResult):
(WTR::urlSuitableForTestResult):
(WTR::InjectedBundlePage::resetAfterTest):
(WTR::dumpRequestDescriptionSuitableForTestResult):
(WTR::dumpResponseDescriptionSuitableForTestResult):
(WTR::dumpErrorDescriptionSuitableForTestResult):
(WTR::InjectedBundlePage::didInitiateLoadForResource):
(WTR::InjectedBundlePage::willSendRequestForFrame):
(WTR::InjectedBundlePage::didReceiveResponseForResource):
(WTR::InjectedBundlePage::didFinishLoadForResource):
(WTR::InjectedBundlePage::didFailLoadForResource):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::LayoutTestController):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(WTR::LayoutTestController::dumpResourceLoadCallbacks):
(WTR::LayoutTestController::shouldDumpResourceLoadCallbacks):
(LayoutTestController):

LayoutTests:

Unskipped correspondong test cases.

* platform/wk2/Skipped:

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