Add a USE() macro for content filtering code
https://bugs.webkit.org/show_bug.cgi?id=107098

Reviewed by Mark Rowe.

Source/WebCore:

* WebCore.exp.in: Use USE(CONTENT_FILTERING).
* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::MainResourceLoader): Ditto.
(WebCore::MainResourceLoader::~MainResourceLoader): Ditto.
(WebCore::MainResourceLoader::cancel): Ditto.
(WebCore::MainResourceLoader::responseReceived): Ditto.
(WebCore::MainResourceLoader::dataReceived): Ditto.
(WebCore::MainResourceLoader::didFinishLoading): Ditto.
(WebCore::MainResourceLoader::notifyFinished): Ditto.
* loader/MainResourceLoader.h:
(MainResourceLoader): Ditto.
* platform/mac/WebCoreSystemInterface.h: Ditto.
* platform/mac/WebCoreSystemInterface.mm: Ditto.

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Use USE(CONTENT_FILTERING).

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Use USE(CONTENT_FILTERING).

Source/WTF:

* wtf/Platform.h: Define WTF_USE_CONTENT_FILTERING on Mac platforms
more recent than Lion.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enable process suppression by default on Mac
https://bugs.webkit.org/show_bug.cgi?id=106804

Patch by Kiran Muppala <cmuppala@apple.com> on 2013-01-21
Reviewed by Alexey Proskuryakov.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext): Change initialized value of
m_processSuppressionEnabled from false to true.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitialize): Since process suppression
is no longer disabled on construction, do not disable it for global
child processes either.  Instead enable occlusion notifications as
they are needed to trigger process suppression.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Update expectations.
https://bugs.webkit.org/show_bug.cgi?id=107481

Unreviewed, expectations update.

After https://src.chromium.org/viewvc/chrome?view=rev&revision=177952,
these tests no longer fail on linux.


* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed.  Rolled Chromium DEPS to r177956.  Requested by
thakis_ via sheriffbot.

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

* DEPS:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Event target rects on the top level document shouldn't be clipped.
https://bugs.webkit.org/show_bug.cgi?id=107339

Reviewed by James Robinson.

Source/WebCore:

clippedOverflowRectForRepaint clips the top-level RenderView to the viewport, which
is wrong for generating event target rects, as the result will not extend to the bounds
of the document on pages that scroll. Changing the top-level view to use documentRect
instead.

Tests updated to cover bug: platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html
                            platform/chromium/fast/events/touch/compositor-touch-hit-rects.html

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::accumulateRendererTouchEventTargetRects): Use converToRootView instead of
a loop around convertToContaining view. This is not a change in behavior.
(WebCore::accumulateDocumentEventTargetRects): Switch to use documentRect instead of
clippedOverflowRectForRepaint for the top-level Document, and use converToRootView
to put rects in the coordinates of the top-level document.

LayoutTests:

Updating existing tests to cover this issue.

* platform/chromium-linux/platform/chromium/fast/events/touch/compositor-touch-hit-rects-expected.txt:
* platform/chromium/fast/events/touch/compositor-touch-hit-rects.html:
* platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt:
* platform/chromium/fast/events/touch/touch-hit-rects-in-iframe.html:
* platform/chromium/fast/events/touch/resources/frame-with-document-touch-handler.html: Added.
* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSS: Make tag sub-selectors standalone CSSSelectors.
<http://webkit.org/b/107111>

Reviewed by Antti Koivisto.

TL;DR: Instead of storing a QualifiedName with every CSSSelector, special-case tag selectors
       by promoting them to stand-alone CSSSelectors.
       33% reduction in CSS selector memory usage, 4.77 MB progression on Membuster3.
       Fixed some bugs in Shadow DOM that were exposed by these changes.

A selector like this:

    div.tripp.trapp#trull { }

Would previously be represented by a chain of 3 CSSSelector objects like so:

    [ Tag: "div",  Type: Class,  Value: "tripp" ]
    [ Tag:     *,  Type: Class,  Value: "trapp" ]
    [ Tag:     *,  Type: ID,     Value: "trull" ]

After this change, the memory layout becomes:

    [ Type: Tag,    Value: "div"   ]
    [ Type: Class,  Value: "tripp" ]
    [ Type: Class,  Value: "trapp" ]
    [ Type: ID,     Value: "trull" ]

This is a huge net memory win since the majority of selectors don't even have a tag name
and those that do now have a flat cost of one more CSSSelector.
Traversal is also slightly cleaner since any tag name will now be in a predictable place.

