[Qt] Poor rounding in GraphicsContext::drawLineForText
https://bugs.webkit.org/show_bug.cgi?id=113301

Reviewed by Jocelyn Turcotte.

Round the position of the line decoration, so lines on subpixel
coordinates are not always rounded up.

* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::drawLineForText):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use DOM ordering for list counts
https://bugs.webkit.org/show_bug.cgi?id=110352

Reviewed by Elliott Sprehn.

Source/WebCore:

Currently the list items ordering is made by traversing the render tree. This gives bad results for:
- list items flown inside regions because they are not rendered as descendants of their DOM list ancestors.
- list items matched to insertion points inside a shadow tree. The insertion point may be a child of a
list so the numbering gets broken.

To implement correct DOM ordering I've taken into account the fact that pseudo-elements can have display: list-item
so they should be included when traversing the DOM tree. I've added helper methods on the NodeTraversal
namespace that should allow easily traversing the tree including the pseudo-elements (e.g. firstChildWithPseudo
for an element with pseudo-before will return the before PseudoElement). Using these helper methods I've implemented
pre-order traversal methods aware of the pseudo-elements.
An effect of this change is how the list items inside shadow tree update their counting. With the patch, if there's
no <ol> or <ul> element on the ancestor chain of a <li> element to the shadow root, the list node will be considered the
first parent of the <li> or the shadow root if there is no ancestor.
The RenderListItem class now makes use of this new method of traversal, replacing the one based on the render tree.
To simplify the CSS counters implementation, I've changed the traversal functions inside RenderCounter to also make use
of this method. The CSS counters and the list items now have the same traversal algorithm.

In later patches I'll add tests that should cover the regions and shadow DOM use cases.
Tests bug for shadow DOM: https://bugs.webkit.org/show_bug.cgi?id=113193
Tests bug for regions: https://bugs.webkit.org/show_bug.cgi?id=103975

Tests: no new tests is this patch; added the correct expectations for fast/lists/positioned-count-crash.html
and fast/dom/shadow/shadow-and-list-elements.html

* dom/Node.cpp:
(WebCore::Node::pseudoAwarePreviousSibling):
(WebCore):
(WebCore::Node::pseudoAwareNextSibling):
(WebCore::Node::pseudoAwareFirstChild):
(WebCore::Node::pseudoAwareLastChild):
* dom/Node.h:
(Node):
* dom/NodeTraversal.cpp:
(WebCore):
(WebCore::NodeTraversal::previousIncludingPseudo):
(NodeTraversal):
(WebCore::NodeTraversal::nextIncludingPseudo):
(WebCore::NodeTraversal::nextIncludingPseudoSkippingChildren):
* dom/NodeTraversal.h:
(ElementTraversal):
(NodeTraversal):
(WebCore::ElementTraversal::previousIncludingPseudo):
(WebCore::ElementTraversal::nextIncludingPseudo):
(WebCore::ElementTraversal::nextIncludingPseudoSkippingChildren):
(WebCore::ElementTraversal::pseudoAwarePreviousSibling):
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::attach):
* html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::updateItemValues):
(WebCore::HTMLOListElement::recalculateItemCount):
* rendering/RenderCounter.cpp:
(WebCore::previousInPreOrder):
(WebCore::previousSiblingOrParent):
(WebCore::parentElement):
(WebCore::nextInPreOrder):
* rendering/RenderListItem.cpp:
(WebCore):
(WebCore::enclosingList):
(WebCore::RenderListItem::nextListItem):
(WebCore::previousListItem):
(WebCore::RenderListItem::calcValue):
(WebCore::RenderListItem::explicitValueChanged):
(WebCore::previousOrNextItem):
(WebCore::RenderListItem::updateListMarkerNumbers):
* rendering/RenderListItem.h:
(RenderListItem):

LayoutTests:

The fast/dom/shadow/shadow-and-list-elements-expected.html has changed because the list items
inside the shadow tree no longer see the root <ol> element.
The test fast/lists/positioned-count-crash.html has the correct rendering after changing
the list counting to be in DOM order.

* fast/dom/shadow/shadow-and-list-elements-expected.html:
* fast/lists/positioned-count-crash-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] UIProcess should initialize WebCoreSystemInterface.
https://bugs.webkit.org/show_bug.cgi?id=113300

