[BlackBerry] clock_gettime() in BackingStore.cpp should use CLOCK_MONOTONIC
https://bugs.webkit.org/show_bug.cgi?id=91898

Reviewed by Yong Li.
Patch by Jacky Jiang  <zhajiang@rim.com>

Let pthread condition variable in BackingStore.cpp use monotonic clock
to fix a regression caused by r123266.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        Chinese IM receives incorrect/duplicated key events in text fields in webpages in Safari.
        https://bugs.webkit.org/show_bug.cgi?id=89048
        <rdar://problem/11786384>

        Reviewed by Andreas Kling.

        Cannot test text input from UI process side.

        Stop relying on IPC to handle key events in order. There are too many complications
        where out of order delivery is performed. Instead, queue the events at UI process
        side.

        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::handleKeyboardEvent):
        (WebKit::WebPageProxy::didReceiveEvent):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] css2.1/t* tests needs rebaseline after new testfonts
https://bugs.webkit.org/show_bug.cgi?id=91999

Unreviewed.

* platform/qt-5.0-wk1/Skipped:
* platform/qt-5.0-wk2/Skipped:
* platform/qt-5.0/Skipped:
* platform/qt-5.0/css2.1/t0805-c5519-brdr-r-01-e-expected.png: Removed.
* platform/qt-5.0/css2.1/t0805-c5519-brdr-r-01-e-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c414-flt-02-c-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c414-flt-03-c-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c414-flt-04-c-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c414-flt-fit-01-d-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltblck-00-d-ag-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltblck-01-d-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltcont-00-d-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-flthw-00-c-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltwidth-00-c-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltwidth-02-c-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltwidth-03-c-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5525-fltwrap-00-b-expected.txt: Removed.
* platform/qt-5.0/css2.1/t0905-c5526-flthw-00-c-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t090501-c414-flt-01-b-expected.txt: Removed.
* platform/qt-5.0/css2.1/t090501-c414-flt-03-b-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t090501-c414-flt-ln-01-d-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t090501-c5525-flt-l-00-b-g-expected.txt: Removed.
* platform/qt-5.0/css2.1/t090501-c5525-flt-r-00-b-g-expected.txt: Removed.
* platform/qt/css2.1/t010403-shand-border-00-c-expected.png:
* platform/qt/css2.1/t010403-shand-border-00-c-expected.txt:
* platform/qt/css2.1/t010403-shand-font-00-b-expected.png:
* platform/qt/css2.1/t010403-shand-font-00-b-expected.txt:
* platform/qt/css2.1/t010403-shand-font-01-b-expected.png:
* platform/qt/css2.1/t010403-shand-font-01-b-expected.txt:
* platform/qt/css2.1/t010403-shand-font-02-b-expected.png:
* platform/qt/css2.1/t010403-shand-font-02-b-expected.txt:
* platform/qt/css2.1/t010403-shand-font-03-b-expected.png:
* platform/qt/css2.1/t010403-shand-font-03-b-expected.txt:
* platform/qt/css2.1/t050201-c12-grouping-00-b-expected.png:
* platform/qt/css2.1/t050201-c12-grouping-00-b-expected.txt:
* platform/qt/css2.1/t0505-c16-descendant-00-e-expected.png:
* platform/qt/css2.1/t0505-c16-descendant-00-e-expected.txt:
* platform/qt/css2.1/t0505-c16-descendant-01-e-expected.png:
* platform/qt/css2.1/t0505-c16-descendant-01-e-expected.txt:
* platform/qt/css2.1/t0505-c16-descendant-02-e-expected.png:
* platform/qt/css2.1/t0505-c16-descendant-02-e-expected.txt:
* platform/qt/css2.1/t050803-c14-classes-00-e-expected.png:
* platform/qt/css2.1/t050803-c14-classes-00-e-expected.txt:
* platform/qt/css2.1/t0509-c15-ids-00-a-expected.png:
* platform/qt/css2.1/t0509-c15-ids-00-a-expected.txt:
* platform/qt/css2.1/t0509-c15-ids-01-e-expected.png:
* platform/qt/css2.1/t0509-c15-ids-01-e-expected.txt:
* platform/qt/css2.1/t0509-id-sel-syntax-01-f-expected.png:
* platform/qt/css2.1/t0509-id-sel-syntax-01-f-expected.txt:
* platform/qt/css2.1/t0509-id-sel-syntax-02-b-expected.png:
* platform/qt/css2.1/t0509-id-sel-syntax-02-b-expected.txt:
* platform/qt/css2.1/t0510-c25-pseudo-elmnt-00-c-expected.png:
* platform/qt/css2.1/t0510-c25-pseudo-elmnt-00-c-expected.txt:
* platform/qt/css2.1/t0511-c21-pseud-anch-00-e-i-expected.png:
* platform/qt/css2.1/t0511-c21-pseud-anch-00-e-i-expected.txt:
* platform/qt/css2.1/t0511-c21-pseud-link-00-e-expected.png:
* platform/qt/css2.1/t0511-c21-pseud-link-00-e-expected.txt:
* platform/qt/css2.1/t0511-c21-pseud-link-01-e-expected.png:
* platform/qt/css2.1/t0511-c21-pseud-link-01-e-expected.txt:
* platform/qt/css2.1/t0511-c21-pseud-link-02-e-expected.png:
* platform/qt/css2.1/t0511-c21-pseud-link-02-e-expected.txt:
* platform/qt/css2.1/t0511-c21-pseud-link-03-e-expected.png:
* platform/qt/css2.1/t0511-c21-pseud-link-03-e-expected.txt:
* platform/qt/css2.1/t051103-c21-activ-ln-00-e-i-expected.png:
* platform/qt/css2.1/t051103-c21-activ-ln-00-e-i-expected.txt:
* platform/qt/css2.1/t051103-c21-focus-ln-00-e-i-expected.png:
* platform/qt/css2.1/t051103-c21-focus-ln-00-e-i-expected.txt:
* platform/qt/css2.1/t051103-c21-hover-ln-00-e-i-expected.png:
* platform/qt/css2.1/t051103-c21-hover-ln-00-e-i-expected.txt:
* platform/qt/css2.1/t051103-dom-hover-01-c-io-expected.png:
* platform/qt/css2.1/t051103-dom-hover-01-c-io-expected.txt:
* platform/qt/css2.1/t051103-dom-hover-02-c-io-expected.png:
* platform/qt/css2.1/t051103-dom-hover-02-c-io-expected.txt:
* platform/qt/css2.1/t051202-c24-first-lttr-00-b-expected.png:
* platform/qt/css2.1/t051202-c24-first-lttr-00-b-expected.txt:
* platform/qt/css2.1/t051202-c26-psudo-nest-00-c-expected.png:
* platform/qt/css2.1/t051202-c26-psudo-nest-00-c-expected.txt:
* platform/qt/css2.1/t0602-c13-inh-underlin-00-e-expected.png:
* platform/qt/css2.1/t0602-c13-inh-underlin-00-e-expected.txt:
* platform/qt/css2.1/t0602-c13-inheritance-00-e-expected.png:
* platform/qt/css2.1/t0602-c13-inheritance-00-e-expected.txt:
* platform/qt/css2.1/t0602-inherit-bdr-pad-b-00-expected.png:
* platform/qt/css2.1/t0602-inherit-bdr-pad-b-00-expected.txt:
* platform/qt/css2.1/t0603-c11-import-00-b-expected.png:
* platform/qt/css2.1/t0603-c11-import-00-b-expected.txt:
* platform/qt/css2.1/t060401-c32-cascading-00-b-expected.png:
* platform/qt/css2.1/t060401-c32-cascading-00-b-expected.txt:
* platform/qt/css2.1/t060402-c31-important-00-b-expected.png:
* platform/qt/css2.1/t060402-c31-important-00-b-expected.txt:
* platform/qt/css2.1/t060403-c21-pseu-cls-00-e-i-expected.png:
* platform/qt/css2.1/t060403-c21-pseu-cls-00-e-i-expected.txt:
* platform/qt/css2.1/t060403-c21-pseu-id-00-e-i-expected.png:
* platform/qt/css2.1/t060403-c21-pseu-id-00-e-i-expected.txt:
* platform/qt/css2.1/t09-c5526c-display-00-e-expected.png:
* platform/qt/css2.1/t09-c5526c-display-00-e-expected.txt:
* platform/qt/css2.1/t090402-c42-ibx-pad-00-d-ag-expected.png:
* platform/qt/css2.1/t090402-c42-ibx-pad-00-d-ag-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-00-d-expected.png:
* platform/qt/css2.1/t0905-c414-flt-00-d-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-01-d-g-expected.png:
* platform/qt/css2.1/t0905-c414-flt-01-d-g-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-02-c-expected.png:
* platform/qt/css2.1/t0905-c414-flt-02-c-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-03-c-expected.png:
* platform/qt/css2.1/t0905-c414-flt-03-c-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-04-c-expected.png:
* platform/qt/css2.1/t0905-c414-flt-04-c-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-fit-00-d-expected.png:
* platform/qt/css2.1/t0905-c414-flt-fit-00-d-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-fit-01-d-g-expected.png:
* platform/qt/css2.1/t0905-c414-flt-fit-01-d-g-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-wrap-00-e-expected.png:
* platform/qt/css2.1/t0905-c414-flt-wrap-00-e-expected.txt:
* platform/qt/css2.1/t0905-c414-flt-wrap-01-d-g-expected.png:
* platform/qt/css2.1/t0905-c414-flt-wrap-01-d-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltblck-00-d-ag-expected.png:
* platform/qt/css2.1/t0905-c5525-fltblck-00-d-ag-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltblck-01-d-expected.png:
* platform/qt/css2.1/t0905-c5525-fltblck-01-d-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltclr-00-c-ag-expected.png:
* platform/qt/css2.1/t0905-c5525-fltclr-00-c-ag-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltcont-00-d-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltcont-00-d-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-flthw-00-c-g-expected.png:
* platform/qt/css2.1/t0905-c5525-flthw-00-c-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltinln-00-c-ag-expected.png:
* platform/qt/css2.1/t0905-c5525-fltinln-00-c-ag-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltmrgn-00-c-ag-expected.png:
* platform/qt/css2.1/t0905-c5525-fltmrgn-00-c-ag-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltmult-00-d-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltmult-00-d-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltwidth-00-c-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltwidth-00-c-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltwidth-01-c-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltwidth-01-c-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltwidth-02-c-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltwidth-02-c-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltwidth-03-c-g-expected.png:
* platform/qt/css2.1/t0905-c5525-fltwidth-03-c-g-expected.txt:
* platform/qt/css2.1/t0905-c5525-fltwrap-00-b-expected.png:
* platform/qt/css2.1/t0905-c5525-fltwrap-00-b-expected.txt:
* platform/qt/css2.1/t0905-c5526-fltclr-00-c-ag-expected.png:
* platform/qt/css2.1/t0905-c5526-fltclr-00-c-ag-expected.txt:
* platform/qt/css2.1/t0905-c5526-flthw-00-c-g-expected.png:
* platform/qt/css2.1/t0905-c5526-flthw-00-c-g-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-00-d-expected.png:
* platform/qt/css2.1/t090501-c414-flt-00-d-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-01-b-expected.png:
* platform/qt/css2.1/t090501-c414-flt-01-b-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-02-d-g-expected.png:
* platform/qt/css2.1/t090501-c414-flt-02-d-g-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-03-b-g-expected.png:
* platform/qt/css2.1/t090501-c414-flt-03-b-g-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-ln-00-d-expected.png:
* platform/qt/css2.1/t090501-c414-flt-ln-00-d-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-ln-01-d-g-expected.png:
* platform/qt/css2.1/t090501-c414-flt-ln-01-d-g-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-ln-02-d-expected.png:
* platform/qt/css2.1/t090501-c414-flt-ln-02-d-expected.txt:
* platform/qt/css2.1/t090501-c414-flt-ln-03-d-expected.png:
* platform/qt/css2.1/t090501-c414-flt-ln-03-d-expected.txt:
* platform/qt/css2.1/t090501-c5525-flt-l-00-b-g-expected.png:
* platform/qt/css2.1/t090501-c5525-flt-l-00-b-g-expected.txt:
* platform/qt/css2.1/t090501-c5525-flt-r-00-b-g-expected.png:
* platform/qt/css2.1/t090501-c5525-flt-r-00-b-g-expected.txt:
* platform/qt/css2.1/t1503-c522-font-family-00-b-expected.png:
* platform/qt/css2.1/t1503-c522-font-family-00-b-expected.txt:
* platform/qt/css2.1/t1508-c527-font-03-b-expected.png:
* platform/qt/css2.1/t1508-c527-font-03-b-expected.txt:
* platform/qt/css2.1/t1508-c527-font-06-b-expected.png:
* platform/qt/css2.1/t1508-c527-font-06-b-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Speech JavaScript API: extract function from SpeechRecognitionResult::emma()
https://bugs.webkit.org/show_bug.cgi?id=92232

