Reversing a GlyphBuffer needlessly queries its size multiple times
https://bugs.webkit.org/show_bug.cgi?id=98530

Reviewed by Simon Fraser.

No new tests because there is no change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::getGlyphsAndAdvancesForSimpleText): Replaced the condition
(i < glyphBuffer.size() / 2) with the equivalent test (i < end).
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::getGlyphsAndAdvancesForComplexText): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Deleting across multiple paragraphs can change the style of surrounding text
https://bugs.webkit.org/show_bug.cgi?id=97266

Reviewed by Levi Weintraub.

Source/WebCore: 

Preserve editing styles from CSS rules in wrappingStyleForSerialization as well as inline styles
even when we're not annotating. We don't want to preserve all styles because it's against
the user expectation to keep borders, etc... when merging paragraphs. We also don't want to copy
styles from a mail blockquote because that's not a style the user has applied. See the comment
in EditingStyle::wrappingStyleForSerialization.

Test: editing/deleting/merge-paragraph-with-style-from-rule.html

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
(WebCore::EditingStyle::wrappingStyleForSerialization):

LayoutTests: 

Added a regression test and rebaselined tests.

* editing/deleting/delete-before-block-image-2-expected.txt:
* editing/deleting/merge-paragraph-from-p-with-style-expected.txt:
* editing/deleting/merge-paragraph-from-p-with-style.html: We changed the behavior. The editing style of p
is now preserved when merging paragraphs.
* editing/deleting/merge-paragraph-with-style-from-rule-expected.txt: Added.
* editing/deleting/merge-paragraph-with-style-from-rule.html: Added.
* platform/mac/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/mac/editing/pasteboard/merge-end-blockquote-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Have perf test assert worst order of magnitude
https://bugs.webkit.org/show_bug.cgi?id=98535

Reviewed by Tony Chang.

Really we only care if tests get order of magnitude slower.
Assert that tests are at least a certain magnitude.
Hopefully this will reduce flakiness some.

* resources/magnitude-perf.js:
(Magnitude._run):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
No autorelease pool in place, causing buildup of autoreleased objects.
https://bugs.webkit.org/show_bug.cgi?id=98522
<rdar://problem/11647950>

Reviewed by Alexey Proskuryakov.

Wrap each timer callback in an AutodrainPool, ensuring an autorelease
pool is present during calls from C/C++ into ObjC.

* platform/cf/RunLoopTimerCF.cpp:
(WebCore::timerFired):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK gardening.

Removing failure expectation for fast/text/vertical-rl-rtl-linebreak.html
since the test only needed platform-specific baselines (which were added
in r130524).

* platform/gtk/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r129478-r129480): http/tests/loading/text-content-type-with-binary-extension.html failing on Apple MountainLion Debug WK2 (Tests)
https://bugs.webkit.org/show_bug.cgi?id=98527

Unreviewed gardening after r129479.

* platform/mac-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Fix regression in proxy auth
https://bugs.webkit.org/show_bug.cgi?id=98533

Patch by Joe Mason <jmason@rim.com> on 2012-10-05
Reviewed by Yong Li.

The proxy auth dialog gets the proxy address from
BlackBerry::Platform::Settings::proxyAddress, which returns
"host:port", but we try to parse it with a KURL, which expects
"scheme://host:port".  Since this is an http proxy, add http:// to the
url to get it to parse.

PR 220567.

* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::sendRequestWithCredentials):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Implement TestRunner.setMockDeviceOrientation
https://bugs.webkit.org/show_bug.cgi?id=98542

Reviewed by Antonio Gomes.

PR 120681

Source/WebKit/blackberry:

Provide framework for mock device motion.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::init):
* WebKitSupport/DumpRenderTreeSupport.cpp:
(toDeviceOrientationClientMock):
(DumpRenderTreeSupport::setMockDeviceOrientation):
* WebKitSupport/DumpRenderTreeSupport.h:
(DumpRenderTreeSupport):