* css/SelectorChecker.cpp:
(WebCore::isFastCheckableMatch):
* html/shadow/HTMLContentElement.cpp:
(WebCore::validateSubSelector):

    Renamed CSSSelector::None to CSSSelector::Tag.

* css/SelectorChecker.h:
(WebCore::SelectorChecker::tagMatches):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::ruleMatches):

    Changed SelectorChecker::tagMatches() to take a QualifiedName instead of a CSSSelector.

* dom/QualifiedName.cpp:
(WebCore::QualifiedName::deref):
(WebCore::QualifiedName::QualifiedNameImpl::~QualifiedNameImpl):
* dom/QualifiedName.h:
(QualifiedNameImpl):

    Give QualifiedNameImpl a destructor so it can remove itself from the global cache instead of
    having QualifiedName do it. This makes it possible to participate in ownership of QualifiedNames
    via a QualifiedNameImpl pointer, as used by the union member in CSSSelector.

* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::createFloatingSelectorWithTagName):
(WebCore::CSSParser::updateSpecifiersWithNamespaceIfNeeded):
(WebCore::CSSParser::updateSpecifiersWithElementName):
* css/CSSParser.h:
* css/CSSParserValues.h:
(CSSParserSelector):
* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::CSSParserSelector):
(WebCore::CSSParserSelector::prependTagSelector):

    Make the CSS parser slap a CSSSelector with m_match=Tag at the head of all selectors that match
    one or more of these criteria:

    - The selector starts with a tag, e.g "div.foo" or just plain "span"
    - There is a @namespace rule in effect, and the override namespace needs to be stored with the selector.
      These will have CSSSelectors::m_isTagForNamespaceRule set, this is only so that selector serialization
      can avoid outputting a '*' tag where we previously didn't.

(WebCore::CSSParserSelector::isSimple):

    Merged the CSSSelector::isSimple() logic into CSSParserSelector, since it's only needed during parsing
    to figure out if a selector is allowed within :not().

* css/CSSSelector.h:
(CSSSelector):
(WebCore::CSSSelector::setValue):
(WebCore::CSSSelector::CSSSelector):
(WebCore::CSSSelector::~CSSSelector):
(WebCore::CSSSelector::tagQName):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::createRareData):
(WebCore::CSSSelector::operator==):

    Add a QualifiedNameImpl* m_tagQName member to the CSSSelector data union. This union pointer is used
    if m_match == Tag. tagQName() is used to retrieve the tag (renamed from tag().)

(WebCore::CSSSelector::selectorText):

    Only serialize Tag selector components that aren't namespace placeholders. This behavior is web-facing
    so we make an effort to stay consistent.

(WebCore::CSSSelector::specificityForOneSelector):
(WebCore::CSSSelector::specificityForPage):
* css/CSSSelectorList.cpp:
(WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
* css/RuleSet.cpp:
(WebCore::isSelectorMatchingHTMLBasedOnRuleHash):
* css/SelectorFilter.cpp:
(WebCore::collectDescendantSelectorIdentifierHashes):
(WebCore::SelectorFilter::collectIdentifierHashes):

    Adapt algorithms to having Tag selectors.

(WebCore::selectorListContainsUncommonAttributeSelector):

    Loop through all selector components when looking for uncommon attributes.

(WebCore::determinePropertyWhitelistType):

    Loop through all selector components when looking for ::cue().

(WebCore::RuleSet::addRule):
(WebCore::RuleSet::findBestRuleSetAndAdd):

    Break addRule into two methods to be able to peek ahead if the first selector is a Tag.
    Otherwise we'd end up sticking most selectors in m_tagRules, breaking the class/ID/etc optimizations.

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::fastCheck):
(WebCore::SelectorChecker::fastCheckSingleSelector):

    It's no longer necessary to check the tagQName for every selector component, so don't.
    Also simplified the signature of the template argument function.

(WebCore::SelectorChecker::fastCheckRightmostSelector):

    Updated for Tag selectors.

(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::matches):
(WebCore::SelectorChecker::match):

    Have match() take a SiblingTraversalStrategy so it can forward that to checkOne().
    This is necessary for shadow DOM code that was incorrectly calling checkOne() instead of match().

