Oilpan: Replace Document& with RawPtrWillBeMember<Document>

Document& in on-heap objects should be RawPtrWillBeMember<Document> and traced.

BUG=340522

Review URL: https://codereview.chromium.org/434003002

git-svn-id: svn://svn.chromium.org/blink/trunk@179352 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Cleanup: Simplify platform unittests targets.

It is seems redundant to have a separate target only for the main()
entry.

It looks cleaner to have everything contained into a single target imo.

BUG=None
TEST=blink_heap_unittests,blink_platform_unittests
R=tkent@chromium.org

Review URL: https://codereview.chromium.org/430933005

git-svn-id: svn://svn.chromium.org/blink/trunk@179353 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Oilpan: Replace Node& with RawPtrWillBeMember<Node>

This CL makes the following classes STACK_ALLOCATED, and replaces Node& with RawPtrWillBeMember<Node>.

- StyleResolverParentScope
- TreeScopeAdopter
- StyleSheetCandidate
- NodeWithIndex
- NodeChildRemovalTracker
- ChildFrameDisconnector
- SubframeLoadingDisabler

BUG=340522

Review URL: https://codereview.chromium.org/435683004

git-svn-id: svn://svn.chromium.org/blink/trunk@179354 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Simplify the code in FrameView::updateLayoutAndStyleIfNeededRecursive a little bit.

Review URL: https://codereview.chromium.org/435793002

git-svn-id: svn://svn.chromium.org/blink/trunk@179355 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Have getChildNodes() take a ContainerNode in argument

Have getChildNodes() take a ContainerNode in argument instead of a Node as
this utility function only makes sense for ContainerNodes. Also, this lets
the compiler generate slighter more efficient code.

This CL also makes use of getChildNodes() in more places to avoid code
duplication.

R=adamk@chromium.org

Review URL: https://codereview.chromium.org/435733002

git-svn-id: svn://svn.chromium.org/blink/trunk@179356 bbb929c8-8fbe-4397-9dbb-9b2b20218538
MSE: Fix flaky mediasource-append-buffer.html test

Media source specification's end of stream algorithm is currently
underspecified when no media data is buffered, and implementation may
transition beyond 'ended' to 'closed' MediaSource readyState.

This change updates the layout test to cover the well-specified case
when there is media data buffered prior to endOfStream() and removes the
flaky fail expectation. Later tests will be added to cover the currently
underspecified cases, once correct behavior is defined and implemented.

BUG=399188
R=acolwell@chromium.org
TEST=mediasource-append-buffer.html passed 100/100 attempts with 8 content_shells in parallel locally on linux

Review URL: https://codereview.chromium.org/417163006

git-svn-id: svn://svn.chromium.org/blink/trunk@179357 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Move Node/ContainerNode's traverseToChildAt() to NodeTraversal

Move Node/ContainerNode's traverseToChildAt() to NodeTraversal and rename to
childAt() as this method does DOM Tree traversal and we already have a utility
class for this.

R=adamk@chromium.org

Review URL: https://codereview.chromium.org/425223005

git-svn-id: svn://svn.chromium.org/blink/trunk@179358 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Oilpan: Replace TreeScope& in TreeScopeStyleSheetCollection with RawPtrWillBeMember<TreeScope>

BUG=340522

Review URL: https://codereview.chromium.org/438743002

git-svn-id: svn://svn.chromium.org/blink/trunk@179359 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Oilpan: Move VisitedLinkState to oilpan's heap

BUG=340522

Review URL: https://codereview.chromium.org/421723003

git-svn-id: svn://svn.chromium.org/blink/trunk@179360 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Oilpan: Fix crash in DataObjectTest::TearDown.

As the code comment says, we need to invoke File destructors before restoring
the original Platform object. So we should call Heap::collectAllGarbage. Also we
need Platform::getTraceCategoryEnabledFlag implementation to make TRACE_EVENT0
in GC workable.

BUG=

Review URL: https://codereview.chromium.org/432253002

git-svn-id: svn://svn.chromium.org/blink/trunk@179361 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Mark some tests flaky

http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_mark.html
is flaky on Window Release too.

timeline/tracing/update-layer-tree.html is flaky.

BUG=398295,399507
TBR=alancutter@chromium.org

Review URL: https://codereview.chromium.org/437753002

git-svn-id: svn://svn.chromium.org/blink/trunk@179363 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Oilpan: Fix Resource-related unit test crashes in CachingCorrectnessTest, MemoryCacheTest, and ImageBitmapTest.

MemoryCache::m_liveResources is the main owner of Resource objects. If we
replace the global memory cache and the global memory cache is collected,
Resource objects are also collected unexpectedly even though their canDelete()
is false. So, replaceMemoryCacheForTesting should transfer m_liveResources of
the previous MemoryCache to the new one.

This CL also fixes additional problems.

* MemoryCacheTest.VeryLargeResourceAccounting
* MemoryCacheTest.DecodeCacheOrder
* ImageBitmapTest.ImageBitmapLiveResourcePriority
  Fix Resource leak. We need to unregister ResourceClient manually.

* RawResourceTest.DontIgnoreAcceptForCacheReuse
  Do not allocate garbage-collected object on stack.

BUG=393516