Reviewed by Adam Barth.

Extract code for creating emma-qualified names to a helper function.

Just a refactoring; covered by the existing test.

* Modules/speech/SpeechRecognitionResult.cpp:
(WebCore::emmaQualifiedName):
(WebCore):
(WebCore::SpeechRecognitionResult::emma):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Build fix for clang builds after r123628
https://bugs.webkit.org/show_bug.cgi?id=92266

Reviewed by Adrienne Walker.

An un-used variable was causing build failures for clang builds
after the refactoring in r123628.  It is correct to simply remove
this value.

* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsInternal):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Geolocation override
https://bugs.webkit.org/show_bug.cgi?id=89365

Reviewed by Pavel Feldman.

Source/WebCore:

Re-added the m_page member variable for GeolocationController since
it's now being used by InspectorInstrumentaiton.

Added a way to override the GeolocationPosition and GeolocationError
using Web Inspector. Curretnly only PositionError can be set.

This will be hidden behind the experiments flag for now.

Tests: inspector/geolocation-error.html
       inspector/geolocation-success.html
       inspector/geolocation-watchPosition.html

* English.lproj/localizedStrings.js:
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::GeolocationController):
(WebCore::GeolocationController::positionChanged):
* Modules/geolocation/GeolocationController.h:
(GeolocationController):
* inspector/Inspector.json:
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::overrideGeolocationPositionImpl):
* inspector/InspectorInstrumentation.h:
(WebCore):
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::overrideGeolocationPosition):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::InspectorPageAgent):
(WebCore::InspectorPageAgent::setGeolocationOverride):
(WebCore):
(WebCore::InspectorPageAgent::clearGeolocationOverride):
(WebCore::InspectorPageAgent::canOverrideGeolocation):
(WebCore::InspectorPageAgent::overrideGeolocationPosition):
* inspector/InspectorPageAgent.h:
* inspector/front-end/Settings.js:
* inspector/front-end/SettingsScreen.js:
(WebInspector.UserAgentSettingsTab):
(WebInspector.UserAgentSettingsTab.prototype._createDeviceMetricsElement):
(WebInspector.UserAgentSettingsTab.prototype._onGeolocationOverrideCheckboxClicked):
(WebInspector.UserAgentSettingsTab.prototype._applyGeolocationUserInput):
(WebInspector.UserAgentSettingsTab.prototype._setGeolocationPosition.set if):
(WebInspector.UserAgentSettingsTab.prototype._setGeolocationPosition):
(WebInspector.UserAgentSettingsTab.prototype._createGeolocationOverrideElement.createInput):
(WebInspector.UserAgentSettingsTab.prototype._createGeolocationOverrideElement):
* inspector/front-end/UserAgentSupport.js:
(WebInspector.UserAgentSupport.GeolocationPosition):
(WebInspector.UserAgentSupport.GeolocationPosition.prototype.toSetting):
(WebInspector.UserAgentSupport.GeolocationPosition.parseSetting):
(WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput):
(WebInspector.UserAgentSupport.GeolocationPosition.clearGeolocationOverride):
* inspector/front-end/inspector.js:
(WebInspector.doLoadedDone):

