TextTrackRegion Not Implemented
https://bugs.webkit.org/show_bug.cgi?id=116546

Reviewed by Eric Carlson.

Merged from Blink (patch by vcarbune@chromium.org):
https://chromium.googlesource.com/chromium/blink/+/4940f89a087fea5b5ea628e98d0b355d398a9eea
http://crbug.com/25798003

Source/WebCore: 

Tests: media/track/regions-webvtt/text-track-region-display.html
       media/track/regions-webvtt/text-track-region-dom-layout.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::newRegionsAvailable):
* html/track/TextTrack.cpp:
* html/track/TextTrack.h:
* html/track/TextTrackRegion.cpp:
(WebCore::TextTrackRegion::TextTrackRegion):
(WebCore::TextTrackRegion::appendTextTrackCueBox):
* html/track/TextTrackRegion.h:
* html/track/VTTCue.cpp:
(WebCore::VTTCue::VTTCue):
(WebCore::VTTCue::notifyRegionWhenRemovingDisplayTree):
(WebCore::VTTCue::removeDisplayTree):
* html/track/VTTCue.h:
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::parseBytes):
(WebCore::WebVTTParser::collectMetadataHeader):
* html/track/WebVTTParser.h:

LayoutTests: 

* media/track/captions-webvtt/captions-regions.vtt: Added.
* media/track/regions-webvtt/text-track-cue-region-attribute-expected.txt: Rebaseline.
* media/track/regions-webvtt/text-track-region-display-expected.txt: Added.
* media/track/regions-webvtt/text-track-region-display.html: Added.
* media/track/regions-webvtt/text-track-region-dom-layout-expected.txt: Added.
* media/track/regions-webvtt/text-track-region-dom-layout.html: Added.
* media/track/regions-webvtt/text-track-region-list-expected.txt: Rebaseline.
* media/track/regions-webvtt/text-track-region-parser-expected.txt: Rebaseline.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add --reset option to Tools/Scripts/set-webkit-configuration script
https://bugs.webkit.org/show_bug.cgi?id=130401

Patch by Eva Balazsfalvi <evab.u-szeged@partner.samsung.com> on 2014-03-18
Reviewed by Csaba Osztrogonác.

* Scripts/set-webkit-configuration:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Renable pagination mode in WK2 MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=130374

Source/WebKit2:

Reviewed by Anders Carlsson.

Add SPI for pagination mode.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _paginationMode]):
(-[WKWebView _setPaginationMode:]):
(-[WKWebView _paginationBehavesLikeColumns]):
(-[WKWebView _setPaginationBehavesLikeColumns:]):
(-[WKWebView _pageLength]):
(-[WKWebView _setPageLength:]):
(-[WKWebView _gapBetweenPages]):
(-[WKWebView _setGapBetweenPages:]):
(-[WKWebView _pageCount]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
(NS_ENUM):

Tools:

Reviewed by Anders Carlsson.

Put the implementation of togglePaginationMode: back, and correctly
enable the menu item.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController isPaginated]):
(-[WK2BrowserWindowController togglePaginationMode:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
More FTL enabling.

Source/JavaScriptCore: 

Rubber stamped by Dan Bernstein and Mark Hahnenberg.

* Configurations/FeatureDefines.xcconfig:
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):

Source/WebCore: 

Rubber stamped by Dan Bernstein and Mark Hahnenberg.

No new tests.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac: 

Rubber stamped by Dan Bernstein.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2: 

Rubber stamped by Dan Bernstein.

* Configurations/FeatureDefines.xcconfig:

Source/WTF: 

Rubber stamped by Dan Bernstein and Mark Hahnenberg.

* wtf/Platform.h:

Tools: 

Rubber stamped by Dan Bernstein.

* Tools/Scripts/build-webkit:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<media> elements are not properly moved to new documents' visibility callback lists
https://bugs.webkit.org/show_bug.cgi?id=127711

Reviewed by David Kilzer.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Mutating rules returned by getMatchedCSSRules can result in crash
https://bugs.webkit.org/show_bug.cgi?id=130209

Source/WebCore: 

Reviewed by Andreas Kling.
        
The non-standard getMatchedCSSRules API returns CSSStyleRule objects that don't
have parent stylesheet pointer (as we don't know which sheet the rule originated from).
Mutating the rule via such wrapper can lead to crashes later as we fail to invalidate
the underlying stylesheet.
        
Fix by disallowing mutation of style rules that don't have parent sheet pointer. CSSStyleRule
has two mutable properties selectorText and style. The latter gives back CSSStyleDeclaration.
This patch disallows mutations in both cases for CSSStyleRules that don't have parent stylesheet
pointer.
        
While it is technically possible to have CSSRules that are legitimately disconnected
from stylesheet (by removing rule from sheet while holding a reference to it) it never
makes sense to mutate such rule as there is no way to do anything with it afterwards.

Tests: fast/css/getMatchedCSSProperties-rule-mutation.html
       fast/css/getMatchedCSSRules-crash.html

* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::setSelectorText):

    Bail out if parent stylesheet is null.

* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setCssText):
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::removeProperty):
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal):
        
    Allow StyleRuleCSSStyleDeclaration subclass cancel the mutation via
    boolean return value from willMutate.