Tools:

This fixes tests in fast/dom/DeviceOrientation.

* DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
(TestRunner::setMockDeviceOrientation):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Modify gesture highlight behaviour. Cancel on GestureLongPress and animate on GestureTapCancel.
https://bugs.webkit.org/show_bug.cgi?id=97355

Reviewed by Adrienne Walker.

This patch revises the behaviour of GestureTapDown highlighting so that the highlight should disappear if
interrupted by GestureTap, and animate away if interrupted by GestureTapCancel.

Source/WebKit/chromium:

* src/LinkHighlight.cpp:
(WebKit::LinkHighlight::LinkHighlight):
(WebKit::LinkHighlight::startHighlightAnimationIfNeeded):
* src/LinkHighlight.h:
(LinkHighlight):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleGestureEvent):
(WebKit::WebViewImpl::enableTouchHighlight):

LayoutTests:

* platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-cancel.html: removed extra testRunner.display().
* platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-cancel2.html: Added.
* platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-longPress.html: Added.
* platform/chromium-linux/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-cancel2-expected.png: Added.
* platform/chromium-linux/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-cancel2-expected.txt: Added.
* platform/chromium-linux/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-longPress-expected.png: Added.
* platform/chromium-linux/platform/chromium-linux/compositing/gestures/gesture-tapHighlight-simple-longPress-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] tests failing after r130443.
https://bugs.webkit.org/show_bug.cgi?id=98545

Unreviewed, expectations change.

 [chromium] fast/text/international/text-spliced-font.html and
 fast/writing-mode/Kusa-Makura-background-canvas.html are failing on
 the Mac after r130443 and we're not quite sure why ...

* platform/chromium-linux/fast/text/vertical-rl-rtl-linebreak-expected.png: Added.
* platform/chromium-mac-snowleopard/fast/text/vertical-rl-rtl-linebreak-expected.png: Added.
* platform/chromium-mac/fast/text/vertical-rl-rtl-linebreak-expected.png: Added.
* platform/chromium-mac/fast/text/vertical-rl-rtl-linebreak-expected.txt: Added.
* platform/chromium-win/fast/text/vertical-rl-rtl-linebreak-expected.png: Added.
* platform/chromium-win/fast/text/vertical-rl-rtl-linebreak-expected.txt: Added.
* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<marquee> element forces itself to be at least 1em high, regardless of 'height' declaration
https://bugs.webkit.org/show_bug.cgi?id=18098

Patch by Tab Atkins <jackalmage@gmail.com> on 2012-10-05
Reviewed by Eric Seidel.

This restriction originally existed to match IE, but IE changed some time ago to be normal instead.
We're the last browser, afaict, to still enforce this de-facto restriction.
This patch makes <marquee> instead act like a normal element.

Tests: fast/css/MarqueeLayoutTest.html (rewritten from the older, bad version)

* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::updateMarqueeStyle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix lint error in TestExpectations from previous change.

Unreviewed.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Gtk] fast/xsl/xslt-missing-namespace-in-xslt.xml is failing on the 64-bit Debug builder
https://bugs.webkit.org/show_bug.cgi?id=91009

Reviewed by Martin Robinson.

Tools: 

Include libxml2 into the jhbuild module. Version 2.8.0 introduces
a more correct (but not completely correct) behavior in the
fast/xsl/xslt-missing-namespace-in-xslt.html test.

* gtk/jhbuild.modules:

LayoutTests: 

Update the test's baselines. The output now properly shows the error.

* platform/gtk/fast/xsl/xslt-missing-namespace-in-xslt-expected.png:
* platform/gtk/fast/xsl/xslt-missing-namespace-in-xslt-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Chromium and Mac rebaselines after r130532.