LayoutTests:

Added new tests.

* inspector/geolocation-error-expected.txt: Added.
* inspector/geolocation-error.html: Added.
* inspector/geolocation-success-expected.txt: Added.
* inspector/geolocation-success.html: Added.
* inspector/geolocation-watchPosition-expected.txt: Added.
* inspector/geolocation-watchPosition.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r123560.
http://trac.webkit.org/changeset/123560
https://bugs.webkit.org/show_bug.cgi?id=90321

Breaks chromium valgrind tests.

Source/WebCore:

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::append):
* html/parser/HTMLEntityParser.cpp:
(WebCore::HTMLEntityParser::consumeNamedEntity):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::stripLeadingAndTrailingHTMLSpaces):
* html/parser/HTMLSourceTracker.cpp:
(WebCore::HTMLSourceTracker::sourceForToken):
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::script):
* platform/text/SegmentedString.cpp:
(WebCore::SegmentedString::SegmentedString):
(WebCore::SegmentedString::operator=):
(WebCore::SegmentedString::clear):
(WebCore::SegmentedString::append):
(WebCore::SegmentedString::prepend):
(WebCore::SegmentedString::advanceSubstring):
(WebCore::SegmentedString::advance):
(WebCore::SegmentedString::advanceSlowCase):
(WebCore::SegmentedString::advanceAndUpdateLineNumberSlowCase):
* platform/text/SegmentedString.h:
(WebCore::SegmentedSubstring::SegmentedSubstring):
(WebCore::SegmentedSubstring::clear):
(WebCore::SegmentedSubstring::appendTo):
(SegmentedSubstring):
(WebCore::SegmentedString::SegmentedString):
(WebCore::SegmentedString::push):
(WebCore::SegmentedString::isEmpty):
(WebCore::SegmentedString::lookAhead):
(WebCore::SegmentedString::lookAheadIgnoringCase):
(WebCore::SegmentedString::advance):
(WebCore::SegmentedString::advanceAndASSERT):
(WebCore::SegmentedString::advanceAndASSERTIgnoringCase):
(WebCore::SegmentedString::advancePastNewlineAndUpdateLineNumber):
(SegmentedString):
(WebCore::SegmentedString::advancePastNonNewline):
(WebCore::SegmentedString::advanceAndUpdateLineNumber):
(WebCore::SegmentedString::operator*):
(WebCore::SegmentedString::operator->):
(WebCore::SegmentedString::current):
(WebCore::SegmentedString::equalsLiterally):
(WebCore::SegmentedString::equalsIgnoringCase):
(WebCore::SegmentedString::lookAheadInline):
(WebCore::SegmentedString::lookAheadSlowCase):
* xml/parser/CharacterReferenceParserInlineMethods.h:
(WebCore::consumeCharacterReference):
* xml/parser/MarkupTokenizerBase.h:
(WebCore::MarkupTokenizerBase::InputStreamPreprocessor::nextInputCharacter):
(WebCore::MarkupTokenizerBase::InputStreamPreprocessor::peek):
(WebCore::MarkupTokenizerBase::InputStreamPreprocessor::advance):