* css/StyleResolver.cpp:
(WebCore::StyleResolver::ruleMatches):

    The meaning of "single-part selector" changes a bit with this patch, and no longer includes "div.foo"
    as that is now a Tag, followed by a Class. Given that, we can't assume the tag check is unnecessary
    just because the rightmost descendant was found in one of the hashes.

(WebCore::StyleResolver::matchPageRulesForList):

    Loop through all selector components when matching @page since pseudo types may not always be in
    the first subselector now.

* html/shadow/ContentDistributor.cpp:
(WebCore::ContentDistributor::collectSelectFeatureSetFrom):

    Collect feature information from subselectors to make sure nothing is missed. (This bug was exposed
    by offsetting the subselectors.)

* html/shadow/ContentSelectorQuery.cpp:
(WebCore::ContentSelectorChecker::checkContentSelector):

    Call SelectorChecker::match() instead of checkOne() to make subselector traversal work properly.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Implement WebInspector::localizedStringsURL() on EFL
https://bugs.webkit.org/show_bug.cgi?id=107363

Patch by Sudarsana Nagineni <sudarsana.nagineni@intel.com> on 2013-01-21
Reviewed by Benjamin Poulain.

Implement WebInspector::localizedStringsURL() method to return the
file URL of the localizedStrings.js.

This prevents printing warnings about "Localized string not found" in
the console and fixes Web inspector related failing tests on the bots.

* WebProcess/WebPage/efl/WebInspectorEfl.cpp:
(WebKit::WebInspector::localizedStringsURL):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Unreviewed, update baselines after r140358. See also bug 107476.
https://bugs.webkit.org/show_bug.cgi?id=107483


* platform/chromium-mac/fast/block/float/024-expected.txt:
* platform/chromium-mac/fast/block/margin-collapse/empty-clear-blocks-expected.txt:
* platform/chromium/fast/block/float/024-expected.txt: Renamed from LayoutTests/platform/chromium-win/fast/block/float/024-expected.txt.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed gardening. Updating expectations for Mac platforms after r140370.

* platform/chromium-mac-snowleopard/platform/chromium/fast/events: Added.
* platform/chromium-mac-snowleopard/platform/chromium/fast/events/touch: Added.
* platform/chromium-mac-snowleopard/platform/chromium/fast/events/touch/touch-hit-rects-in-iframe-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140374 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Don't archive generated source files.
https://bugs.webkit.org/show_bug.cgi?id=106736

Reviewed by Eric Seidel.

They shouldn't be needed to run tests. They don't need a lot of space,
but add many lines to the "extracting" stdout. This attempts to reduce
that noise a bit.

* BuildSlaveSupport/built-product-archive:
(archiveBuiltProduct):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Add APIs to set/get view source mode
https://bugs.webkit.org/show_bug.cgi?id=106633

Patch by Jinwoo Song <jinwoo7.song@samsung.com> on 2013-01-21
Reviewed by Gyuyoung Kim.

Source/WebKit2:

Added APIs to set/get view source mode for enabling to load
the source code of the web page.

* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_source_mode_set):
(ewk_view_source_mode_get):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(TEST_F):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setMainFrameInViewSourceMode):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::mainFrameInViewSourceMode):
(WebPageProxy):

Tools:

Added a shotcut 'F8' in Minibrowser to display a source code
of the web page in a new window.

       * MiniBrowser/efl/main.c:
(on_key_down):
(on_window_create):
(window_create):
(elm_main):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add build flag for Canvas's Path object (disabled by default)
https://bugs.webkit.org/show_bug.cgi?id=107473

Patch by Dirk Schulze <dschulze@adobe.com> on 2013-01-21
Reviewed by Dean Jackson.

.:

Add CANVAS_PATH build flag to build systems.

* Source/cmake/WebKitFeatures.cmake:
* Source/cmakeconfig.h.cmake:
* configure.ac:

Source/JavaScriptCore:

Add CANVAS_PATH build flag to build systems.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Add CANVAS_PATH build flag to build systems.

* Configurations/FeatureDefines.xcconfig:
* GNUmakefile.am:

Source/WebKit/chromium:

Add CANVAS_PATH build flag to build systems.

* features.gypi:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

Add CANVAS_PATH build flag to build systems.

* Configurations/FeatureDefines.xcconfig:

Tools:

Add CANVAS_PATH build flag to build systems.

* Scripts/webkitperl/FeatureList.pm:

WebKitLibraries:

Add CANVAS_PATH build flag to build systems.