Review URL: https://codereview.chromium.org/426183003

git-svn-id: svn://svn.chromium.org/blink/trunk@179364 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Cleanup: Also simplify wtf_unittests target.

It is seems redundant to have a separate target only for the main() entry.

It looks cleaner to have everything contained into a single target imo.

Previous patch did it for blink_heap_unittests and
blink_platform_unittests in
https://src.chromium.org/viewvc/blink?revision=179353&view=revision

BUG=None
TEST=wtf_unittests
R=tkent@chromium.org

Review URL: https://codereview.chromium.org/436793003

git-svn-id: svn://svn.chromium.org/blink/trunk@179365 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Update a comment so that it contains a bug URL.

BUG=353585
NOTRY=true

Review URL: https://codereview.chromium.org/437593005

git-svn-id: svn://svn.chromium.org/blink/trunk@179366 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Fix crash in blink::Internals::numberOfScrollableAreas

The frame can be gone since there could have been a navigation that
removes it, as the testcase demonstrates. So like other methods
in Internals test for it first.

BUG=381066

Review URL: https://codereview.chromium.org/436673003

git-svn-id: svn://svn.chromium.org/blink/trunk@179367 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Revert of Always notify the MediaPlayer of any seek. (https://codereview.chromium.org/431903003/)

Reason for revert:
Test now flakily crashing on all platforms after this change:
http/tests/media/media-source/mediasource-duration.html

http://test-results.appspot.com/dashboards/flakiness_dashboard.html#tests=http%2Ftests%2Fmedia%2Fmedia-source%2Fmediasource-duration.html

Example build: http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux/builds/34873

BUG=399523

Original issue's description:
> Always notify the MediaPlayer of any seek.
> 
> This change removes short circuit logic for seeking to the current position.
> There are certain situations, like seeking to a truncated duration, where the
> HTMLMediaElement is not in the best position to determine whether a call to
> the MediaPlayer is necessary or not. This change allows the
> MediaPlayer/WebMediaPlayer implementation to determine what the best course
> of action should be. This also makes the seeking behavior more spec
> compliant because even a seek to the current position should have the
> seeking attribute be true until a stable state occurs. This is guaranteed
> when calling into the MediaPlayer and allows all seeks to be treated the
> same at the HTMLMediaElement level.
> 
> BUG=266631
> TEST=LayoutTests/media/video-seek-to-current-position.html
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179347

TBR=acolwell@chromium.org,philipj@opera.com,srirama.m@samsung.com
NOTREECHECKS=true
NOTRY=true
BUG=266631

Review URL: https://codereview.chromium.org/431273003

git-svn-id: svn://svn.chromium.org/blink/trunk@179368 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Revert of Delete mediaPlaybackRequiresUserGesture (https://codereview.chromium.org/414543002/)

Reason for revert:
We're going to gather some data about how users react to autoplaying videos in order to decide whether to keep this restriction

Original issue's description:
> Delete mediaPlaybackRequiresUserGesture
> 
> The Android framework does not require a user gesture to begin media playback.
> The web shouldn't have that restriction either.
> 
> BUG=178297
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=178731

TBR=eseidel@chromium.org,philipj@opera.com
NOTREECHECKS=true
NOTRY=true
BUG=178297

Review URL: https://codereview.chromium.org/428263004

git-svn-id: svn://svn.chromium.org/blink/trunk@179369 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Add support for case-insensitive attribute value selectors

Selectors Level 4 adds the syntax '*[foo="bar" i]' for making an attribute
value selector case-insensitive. Add support for that.

Does not alter the actual case-sensitivity match - i.e. matching is
performed using Unicode case-insensitivity rather than ASCII which
the spec expects.

Based on patch by <jl@opera.com>.

BUG=366563

Review URL: https://codereview.chromium.org/330043003

git-svn-id: svn://svn.chromium.org/blink/trunk@179370 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Interim change for using testharness.js from serviceworker tests.

The W3C testharness.js currently doesn't work from within a web worker
or a service worker. While this is being addressed upstream, this change
introduces worker-test-harness.js as an interim fix. It exposes symbols
to allow testharness to load and sets up handlers for capturing test
results that are then sent over to any client document that requests it.

New Service Worker tests should pull in the worker-test-harness.js as
follows:

    importScript('worker-test-harness.js');

The client document should invoke load the test harness using
service_worker_test() from resources/test-helpers.js:

    <script src="resources/test-helpers.js"></script>

    <script>
      service_worker_test('resources/my-worker-test-script.js');
    </script>

The service_worker_test() function handles:
  * Unregistering and registering the worker.
  * Create a message port and request test results from the worker.
  * Replay the results in the client document so that reporting
    infrastructure can properly report the results.

The test service worker is assigned to a scope that's unique to the top
level document:

   <origin of top level document>/service-worker-scope/<document-path>

BUG=374822

Review URL: https://codereview.chromium.org/432603002

git-svn-id: svn://svn.chromium.org/blink/trunk@179371 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Simplify construction and usage of BasicShapeCenterCoordinate

Review URL: https://codereview.chromium.org/433783002

git-svn-id: svn://svn.chromium.org/blink/trunk@179372 bbb929c8-8fbe-4397-9dbb-9b2b20218538