(WebCore::StyleRuleCSSStyleDeclaration::willMutate):
        
    Disallow mutation if the owning CSSStyleRule is null or has null stylesheet.

(WebCore::StyleRuleCSSStyleDeclaration::didMutate):
        
    We never get here with null rule or stylesheet anymore.

* css/PropertySetCSSStyleDeclaration.h:
(WebCore::PropertySetCSSStyleDeclaration::willMutate):

LayoutTests: 

Reviewed by Andreas Kling.

* fast/css/getMatchedCSSProperties-rule-mutation-expected.txt: Added.
* fast/css/getMatchedCSSProperties-rule-mutation.html: Added.
* fast/css/getMatchedCSSRules-crash-expected.txt: Added.
* fast/css/getMatchedCSSRules-crash.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Micro-optimize element descendant iterator.
<https://webkit.org/b/130384>

Add a slightly more efficient ElementDescendantIterator that keeps a stack
of relevant ancestor siblings instead of walking up the parent chain every
time we run out of children.

Reviewed by Antti Koivisto.

* WebCore.xcodeproj/project.pbxproj:
* dom/ElementDescendantIterator.h: Added.
(WebCore::ElementDescendantIterator::ElementDescendantIterator):
(WebCore::ElementDescendantIterator::operator++):
(WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator):
(WebCore::ElementDescendantConstIterator::operator++):
(WebCore::ElementDescendantIteratorAdapter::ElementDescendantIteratorAdapter):
(WebCore::ElementDescendantIteratorAdapter::begin):
(WebCore::ElementDescendantIteratorAdapter::end):
(WebCore::ElementDescendantConstIteratorAdapter::ElementDescendantConstIteratorAdapter):
(WebCore::ElementDescendantConstIteratorAdapter::begin):
(WebCore::ElementDescendantConstIteratorAdapter::end):
(WebCore::elementDescendants):
* dom/ElementIterator.h:
* dom/SelectorQuery.cpp:
(WebCore::elementsForLocalName):
(WebCore::anyElement):
(WebCore::SelectorDataList::executeSingleTagNameSelectorData):
(WebCore::SelectorDataList::executeSingleClassNameSelectorData):
(WebCore::SelectorDataList::executeSingleSelectorData):
(WebCore::SelectorDataList::executeSingleMultiSelectorData):
(WebCore::SelectorDataList::executeCompiledSimpleSelectorChecker):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Pass ranges over IPC in a cross-platform manner
https://bugs.webkit.org/show_bug.cgi?id=130376

Reviewed by Anders Carlsson.

Added an EditingRange class for IPC, which automatically converts to and from
NSRanges, knowing the difference between notFound and NSNotFound.

Manually applied the same fix to characterIndexForPoint.

* Scripts/webkit2/messages.py:
(struct_or_class):
* Shared/EditingRange.h: Added.
(WebKit::EditingRange::EditingRange):
(WebKit::EditingRange::isValid):
(WebKit::EditingRange::operator NSRange):
* UIProcess/API/mac/WKView.mm:
(-[WKView insertText:replacementRange:]):
(-[WKView selectedRange]):
(-[WKView hasMarkedText]):
(-[WKView setMarkedText:selectedRange:replacementRange:]):
(-[WKView markedRange]):
(-[WKView attributedSubstringForProposedRange:actualRange:]):
(-[WKView characterIndexForPoint:]):
(-[WKView firstRectForCharacterRange:actualRange:]):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setMarkedText:selectedRange:]):
(-[WKContentView insertText:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::insertDictatedText):
(WebKit::WebPageProxy::getMarkedRange):
(WebKit::WebPageProxy::getSelectedRange):
(WebKit::WebPageProxy::getAttributedSubstringFromRange):
(WebKit::WebPageProxy::firstRectForCharacterRange):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setComposition):
(WebKit::WebPageProxy::insertText):
(WebKit::WebPageProxy::insertDictatedText):
(WebKit::WebPageProxy::getMarkedRange):
(WebKit::WebPageProxy::getSelectedRange):
(WebKit::WebPageProxy::getAttributedSubstringFromRange):
(WebKit::WebPageProxy::firstRectForCharacterRange):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::rangeFromEditingRange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getMarkedRange):
(WebKit::WebPage::getSelectedRange):
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::WebPage::firstRectForCharacterRange):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setComposition):
(WebKit::WebPage::insertText):
(WebKit::WebPage::insertDictatedText):
(WebKit::WebPage::getMarkedRange):
(WebKit::WebPage::getSelectedRange):
(WebKit::WebPage::getAttributedSubstringFromRange):
(WebKit::WebPage::characterIndexForPoint):
(WebKit::WebPage::firstRectForCharacterRange):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
webkit-patch land shouldn't add a reviewer for unreviewed build fixes
https://bugs.webkit.org/show_bug.cgi?id=130220

Patch by Eva Balazsfalvi <evab.u-szeged@partner.samsung.com> on 2014-03-18
Reviewed by Csaba Osztrogonác.

* Scripts/webkitpy/common/checkout/changelog.py:
(ChangeLog.set_reviewer):
* Scripts/webkitpy/common/checkout/changelog_unittest.py:
(test_set_reviewer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Dan says that options should be unsigned, and enums should be signed.

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
(NS_ENUM):

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