* platform/chromium-linux-x86/editing/pasteboard/interchange-newline-1-expected.txt: Added.
* platform/chromium-linux-x86/editing/pasteboard/paste-text-002-expected.txt: Added.
* platform/chromium-linux-x86/editing/pasteboard/paste-text-003-expected.txt: Added.
* platform/chromium-linux/editing/pasteboard/interchange-newline-1-expected.txt: Added.
* platform/chromium-linux/editing/pasteboard/paste-text-002-expected.txt: Added.
* platform/chromium-linux/editing/pasteboard/paste-text-003-expected.txt: Added.
* platform/chromium-mac-snowleopard/editing/pasteboard/paste-text-002-expected.txt:
* platform/chromium-mac-snowleopard/editing/pasteboard/paste-text-003-expected.txt:
* platform/chromium-win-xp/editing/pasteboard/interchange-newline-1-expected.txt: Added.
* platform/chromium-win-xp/editing/pasteboard/paste-text-002-expected.txt: Added.
* platform/chromium-win-xp/editing/pasteboard/paste-text-003-expected.txt: Added.
* platform/chromium-win/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/chromium-win/editing/pasteboard/interchange-newline-1-expected.txt:
* platform/chromium-win/editing/pasteboard/merge-end-blockquote-expected.txt:
* platform/chromium-win/editing/pasteboard/paste-text-002-expected.txt:
* platform/chromium-win/editing/pasteboard/paste-text-003-expected.txt:
* platform/chromium/svg/custom/delete-text-crash-expected.txt: Added.
* platform/chromium/svg/custom/delete-text-innerText-crash-expected.txt: Added.
* svg/custom/delete-text-crash-expected.txt:
* svg/custom/delete-text-innerText-crash-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Support zooming focused node for mobile devices
https://bugs.webkit.org/show_bug.cgi?id=97958

Patch by Yusuf Ozuysal <yusufo@google.com> on 2012-10-05
Reviewed by Adam Barth.

This unforks the Android version of scrollFocusedNodeIntoRect().A new setting
autoZoomFocusedNodeToLegibleScale was added to turn it on, since not all
platforms with ENABLE(GESTURE_EVENTS) want this.

Test: WebFrameTest.DivScrollIntoEditableTest

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::WebSettingsImpl):
(WebKit::WebSettingsImpl::setAutoZoomFocusedNodeToLegibleScale):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):
(WebKit::WebSettingsImpl::autoZoomFocusedNodeToLegibleScale):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::scrollFocusedNodeIntoRect):
* tests/WebFrameTest.cpp:
* tests/data/get_scale_for_zoom_into_editable_test.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
GTK+ and Qt rebaselines after r130532.

* platform/chromium-linux-x86/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/chromium-linux-x86/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/chromium-linux-x86/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/chromium-linux/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/chromium-linux/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/chromium-linux/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/chromium-mac-snowleopard/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/chromium-mac-snowleopard/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/chromium-win-xp/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/chromium-win-xp/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/chromium-win-xp/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/chromium-win/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/chromium-win/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/chromium-win/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/chromium/svg/custom/delete-text-crash-expected.txt: Removed.
* platform/chromium/svg/custom/delete-text-innerText-crash-expected.txt: Removed.
* platform/gtk/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/gtk/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/gtk/editing/pasteboard/merge-end-blockquote-expected.txt:
* platform/gtk/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/gtk/editing/pasteboard/paste-text-003-expected.txt: Removed.
* platform/qt/editing/deleting/delete-block-merge-contents-001-expected.txt:
* platform/qt/editing/pasteboard/interchange-newline-1-expected.txt: Removed.
* platform/qt/editing/pasteboard/merge-end-blockquote-expected.txt:
* platform/qt/editing/pasteboard/paste-text-002-expected.txt: Removed.
* platform/qt/editing/pasteboard/paste-text-003-expected.txt: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Allow EventHandler to handle longpress gestures, including longpress selection on Android.
https://bugs.webkit.org/show_bug.cgi?id=98173

Patch by Oli Lan <olilan@chromium.org> on 2012-10-05
Reviewed by Ryosuke Niwa.