Source/WTF:

* wtf/text/WTFString.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make ElementAttributeData a variable-sized object to reduce memory use.
<http://webkit.org/b/88240>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Take advantage of the fact that we know at ElementAttributeData construction time how many attributes
it needs to accomodate and allocate exactly as much space as needed instead of using a Vector.
For elements that never have their attribute list mutated (the vast majority), this saves a lot of
memory and removes the indirection to Vector<Attribute>'s heap-allocated storage.

Introduced a mutability flag to ElementAttributeData and sprinkled assertions all over to make sure
that nothing tries to mutate an element with a raw attribute array.

When an Element's attribute(s) are mutated, we reconstruct the ElementAttributeData, this time using
a Vector as backing instead. This is triggered when calling Element::mutableAttributeData().

This reduces memory consumption by 3.2MB when viewing the full HTML5 spec at <http://whatwg.org/c/>.
That is a ~35% reduction in DOM attribute memory use.

Furthermore, that page ends up promoting 27% of the elements to mutable attribute storage due to dynamic
adding of "class" attributes. For more static pages, savings are even greater.

Also did away with ElementAttributeData::removeAttribute(name) and do separate index lookup where
needed. Not a big deal but avoids double lookup of attributes when removing them.

* dom/Element.cpp:
(WebCore::Element::detachAttribute):
(WebCore::Element::removeAttribute):
(WebCore::Element::attributes):
(WebCore::Element::setAttributeInternal):
(WebCore::Element::parserSetAttributes):
(WebCore::Element::hasEquivalentAttributes):
(WebCore::Element::setAttributeNode):
(WebCore::Element::removeAttributeNode):
(WebCore::Element::getAttributeNode):
(WebCore::Element::getAttributeNodeNS):
(WebCore::Element::hasAttribute):
(WebCore::Element::hasAttributeNS):
(WebCore::Element::cloneAttributesFromElement):

    Sprinkle const on ElementAttributeData* pointers.
    Switch to using mutableAttributeData() in code paths that modify attributes.