* win/tools/vsprops/FeatureDefines.vsprops:
* win/tools/vsprops/FeatureDefinesCairo.vsprops:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Update webaudio/realtimeanalyser-fft-sizing.html expectation on Win

Unreviewed gardening.

* platform/chromium-win-xp/webaudio/realtimeanalyser-fft-sizing-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] REGRESSION(r139347) roll chromium deps broke webkit-unit-tests
https://bugs.webkit.org/show_bug.cgi?id=106631

Reviewed by Kent Tamura.

Fixed in http://crrev.com/177931 and rolled. Renable these tests.

* tests/WebImageTest.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed.  Rolled Chromium DEPS to r177962.  Requested by
"Yoshifumi Inoue" <yosin@chromium.org> via sheriffbot.

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

* DEPS:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
FrameSelection should use shadowHost instead of shadowAncestorNode
https://bugs.webkit.org/show_bug.cgi?id=107220

Reviewed by Kent Tamura.

shadowAncestorNode() is deprecated and we want to use shadowHost.
Here, all objects calling shadowAncestorNode() is in ShadowDOM, we can safely convert
the call to shadowHost().

No new tests, simple refactoring.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::selectAll):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140381 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move HTML Attribute case-sensitivity logic out of SelectorChecker to HTMLDocument.
https://bugs.webkit.org/show_bug.cgi?id=107460

The case-sensitivity of HTML attributes is defined in HTML spec and is only applicable in HTML documents,
so having this logic in HTMLDocument seems like a good thing.

Reviewed by Eric Seidel.

Refactoring, covered by existing tests.

* css/SelectorChecker.cpp:
(WebCore): Moved code out of here.
(WebCore::isFastCheckableMatch): Changed the callsite to use new location.
(WebCore::SelectorChecker::checkOne): Ditto.
* html/HTMLDocument.cpp:
(WebCore::addLocalNameToSet): Moved the code into here.
(WebCore): Ditto.
(WebCore::createHtmlCaseInsensitiveAttributesSet): Ditto.
(WebCore::HTMLDocument::isCaseSensitiveAttribute): Ditto.
* html/HTMLDocument.h:
(HTMLDocument): Added decl for the newly moved function.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSSSelector::value() should assert that m_match != Tag.
<http://webkit.org/b/107500>

Reviewed by Anders Carlsson.

Add an assertion to catch anyone trying to extract a value() from a Tag selector.

* css/CSSSelector.h:
(CSSSelector):
(WebCore::CSSSelector::value):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CHROMIUM] Suppress c4267 build warnings for Win64 targets
https://bugs.webkit.org/show_bug.cgi?id=107499

Reviewed by Abhishek Arya.

Source/JavaScriptCore:

* JavaScriptCore.gyp/JavaScriptCore.gyp:

Source/Platform:

* Platform.gyp/Platform.gyp:

Source/WebCore:

No new tests. No code changes.

* WebCore.gyp/WebCore.gyp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Date selection from calendar picker should dispatch 'input' event in addition to 'change' event
https://bugs.webkit.org/show_bug.cgi?id=107427

Reviewed by Kentaro Hara.

Source/WebCore:

According to the specification and Opera's behavior, we should dispatch
not only 'change' event but also 'input' event when a user chooses a
date from the calender picker.

http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#common-event-behaviors
> When the user agent changes the element's value on behalf of the user
> (e.g. as part of a form prefilling feature), the user agent must follow
> these steps:
> 1. If the input event applies, queue a task to fire a simple event
> that bubbles named input at the input element.
> 2. If the change event applies, queue a task to fire a simple event
> that bubbles named change at the input element.

Tests: platform/chromium/fast/forms/calendar-picker/date-picker-events.html
       platform/chromium/fast/forms/calendar-picker/datetimelocal-picker-events.html

* html/InputType.cpp:
(WebCore::InputType::setValue): Add DispatchInputAndChangeEvent support.
* html/BaseChooserOnlyDateAndTimeInputType.cpp:
(WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
Use DispatchInputAndChangeEvent, not DispatchChangeEvent.
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorChooseValue):
Ditto.

LayoutTests:

* platform/chromium/fast/forms/calendar-picker/date-picker-events-expected.txt: Added.
* platform/chromium/fast/forms/calendar-picker/date-picker-events.html: Added.
* platform/chromium/fast/forms/calendar-picker/datetimelocal-picker-events-expected.txt: Added.
* platform/chromium/fast/forms/calendar-picker/datetimelocal-picker-events.html: Added.


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