Adds handling for GestureLongPress to EventHandler::handleGestureEvent, with a new
handleGestureLongPress method. On Android, this method selects the closest word
if the gesture event was over non-link text.

This is tested via a new chromium test WebViewTest.LongPressSelection.

* page/EventHandler.cpp:
(WebCore::EventHandler::selectClosestWordFromHitTestResult):
(WebCore::EventHandler::selectClosestWordFromMouseEvent):
(WebCore):
(WebCore::EventHandler::handleGestureEvent):
(WebCore::EventHandler::handleGestureLongPress):
* page/EventHandler.h:
(EventHandler):

Source/WebKit/chromium: Allow EventHandler to handle longpress gestures, including longpress selection on Android.
https://bugs.webkit.org/show_bug.cgi?id=98173

Patch by Oli Lan <olilan@chromium.org> on 2012-10-05
Reviewed by Ryosuke Niwa.

This patch changes the longpress gesture handling code in WebViewImpl to call EventHandler::handleGestureEvent.
The WebCore part of this patch adds longpress handling to that method, including the long press selection behaviour
required for Android. This means that a long press gesture performed on word (that is not part of a link)
selects the word, without generating a context menu event.

A new test, WebViewTest.LongPressSelection has been added to test this.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleGestureEvent):
(WebViewImpl):
* tests/WebViewTest.cpp:
* tests/data/longpress_selection.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make tables which don't use col/row span much faster to layout
https://bugs.webkit.org/show_bug.cgi?id=98221

Reviewed by Julien Chaffraix.

My sense is that most tables on webpages do not use colspan/rowspan
so I stole another bit from RenderTableCell::m_column to avoid
having to re-parse the colSpan/rowSpan attributes for every cell
when doing table layout.
This made these symbols disappear from biggrid.html/redraw.html (dglazkov's spreadsheets benchmarks)
as well as moved our robohornet/resizecol.html number from an average of 3221ms to 2608ms (~20%!).

I removed m_hasHTMLTableCellElement (from http://trac.webkit.org/changeset/97691)
since it was attempting to do the same sort of optimization.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::RenderTableCell):
(WebCore::RenderTableCell::parseColSpanFromDOM):
(WebCore::RenderTableCell::parseRowSpanFromDOM):
(WebCore::RenderTableCell::layout):
* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::colSpan):
(WebCore::RenderTableCell::rowSpan):
(RenderTableCell):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Deprecated flexboxes subtract scrollbar width/height twice
https://bugs.webkit.org/show_bug.cgi?id=98552

Reviewed by Tony Chang.

Source/WebCore:

This is a regression from http://trac.webkit.org/changeset/119507.
The problem is that contentHeight subtracts the scrollbar and
RenderDeprecatedFlexbox subtracts the scrollbar.

-Make it so that we only access override sizes if one has been set.
I think this makes the calling code more clear.
-If we don't have one set, grab the height/width - borderAndPadding.
-Add a FIXME to change this all back to being borderbox sizes.
There's something trick with making table padding/border work right for that
though (noted in the original patch).

Test: fast/flexbox/flexing-overflow-scroll-item.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::overrideLogicalContentWidth):
(WebCore::RenderBox::overrideLogicalContentHeight):
(WebCore::RenderBox::availableLogicalHeightUsing):
* rendering/RenderBox.h:
(RenderBox):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::contentWidthForChild):
(WebCore):
(WebCore::contentHeightForChild):
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
(WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
(WebCore::RenderDeprecatedFlexibleBox::allowedChildFlex):

LayoutTests:

* fast/flexbox/flexing-overflow-scroll-item-expected.txt: Added.
* fast/flexbox/flexing-overflow-scroll-item.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix after r130545.

* tests/WebFrameTest.cpp:
Avoid a warning about truncating the double constant on Windows. While touching the variable, changed
it to be proper camelCase.


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