(WebCore::Element::normalizeAttributes):

    Cleaner iteration over attributes, I removed ElementAttributeData::attributeVector() since that
    was just incurring a bunch of extra Vector copying. Since ElementAttributeData already exposes
    length() and attributeItem(index), use those to iterate directly over the attributes.

(WebCore::Element::createMutableAttributeData):

    Added, converts existing ElementAttributeData to a mutable object. Otherwise creates a new
    ElementAttributeData (mutable and empty.)

* dom/Element.h:
(WebCore::Element::attributeData):
(WebCore::Element::updatedAttributeData):
(WebCore::Element::ensureAttributeData):
(WebCore::Element::ensureUpdatedAttributeData):

    Made all of these return "const ElementAttributeData*" to ensure at compile-time that nothing
    attempts to modify an ElementAttributeData that may be immutable.

    ensureUpdatedAttributeData() is still const, despite possibly calling mutableAttributeData().
    The goal of having methods be const is to prevent conversion from one ElementAttributeData
    object to another, so that pointers remain intact and no unnecessary work gets done.

(WebCore::Element::mutableAttributeData):

    Added, returns a guaranteed mutable ElementAttributeData* pointer.

* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::createImmutable):

    Creates a new ElementAttributeData tailored to fit the provided Vector<Attribute>.