The WebCoreSystemInterface is necessary to detect supported
mime types on Mac OS. In particular it is needed for download
support.
This patch fixes in particular the previously failing
Qt API qmltest WebViewDownload::test_downloadRequest.
The test was crashing when using QTKit, because functions
in WebCoreSystemInterface could not be resolved on the UIProcess side.

Reviewed by Jocelyn Turcotte.

* UIProcess/qt/WebContextQt.cpp:
(WebKit::WebContext::platformInitializeWebProcess):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Updated test expectations for compositing/geometry/fixed-in-composited.html

* platform/chromium-linux-x86/platform/chromium/virtual/softwarecompositing/geometry/fixed-in-composited-expected.png: Removed.
* platform/chromium-win/platform/chromium/virtual/softwarecompositing/geometry/fixed-in-composited-expected.png: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
remoeveAllEventListeners() should be called to shadow trees
https://bugs.webkit.org/show_bug.cgi?id=113037

Reviewed by Dimitri Glazkov.

Source/WebCore:

Document::removeAllEventListeners() doesn't traverse shadow tree, but we should.
This change override Element::removeAllEventListeners() so that it cleans its shadow trees up.

Test: fast/dom/shadow/shadow-tree-listener-clearance.html

* dom/Element.cpp:
(WebCore::Element::removeAllEventListeners):
(WebCore):
* dom/Element.h:
(Element):
* dom/ElementShadow.cpp:
(WebCore::ElementShadow::removeAllEventListeners): Added.
(WebCore):
* dom/ElementShadow.h:
(ElementShadow):

LayoutTests:

* fast/dom/shadow/resources/shadow-tree-listener-clearance-frame.html: Added.
* fast/dom/shadow/shadow-tree-listener-clearance-expected.txt: Added.
* fast/dom/shadow/shadow-tree-listener-clearance.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r146879.
http://trac.webkit.org/changeset/146879
https://bugs.webkit.org/show_bug.cgi?id=113312

Multiple layout test crashes in
WebCore::RenderListItem::updateListMarkerNumbers (Requested by
yurys on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-03-26

Source/WebCore:

* dom/Node.cpp:
* dom/Node.h:
(Node):
* dom/NodeTraversal.cpp:
* dom/NodeTraversal.h:
(ElementTraversal):
(NodeTraversal):
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::attach):
* html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::updateItemValues):
(WebCore::HTMLOListElement::recalculateItemCount):
* rendering/RenderCounter.cpp:
(WebCore::previousInPreOrder):
(WebCore::previousSiblingOrParent):
(WebCore::parentElement):
(WebCore::nextInPreOrder):
* rendering/RenderListItem.cpp:
(WebCore::enclosingList):
(WebCore::RenderListItem::nextListItem):
(WebCore::previousListItem):
(WebCore::RenderListItem::calcValue):
(WebCore::RenderListItem::explicitValueChanged):
(WebCore::previousOrNextItem):
(WebCore::RenderListItem::updateListMarkerNumbers):
* rendering/RenderListItem.h:
(RenderListItem):

LayoutTests:

* fast/dom/shadow/shadow-and-list-elements-expected.html:
* fast/lists/positioned-count-crash-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FormData::deepCopy() could use Vector::uncheckedAppend()
https://bugs.webkit.org/show_bug.cgi?id=113309

Reviewed by Kenneth Rohde Christiansen.

FormData::deepCopy() calls reserveInitialCapacity() on the Vector but then uses the
regular append() method. This patch switches to using uncheckedAppend() method
instead to bypass capacity checks as we already know it is sufficient.

No new tests, no behavior change.

* platform/network/FormData.cpp:
(WebCore::FormData::deepCopy):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Main frame fixed divs not positioned correctly
https://bugs.webkit.org/show_bug.cgi?id=112889

Reviewed by Carlos Garcia Campos.

PR 283363

This was a regression from bug #112806. It caused main frame fixed
handling to enter the iframe/scrollable div code path in LayerRenderer.

Fixed by not setting the container for fixed flag on the main frame,
the LayerRenderer expects this flag to be set only on non-mainframe
containers.

Only manually testable.