(WebCore::ElementAttributeData::ElementAttributeData):

    Moved constructors out-of-line, getting too complex for header files.

    ElementAttributeData(const Vector<Attribute>&) creates an immutable ElementAttributeData
    containing the provided attributes in an array tacked onto the end of the object.

(WebCore::ElementAttributeData::~ElementAttributeData):

    Free the attribute vector if mutable.
    For immutable objects, manually invoke destructor on each Attribute object,
    since these won't be destroyed automatically by ~ElementAttributeData.

(WebCore::ElementAttributeData::attrIfExists):

(WebCore::ElementAttributeData::ensureAttr):
(WebCore::ElementAttributeData::setAttr):
(WebCore::ElementAttributeData::removeAttr):

    Make these const, as they should always have been- they don't affect the ElementAttributeData,
    only the global DOM Attr <-> ElementAttributeData mappings.

(WebCore::ElementAttributeData::ensureInlineStyle):
(WebCore::ElementAttributeData::ensureMutableInlineStyle):

    Sprinkle ASSERT(isMutable()). This doesn't mean that all Elements with inline styles automatically
    have mutable attribute data. There's still inlineStyle() for that, which may return null.
    These are only for use where you need a valid StylePropertySet*, even if there is no inline style
    attribute, e.g in editing code that wants to add style.

(WebCore::ElementAttributeData::updateInlineStyleAvoidingMutation):
(WebCore::ElementAttributeData::destroyInlineStyle):

    Make these const. While destroyInlineStyle() doesn't sound very const-y, immutable objects that
    contain a style attribute will have a valid inlineStyle() with that style data. This is just
    an interface for ~StyledElement to destroy the style object.
    It'd be nice to do that in ~ElementAttributeData(), but we need a StyledElement* pointer to
    clean up properly and we don't store one in this class.

(WebCore::ElementAttributeData::addAttribute):
(WebCore::ElementAttributeData::removeAttribute):
(WebCore::ElementAttributeData::clearAttributes):
(WebCore::ElementAttributeData::replaceAttribute):

    Sprinkle ASSERT(isMutable()).
    Always go straight for m_mutableAttributeVector since we know that's the storage being used.

(WebCore::ElementAttributeData::isEquivalent):
(WebCore::ElementAttributeData::detachAttrObjectsFromElement):
(WebCore::ElementAttributeData::getAttributeItemIndexSlowCase):
(WebCore::ElementAttributeData::removeAttribute):
(WebCore::ElementAttributeData::getAttributeItem):
(WebCore::ElementAttributeData::getAttributeItemIndex):

    Use length() and attributeItem(index) to iterate over the attributes.

(WebCore::ElementAttributeData::cloneDataFrom):

    Sprinkle ASSERT(isMutable()). Added a FIXME that cloning elements could create immutable
    attribute data. I'm not sure this optimization is worthwhile, as cloning elements is already
    a semi-rare occurrence.

    Updated code to handle both immutable and mutable source objects. This could

(WebCore::ElementAttributeData::getAttributeNode):

    Const correctness.

* dom/ElementAttributeData.h:
(ElementAttributeData):

    Turn attribute storage into what's effectively union { OwnPtr<Vector<Attribute>>; Attribute[]; }
    The new m_isMutable bit determines which union member should be used for access.

(WebCore::ElementAttributeData::create):
(WebCore::ElementAttributeData::createImmutable):

    Added createImmutable(const Vector<Attribute>&) as a complement to create().

(WebCore::ElementAttributeData::setClass):
(WebCore::ElementAttributeData::setIdForStyleResolution):
(WebCore::ElementAttributeData::inlineStyle):
(WebCore::ElementAttributeData::setAttributeStyle):

    Make these const, and their data member counterparts 'mutable'.
    An immutable ElementAttributeData object still has m_classNames, m_idForStyleResolution,
    m_inlineStyleDecl and m_attributeStyle.

(WebCore::ElementAttributeData::reportMemoryUsage):

    Updated for isMutable().

(WebCore::ElementAttributeData::makeMutable):

    Returns a mutable clone of itself.

(WebCore::ElementAttributeData::isEmpty):
(WebCore::ElementAttributeData::length):
(WebCore::ElementAttributeData::attributeItem):

    Check isMutable() to know how to access attribute storage.