* page/scrolling/blackberry/ScrollingCoordinatorBlackBerry.cpp:
(WebCore::scrollLayerForFrame):
(WebCore):
(WebCore::ScrollingCoordinatorBlackBerry::setLayerIsContainerForFixedPositionLayers):
(WebCore::ScrollingCoordinatorBlackBerry::setLayerIsFixedToContainerLayer):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSP 1.1: Experiment with 'base-uri' directive.
https://bugs.webkit.org/show_bug.cgi?id=113307

Reviewed by Jochen Eisinger.

Source/WebCore:

The 'base-uri' directive was introduced[1] as an experimental directive
in CSP 1.1 after a bit of discussion[2][3]. The exact semantics will
likely change, but it would be good for us to get some implementation
experience with the API as currently specified, and to allow folks to
play with the implementation to determine whether it meets the
requirements the way we think it might.

This patch is a first pass at that implementation: it will have no
effect on ports that haven't enabled the CSP_NEXT flag.

[1]: https://dvcs.w3.org/hg/content-security-policy/rev/4b89c246ea16
[2]: http://lists.w3.org/Archives/Public/public-webappsec/2012Oct/0022.html
[3]: http://lists.w3.org/Archives/Public/public-webappsec/2013Feb/0074.html

Tests: http/tests/security/contentSecurityPolicy/1.1/base-uri-allow.html
       http/tests/security/contentSecurityPolicy/1.1/base-uri-deny.html

* dom/Document.cpp:
(WebCore::Document::processBaseElement):
    Check that the new base URI is allowed by CSP before using it as
    the document's base URI.
* page/ContentSecurityPolicy.cpp:
    Add a constant for the new directive name (and, as a drive-by, split
    the list into CSP 1.0 and CSP 1.1 for clarity).
(CSPDirectiveList):
    Add a property to hold the base URI policy directive value.
(WebCore::CSPDirectiveList::checkSourceAndReportViolation):
    Customize the error message iff we're dealing with 'base-uri'.
(WebCore::CSPDirectiveList::allowBaseURI):
    Check the given URI against the 'base-uri' directive's value,
    exactly as we do for every other source-list type of directive.
(WebCore::CSPDirectiveList::addDirective):
    Accept 'base-uri' as a valid directive iff CSP_NEXT is set, and
    the embedder has opted-in via the runtime flag.
(WebCore::ContentSecurityPolicy::allowBaseURI):
    Expose an API method on ContentSecurityPolicy to check URIs against
    the 'base-uri' directive's value.

LayoutTests:

* http/tests/security/contentSecurityPolicy/1.1/base-uri-allow-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/base-uri-allow.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/base-uri-deny-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/base-uri-deny.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ArrayMode should not consider SpecOther when refining the base
https://bugs.webkit.org/show_bug.cgi?id=113271

Reviewed by Geoffrey Garen.
        
9% speed-up on Octane/pdfjs.

* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::refine):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Flame Chart. Scroll dividers together with underlying chart.
http://bugs.webkit.org/show_bug.cgi?id=113080

Reviewed by Pavel Feldman.

* inspector/front-end/FlameChart.js:
(WebInspector.FlameChart.Calculator.prototype.grandMinimumBoundary):
(WebInspector.FlameChart.prototype._canvasDragging):
* inspector/front-end/TimelineGrid.js:
(WebInspector.TimelineGrid.prototype.updateDividers):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. WebInspector: remove unnecessary method.

* inspector/front-end/OverviewGrid.js:
(WebInspector.OverviewGrid.Window):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Convert WebInputEvent::GestureDoubleTap to  PlatformEvent::NoType
https://bugs.webkit.org/show_bug.cgi?id=113215

In bug 93045 we removed PlatformEvent::GestureDoubleTap since now DoubleTap gesture
is implemented as a Tap gesture with tap_count = 2.

In WebViewImpl::handleGestureEvent(), a PlatformEvent is built from the WebGestureEvent
regardless, even though the PlatfromEvent will never reach the WebCore. DoubleTap, in
our case, is only handled in WebViewImpl for doube-tap-to-zoom, will also go through
conversion in WebInpuEventConversion.cpp::PlatformGestureEventBuilder() and reach
ASSERT_NOT_REACHED()

This patch converts WebGestureEvent::DoubleTap to PlatformEvent::NoType, this makes the
conversion list from WebInputEvent to PlatformEvent complete and we don't need a special
handling for the DoubleTap event in WebViewImpl::handleGestureEvent()