* dom/StyledElement.cpp:
(WebCore::StyledElement::style):
(WebCore::StyledElement::setInlineStyleProperty):

    Simplify by using StyledElement::ensureInlineStyle().

(WebCore::StyledElement::classAttributeChanged):

    Use mutableAttributeData() if the attribute is being removed completely.
    In other cases, tiptoe around without causing the attribute data to go mutable.

(WebCore::StyledElement::removeInlineStyleProperty):

    Use mutableAttributeData() if/when actually removing something.

(WebCore::StyledElement::addSubresourceAttributeURLs):

    Const correctness.

* dom/StyledElement.h:
(WebCore::StyledElement::ensureInlineStyle):

    This now implies conversion to mutable attribute data. Used by codepaths that add/remove
    properties, so conversion is inevitable.

* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
(WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement):
* svg/properties/SVGAnimatedPropertyMacros.h:
(WebCore::SVGSynchronizableAnimatedProperty::synchronize):

    Use mutableAttributeData() as appropriate.

* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):

    Const correctness.

LayoutTests:

Extended this test to cover the case where setAttributeNode() returns a lazily serialized value.

* fast/dom/attr-style-too-lazy-expected.txt:
* fast/dom/attr-style-too-lazy.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=89114
REGRESSION (r112919): Setting scrollTop after setting display from none to block 
fails
-and corresponding-
<rdar://problem/11656050>

Reviewed by Simon Fraser.

Source/WebCore: 

ScrollAnimatorMac::immediateScrollTo() and ScrollAnimatorMac::immediateScrollBy() 
both have an optimization in place so that they do not call 
notifyPositionChanged() if the new scroll offset matches the ScrollAnimator's 
cached m_currentPosX and m_currentPosY. So revision 112919 caused troubled with 
this optimization because it allowed RenderLayers to restore a scrollOffset from 
the Element if there is one cached there. This caused the RenderLayer to have a 
scrollOffset that is improperly out-of-synch with the ScrollAnimator's 
currentPosition (which will just be 0,0 since it is being re-created like the 
RenderLayer). This fix makes sure they are in synch by calling 
setCurrentPosition() on the ScrollAnimator when the cached position is non-zero.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):

LayoutTests: 

* fast/overflow/setting-scrollTop-after-hide-show-expected.txt: Added.
* fast/overflow/setting-scrollTop-after-hide-show.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web inspector auto-completes "optimizequality" but then complains
https://bugs.webkit.org/show_bug.cgi?id=92262

Reviewed by Timothy Hatcher.

Fixed optimizeSpeed, optimizeLegibility, geometricPrecision.

* inspector/front-end/CSSKeywordCompletions.js:

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

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::clearGeolocationOverride):
Changed ASSERT_UNUSED() to UNUSED_PARAM().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add Mac results for media/controls-styling-strict.html.

Rubber-stamped by Michael Saboff.

* platform/mac/media/controls-styling-strict-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: follow up to r123612, fixing CSS value suggest.

Not reviewed, minor JS fix.

* inspector/front-end/CSSCompletions.js:
(WebInspector.CSSCompletions):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylePropertyTreeElement.prototype):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium-Android] NRWT driver should not restart between reftests
https://bugs.webkit.org/show_bug.cgi?id=92267

Reviewed by Dirk Pranke.

* Scripts/webkitpy/layout_tests/port/chromium_android.py:
(ChromiumAndroidDriver.start): Resets self._pixel_tests when the pixel_tests parameter changes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123642 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Fix timeout issues when debugging WebProcess.
https://bugs.webkit.org/show_bug.cgi?id=92245

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-07-25
Reviewed by Dirk Pranke.

Fix timeout issues when debugging the WebProcess
under valgrind or gdb.

* Scripts/webkitpy/layout_tests/port/efl.py:
(EflPort.default_timeout_ms):
* WebKitTestRunner/efl/TestControllerEfl.cpp:
(WTR::TestController::platformInitialize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Turn the debug HUD into a layer so that it can be drawn as a WebCompositorQuad
https://bugs.webkit.org/show_bug.cgi?id=92182

Reviewed by Adrienne Walker.

Source/WebCore:

By changing the HUD into a quad, we are able to create a HUD and pass
it to the host compositor, allowing the HUD to be used for renderers
under Ubercompositor.

This also removes the special drawing code for the HUD from
LayerRendererChromium, allowing us to move finishDrawingFrame
into LayerRendererChromium as a private method and remove it
from the CCRenderer interface.

Finally, we can remove the CCFontAtlas transport code from CCProxy
and its implementations as the atlas can be synced to impl thread
through the usual layer commit mechanism.

The debug HUD is not covered by tests.

* WebCore.gypi:
* platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp: Added.
(WebCore):
(WebCore::HeadsUpDisplayLayerChromium::create):
(WebCore::HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium):
(WebCore::HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium):
(WebCore::HeadsUpDisplayLayerChromium::createCCLayerImpl):
* platform/graphics/chromium/HeadsUpDisplayLayerChromium.h: Added.
(WebCore):
(HeadsUpDisplayLayerChromium):
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawFrame):
(WebCore::LayerRendererChromium::cleanupSharedObjects):
* platform/graphics/chromium/LayerRendererChromium.h:
(LayerRendererChromium):
* platform/graphics/chromium/cc/CCDebugRectHistory.cpp:
(WebCore::CCDebugRectHistory::savePropertyChangedRects):
* platform/graphics/chromium/cc/CCDebugRectHistory.h:
* platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp.
(WebCore):
(WebCore::CCHeadsUpDisplayLayerImpl::CCHeadsUpDisplayLayerImpl):
(WebCore::CCHeadsUpDisplayLayerImpl::~CCHeadsUpDisplayLayerImpl):
(WebCore::CCHeadsUpDisplayLayerImpl::willDraw):
(WebCore::CCHeadsUpDisplayLayerImpl::appendQuads):
(WebCore::CCHeadsUpDisplayLayerImpl::didDraw):
(WebCore::CCHeadsUpDisplayLayerImpl::didLoseContext):
(WebCore::CCHeadsUpDisplayLayerImpl::drawHudContents):
(WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounter):
(WebCore::CCHeadsUpDisplayLayerImpl::drawFPSCounterText):
(WebCore::CCHeadsUpDisplayLayerImpl::drawDebugRects):
* platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h.
(WebCore):
(CCHeadsUpDisplayLayerImpl):
(WebCore::CCHeadsUpDisplayLayerImpl::create):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::layerIsAlwaysDamaged):
This flag is used to mark the HUD as always damaged, so that it is
continually drawn on the impl thread. It is also used as a hint by
the CCDebugRectHistory class to not include the layer in the display
of damage, since always damaged is not interesting damage.
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::create):
(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::initialize):
(WebCore::CCLayerTreeHost::willCommit):
(WebCore::CCLayerTreeHost::didCommit):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeSettings):
(WebCore::CCLayerTreeSettings::showDebugInfo):
(WebCore::CCLayerTreeSettings::showDebugRects):
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::drawLayers):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(WebCore):
(CCLayerTreeHostImpl):
* platform/graphics/chromium/cc/CCProxy.h:
(CCProxy):
* platform/graphics/chromium/cc/CCRenderer.h:
(CCRenderer):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
* platform/graphics/chromium/cc/CCThreadProxy.h:
(CCThreadProxy):

Source/WebKit/chromium:

* tests/LayerRendererChromiumTest.cpp:
(TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas
https://bugs.webkit.org/show_bug.cgi?id=92008

Reviewed by Darin Fisher.

Moved the ownership of canvas to WebViewBenchmarkSupport::PaintClient.

* public/WebViewBenchmarkSupport.h:
(PaintClient):
(WebKit::WebViewBenchmarkSupport::PaintClient::willPaint):
(WebKit::WebViewBenchmarkSupport::PaintClient::didPaint):
* src/WebViewBenchmarkSupportImpl.cpp:
(WebKit::WebViewBenchmarkSupportImpl::paintLayer):
(WebKit::WebViewBenchmarkSupportImpl::softwarePaint):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed chromium expectations change to mark tests as slow.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2][WTR] Alt, Shift and Ctrl keys are not handled by EventSenderProxy.
https://bugs.webkit.org/show_bug.cgi?id=92241

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

Alt, Shift and Ctrl keys were not handled by EventSenderProxy.
It caused failure of fast/events/keydown-leftright-keys.html test.

* WebKitTestRunner/efl/EventSenderProxyEfl.cpp: Added handling of Alt, Shift and Ctrl keys.
(WTR::keyName):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash when a web page is closed with outstanding scrolling thread barriers
https://bugs.webkit.org/show_bug.cgi?id=92280
<rdar://problem/11630200>

Reviewed by Andreas Kling.

There was a check in forceRepaintAsync to handle the drawing area going away before the block had
been invoked,  but this check needs to be done earlier (as the FIXME suggested).
Move this check to dispatchAfterEnsuringUpdatedScrollPosition instead.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):

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