Patch by Yufeng Shen <miletus@chromium.org> on 2013-03-26
Reviewed by Antonio Gomes.

* src/WebInputEventConversion.cpp:
(WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix incorrect test name in content shell expectations

Unreviewed. Typing is hard.

* platform/chromium/ContentShellTestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=113164
Custom Elements: readyCallback should be called for outerHTML and insertAdjecentHTML

Source/WebCore:

These APIs also create new elements thus should have V8DeliverCustomElementCallbacks attribute.

Reviewed by Dimitri Glazkov.

Test: Updated lifecycle-ready-creation-api.html.

* html/HTMLElement.idl:

LayoutTests:

Reviewed by Dimitri Glazkov.

* fast/dom/custom/lifecycle-ready-creation-api-expected.txt:
* fast/dom/custom/lifecycle-ready-creation-api.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: [Elements] Unable to "Edit as HTML" XHTML/SVG documents.
https://bugs.webkit.org/show_bug.cgi?id=113290

Reviewed by Pavel Feldman.

Source/WebCore:

DOMPatchSupport has been slightly augmented to handle XML (XHTML and SVG) documents.

Test: inspector/elements/set-outer-html-for-xhtml.xhtml

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument):
(WebCore::DOMPatchSupport::patchNode):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setOuterHTML): Let HTML, XHTML, and SVG documents through.

LayoutTests:

* inspector/elements/set-outer-html-for-xhtml-expected.txt: Added.
* inspector/elements/set-outer-html-for-xhtml.xhtml: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: UISourceCodes are leaking on reload sometimes.
https://bugs.webkit.org/show_bug.cgi?id=113310

Reviewed by Pavel Feldman.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype._projectWillReset.get for):
(WebInspector.BreakpointManager.prototype._projectWillReset):
* inspector/front-end/ConsoleModel.js:
(WebInspector.ConsoleModel.prototype.clearMessages):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTTPHeaderMap::copyData() could call uncheckedAppend()
https://bugs.webkit.org/show_bug.cgi?id=113279

Reviewed by Alexey Proskuryakov.

HTTPHeaderMap::copyData() calls reserveInitialCapacity() on the Vector
but then appends items using append() function. Since we already know
the capacity is sufficient, it is more efficient to call uncheckedAppend()
instead to bypass capacity checks.

No new tests, no behavior change for layout tests.

* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::copyData):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: refactor code duplication: WebInspector.ObjectPropertyTreeElement.wrapPropertyAsElements
https://bugs.webkit.org/show_bug.cgi?id=113211

Patch by Peter Rybin <prybin@chromium.org> on 2013-03-26
Reviewed by Yury Semikhatsky.

A new method WebInspector.ObjectPropertyTreeElement.wrapPropertyAsElements is added and used
from 2 sites.

* inspector/front-end/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertiesSection.prototype.update.callback):
(WebInspector.ObjectPropertiesSection.prototype.update):
(WebInspector.ObjectPropertiesSection.prototype.updateProperties):
(.callback):
(WebInspector.ObjectPropertyTreeElement.populate):
(WebInspector.ObjectPropertyTreeElement.wrapPropertyAsElements):
* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSection.prototype.update.appendResult):
(WebInspector.WatchExpressionsSection.prototype.update):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Remove remainings of CSS-based console message filtering.
https://bugs.webkit.org/show_bug.cgi?id=112710

Patch by Dmitry Zvorygin <zvorygin@chromium.org> on 2013-03-26
Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.get this):
(WebInspector.ConsoleView.prototype.):
(WebInspector.ConsoleView.prototype.filter):
(WebInspector.ConsoleView.prototype._consoleMessageAdded):
(WebInspector.ConsoleView.prototype._appendConsoleMessage):
(WebInspector.ConsoleView.prototype._consoleCleared):
(WebInspector.ConsoleView.prototype._shouldBeVisible):
(WebInspector.ConsoleView.prototype._updateMessageList):
(WebInspector.ConsoleView.prototype._promptKeyDown):
(WebInspector.ConsoleView.prototype._printResult):
(WebInspector.ConsoleCommand.prototype.highlightSearchResults):
* inspector/front-end/inspector.css:
(.console-debug-level.repeated-message):

LayoutTests:

* inspector/console/console-preserve-log.html:

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