Opera Software upstreamed commits

Upstreamed commits in Chromium: 6360, V8: 38, Skia: 12, BoringSSL: 16.

Click message to expand

Chromium

Author Message When
rune
Skip ruleset invalidations for SubtreeStyleChange roots.
When the TreeScope invalidation root is already with SubtreeStyleChange
there is no need to schedule ruleset invalidations for that scope. We
did not end up scheduling the invalidation sets, but went through a lot
of unnecessary steps in scheduleInvalidationsForRuleSets(). Instead,
just return early.

Added some more tests and corrected typos from
https://crrev.com/5fef4a38

Review-Url: https://codereview.chromium.org/2751193004
Cr-Commit-Position: refs/heads/master@{#457715}
mstensho
Make the gdb Vector pretty-printer work with Python version >= 3.
In iterators it's now called __next__(), not next(), apparently.

Review-Url: https://codereview.chromium.org/2754473007
Cr-Commit-Position: refs/heads/master@{#457711}
rune
Remove incorrect styleResolver() checks.
Whether the StyleResolver is created or not does no longer tell if we
have usable invalidation sets or not. Removing SubtreeStyleChange which
is presumably not necessary anymore.

Add a check for not scheduling any invalidation sets if the document is
already marked for full recalc.

Review-Url: https://codereview.chromium.org/2749273004
Cr-Commit-Position: refs/heads/master@{#457383}
tsniatowski
Fix android key event timestamps
Pass a Java long to C++ as a jlong type, not a C++ long which can have a
different size to avoid broken / negative event timestamp values.
ImeAdapter's Java side uses "long" in SendKeyEvent, so the C++ side must
use a jlong or int64_t, and not a C++ long. Otherwise things don't work
well when system uptime is over 2^31ms (~25 days).

Additionally, do not do an extra divide-by-1000 when the used helper
function will do the milliseconds to seconds conversion already, so the
timestamps are correctly measured in milliseconds.

The resulting keyboard event timestamps end up nicely sane and positive,
and no longer clamped to 0 in PerformanceBase.cpp.

BUG=701726
R=aelias@chromium.org

Review-Url: https://codereview.chromium.org/2755453004
Cr-Commit-Position: refs/heads/master@{#457369}
mstensho
Strictly unbreakable objects need to prevent interaction with the outside.
A strictly unbreakable object (i.e. when getPaginationBreakability() ==
ForbidBreaks) has no valid break points inside. This is the case for e.g.
images, writing mode roots and scrollable objects. If such an object is in the
containing block chain between two nested multicol containers, column content
in multicol containers on the inside shouldn't interact with columns in the
enclosing multicol container.

BUG=698686

Review-Url: https://codereview.chromium.org/2748973002
Cr-Commit-Position: refs/heads/master@{#457177}
mstensho
Remove old flow-thread aware code from computeLogicalLocationForFloat().
CSS regions supported variable fragmentainer widths. However, multicol doesn't,
so the code is no longer necessary.

Review-Url: https://codereview.chromium.org/2748963002
Cr-Commit-Position: refs/heads/master@{#457149}
sigbjornf
sendBeacon(): once transmission allowance has been reached, always fail.
Fix allowance checking logic for Beacon transmissions upon reaching
the limit. If the allowance limit was 'perfectly' exhausted after N
Beacon requests, subsequent Beacon requests would go ahead without
the (now zero) allowance limit imposed.

R=mkwst
BUG=701678

Review-Url: https://codereview.chromium.org/2751953002
Cr-Commit-Position: refs/heads/master@{#457088}
sigbjornf
Accurate transfer of SerializedScriptValue allocation costs.
r456009 added transferring of allocation costs for a
SerializedScriptValue and any array buffers that it refers to,
transferring that cost from one v8 context to another as part
of a postMessage()

The handoff 'protocol' provided there fell short in that it could
fail to subtract transferable (array buffer contents) costs in
the source context, or end up doing it twice if the postMessage()
failed. Bookkeeping confusion resulted.

Rework the mechanism by instead having ArrayBufferContents keep
track of its external allocation cost registration status, so as
to prevent double discounting. Along with that, it is both safe
and accurate to unregister all allocation costs prior to
transfer. Should the value successfully be posted to its target
context, cost will be registered there. And if not, the value will
be destructed (..but without discounting allocation cost yet again.)

R=jbroman,haraken
BUG=700353

Review-Url: https://codereview.chromium.org/2741793003
Cr-Commit-Position: refs/heads/master@{#456800}
sigbjornf
Pull AudioDestinationConsumer off the Blink GC heap.
The AudioDestinationConsumer interface and its single implementation
does not meet the bar for being on the Blink GC heap. It doesn't cause
harm to have them there, but in order to diagnose an unexplained
failure, pull these objects off the heap.

We may want to restore them to the Blink GC heap once the issue has
been resolved.

R=
BUG=682945

Review-Url: https://codereview.chromium.org/2748133003
Cr-Commit-Position: refs/heads/master@{#456736}
fs
Dirty pres. attribute style on <svg> dimension change when not attached
When an <svg> wasn't attached, and it had its 'width'/'height' mutated
via the SVG DOM interfaces (SVG*Length), presentation attribute style
would not be dirtied. This could lead to an incorrect size being
computed in some cases.
Ensure that presentation attribute style is always updated if the <svg>
element is not attached.

BUG=701075

Review-Url: https://codereview.chromium.org/2747153002
Cr-Commit-Position: refs/heads/master@{#456702}
fs
Invalidate SVG 'transform' pres. attribute style even if not attached
When the 'transform' attribute was manipulated via its SVG DOM
representation (SVGTransformList), the
presentation-attribute-style-is-dirty flag would not be set unless the
element had been attached.
Reorder the contents of the 'transform' branch in
SVGGraphicsElement::svgAttributeChanged so that the presentation
attribute style is always dirtied regardless of attachment status.

BUG=701075

Review-Url: https://codereview.chromium.org/2745053005
Cr-Commit-Position: refs/heads/master@{#456696}
fs
Remove argument to LayoutSVGResourceGradient::collectGradientAttributes
We can assume that element() is non-null, and just cast it in the
overriding implementations.
Move the synchronizeAnimatedSVGAttribute(...) calls into actual
attribute collection, so that it applies to all elements in the
inheritance chain.
Also rewrite the lengthy comment, because gradient building has changed
significantly from what it describes, and attribute collection now
precedes the actual Gradient construction. Replicate the new comment to
the similar place for <pattern>s.

BUG=661598

Review-Url: https://codereview.chromium.org/2749593002
Cr-Commit-Position: refs/heads/master@{#456662}
fs
Add Gradient::addColorStops method
This seems a better fit on Gradient than on LayoutSVGResourceGradient.

Review-Url: https://codereview.chromium.org/2749583002
Cr-Commit-Position: refs/heads/master@{#456504}
sigbjornf
Turn IDBTransaction into the ContextLifecycleObserver it needs to be.
Revert r453574's switch to using ContextClient for IDBTransaction,
going back to ContextLifecycleObserver. This is needed in order for
IDBTransaction's debug checks upon destruction to be able to safely access
the ExecutionContext.

While ContextClient keeps a weak reference to its ExecutionContext,
accessing it from a destructor assumes that weak processing for the
ContextClient will already have run (and cleared out the ExecutionContext
weak reference, if needs be.) This assumes that weak processing will
always run, which it won't if the ContextClient and ExecutionContext are
determined to be garbage during the same GC.

Update ContextLifecycleObserver comments to mention this subtle detail.

R=jsbell,haraken
BUG=699819

Review-Url: https://codereview.chromium.org/2742393002
Cr-Commit-Position: refs/heads/master@{#456432}
fs
Remove <filter> from the chainableResourceTags set
We don't actually support inheritance for <filter>, so having it in the
set is of no use.

BUG=661598

Review-Url: https://codereview.chromium.org/2743293002
Cr-Commit-Position: refs/heads/master@{#456380}
fs
Refactor <paint> URL resolution in SVGResources
Hoist the has-url check out of paintingResourceFromSVGPaint(), and
remove |hasPendingResource| - consider all null-returns as having pending
resources. (This means "incorrect" <paint> URL references are considered
pending, just as URL references for other resource types.)

BUG=454767

Review-Url: https://codereview.chromium.org/2746933002
Cr-Commit-Position: refs/heads/master@{#456374}
fs
Move common gradient attribute collection to SVGGradientElement
Move the collection of attributes shared by both gradient types to the
base class (collectCommonAttributes.) Introduce a new helper for looking
up a potential element to inherit attributes from. Restructure the
"collection loop" a bit after the common code has been broken out.
This also means that buildStops() can be made private.

BUG=661598

Review-Url: https://codereview.chromium.org/2741993002
Cr-Commit-Position: refs/heads/master@{#456371}
fs
Use IdTargetObserver in SVGSMILElement
Move SVGSMILElement (target reference) and SVGSMILElement::Condition to
use IdTargetObserver via SVGURIReference::observeTarget.
Simplify the result to avoid needing the lookupEventBase helper.

BUG=661598

Review-Url: https://codereview.chromium.org/2737403003
Cr-Commit-Position: refs/heads/master@{#456367}
sigbjornf
PartitionAlloc: use less stack when dumping stats.
Avoid unnecessary stack usage in PartitionDumpStatsGeneric() for
the intermediate array of sizes used for full stats reporting.

Full stat dumps are currently only made use of by unit tests,
light reports do not make really use of an intermediate array and
allocation can be avoided for those. Addressing some reported
stack overflow failures (Windows.)

R=haraken
BUG=699893, 699922

Review-Url: https://codereview.chromium.org/2741853007
Cr-Commit-Position: refs/heads/master@{#456291}
rune
Track lastTextNode during rebuildLayoutTree.
We keep track of last seen text node for more efficient whitespace
re-attachment. When style recalc and layout tree building was split,
the text node is still tracked during recalc, stored in a hash map, and
retreived when needed during layout tree building.

However, the text nodes are also traversed during layout tree building
so that we can track the nodes during that phase instead.
StyleReattachData is removed and this CL reverts back to using the
m_nonAttachedStyle map for ComputedStyle.

The comment about reversed traversal of children for avoiding n^2
performance is moved to rebuildChildrenLayoutTrees() since that's where
the issue is. We should be able to do the child recalc first-to-last
now if we want to.

R=nainar@chromium.org,esprehn@chromium.org
BUG=595137

Review-Url: https://codereview.chromium.org/2740823005
Cr-Commit-Position: refs/heads/master@{#456047}
rune
Initial containing block for print not affected by page zoom.
The page zoom factor is not applied to the ICB for printing, yet the
ICB basis for media queries and viewport units were. Use 1 as a page
zoom factor in viewportSizeForViewportUnits and use that method to get
the size for the ICB for evaluating media queries.

BUG=699014,699910

Review-Url: https://codereview.chromium.org/2738173002
Cr-Commit-Position: refs/heads/master@{#456040}
sigbjornf
MediaStreamSource: verify unlocked state when finalizing.
To diagnose an audio thread crash condition, verify that the lock
over audio consumers that MediaStreamSource keeps, isn't held when it is
being finalized. If it is, then the audio thread is active using the
MediaStreamSource object..which is not a well-formed state to be in.

R=
BUG=682945

Review-Url: https://codereview.chromium.org/2741663004
Cr-Commit-Position: refs/heads/master@{#456029}
hugoh
Remove LayoutTests that test the now unsupported user-select: ignore
BUG=none

Review-Url: https://codereview.chromium.org/2740953004
Cr-Commit-Position: refs/heads/master@{#456028}
wdzierzanowski
Stop assuming anything about result of MFStartup()
MFStartup() usually returns S_OK.  However, being a system library
function it doesn't have to, and we have no control over it.  It can
return an error when something goes wrong within Media Foundation, or
simply on an "N" edition of Windows that doesn't even have Media
Foundation.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2735783002
Cr-Commit-Position: refs/heads/master@{#456026}
sigbjornf
postMessage(): transfer allocation costs along with value.
A MessageEvent's data value will in some cases hold on to significant
amounts of off-heap memory, so we take care of registering that
external allocation with v8, so that it can be taken into consideration
by the GC triggering logic.

However, when posting a message to another context, we must arrange for
its total 'external allocation' to be associated with the target context.
Including the sizes of any transferables (array buffers), so balance the
books more accurately by also transferring the external allocation cost
of those transferables.

R=
BUG=698981

Review-Url: https://codereview.chromium.org/2734173002
Cr-Commit-Position: refs/heads/master@{#456009}
fs
Remove side-effects from the SVGTreeScopeResources constructor
SVGTreeScopeResources and SVGDocumentExtensions carries disjoint state,
so this side-effect is not required.

Review-Url: https://codereview.chromium.org/2739063004
Cr-Commit-Position: refs/heads/master@{#455826}
fs
Fold SVGDocumentExtensions::reportError into only user
This method only had a single user, and it seems like it could just call
Document::addConsoleMessage directly.
Also remove a stray 'public' access specifier by moving the single
method in it up a bit in the file.

Review-Url: https://codereview.chromium.org/2738233002
Cr-Commit-Position: refs/heads/master@{#455802}
sigbjornf
Remove some dated Member friendships.
CollectionBackingTraceTrait no longer exists, and Visitor only
needs to be friend with WeakMember<>.

R=
BUG=

Review-Url: https://codereview.chromium.org/2745433003
Cr-Commit-Position: refs/heads/master@{#455786}
fs
Use IdTargetObserver in SVGUseElement
Change SVGUseElement to use the observeTarget() helper from
SVGURIReference. Since SVGUseElement has some additional requirements
for its reference management, a more low-level observeTarget() variant
is exposed.
To facilitate this change, clearShadowTree() is renamed to
clearResourceReference(), and the shadow tree tear-down is hoisted out
of it.

BUG=661598

Review-Url: https://codereview.chromium.org/2744613002
Cr-Commit-Position: refs/heads/master@{#455769}
fs
Use IdTargetObserver in SVGFEImageElement
Change SVGFEImageElement to use the observeTarget() helper from
SVGURIReference.
A slight change in behavior for when a load is initiated for a potential
image resource is made. Instead of using a "failed element lookup and a
non-existing id" as the condition, use "failed element lookup and non-
local resource reference".
Also add a new method clearImageResource() and put the tear-down for
the image resource, and change a use of ownerDocument() to just
document().

BUG=661598

Review-Url: https://codereview.chromium.org/2740003003
Cr-Commit-Position: refs/heads/master@{#455765}
fs
Disable virtual/gpu-rasterization/images/cross-fade-background-size.html
Minor differences on Windows bots.

TBR=xhwang@chromium.org
NOTRY=true
BUG=699573

Review-Url: https://codereview.chromium.org/2741693002
Cr-Commit-Position: refs/heads/master@{#455714}
fs
Store element reference for event-bases too
Rather than using the (obviously "racy") technique of looking up the
event-base element again when disconnecting from it, store the reference
on connect (sharing storage with the sync-base element since they are
mutual exclusive) and use it to disconnect properly.

BUG=641437

Review-Url: https://codereview.chromium.org/2739893002
Cr-Commit-Position: refs/heads/master@{#455699}
mstensho
Text control elements should contain all (shadow DOM) children.
For instance, INPUT type="search" elements allow styling of the cancel button,
via a ::-webkit-search-cancel-button pseudo element selector. We don't want authors
to be able to escape the containing INPUT element by styling the cancel button as
position:absolute, etc.

Force INPUT and other text control elements to be in the containing block chain of
all its descendants. This should be a good idea in general (and at least harmless),
and there's also C++ code [1] that essentially assumes that it is so.

Since this change makes canContainFixedPositionObjects() in LayoutObject and
ComputedStyle even more different than they used to be, we need to change some
code from using the one in ComputedStyle to the one in LayoutObject.

Two existing tests in fast/forms/ had to be updated, since they were adding together
offsetLeft of an INPUT element and offsetLeft of something inside the INPUT element
in a way that used to work by accident. Use getBoundingClientRect() instead, since
the test ultimately wants absolute coordinates anyway.

[1] See ThemePainterDefault::paintSearchFieldCancelButton()

BUG=685527
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2733593002
Cr-Commit-Position: refs/heads/master@{#455644}
fs
Add a new mechanism for watching SVGElement 'href' targets
This CL adds a new mechanism for watching elements referenced via 'href'
attributes. It uses IdTargetObserver as the basis adding a callback for
notification.
This is a step away from relying on SVGTreeScopeResources for tracking
of "pending" elements for these use cases. Each element is instead does
its own tracking via the relevant TreeScope. This will eventually mean
that the buildPendingResourcesIfNeeded mechanism can be removed.

SVGTextPathElement and SVGMPathElement are updated to use this new
scheme. Other uses will be replaced in future CLs.

BUG=661598

Review-Url: https://codereview.chromium.org/2737653006
Cr-Commit-Position: refs/heads/master@{#455584}
karlo
Account for borders and padding when calculating background tile size.
This is required when sub-pixel borders and padding are used, otherwise
the tile size may become one pixel too small, causing rendering artifacts.
Test case attached.

BUG=686435
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2689993003
Cr-Commit-Position: refs/heads/master@{#455454}
mstensho
Search the entire subtree when looking for the end of an inline continuation chain.
Inlines may be nested, so we may not find the last inline in the chain as a
direct child of the anonymous blocks. We need to search the entire subtree.
Don't do this with anonymous blocks that wrap block children (the block-level
DOM children of the inline-level objects), though. We're not going to find
anything interesting there.

This fix is speculative; the original bug report didn't come with a test case.

BUG=662767

Review-Url: https://codereview.chromium.org/2738503004
Cr-Commit-Position: refs/heads/master@{#455420}
sigbjornf
XMLHttpRequest: return null upon failing responseArrayBuffer allocation.
The allocation of a response ArrayBuffer may fail, a large enough
contiguous chunk of memory simply not being available from the
underlying allocator. The spec [1] now admits allocation failure as a
possibility, allowing the return of a null buffer if so.

Update our implementation accordingly, returning null rather than
failing hard with an OOM.

1 - https://xhr.spec.whatwg.org/#arraybuffer-response

R=haraken,yhirano
BUG=673211

Review-Url: https://codereview.chromium.org/2730943002
Cr-Commit-Position: refs/heads/master@{#455398}
rune
Move ::selection invalidation to applyPseudoStyleChanges.
Removed need for separate StyleDifference constant for ::selection and
otherwise simplified the code.

R=mstensho@opera.com

Review-Url: https://codereview.chromium.org/2732113002
Cr-Commit-Position: refs/heads/master@{#455262}
rune
Make ::first-line invalidation work when added or removed.
We were only invalidating ::first-line properly when both old and new
ComputedStyle contained ::first-line styles. Now, instead call
setNeedsLayoutAndPrefWidthsRecalc to trigger changes when either old or
new ComputedStyle does not have ::first-line style.

The ::first-line invalidation is moved from Element to LayoutObject,
and unnecessary traversal code removed.

I have not been able to come up with a case where we need to compare
PseudoIdFirstLineInherited style, so diffing that is removed.

R=mstensho@opera.com
BUG=562418,564239,689979

Review-Url: https://codereview.chromium.org/2728383002
Cr-Commit-Position: refs/heads/master@{#455088}
fs
Make HashTraits<QualifiedName>::emptyValue return a const reference
This avoids unnecessary construction of a temporary object, saving a few
cycles and some code-space (~2k on x86-64.)
Also inline QualifiedName::null for some additional savings.

Review-Url: https://codereview.chromium.org/2702403013
Cr-Commit-Position: refs/heads/master@{#455069}
fs
Don't double-resolve URL in TextTrackLoader::load
The caller (HTMLTrackElement::loadTimerFired) will already have
resolved the URL.

BUG=466083

Review-Url: https://codereview.chromium.org/2731953002
Cr-Commit-Position: refs/heads/master@{#455050}
mstensho
Allow zero-height fragmentainers.
We used to assert against this, but we really can't, since there are
legitimiate reasons for a fragmentainer (and fragmentainer groups and column
sets) to have zero height, e.g. when its content is zero-height.

BUG=698359

Review-Url: https://codereview.chromium.org/2737503002
Cr-Commit-Position: refs/heads/master@{#455040}
sigbjornf
TestInterfaces: support delegate clearing.
Following r454834, the implementation of SetDelegate() also needs to
handle resetting of the test delegate.

R=
BUG=698713

Review-Url: https://codereview.chromium.org/2738513004
Cr-Commit-Position: refs/heads/master@{#455030}
fs
Improve handling of duplicate id's for SVG resources
This CL attempts to fix the known issues with duplicate id's and SVG
resources. There are a variety of cases where this fails, and the added
tests attempt to cover those as well as possible.

The know bugs generally stem from:

 * Resources being registered in (layout) tree order after style
   recalc. This for instance mean that any later defined resources
   will shadow any earlier appearing resource (which would the correct
   one.)

 * Removing a resource container does not consider that there could now
   be another resource that is no longer shadowed by the one removed.
   Together with the above, this also meant that removing a resource
   from the DOM could invalidate, and break, all occurences of said
   resource.

This CL attempts to handle the above by factoring the result of
getElementById into the equation, considering it to be "the truth" when
possible/required. The new methods registerResource and
unregisterResource form the basis of this, codifying the two basic
operations on which the tracking is built. The tracking of the
'registered' flag from LayoutSVGResourceContainer is now handled by
SVGTreeScopeResources. While this flag could be considered an
optimization at this point, DCHECKs are added to attempt to keep it
true to it's purpose.

BUG=454767

Review-Url: https://codereview.chromium.org/2722543002
Cr-Commit-Position: refs/heads/master@{#454951}
bratell
Stop casting HTMLInputElement to HTMLInputElement.
There can be some confusion which cast method to use, the
one for HTMLElements or the one for ListedElements so don't
even bother.

Review-Url: https://codereview.chromium.org/2728403003
Cr-Commit-Position: refs/heads/master@{#454899}
ckulakowski
Add message loop to v8's unittests
When (at least some) v8 unittests are started in bigger batch
we hit v8 garbage collector's incremental marking hard limit.
When it happens v8's engine posts task and it causes crash as
there is no active message loop. This change creates message
loop for v8's unittests to fix this crash.

BUG=695374

Review-Url: https://codereview.chromium.org/2735703003
Cr-Commit-Position: refs/heads/master@{#454898}
sigbjornf
RenderFrameImpl: avoid creating many temporary WebDocuments.
Accessing a property off of a WebFrame's document will entail instantiating
a WebDocument, which implies a WebPrivatePtr<> holding a persistent reference.

Avoid the overhead via some manual CSEing.

R=esprehn,jochen
BUG=

Review-Url: https://codereview.chromium.org/2723083002
Cr-Commit-Position: refs/heads/master@{#454878}
rune
Bit-mask incorrectly removed first-line pseudo bit.
The m_pseudoBits member only contains the 8 bits for the public pseudo
element bits, yet we used a mask to retrieve them. That mask was
incorrectly set to 0x1fe when it should have been 0xff. Anyway, that
mask is unnecessary and removed.

The mask issue caused StylePropagationDiff, returned from
diffPseudoStyles, to be NoChange for pure ::first-line changes. That
NoChange return were the only case which triggered first-line
invalidation properly.

Instead, always check for pseudo style changes in
pseudoStyleCacheIsInvalid. This fixes issue 698451.

The pseudoStyleCacheIsInvalid method has a weird name, has bugs, and
should be put on LayoutObject and called as part of setStyle instead.
That is for follow-up CLs.

R=meade@chromium.org,mstensho@opera.com
BUG=698451

Review-Url: https://codereview.chromium.org/2729373003
Cr-Commit-Position: refs/heads/master@{#454850}
mharanczyk
Avoid fetching RFH from nav handle for not committed navigations.
For devtool use case there is only a need to check if hosts match,
so compareing frame tree node id instead of raw pointers will give
same result.

BUG=697991

Review-Url: https://codereview.chromium.org/2730873002
Cr-Commit-Position: refs/heads/master@{#454849}
karlo
Calculate positioningArea and not just size, for tiling background.
Computing the correct background tiling size when sub-pixel border or
padding is used, requires calculating the full positioning area and not
just size. The actual fix for 686435 is in a followup cl.

BUG=686435
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2690053002
Cr-Commit-Position: refs/heads/master@{#454843}
sigbjornf
WebViewTestProxyBase: clear out main test delegate upon destruction.
The first BlinkTestRunner created is set as the main delegate of test
interfaces along with being set as the delegate of the web view test
proxy object.

When that view test proxy goes away, unregister the main delegate at
the same time as it can no longer be safely accessed.

R=tkent
BUG=698166

Review-Url: https://codereview.chromium.org/2734713002
Cr-Commit-Position: refs/heads/master@{#454834}
mstensho
Isolate strictly unbreakable multicol containers that are nested.
A strictly unbreakable object (i.e. when getPaginationBreakability() ==
ForbidBreaks) has no valid break points inside. This is the case for e.g.
images, writing mode roots and scrollable objects. If such an object is an
inner multicol container, column content inside shouldn't interact with
enclosing columns.

BUG=696726,695535,675070

Review-Url: https://codereview.chromium.org/2729903003
Cr-Commit-Position: refs/heads/master@{#454765}
mmarkowicz
Update views::Textfield cursor color on text color change
views::Textfield::SetTextColor should apply new color to the cursor as well.
Currently this will happen but only after Textfield::OnNativeThemeChanged
is triggered in some way.

BUG=697939

Review-Url: https://codereview.chromium.org/2730623003
Cr-Commit-Position: refs/heads/master@{#454616}
bratell
Remove some unnecessary 'using namespace'
The construct "using namespace" is not allowed by the Chromium
coding style and since these are not even necessary I'm just
removing them.

Review-Url: https://codereview.chromium.org/2729093003
Cr-Commit-Position: refs/heads/master@{#454605}
fs
The WebVTT 'line' settings should be parsed as a float
Per https://w3c.github.io/webvtt/#parse-the-webvtt-cue-settings .
Negative zero is transformed to positive zero.

Also make valid percentages outside of [0, 100] fail quicker.

BUG=697869

Review-Url: https://codereview.chromium.org/2725313002
Cr-Commit-Position: refs/heads/master@{#454587}
rune
Call getUncachedPseudoStyle on correct node for ::selection.
getUncachedSelectionStyle is typically called for the LayoutObject we
are currently painting. This might not be the node the ::selection
style is matched for. Specifically, we request getUncachedSelectionStyle
on LayoutText objects, but we need to match the ::selection style on its
parent element.

This already happened inside getUncachedPseudoStyle, but it's guarded by
a hasPseudoStyle() call for the pseudo element type. In the case where
we pass in a LayoutText, we are relying on the computed style with the
PseudoIdSelection bit set to be propagated down to the LayoutText object.
That does not happen if the style change for the element parent is
NoChange or NoInherit.

Instead find the element for which we are matching ::selection in
getUncachedSelectionStyle instead. The firstAncestorOrSelf() call is
still present in getUncachedPseudoStyle as there may be other pseudo
elements types where we rely on this.

R=mstensho@opera.com
BUG=685174

Review-Url: https://codereview.chromium.org/2727253004
Cr-Commit-Position: refs/heads/master@{#454575}
sigbjornf
Support XMLHttpRequest.send(URLSearchParams)
Update send()'s overloaded set to also include URLSearchParams,
mirroring a recent BodyInit spec addition,

 https://fetch.spec.whatwg.org/#bodyinit

R=yhirano,tyoshino
BUG=694449

Review-Url: https://codereview.chromium.org/2723583005
Cr-Commit-Position: refs/heads/master@{#454571}
rune
needsPaintInvalidation() should not return true for selection.
In [1] we introduced a paint invalidation constant for repainting
selection. needsPaintInvalidation() started to also return true when
only the selection needed paint invalidation. Callers of that method
assumes that true will cause at least a full element repaint which made
us skip setting the diff to invalidate the object and only invalidate
the selection in some cases. Instead, only return true for
PaintInvalidationObject and PaintInvalidationSubtree.

[1] https://crrev.com/eff357ef

R=mstensho@opera.com
BUG=697337

Review-Url: https://codereview.chromium.org/2727843004
Cr-Commit-Position: refs/heads/master@{#454564}
bratell
Remove some unnecessary using namespaces and add include guards
The Chromium Code Style doesn't allow using namespace and when
I looked at the code it seems some of them in layout are not
even needed. This removes the ones that are not needed and
adds explicit scoping at the one place it's needed.

Also adding a missing header guard and remove an unused enum.

Review-Url: https://codereview.chromium.org/2722313007
Cr-Commit-Position: refs/heads/master@{#454563}
msimonides
Add View::AddedToWidget and RemovedFromWidget.
Many views implement ViewHierarchyChanged to perform some setup once a
Widget becomes available to them. This results with code duplication.
With these new methods there will be no need to implement
ViewHierarchyChanged for the common case.

BUG=5191

Review-Url: https://codereview.chromium.org/2713643002
Cr-Commit-Position: refs/heads/master@{#454542}
bratell
Skip a few "using namespace" that we don't really need.
The Chromium coding style doesn't allow "using namespace" at all
and since the code will eventually adapt and they are causing
issues with some experiments I rather remove them now.

Review-Url: https://codereview.chromium.org/2729583004
Cr-Commit-Position: refs/heads/master@{#454449}
mstensho
Respect constrained height on nested multicol containers.
If there's no more space in an inner multicol container (according to e.g. its
height or max-height), don't create any additional fragmentainer groups (i.e.
column rows).

The spec isn't clear here, but this change moves us closer to Edge, and also
eliminates cases where we'd previously end up with pathological numbers of
fragmentainer groups.

Also flipped the logic in hasFragmentainerGroupForColumnAt(), and renamed it to
needsNewFragmentainerGroupAt().

BUG=688158

Review-Url: https://codereview.chromium.org/2725943003
Cr-Commit-Position: refs/heads/master@{#454411}
fs
Add a use-counter for transforms using the reference box on SVG element
For gauging the risk of implementing 'transform-box' proper - mostly
with an eye towards the initial value.

BUG=595829

Review-Url: https://codereview.chromium.org/2725973003
Cr-Commit-Position: refs/heads/master@{#454408}
bratell
Avoid name collision for secondsPerHour/secondsPerMinute
There are other places declaring the names secondsPerHour
and secondsPerMinute. They don't collide right now, but by
moving these to a smaller namespace I can avoid collisions
in some experiments.

Review-Url: https://codereview.chromium.org/2730683004
Cr-Commit-Position: refs/heads/master@{#454384}
fs
Fix core/frame PRESUBMIT for UseCounter changes
The start marker was missing a piece after
https://codereview.chromium.org/2586863002

Review-Url: https://codereview.chromium.org/2728543006
Cr-Commit-Position: refs/heads/master@{#454312}
sigbjornf
blink_gc_plugin: always enable warn_stack_allocated_trace_method check.
R=haraken,thakis
BUG=689864

Review-Url: https://codereview.chromium.org/2730673003
Cr-Commit-Position: refs/heads/master@{#454307}
sigbjornf
Enable Blink GC plugin check for stack allocated classes.
The latest clang roll (crbug.com/685244) included a GC plugin with
support for checking STACK_ALLOCATED() classes w/ unwanted trace
method definitions. Add support for that check to the build system,
unconditionally enabled.

R=haraken,thakis
BUG=689874

Review-Url: https://codereview.chromium.org/2724353002
Cr-Commit-Position: refs/heads/master@{#454306}
fs
Sync the FeatureObserver (UseCounter) metric in histograms.xml
Catching up with changes to Blink's
third_party/WebKit/Source/core/frame/UseCounter.h.

Review-Url: https://codereview.chromium.org/2729543004
Cr-Commit-Position: refs/heads/master@{#454280}
mharanczyk
React to not committed render frame navigations in devtools.
Currently it was trying to handle only error pages or committed
navigations which lead to RenderFrameDevToolsAgentHost being stuck
in suspended state for navigations that did not commit (for example
downloads). This in turn caused webdriver to get stuck on further
interactions with such frames. This is regression caused by
https://codereview.chromium.org/2655413002.

BUG=682002

Review-Url: https://codereview.chromium.org/2720823004
Cr-Commit-Position: refs/heads/master@{#454229}
bratell
Drop some "using namespace" in WebKit/Source/html.
Drop some "using namespace" that are not used or not allowed
by the coding standard.

Review-Url: https://codereview.chromium.org/2726603002
Cr-Commit-Position: refs/heads/master@{#453964}
sigbjornf
Construct URLSearchParams from sequence initializer.
Follow up recent spec addition[1,2] and support sequence<sequence<USVString>>
initializers for URLSearchParams.

1 - https://github.com/whatwg/url/issues/27
2 - https://github.com/whatwg/url/pull/175

R=tyoshino,haraken
BUG=680531

Review-Url: https://codereview.chromium.org/2725593003
Cr-Commit-Position: refs/heads/master@{#453903}
fs
Move MarkupTokenizerInlines.h to core/html
This set of helpers is used by HTMLTokenizer and VTTTokenizer - both of
which reside in core/html.

Review-Url: https://codereview.chromium.org/2724593002
Cr-Commit-Position: refs/heads/master@{#453887}
bratell
Avoid conflict between 2 enums named Mode and 2 values named None.
If you include (directly or indirectly) forms/TypeAhead.h or
MediaFragmentURIParser.h or track/vtt/VTTRegion.h you get conflicts
either with the enum value None or the enum name Mode so give the
enum a less generic name.

Review-Url: https://codereview.chromium.org/2724533003
Cr-Commit-Position: refs/heads/master@{#453634}
perja
bluetooth: show better error messages for services, characteristics and descriptors.
The error message now contains the UUID of the respective service, characteristic or descriptor.

BUG=619932

Review-Url: https://codereview.chromium.org/2680783002
Cr-Commit-Position: refs/heads/master@{#453590}
sigbjornf
Convert unnecessary ContextLifecycleObservers into ContextClients.
Convert remaining types that do not make use of |contextDestroyed()|
overriding, making them be context clients instead.

R=dcheng,haraken
BUG=610176

Review-Url: https://codereview.chromium.org/2721603005
Cr-Commit-Position: refs/heads/master@{#453574}
rune
Use independent property inheritance fast-path for text-align.
This was originally attempted in [1], but the custom function for
applying text-align values did not clear the inherited bit.

Added a test to the framework to catch the case for trying to propagate
a value down to a descendant with the property explicitly set.

[1] https://codereview.chromium.org/2628503002/

R=sashab@chromium.org,napper@chromium.org
BUG=628043,686585

Review-Url: https://codereview.chromium.org/2715213003
Cr-Commit-Position: refs/heads/master@{#453430}
rune
Remove out-of-date comment about scoped style resolvers.
Collecting features is not longer connected to StyleResolver and the
comment is no longer correct in any way. The nullptr test is still
there because a TreeScope may have stylesheet candidates which do not
have style sheets. A candidate is causing the TreeScope to be added to
the active list, while it has to have at least one active stylesheet to
enforce a ScopedStyleResolver instance.

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2716363002
Cr-Commit-Position: refs/heads/master@{#453427}
fs
Rename SVGPaintContext::paintSubtree to paintResourceSubtree
To better reflect it's use and function.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2715513009
Cr-Commit-Position: refs/heads/master@{#453278}
fs
Tidy up instance time handling in SVGSMILElement
Merge the addBeginTime and addEndTime methods into a single method
addInstanceTime (that takes a BeginOrEnd argument.) Migrate callers to
the new method, getting rid of SVGSMILElement::handleConditionEvent in
the process.
Also inline some trivial functions in SVGAnimationElement.

BUG=641437

Review-Url: https://codereview.chromium.org/2712343004
Cr-Commit-Position: refs/heads/master@{#453233}
sigbjornf
MessagePort: don't post repeated message dispatch tasks.
If a task has already been posted to drain the incoming queue of messages,
don't post another.

R=haraken,dcheng
BUG=693595

Review-Url: https://codereview.chromium.org/2716163002
Cr-Commit-Position: refs/heads/master@{#453205}
mstensho
Allow flow thread portion logical bottom to be above its logical top.
We used to try to prevent this, as an attempt to make sure that no
fragmentainer group would have overlapping flow thread portion rectangles with
other fragmentainer groups. But that was already easily achievable with e.g. an
empty block between two column spanners anyway.

There is a legitimate reason for the flow thread portion bottom to be above the
top: negative margins.

Introduce MultiColumnFragmentainerGroup::logicalHeightInFlowThreadAt().
Less duplicated code. Some extra care is now needed, to make sure that we don't
end up with negative logical heights.

BUG=688760,683090,683554

Review-Url: https://codereview.chromium.org/2709013007
Cr-Commit-Position: refs/heads/master@{#453201}
fs
Add comment about SVGGraphicsElement.{nearest,farthest}ViewportElement
Move to bottom of interface per common practice.

BUG=695981

Review-Url: https://codereview.chromium.org/2714123003
Cr-Commit-Position: refs/heads/master@{#453124}
fs
Update VTTCue enum AlignSetting, "middle" -> "center"
Apparently this was missed in https://codereview.chromium.org/2683633006

R=foolip@chromium.org
BUG=663797

Review-Url: https://codereview.chromium.org/2719513002
Cr-Commit-Position: refs/heads/master@{#453121}
fs
Fold svgAttributeChanged into parseAttribute for SVGAnimateElement
This separation does not really give much in terms of benefits. Since
none of the SMIL-related attributes are exposed through SVG DOM, the
former method is always called after the latter. Move the code from the
former to the latter. This even avoids the attribute value lookup, for a
tiny perf gain...

BUG=641437

Review-Url: https://codereview.chromium.org/2706243012
Cr-Commit-Position: refs/heads/master@{#452861}
fs
Remove 'begin'/'end' processing from SVGSMILElement::svgAttributeChanged
The svgAttributeChanged hook is (with one exception) used for attributes
that are part of the SVG DOM representation ("object model".) 'begin'
and 'end' are not. Move handling to SVGSMILElement::parseAttribute
instead.

BUG=641437

Review-Url: https://codereview.chromium.org/2719493002
Cr-Commit-Position: refs/heads/master@{#452858}
fs
Tidy up event-/syncbase registration in SVGSMILElement
Move code for connect/disconnecting from event- and syncbase into the
Condition innerclass to improve readability.
Also make Condition::m_baseID and m_name be AtomicStrings (to avoid
casting and hashing all over the place), convert loops to range-syntax
and use references where it makes sense in related code-paths.

BUG=641437

Review-Url: https://codereview.chromium.org/2714643007
Cr-Commit-Position: refs/heads/master@{#452857}
fs
Avoid duplicating the CSS property mapping for SVG pres. attrs.
The attribute (object) -> CSS property mapping is specified at
construction and stored, so rather than having to repeat it, just read
and use the stored value.

Also add a cssValue() helper method to SVGAnimatedPath.

Review-Url: https://codereview.chromium.org/2708923011
Cr-Commit-Position: refs/heads/master@{#452839}
fs
Remove LayoutSVGResourceContainer::m_id
By passing the old and new values to the idChanged() method, the only
"reload" of the value can be eliminated, and other instances can use
getIdAttribute() on the element. This makes the m_id field unused, so
it can be removed.

BUG=454767

Review-Url: https://codereview.chromium.org/2714153002
Cr-Commit-Position: refs/heads/master@{#452838}
sigbjornf
Verify that a new heap page isn't also marked as being off heap.
Attempt to diagnose a rare assert failure, where a conservative
GC stack scan finds a potential pointer in both the heap's
negative heap page cache and in the map of in-use heap pages.

Those two mapping should be mutually exclusive by construction,
and must be -- the negative page cache must not contain false
positives. Hence, add verification when a new page is committed
& used, it does not already have a mapping in that negative cache.

R=haraken
BUG=649485

Review-Url: https://codereview.chromium.org/2715713005
Cr-Commit-Position: refs/heads/master@{#452833}
sigbjornf
A per-heap RegionTree needs no lock.
R=keishi,haraken
BUG=671856

Review-Url: https://codereview.chromium.org/2717613004
Cr-Commit-Position: refs/heads/master@{#452814}
bratell
Add header guards to CanvasAsyncBlobCreator.h
R=fs

Review-Url: https://codereview.chromium.org/2711333002
Cr-Commit-Position: refs/heads/master@{#452812}
fs
Cleanup the SVGTreeScopeResources interface
After some previous refactoring, some methods no longer need to be
public, and some methods can be folded into others to avoid some hash-
lookups.
Also use HashMap::removeAll in removeElementFromPendingResources, change
some methods to use references and hide a longish typename with 'auto'.

BUG=454767

Review-Url: https://codereview.chromium.org/2705163008
Cr-Commit-Position: refs/heads/master@{#452645}
sigbjornf
Tidy ScriptRunner pending script handling.
R=hiroshige
BUG=686281

Review-Url: https://codereview.chromium.org/2710233002
Cr-Commit-Position: refs/heads/master@{#452619}
mstensho
Avoid negative content box sizes.
Negative values had two possible causes:

1. Subtracting the scrollbar size from the border box size. Scrollbars do not
affect the border box size, but they occupy space between some border edge and
padding edge. This means that the presence of a scrollbar on an object reduces
the size of the content box and the containing block established by said
object. This means that if e.g. the specified width of an object is 10px and it
has a vertical scrollbar that takes up more than that, e.g. 15px, the content
box width should become 0, not -5px.

2. Subtracting two huge (or even saturated) LayoutUnit values from one
LayoutUnit value. When we during layout convert a specified content-box width
to border-box (via padding-box), which is what LayoutBox::m_frameRect uses, we
may end up with saturated LayoutUnit values, so that:
LayoutUnit specified_content_box_width = <whatever, something nice, maybe>;
LayoutUnit left_padding = LayoutUnit::max() /*(or something huge, at least)*/;
LayoutUnit right_padding = LayoutUnit::max() /*(or something huge, at least);*/
LayoutUnit padding_box_width = content_box_width + left_padding + right_padding;
LayoutUnit content_box_width = padding_box_width - left_padding - right_padding;
Here, content_box_width won't be the same as specified_content_box_width,
because padding_box_width got saturated. That's kind of inevitable, with
saturated arithmetic and all, but what's worse is that we used to end up with a
negative value in content_box_width, which is illegal. So just clamp negative
values to 0 to avoid that.

Negative box sizes have various kinds of ill effects, such as inline-axis
misalignment and unwanted negative block direction progression. It was possible
to get negative padding (which is illegal) resolved from percentage values.
This in turn caused unnecessary assertion failures in multicol.

Attempted to come up with sensible layout tests that don't make assumptions
about how the engine deals with extreme values internally.

BUG=683554,683090

Review-Url: https://codereview.chromium.org/2716583002
Cr-Commit-Position: refs/heads/master@{#452578}
mstensho
Merge overflowRectForFlowThreadPortion() into flowThreadPortionOverflowRectAt().
No need to keep this in LayoutMultiColumnSet anymore. Also got rid of
unused method LayoutMultiColumnSet::flowThreadPortionOverflowRect().

No behavior changes intended.

Review-Url: https://codereview.chromium.org/2711003005
Cr-Commit-Position: refs/heads/master@{#452537}
sigbjornf
Avoid needless InstanceCounter.h inclusion.
Only needed if RefCounted<> is compiled specially.

R=
BUG=

Review-Url: https://codereview.chromium.org/2714703002
Cr-Commit-Position: refs/heads/master@{#452453}
fs
Move SVGElement::buildPendingResourcesIfNeeded to SVGTreeScopeResources
Move notification of a resource "appearing" to SVGTreeScopeResources,
naming the method notifyResourceAvailable().
Simplify the handling of the pending resources map to avoid unnecessary
hash-lookups in some cases.

BUG=454767

Review-Url: https://codereview.chromium.org/2710583005
Cr-Commit-Position: refs/heads/master@{#452187}
sigbjornf
DisplayItemClient: avoid hash table temporaries when iterating.
R=pdr.
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2712703002
Cr-Commit-Position: refs/heads/master@{#452147}
sigbjornf
Avoid unnecessary HashTable resizing during copy construction.
We do know the final table size, so reserve its size before starting
to copy over. Thereby avoiding intermediate table allocations.

R=esprehn
BUG=

Review-Url: https://codereview.chromium.org/2715473004
Cr-Commit-Position: refs/heads/master@{#452060}
fs
Move LayoutSVGResourceContainer registration to SVGTreeScopeResources
Move LayoutSVGResourceContainer::registerResource to
SVGTreeScopeResources, renaming it to updateResource while getting rid
of addResource (since it's only called from updateResource.)
Simplify the interaction with the m_pendingResources set a bit, to
eliminate a hash-lookup in certain code-paths.

BUG=454767

Review-Url: https://codereview.chromium.org/2714473002
Cr-Commit-Position: refs/heads/master@{#452050}
sigbjornf
Remove unnecessary PagePool locks.
With per-thread heap (arenas), there will not be any contention
on adding and removing page pool entries.

R=haraken
BUG=671856

Review-Url: https://codereview.chromium.org/2707193004
Cr-Commit-Position: refs/heads/master@{#452023}
rune
Repaint selection when element with ::selection style is recalculated.
Selection was not repainted unless the selected text was repainted due
to other style changes. Now, if the ComputedStyle is recalculated for
an element and either the old or the new ComputedStyle had a bit set
for PseudoIdSelection, schedule paint invalidation for the selection
leaf children of that element.

Note that we don't need to traverse down the descendants because the
current implementation of ::selection in Blink only affects direct
children. The selection state is only propagated to containing block
ancestor, which is why we look for a containing block to check if any
of the children is selected.

R=mstensho@opera.com
BUG=685174

Review-Url: https://codereview.chromium.org/2709693003
Cr-Commit-Position: refs/heads/master@{#451992}
fs
Compute a more correct "screen scope" transform for SVGSVGElement
For getScreenCTM, only the position (translation) of the outermost svg
element was computed - any additional transform data was dropped.

Use LayoutObject::localToAbsoluteTransform to compute the full transform
rather than just the position of the layout box. Since using this method
works for any (attached) element, implement getScreenCTM without using
computeCTM, and get rid of the ScreenScope variant of the latter. This
also allows us to simplify SVGSVGElement::localCoordinateSpaceTransform
a bit, and drop the CTMScope argument from the
localCoordinateSpaceTransform declaration(s).

It's not clear from [1] how elements which are not in the rendering tree
(i.e has 'display: none' or similar) should be handled. With this
implementation we will return an identity matrix in those cases, which
doesn't seem unreasonable. (The option would be to return 'null', which
is how elements not in the document should be treated, but we don't have
that semantic implemented yet.)

[1] https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getScreenCTM

BUG=678167

Review-Url: https://codereview.chromium.org/2711503002
Cr-Commit-Position: refs/heads/master@{#451938}
fs
Clean up the getLayoutSVGResource*ById helpers
Drop getLayoutSVGResourceContainerById helper, since we can just use
SVGTreeScopeResources::resourceById directly.

For getLayoutSVGResourceById, rather than calling through
TreeScope::ensureSVGTreeScopedResources, just pass the
SVGTreeScopeResources and do the lookup from there. Said object is
already available in the relevant places (only the layout tree dumping
needs to be updated wrt that.)

BUG=454767

Review-Url: https://codereview.chromium.org/2708543003
Cr-Commit-Position: refs/heads/master@{#451839}
sigbjornf
Disallow cross-thread Persistent<> read access.
A Persistent<> reference is belongs to the thread that created it,
read and write access must only be performed by that thread.

Debug verification have been in place for some time to verify that Persistent<>
updates only happen on its creation thread, and that the updated heap pointer
resides on that thread's heap. Extend the debug checks to also apply to read
access, checking that no other thread accesses the Persistent<>.

This requires converting a handful of Persistent<>s to CrossThreadPersistent<>s.

R=haraken
BUG=693988

Review-Url: https://codereview.chromium.org/2702243003
Cr-Commit-Position: refs/heads/master@{#451753}
sigbjornf
Gracefully handle navigator.getVRDisplays() in detached contexts.
R=haraken
BUG=686602

Review-Url: https://codereview.chromium.org/2703283003
Cr-Commit-Position: refs/heads/master@{#451734}
sigbjornf
Simplify MediaStreamAudioSourceNode ownerships.
The processing that happens on the audio thread for this object
doesn't access the MediaStream. Hence the reference to it and the
track can be kept directly on the node object, thereby avoiding the
use of a pair of Persistent<>s.

R=haraken
BUG=693988

Review-Url: https://codereview.chromium.org/2699403002
Cr-Commit-Position: refs/heads/master@{#451726}
mwrobel
Make Editor::findEventTargetFrom() to align Clipboard API specification
This patch changes |Editor::findEventTargetFrom()| to return focused element if
selection start is not editable to align Clipboard API specification[1] for
improving interoperability.

[1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event

BUG=690104
TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.*

Review-Url: https://codereview.chromium.org/2685723005
Cr-Commit-Position: refs/heads/master@{#451716}
fs
Rewrite svg/zoom/page/zoom-get-screen-ctm.html to use testharness
In preparation for some future tweaks to this test.

BUG=678167

Review-Url: https://codereview.chromium.org/2708493003
Cr-Commit-Position: refs/heads/master@{#451657}
rune
Remove unused processedBlocks variable.
R=mstensho@opera.com

Review-Url: https://codereview.chromium.org/2702233003
Cr-Commit-Position: refs/heads/master@{#451651}
fs
Disable flaky compositing/reflections/nested-reflection-* tests
The following two tests appear to produce slightly different results
(different offsets?) somewhat randomly:

 compositing/reflections/nested-reflection-anchor-point.html
 compositing/reflections/nested-reflection-animated.html

TBR=cfroussios@chromium.org
NOTRY=true
BUG=693510

Review-Url: https://codereview.chromium.org/2702343002
Cr-Commit-Position: refs/heads/master@{#451635}
sigbjornf
Removed dated Persistent<>::checkPointer() assert.
Remove the ASan-only verification that a Persistent<> refers to a heap
object. Static asserts will ensure that Persistent<T> is only instantiated
for GCed types, so this verification adds little extra value.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2701273002
Cr-Commit-Position: refs/heads/master@{#451580}
rune
Invalidate custom pseudo elements for RuleSet invalidations.
When we have selectors containing custom pseudo elements matching
elements inside the UA shadow, and no id, class, or attribute selectors
present, do like we do for type selectors and invalidate as part of an
invalidation set scheduled on the root node of the tree scope for
RuleSet invalidations.

We utilize the same invalidation set as for type invalidations and mark
it as invalidating custom pseudo elements as well as marking it as
tree-boundary-crossing to allow drilling into the UA shadow.

This means we will traverse into all shadow sub-trees, but it should at
least be better than the existing recalc all behavior.

The full recalc for custom pseudo elements caused a full recalc for one
of the stylesheets on facebook.com.

R=ericwilligers@chromium.org
BUG=680549

Review-Url: https://codereview.chromium.org/2700943003
Cr-Commit-Position: refs/heads/master@{#451578}
mstensho
Add out-of-flow objects under the inline in a continuation chain, when possible.
The same goes for floating objects. Only when a floating or out-of-flow
positioned object is to be added between two block-level children should we add
it to the anonymous block box holding the block-level children. If the new
child is to be added before a block-level child, and this beforeChild is the
first block-level child, we should rather make the new child the last child of
the preceding inline, rather than the first child of the anonymous block
containing block-level children.

Also cleaned up and documented the code somewhat.

BUG=689643

Review-Url: https://codereview.chromium.org/2698243002
Cr-Commit-Position: refs/heads/master@{#451525}
rune
Schedule a type selector invalidation set for RuleSet invalidations.
We marked all elements which had a selector in the tagRules bucket for
style recalc for RuleSet invalidations. That means we would recalculate
style for all spans if we added a stylesheet containing a rule with an
"#id span" selector (but not for "#id span.class" as that ends up in
the classRules bucket).

Instead, use an invalidation set containing only tag names for the
selectors where there are no ids, classes, or attribute selectors, and
which have a type selector in the rightmost compound. This means that
"#id span" will not add "span" to that set, but "span" and "div span"
will. "div span" will not add "div", and "div *" will cause a full
scope recalc. In order to support invalidation for those, we would have
had to have one invalidation set for each tag name instead of a single
descendant invalidation set for all.

RuleSet invalidations schedule this typeRuleInvalidationSet on the root
of the TreeScope When doing ruleset invalidations.

BUG=680549

Review-Url: https://codereview.chromium.org/2703643003
Cr-Commit-Position: refs/heads/master@{#451488}
fs
Use unique id's in svg/filters/feBlend-all-modes.html
The same id's would be reused in all the three groups (color
combinations.) Add the group index to the id's to avoid this.

BUG=454767

Review-Url: https://codereview.chromium.org/2703803003
Cr-Commit-Position: refs/heads/master@{#451483}
mstensho
Avoid over-eager clipping of child layers in multicol.
Self-painting layers (caused by e.g. position:relative) don't contribute to
visual overflow in their parent layout object; see
LayoutBox::addOverflowFromChild(). We cannot use the visual overflow rectangle
set on the flow thread when calculating the bounding box of a fragment
established by a child layer.

Therefore, only clip in the flow thread's block direction in
overflowRectForFlowThreadPortion(), and leave the inline axis alone. I
simplified the implementation, since it's now way easier to start with an
infinite rectangle, and just limit the dimensions that need it afterwards.

Also got rid of an old check for hasOverflowClip(), which must have been
residue from the CSS regions implementation.

This also happened to fix some inaccuracies mostly invisible to the naked
eye, when it comes to transform:scale()d text with glyphs that have negative
left bearing or overflow the line box vertically. It looks like we measure and
lay out with the CSS computed font, and then switch to a scaled font when
painting, so that it looks crisp and nice. This may result in tiny
inaccuracies in the bounding box of the text, and
fast/borders/border-antialiasing.html exhibited this, and had to be
rebaselined. Added fast/multicol/scale-transform-text.html to better
demonstrate what we're fixing.

paint/invalidation/multicol-with-relpos.html also had to be rebaselined,
since it turns out that it has never painted its stuff correctly until now.

BUG=571978

Review-Url: https://codereview.chromium.org/2699653002
Cr-Commit-Position: refs/heads/master@{#451376}
rune
Remove stray method declaration in RuleFeatureSet.
Review-Url: https://codereview.chromium.org/2703693002
Cr-Commit-Position: refs/heads/master@{#451307}
sigbjornf
Tidy DEFINE_(THREAD_SAFE_)STATIC_LOCAL() implementations.
Move the handling of static local singletons into the
WTF::StaticSingleton<T> wrapper class, including the "same thread"
debug verification.

Use it to also implement the "thread safe" variant also, which can
now be done in a straightforward manner after issue 686866 enabled
C++ thread safe statics.

R=kinuko
BUG=686866

Review-Url: https://codereview.chromium.org/2680843006
Cr-Commit-Position: refs/heads/master@{#451305}
mstensho
Don't keep pointers to table sections when told to recalculate sections.
They may have been deleted.

We should ideally assert in header(), footer() and firstBody() in LayoutTable
that we're not waiting for a section recalc, but that's currently failing in one
trybot; see crbug.com/693212

This would have fixed the original use-after-free issue with bug 680224, but
before this CL landed, I found another fix that attacked the root cause instead.
Still no point in keeping potentially dead pointers around, though.

BUG=680224

Review-Url: https://codereview.chromium.org/2636153002
Cr-Commit-Position: refs/heads/master@{#451257}
rune
Add type selector invalidation set for ruleset invalidations.
We currently look at RuleSet::tagRules() to figure out if an element
needs a style recalc when adding a stylesheet. This recalculates too
much for rules like "#id span" which ends up in the tagRules bucket,
causing style recalcs for every span. The plan is to use an
m_typeRuleInvalidationSet which contains the tag names for rules which
don't contain other simple selectors which have associated invalidation
sets.

For instance, "#id span" will not add span to m_typeRuleInvalidationSet
since we can rely on the invalidation set for #id to invalidate spans.
However, "span" or "div span" will add span to that set.

This CL prepares for this by introducing the set and a way to collect
it. This new set will be scheduled on the root node of the TreeScope
when adding/removing a stylesheet. We did not support scheduling
invalidation sets on the document node, so this CL adds that
possibility as well.

BUG=680549

Review-Url: https://codereview.chromium.org/2699883002
Cr-Commit-Position: refs/heads/master@{#451170}
sigbjornf
document.lastModified: treat invalid dates like unknown ones.
If the value supplied via Last-Modified: is unparseable, treat the
modification date as unknown and return the current time (rather than
00-00-0000 00:00:00)

This aligns behavior with all other browsers.

R=foolip
BUG=693053

Review-Url: https://codereview.chromium.org/2698773005
Cr-Commit-Position: refs/heads/master@{#451123}
sigbjornf
Remove unused blink_gc_plugin_flags.py script.
Became unused with GN, now safe to remove.

R=dcheng,thakis
BUG=

Review-Url: https://codereview.chromium.org/2691943009
Cr-Commit-Position: refs/heads/master@{#451056}
mstensho
Less code duplication in PaintLayer::collectFragments()
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2691303004
Cr-Commit-Position: refs/heads/master@{#450737}
fs
Don't clear 'web animations dirty' flag if we have no rare data
If an SVGElement has an instantiated ElementAnimations object and
animation time has progressed, but no actual animation has been applied
(and hence no SVGElementRareData has been created), we don't need to
clear the dirty bit in the rare data.
The initial trigger for this seems to be the Element.computedName
implementation for a detached node, which tries to compute style in
this case, triggering a DCHECK in Node::containingTreeScope when doing
so.

BUG=686424

Review-Url: https://codereview.chromium.org/2689713003
Cr-Commit-Position: refs/heads/master@{#450689}
karlo
Reorder setting of zooming, to prevent reflowing and size mismatch.
When zooming is applied to the document, the color suggestion picker can lose
or gain bottom pixels, which causes missing borders or rendering artifacts.

This appears to be caused by some unfortunate assumptions and interactions
in Source/web/resources/colorSuggestionPicker.js and friends.

The color picker is a separate window, and the contents of the window is
generated in ColorChooserPopupUIController.cpp.  colorSuggestionPicker.js
resizes the window to exactly fit the content, but the zoom factor is applied
afterwards, causing an additional reflow (see WebPagePopupImpl.cpp:329).
There is no guarantee that the zoomed contents will fit the window any more,
and much of the time it doesn't.

By setting zoom factor before forcing layout, the final size is reached the first
time around, and the window size should be correct.

BUG=691375

Review-Url: https://codereview.chromium.org/2695723002
Cr-Commit-Position: refs/heads/master@{#450513}
fs
Actually delegate in additional FilterEffectBuilder constructor
Because url(...) filters are ignored/dropped this will not have any
practical effect, but could avoid issues in the future.

BUG=593838
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2692883003
Cr-Commit-Position: refs/heads/master@{#450374}
fs
Remove unused includes of SVGDocumentExtensions.h
Review-Url: https://codereview.chromium.org/2696803002
Cr-Commit-Position: refs/heads/master@{#450334}
mstensho
ColumnBalancer: need to examine lines that protrude into the flow thread portion.
We cannot skip a line that starts before the flow thread portion of interest,
if it ends inside the portion.

Some extra care is needed to avoid regressions here: The part of a line that
starts before the multicol container itself needs to be ignored, or we risk
overstretching the multicol container.

BUG=642181

Review-Url: https://codereview.chromium.org/2690863003
Cr-Commit-Position: refs/heads/master@{#450033}
karlo
Support subpixel layout of borders.
This cl implements subpixel layout of borders.  Painting of subpixel
borders now uses rounding to nearest CSS pixel, and is aligned with
Edge.  Handling of device pixel ratios > 1 isn't implemented here,
and is better covered in a separate task.

This does not implement subpixel borders for tables, as that interacts
with table layout width calculations, which would also need to be
adapted to subpixels.  Again, that's better dealt with in a separate
task.

A number of test cases had to be rebaselined, due to minor changes in
layout and/or painting.  Most of these changes appear in tests that uses
zooming, and implicitly have fractional borders.

svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm now looks a bit
broken, but that's due to an unrelated issue with aspect ratio and
subpixels (in LayoutPart, if I recall correctly).

BUG=227192
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2640143005
Cr-Commit-Position: refs/heads/master@{#449943}
sigbjornf
Fix partition_alloc unit tests.
R=haraken
BUG=691197, 684513

Review-Url: https://codereview.chromium.org/2689103002
Cr-Commit-Position: refs/heads/master@{#449892}
sigbjornf
Tie DragState to DragController.
Clarify ownership & scope of DragState and have the page's
DragController own it.

R=dcheng
BUG=688569

Review-Url: https://codereview.chromium.org/2687193004
Cr-Commit-Position: refs/heads/master@{#449889}
fs
Remove TextTrack.regions and VTTRegionList
Removed from the WebVTT spec https://github.com/w3c/webvtt/pull/31

Because we no longer need to track a list of regions in TextTrack, we
can also remove all the plumbing between the parser and the (loadable)
TextTrack.

BUG=690014

Review-Url: https://codereview.chromium.org/2685943004
Cr-Commit-Position: refs/heads/master@{#449791}
fs
Various cleanups in VTTRegion
 * Eliminate single-use pseudo-id functions (and associated statics)

 * Avoid redundant calls to getBoundingClientRect, and use
   ClientRect::height where appropriate.

 * Allow using ElementTraversal::childrenOf in
   VTTRegion::displayLastVTTCueBox by putting a break after
   startTimer().

 * Get rid of VTTRegion::m_settings and updateParametersFromRegion
   (they are not used.)

 * Replace 'long' with 'int' for lines, because that matches the
   WebIDL type better.

 * Remove unused includes (add more specific ones when needed.)

Review-Url: https://codereview.chromium.org/2689703002
Cr-Commit-Position: refs/heads/master@{#449790}
mstensho
Specify orphans:1 and widows:1 in old multicol test.
The test and the ref rendered identically, but it didn't look as asserted by
the textual pass condition.

Review-Url: https://codereview.chromium.org/2692453002
Cr-Commit-Position: refs/heads/master@{#449637}
fs
Implement VTTCue.region and sync the VTTRegion interface
This CL implements the VTTCue.region property, replacing 'regionId'. The
main implementation mechanism is a new map in VTTParser that tracks the
regions currently seen.

Rewrite the region parser test to be based on cues rather than the list
of regions. This will ease the removal of TextTrack.regions.

Sync the VTTRegion with the current spec by

 * renaming the 'height' property to 'lines',

 * adding and using the ScrollSetting IDL enumeration type and

 * dropping the 'id' and 'track' properties.

Update tests as needed to match the above changes.

BUG=690014

Review-Url: https://codereview.chromium.org/2682333002
Cr-Commit-Position: refs/heads/master@{#449589}
sigbjornf
Prevent icf/comdat folding for OOM_CRASH() entry points.
We have various OOM-failure entry points which call OOM_CRASH() but
not much more. These are all NO/NEVER_INLINEd, but that isn't sufficient
to prevent the linker from common'ing up these identical functions
(see associated bug for an example), leading to confused crash stacks.

Avoid invasive linker optimization by adopting r306650 to OOM_CRASH().

R=haraken,primiano
BUG=690447

Review-Url: https://codereview.chromium.org/2683033008
Cr-Commit-Position: refs/heads/master@{#449582}
sigbjornf
Move VisitorMarkingMode into Visitor.
Move this enum back into Visitor where it better belongs; recent
simplifications to the marking visitor implementation class types
makes that a trivial exercise.

R=haraken
BUG=671856

Review-Url: https://codereview.chromium.org/2688083002
Cr-Commit-Position: refs/heads/master@{#449568}
mstensho
Stay within the containing block when looking for a line to dirty.
BUG=686469

Review-Url: https://codereview.chromium.org/2686913002
Cr-Commit-Position: refs/heads/master@{#449237}
fs
Remove TextTrack.{add,remove}Region
Removed from the spec by https://github.com/w3c/webvtt/pull/31

BUG=690014

Review-Url: https://codereview.chromium.org/2684993003
Cr-Commit-Position: refs/heads/master@{#449140}
sigbjornf
blink_gc_plugin: warn of unused trace methods to stack allocated classes.
A STACK_ALLOCATED()-annotated class does not need a trace method; issue
a warning if encountered.

R=haraken
BUG=689874

Review-Url: https://codereview.chromium.org/2685583002
Cr-Commit-Position: refs/heads/master@{#449046}
fs
SVGTransformList.consolidate() should return null on an empty list
SVGTransformList.consolidate() returns an SVGTransform with type
"unknown", which is an invalid object that other parts of the code
couldn't cope with. The specification:

 https://svgwg.org/svg2-draft/coords.html#__svg__SVGTransformList__consolidate

say that 'null' should be returned in this case though, so do that
instead.

Rewrite svg/dom/SVGTransformList-empty-list-consolidation.html to use
actually assert this part of the contract, and also convert it use
testharness.js while at it.

BUG=688306, 688303

Review-Url: https://codereview.chromium.org/2681803004
Cr-Commit-Position: refs/heads/master@{#448994}
rune
Clear MatchedPropertiesCache on StyleRule changes.
CSSOM changes used to cause a FullStyleUpdate which cleared the whole
StyleResolver. With the new active stylesheet update using RuleSet-
based style invalidation, clearing the MatchedPropertiesCache was
missing. The reason it needs to be cleared, is that the hash key for
the cache entry is based on StylePropertySet pointers which don't
change when adding/removing declarations to a mutable StylePropertySet.

R=meade@chromium.org
BUG=681183

Review-Url: https://codereview.chromium.org/2679623002
Cr-Commit-Position: refs/heads/master@{#448939}
sigbjornf
blink_gc_plugin: report illegal on-heap iterators as warnings/errors.
Fix classification bug, when encountered this should be reported as a
warning/error, not as a supplementary note.

R=
BUG=

Review-Url: https://codereview.chromium.org/2681753002
Cr-Commit-Position: refs/heads/master@{#448932}
fs
Remove faulty assertion in LayoutSVGResourceContainer::registerResource
When notifying pending elements we don't know what resource type the
registration is for, so it's entirely plausible that the resource type
is one that a possible client isn't really interested in (like a 'mask'
ending up pointing to a <filter>, like in this particular case.)

BUG=687985

Review-Url: https://codereview.chromium.org/2680683003
Cr-Commit-Position: refs/heads/master@{#448688}
sigbjornf
Remove trace() methods for stack-only classes.
A class annotated with STACK_ALLOCATED() does not require a trace
method, as its heap references are reachable and kept alive by virtue
of being on the stack, should any conservative GC go ahead.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2685563002
Cr-Commit-Position: refs/heads/master@{#448627}
sigbjornf
Track constant InputDeviceCapabilities objects per-window.
Do not keep global main thread Persistent<>s for the two
constant InputDeviceCapabilities objects, as that will
end up sharing wrapper objects across contexts.

R=dcheng
BUG=688569

Review-Url: https://codereview.chromium.org/2675793005
Cr-Commit-Position: refs/heads/master@{#448597}
sigbjornf
Out-of-line trace() methods of editing template types.
With a simpler trace method infrastructure in place, we
can now define trace methods of the editing templates
out-of-line.

R=haraken
BUG=654985

Review-Url: https://codereview.chromium.org/2672413003
Cr-Commit-Position: refs/heads/master@{#448563}
sigbjornf
Add missing documentation for Allocator.h macros + EAGERLY_FINALIZE().
R=haraken
BUG=662326

Review-Url: https://codereview.chromium.org/2672273002
Cr-Commit-Position: refs/heads/master@{#448234}
sigbjornf
Have SubframeLoadingDisabler singleton live off-heap.
Primarily to diagnose potential heap corruption, keep
track of the disabled set off-heap. The untraced references
added aren't unsafe, as they are all stack-reachable by
construction.

R=dcheng,haraken
BUG=684551

Review-Url: https://codereview.chromium.org/2667853006
Cr-Commit-Position: refs/heads/master@{#447682}
sigbjornf
Disallow sequences with lengths exceeding max allocation supported.
Vector backing stores are limited in size by the maximum allowed by
their allocator. When converting incoming IDL sequence types into
native arrays, check if the requested size exceed that max limit and
throw a TypeError(), if needed.

Only pathological inputs will run up against this limit and exception.

R=
BUG=682910

Review-Url: https://codereview.chromium.org/2657173002
Cr-Commit-Position: refs/heads/master@{#447466}
mstensho
Remove unused declarations of pageLogicalHeight.
BUG=686648

Review-Url: https://codereview.chromium.org/2664063003
Cr-Commit-Position: refs/heads/master@{#447323}
sigbjornf
Change HeapCompaction feature status to stable.
R=
BUG=672030

Review-Url: https://codereview.chromium.org/2653413002
Cr-Commit-Position: refs/heads/master@{#447248}
ckulakowski
Chromium doesn't compile with -Wglobal-constructors
We compile chromium with clang flag -Wglobal-constructors in our
project. We have following compilation error during compilation
of user_input_tracker.cc:

../../chrome/browser/page_load_metrics/user_input_tracker.cc:27:11:
error: declaration requires a global constructor [-Werror,-Wglobal-constructors]
const int kRateLimitClampMillis = (kOldestAllowedEventAgeSeconds * 1000) /

In order to get rid of this global constructor I recommend to declare
static class variable UserInputTracker::kMaxTrackedEvents and global
variable kRateLimitClampMillis as constexpr which will be expanded to
numerical value during compilation.

BUG=686669

Review-Url: https://codereview.chromium.org/2662803002
Cr-Commit-Position: refs/heads/master@{#447000}
sigbjornf
Tidy generated toMemberNativeArray<>() invocations.
R=haraken
BUG=682910

Review-Url: https://codereview.chromium.org/2654143006
Cr-Commit-Position: refs/heads/master@{#446662}
sigbjornf
Cleanly detach XHR and other pending loader clients from Inspector.
If the XHR object is finalized without first being notified of
ExecutionContext destruction, its prefinalizer is responsible for making
up the difference and behave as if that did.

Do so by delegating to contextDestroyed(); this takes care of
releasing its resources promptly, along with unregistering as
a loader client (with its associated async loader and Inspector.)

Also make other Inspector loading clients cleanly detach when
finalized; prevents Inspector from keeping dead raw pointers to them.

R=yhirano,haraken
BUG=667254

Review-Url: https://codereview.chromium.org/2649323005
Cr-Commit-Position: refs/heads/master@{#446660}
fs
Don't paint selections in <mask>s, <clipPath>s and <pattern>s
Painting a selection within a <mask>, <clipPath> or <pattern> can
trigger a client "style change" to update the resource cache with
whatever the selection style refers to. This "style change" signal will
trigger a layout on the resource's clients while painting.
Since painting selections within these types of resources, add a
PaintLayerFlag and use it to disable selection painting in these cases.
Include the painting of elements references from feImage as well under
the same umbrella.

BUG=683388
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2648343004
Cr-Commit-Position: refs/heads/master@{#446318}
sigbjornf
Remove trace frame template specialization.
More tidying after r445993, only one instantiation of these method
templates.

R=haraken
BUG=683019

Review-Url: https://codereview.chromium.org/2654243002
Cr-Commit-Position: refs/heads/master@{#446302}
sigbjornf
Float32ImageData, PerformanceObserver: no finalization needed.
R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2652393002
Cr-Commit-Position: refs/heads/master@{#446289}
sigbjornf
Emit trace(Visitor*) rather than a templated trace().
One trace() method will now suffice, simplify generated code.

R=haraken
BUG=683019

Review-Url: https://codereview.chromium.org/2653153003
Cr-Commit-Position: refs/heads/master@{#446262}
sigbjornf
blink_gc_plugin: retire overloaded traceImpl detection and handling.
With the specialized InlineGlobalMarkingVisitor gone (r445993), Blink no
longer use a templated traceImpl() method for its trace methods. Follow
up and remove the checks for it in the GC plugin.

R=
BUG=683019

Review-Url: https://codereview.chromium.org/2655933002
Cr-Commit-Position: refs/heads/master@{#446137}
rune
Return ActiveSheetsChanged when rulesets change in common prefix.
When comparing old and new active sheets, we only append the added
sheets to the ScopedStyleResolver if the old sheet vector is a prefix
of the new sheets. However, that's not correct if any of the RuleSets
in the common prefix changed due to media query changes or cssom
modifications of a stylesheet.

I can confirm that this fixes 681472. The other two issues in the BUG
field look like duplicates, but I've not been able to reproduce them.

R=meade@chromium.org,sashab@chromium.org
BUG=681472,677371,681882

Review-Url: https://codereview.chromium.org/2650743002
Cr-Commit-Position: refs/heads/master@{#446008}
sigbjornf
Revert of Add null check to animations for registered custom property initial values (patchset #2 id:20001 of https://codereview.chromium.org/2649863006/ )
Reason for revert:
This goes together with the revert https://codereview.chromium.org/2649103008/ ; looks like the two CLs didn't match up,

 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.10/builds/29275

(Hope the double revert doesn't cause too much work.)

Original issue's description:
> Add null check to animations for registered custom property initial values
>
> After a recent change to CSSInterpolationType for registered custom properties
> it was assumed that all registered custom properties had initial CSSValues.
> This is not the case and null derefs were reachable. This patch fixes up
> the false assumption.
>
> BUG=684234
>
> Review-Url: https://codereview.chromium.org/2649863006
> Cr-Commit-Position: refs/heads/master@{#445969}
> Committed: https://chromium.googlesource.com/chromium/src/+/f2ec8922cbe5f632a937cf242faf5f23c0d1b3ff

TBR=ericwilligers@chromium.org,alancutter@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=684234

Review-Url: https://codereview.chromium.org/2650403002
Cr-Commit-Position: refs/heads/master@{#445996}
sigbjornf
Revert of Add smooth interpolation support for <color> custom properties (patchset #5 id:80001 of https://codereview.chromium.org/2564793002/ )
Reason for revert:
Added test is seen failing on the bots, e.g.,

 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Trusty/builds/22494
 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.11/builds/15502

Original issue's description:
> Add smooth interpolation support for <color> custom properties
>
> This change enables smooth interpolation for animations on
> custom properties registered as <color>.
>
> This does not add support for CSS Transitions, only CSS
> Animations and Web Animations.
> This does not add support for currentcolor for CSS Animations,
> supporting this may require further redesigns to style resolution.
>
> BUG=671904
>
> Review-Url: https://codereview.chromium.org/2564793002
> Cr-Commit-Position: refs/heads/master@{#445967}
> Committed: https://chromium.googlesource.com/chromium/src/+/96bee2c42c8df73523e971850215d29d1c40c15f

TBR=sashab@chromium.org,alancutter@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=671904

Review-Url: https://codereview.chromium.org/2649103008
Cr-Commit-Position: refs/heads/master@{#445994}
sigbjornf
Devirtualize Visitor and remove inline visitor specialization.
The Blink GC infrastructure requires its managed objects to provide
a "trace()" method which will visit all the heap references it keeps
into the Blink GC heap, by calling the "trace()" method on each of
these via an incoming |visitor| argument (a Visitor.)

The Visitor interface is really only used for that, i.e., to perform GC
marking, so the flexibility it provides by way of overridable virtual
methods, is unused. And it slows down the GC marking phase, something
the specialized "inline visitor" (InlineGlobalMarkingVisitor) demonstrated,
which devirtualized the mark() method, with noticable improvements to
overall GC marking times.

Given that and Visitor's use, devirtualize Visitor entirely and make
it a GC marking visitor and nothing else. Besides removing code complexity,
this also allows the removal of InlineGlobalMarkingVisitor along with
all the specialized trace() implementation methods that we emit for each
Blink GC managed object.

Performance numbers show a ~10% improvement on marking times for
oilpan_gc_times.{tough_animation_cases, blink_perf_stress}; code size
(Android(ARM) official build, content shell) is 180k less.

R=
BUG=683019

Review-Url: https://codereview.chromium.org/2652923002
Cr-Commit-Position: refs/heads/master@{#445993}
fs
Don't "repack" parameters in SVGElement::attributeChanged
Instead of making a AttributeModificationParams which always uses the
"directly" modification reason, just forward the original reason.
The 'reason' argument was added by [1] which did not indicate why SVG
elements would be subject to different treatment than regular elements.

[1] https://codereview.chromium.org/14234005

Review-Url: https://codereview.chromium.org/2652653002
Cr-Commit-Position: refs/heads/master@{#445698}
mstensho
Merge list of orthogonal writing mode roots into depth-ordered layout list.
If we're going to perform a series of subtree layouts, rather than one layout
from LayoutView, and we at the same time have a list of orthogonal writing mode
roots that need to be laid out before their ancestors, we need to make sure
that subtrees are laid out in an overall tree depth ordered manner, or we risk
skipping layout of a subtree needing layout. That would cause trouble for the
column balancer (which examines the tree after layout and expects everything to
be laid out), and quite possibly other kinds of trouble elsewhere too.

BUG=680224

Review-Url: https://codereview.chromium.org/2635143003
Cr-Commit-Position: refs/heads/master@{#445497}
mstensho
Don't cancel out scroll offset when calculating the clip rectangle for multicol.
We still want the clip rect to be relative to the multicol container, but we
cannot get there by using the location() of the flow thread's PaintLayer,
because then we'll then cancel out the scroll offset that's also baked into
offsetOfPaginationLayerFromRoot.

This CL will cause paint/invalidation/paged-with-overflowing-block-rl.html to
regress, but it turned out that it just passed by accident anyway. Having that
test broken is way less serious than barely being able to scroll at all in a
regular multicol container.

BUG=674640
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2643123004
Cr-Commit-Position: refs/heads/master@{#445478}
fs
Move 'id'-related invalidation to SVGElement::attributeChanged
There's no reason for 'id'-related invalidation to reside in
SVGElement::svgAttributeChanged since it has no interaction with an
(animated) SVG DOM attribute. Move it to SVGElement::attributeChanged
instead.
This will also enable us to make use of the old/new value that is
available in attributeChanged().

BUG=454767

Review-Url: https://codereview.chromium.org/2645383002
Cr-Commit-Position: refs/heads/master@{#445393}
fs
SVG objects with same idrefs conflict when under different shadow root
When SVG idrefs are the same, even though the
LayoutSVGResourcesContainers are created under different shadow roots,
they conflict and only the last one is available. The problem is that,
currently, the HashMap mapping id's to LayoutSVGResourcesContainers are
owned/scoped to the document instead of the treeScope.
This CL moves that hash map from document to treeScope, so that
LayoutSVGResourcesContainers with the same id in different shadow roots
won't conflict.

Currently the following 2 maps (which are wrapped into the
SVGDocumentExtensions class) are owned by document instead of treeScope:

  HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources;
  HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources;

Thus when a new LayoutSVGResourcesContainer with the same id is created,
it is inserted into m_resources and overwrites the one with the same
key (id).

This CL separates these 2 maps from SVGDocumentExtensions and wrap them
into a new class (named SVGTreeScopeResources), and lets TreeScope have
them as a member variable (m_svgTreeScopedResources).
This CL also moves the corresponding methods accessing these 2 maps into
the new class.

To make this work together with <use>, we need to make sure to use the
TreeScope of the "original" element. Move the helper from LayoutSVGTextPath
to SVGElement::treeScopeForIdResolution and then use that for this.

Based on https://codereview.chromium.org/2107153002 by Taijin Tei.

BUG=597080

Review-Url: https://codereview.chromium.org/2633143002
Cr-Commit-Position: refs/heads/master@{#445378}
tommyt
PaymentApp: Implement invokePaymentApp for Android
This change implements the
ServiceWorkerPaymentAppBridge.invokePaymentApp() function along with the
corresponding native InvokePaymentApp() function.

The signature of PaymentInstrument.invokePaymentApp() has also been
changed to add the payment details modifiers field, and to align the
ordering and naming of the arguments with the definition of the
PaymentAppRequest dictionary in the specification:

    https://w3c.github.io/webpayments-payment-apps-api/#sec-app-request

BUG=669876

Review-Url: https://codereview.chromium.org/2640743005
Cr-Commit-Position: refs/heads/master@{#445301}
sigbjornf
Disable g++ inlining of eager-tracing mark() method.
Versions of g++ (with -Os) are over-eager about inlining the mark()
method that's used for all non-mixin Oilpan objects, resulting in
a code size increase that's unwanted (for Android official builds.)
Other compilers and g++ (with -O2/-O3) are more discriminate about
inlining the method, with no comparable code size increase delta.

Tuning the compiler's optimization option set to avoid the problem
hasn't proven successful, so bluntly address the problem by disabling
inlining for the method.

R=haraken
BUG=681991

Review-Url: https://codereview.chromium.org/2643403003
Cr-Commit-Position: refs/heads/master@{#445288}
rune
Initially load new_tab.css with a timestamp for chrome://apps.
This is what incognito_tab.html already does. Changing the url to add a
timestamp query on DOMContentLoaded caused a FoUC.

BUG=681495
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2647653002
Cr-Commit-Position: refs/heads/master@{#445285}
sigbjornf
Have VisitorHelper<> handle moving object registration.
As the registration of objects is only done by a compacting
GC, there isn't any need to be indirect about registering
them - remove a layer of Visitor virtual methods and have
the VisitorHelper<> do the registration directly.

R=haraken
BUG=681991

Review-Url: https://codereview.chromium.org/2642933005
Cr-Commit-Position: refs/heads/master@{#445245}
perja
Enable more unittests for BlueZ and ChromeOS.
This patch fixes an issue with the DBUS naming needed for the generic unittests.
This again made it possible to enable a couple of more tests for BlueZ and
ChromeOS.

Review-Url: https://codereview.chromium.org/2640883002
Cr-Commit-Position: refs/heads/master@{#445117}
fs
'*' is not a valid attribute selector
Per the CSS Selectors specification [1], a '*' is not allowed as the
name of an attribute.

[1] https://drafts.csswg.org/selectors-4/#typedef-attribute-selector

BUG=681814

Review-Url: https://codereview.chromium.org/2646493002
Cr-Commit-Position: refs/heads/master@{#445046}
wdzierzanowski
Stop requiring a reader in MultibufferDataSource::SetBitrateTask()
Callers of MultibufferDataSource::SetBitrate() must not be required to
be aware of whether or not there is a |reader_| available, because
that's internal MultibufferDataSource state that changes for several
reasons, some of which aren't necessarily visible to the client calling
SetBitrate(), e.g., OnBufferingHaveEnough().

Note that UpdateBufferSizes(), called from SetBitrate(), handles the
case of a null |reader_| gracefully.

Review-Url: https://codereview.chromium.org/2647483003
Cr-Commit-Position: refs/heads/master@{#444867}
fs
Add SVGResources helper for resource-bounds invalidation
Add a new helper method removeClientFromCacheAffectingObjectBounds to
SVGResources to better describe the intention of code that performs this
operation (removeFromCacheAndInvalidateDependencies.) It also makes
LayoutSVGResourceContainer not depend on its derived classes.
Also make use of it in the generic SVGResources::removeClientFromCache.

Review-Url: https://codereview.chromium.org/2647443004
Cr-Commit-Position: refs/heads/master@{#444811}
fs
Serialize type and attribute selectors as identifiers
Per [1], both the element name of a type selector and the attribute name
of an attribute selector - as well as their corresponding namespace
prefix (if any) - should be serialized as identifiers [2].

[1] https://drafts.csswg.org/cssom/#serialize-a-simple-selector
[2] https://drafts.csswg.org/cssom/#serialize-an-identifier

BUG=681814

Review-Url: https://codereview.chromium.org/2645563002
Cr-Commit-Position: refs/heads/master@{#444766}
sigbjornf
Adjust placement of non-compaction checks.
The registration of movable objects and their callbacks should be
ignored when running non-compaction GCs. Move the GC kind check one
level out.

At the same time, make these registration methods untyped -- the
Allocator interface for heap collections already provide a typed view,
so unnecessary to extend that one more level.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2645873002
Cr-Commit-Position: refs/heads/master@{#444760}
sigbjornf
LocalFileSystem::deleteFileSystem() is no longer used.
This method stopped being used when DevTools retired
its FileSystem API support (crbug.com/588817); follow
through and remove the unused implementation.

R=nhiroki,kinuko,haraken
BUG=

Review-Url: https://codereview.chromium.org/2640963002
Cr-Commit-Position: refs/heads/master@{#444667}
mstensho
[LayoutNG] Initial support for multicol, introducing NGBlockBreakToken.
We can now lay out block-level floats and in-flow blocks inside a multicol
container. Note that painting and hit testing doesn't work too well, since
those operations are still performed on the legacy LayoutObject tree, and
there's no way to fragment a LayoutObject.

No attempt has been made at integrating this with out-of-flow positioning or
inline-level layout.

Review-Url: https://codereview.chromium.org/2632523002
Cr-Commit-Position: refs/heads/master@{#444512}
mstensho
Percent-width blocks cannot form a re-layout boundary.
A block with non-visible overflow can only form a re-layout boundary if both
width and height are fixed.

The block may be inside a shrink-to-fit container (there's no cheap and
reliable way to detect that), so that changes inside it may affect its width.

BUG=681657

Review-Url: https://codereview.chromium.org/2643703002
Cr-Commit-Position: refs/heads/master@{#444467}
fs
Split svg/dom/transform-parser.html
This CL splits the mentioned test into two to alleviate the potential
for test timeouts.
The bulk of the test is moved to a JS file, and the js-test dependency
is dropped since the only useful output of this test is the console log
generated.
The TestExpectations entry is dropped.

BUG=664849

Review-Url: https://codereview.chromium.org/2646503002
Cr-Commit-Position: refs/heads/master@{#444418}
sigbjornf
Leave out empty-valued Access-Control-Request-Headers: on preflights.
Following https://github.com/whatwg/fetch/issues/459 , the above
preflight header should not be included if the request following CORS
has no headers to enumerate in a preflight.

R=tyoshino,yhirano
BUG=633729

Review-Url: https://codereview.chromium.org/2633423003
Cr-Commit-Position: refs/heads/master@{#444303}
fs
Resolve CSS url(...) non-<image> values against the correct base
In an external stylesheet, the url(...) should resolve against the URL of
the stylesheet. We were always resolving against the document base URL,
meaning that 'filter' url(...)'s referencing external files could resolve
to the wrong URL.
Besides this, add a more generic mechanism to determine whether a CSSValue
contains a URL (and hence may need to be re-resolved if it's within an
inline style declaration, and it's context element is moved to a different
document.)
Also adjust the <canvas> 'filter' implementation to resolve against the
elements document when applicable.

BUG=405315

Review-Url: https://codereview.chromium.org/2625873010
Cr-Commit-Position: refs/heads/master@{#444179}
bratell
Split renderer.lib on Windows to avoid files larger than 2GB.
In certain configurations renderer.lib can exceed 2GB in size which is
too much for the 32 bit build tools. Splitting it avoids that problem.

BUG=679644

Review-Url: https://codereview.chromium.org/2622583005
Cr-Commit-Position: refs/heads/master@{#444143}
mstensho
Introduce LayoutObject::AncestorSkipInfo.
This replaces three optional parameters to container() and similar methods.

No behavioral changes intended.

Review-Url: https://codereview.chromium.org/2634493007
Cr-Commit-Position: refs/heads/master@{#444105}
sigbjornf
Document::shutdown(): remove unnecessary static_cast<>.
R=
BUG=

Review-Url: https://codereview.chromium.org/2638883002
Cr-Commit-Position: refs/heads/master@{#444061}
mstensho
Try to avoid working on zero-height column sets, when possible.
We may end up with an empty column set between two column spanners, if there is
zero-height column content "separating" them.

We typically have no business inside a zero-height column set, since
fragmentation is impossible there. Fragmentation requires a positive
fragmentainer block size to ensure content progression. So keep looking for a
column set that has a height, and use that one instead, as long as its flow
thread start offset is the same as the one we were requested to map to a
column set.

BUG=675100

Review-Url: https://codereview.chromium.org/2631013002
Cr-Commit-Position: refs/heads/master@{#443998}
sigbjornf
Do not initiate fetch() on a detached FetchManager.
R=
BUG=681378

Review-Url: https://codereview.chromium.org/2631153002
Cr-Commit-Position: refs/heads/master@{#443897}
fs
Provide a CSSParserContext to CSSSyntaxDescriptor
Add a CSSParserContext* argument to CSSSyntaxDescriptor::parse to allow
CSSValues to be resolve against a proper parser context, and resolve
relative URLs and other sourcing sensitive data.
Provide parser contexts as available on call-sites, or use the
strictCSSParserContext() if none is available. Move the TODO up the
callstack as needed.

BUG=618165

Review-Url: https://codereview.chromium.org/2632083002
Cr-Commit-Position: refs/heads/master@{#443882}
sigbjornf
Remove PageVisibilityObserver contextDestroyed() notifications.
PageVisibilityObserver allows a Page's lifetime states to be
observed, but none of the observers need to be notified of Page
destruction.

Adjust LifecycleNotifier<>::notifyContextDestroyed(), having it
call its corresponding LifecycleObserver's  contextDestroyed()
notification method if the observer implements it, but not require
that it does implement contextDestroyed(). With that in place,
only have the lifecycle observers that need a contextDestroyed()
notification (all but PageVisibilityObserver) declare it.

This allows the removal of all the empty
PageVisibilityObserver::contextDestroyed() overrides.

R=haraken
BUG=610176

Review-Url: https://codereview.chromium.org/2634713002
Cr-Commit-Position: refs/heads/master@{#443816}
bjornr
Fixed google::FindSymbol reading past end of a section
The symbol reading logic of google::FindSymbol was reading symbols in
blocks of N, not accounting for that a section might not have a multiple
of N symbols in it.

This makes it read in blocks of N or the number of symbols remaining,
whichever is smallest.

BUG=672481

Review-Url: https://codereview.chromium.org/2566623003
Cr-Commit-Position: refs/heads/master@{#443571}
perja
bluetooth: bluez: Fixed issue with missing notifications after reconnect.
BUG=680099

Review-Url: https://codereview.chromium.org/2625013003
Cr-Commit-Position: refs/heads/master@{#443451}
sigbjornf
Simplify visitor marking mode tracking.
Move the marking mode to VisitorHelper<>, so that
both Visitor and InlinedGlobalMarkingVisitor can access
and reuse it.

In order to do so, hoist out Visitor::MarkingMode as an
enum class.

R=
BUG=

Review-Url: https://codereview.chromium.org/2625363002
Cr-Commit-Position: refs/heads/master@{#443444}
fs
Look for favicon URLs (and similar <link>s) in SVG documents
Previously we were only looking for <link>s with icons within <head>,
and since SVG document don't have those, no icons would be found.
Instead, for SVG documents (with a root/document element of <svg>), just
collect all <link> (HTMLLinkElement) elements, regardless of position in
the document, using a pre-order traversal. This appears to match the
behavior of Gecko.

BUG=385466

Review-Url: https://codereview.chromium.org/2628873003
Cr-Commit-Position: refs/heads/master@{#443336}
sigbjornf
Revert ExtendableMessageEvent same heap verification.
Revert r440390's debug instrumentation of ExtendableMessageEvent.

R=
BUG=655926

Review-Url: https://codereview.chromium.org/2623273004
Cr-Commit-Position: refs/heads/master@{#443299}
mstensho
[LayoutNG] Make NGLayoutInputNode::AlgorithmForInputNode() more readable.
Use early returns and variables to avoid unwanted line breaks in statements.

Review-Url: https://codereview.chromium.org/2631513002
Cr-Commit-Position: refs/heads/master@{#443284}
mstensho
[LayoutNG] Put #includes in alphabetical order.
Review-Url: https://codereview.chromium.org/2623423003
Cr-Commit-Position: refs/heads/master@{#443279}
sigbjornf
Revert "Verify that FetchEvent::m_request holds same-thread reference."
Undo r440475's temporary use of SameThreadCheckedMember<>.

R=
BUG=655926

Review-Url: https://codereview.chromium.org/2629613002
Cr-Commit-Position: refs/heads/master@{#443257}
rune
Try to do less work clearing the font-cache in StyleEngine::didDetach.
Clearing the whole font-cache without considering css-connected fonts
could be cheaper. This is a speculative fix for issue 677415.

BUG=677415

Review-Url: https://codereview.chromium.org/2622673003
Cr-Commit-Position: refs/heads/master@{#443202}
tmoniuszko
Add missing url/gurl.h include
Functions declared in this file return GURL by value.

BUG=

Review-Url: https://codereview.chromium.org/2627883003
Cr-Commit-Position: refs/heads/master@{#443187}
fs
Add test for style 'transform' vs. presentation attribute 'transform'
The former should "win" over the latter.
Fixed by https://codereview.chromium.org/2478233002.

TBR=pdr@chromium.org
BUG=415950

Review-Url: https://codereview.chromium.org/2621153005
Cr-Commit-Position: refs/heads/master@{#442980}
fs
Update svg/wicd/test-rightsizing-b.xhtml Mac expectations
Less stale expectations (DRT format changes.)

TBR=schenney@chromium.org
NOTRY=true
BUG=639147

Review-Url: https://codereview.chromium.org/2628893002
Cr-Commit-Position: refs/heads/master@{#442935}
fs
Block animation of the SVGScriptElement
'href' should not be animatable for SVGScriptElements, but currently is.
This will "break" animation of 'className' on the same element.

R=mkwst@chromium.org,pdr@chromium.org
BUG=679291

Review-Url: https://codereview.chromium.org/2618323002
Cr-Commit-Position: refs/heads/master@{#442915}
sigbjornf
Remove redefinitions of ExceptionCode.
R=haraken
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2625053002
Cr-Commit-Position: refs/heads/master@{#442878}
sigbjornf
Remove marking visitors' shouldMarkObject().
With per-thread heap handling being fully enabled, checking for any
cross-thread pointer marking (and not doing it), is no longer an issue.

Retire the should-mark predicate.

R=haraken
BUG=671856

Review-Url: https://codereview.chromium.org/2617393004
Cr-Commit-Position: refs/heads/master@{#442554}
sigbjornf
Drop MSVC pch warning avoidance.
Unable to reproduce the warning with VS2015; let's try to remove this
special case.

R=
BUG=

Review-Url: https://codereview.chromium.org/2621763002
Cr-Commit-Position: refs/heads/master@{#442368}
sigbjornf
Handle repeated and overlapping (re)starts of mock speechrecognizer.
R=tommi
BUG=678863

Review-Url: https://codereview.chromium.org/2617113002
Cr-Commit-Position: refs/heads/master@{#442337}
rune
Added trace for scheduleInvalidationsForRuleSets.
R=esprehn@chromium.org
BUG=678849

Review-Url: https://codereview.chromium.org/2620673002
Cr-Commit-Position: refs/heads/master@{#442332}
sigbjornf
Prefer ContextClient mixin over manual ExecutionContext handling.
The ContextClient mixin interface bundles up the safe handling of
references to ExecutionContexts. Prefer using it over keeping explicit
Member<ExecutionContext> references.

R=
BUG=610176

Review-Url: https://codereview.chromium.org/2622533002
Cr-Commit-Position: refs/heads/master@{#442250}
mostynb
avoid GCC content::CacheStorage::kSizeUnknown redeclaration error
Fixes:
../../content/browser/cache_storage/cache_storage.cc:62:29: error: redeclaration 'content::CacheStorage::kSizeUnknown' differs in 'constexpr'

BUG=617963

Review-Url: https://codereview.chromium.org/2607983002
Cr-Commit-Position: refs/heads/master@{#442242}
sigbjornf
CrossOriginAccessControl: separate access checks and error message generation
The checking and construction of legible error messages can with benefit
be separated, having the security access checks return an error status
which then can be used to generate a suitable error message.

Along with separating the two, switch to using StringBuilders.

R=
BUG=

Review-Url: https://codereview.chromium.org/2616323002
Cr-Commit-Position: refs/heads/master@{#442236}
tsniatowski
Add use_rtti gn arg to enable rtti globally in the build
Some sanitizer configs already enabled rtti, move the logic to the arg
default value to make experimenting easier. Can be useful when dealing
with some asan-instrumented build startup issued that may go away when
rtti is enabled globally, but don't fall into the existing enable-rtti
cases.

One example scenario I had was with a shared_library built with both rtti
and exceptions (in a downstream project) causing immediate asan failure
on startup around std::exception typeinfo alignment. Rebuilding with
rtti enabled globally made things work, so it helps if that's possible
with just a gn arg.

Note that targets that need rtti to be not disabled regardless of global
settings (e.g. third party libraries like icu that need rtti to build)
can still remove the //build/config/compiler:no_rtti config and add
//build/config/compiler:rtti in its place; this is unchanged.

BUG=webrtc:6468

Review-Url: https://codereview.chromium.org/2607903002
Cr-Commit-Position: refs/heads/master@{#442227}
rune
Use setNeedsActiveStyleUpdate instead of markTreeScopeDirty.
setNeedsActiveStyleUpdate checks if the document is active before
calling markTreeScopeDirty. This avoids marking shadow root tree scopes
dirty for non-active documents which caused a DCHECK fail in
markTreeScopeDirty.

R=esprehn@chromium.org
BUG=676441

Review-Url: https://codereview.chromium.org/2611053004
Cr-Commit-Position: refs/heads/master@{#442028}
sigbjornf
Enable type_traits fallback for all < gcc 5.0 releases.
Fixes compilation failures with various < gcc-5.0  toolchains lacking
std::is_trivially_copyable<T>. Without it, compile errors like

../../base/template_util.h:189:36: error: no type named 'is_trivially_copyable' in namespace 'std'
using is_trivially_copyable = std::is_trivially_copyable<T>;
                              ~~~~~^
../../base/template_util.h:189:57: error: expected ';' after alias declaration
using is_trivially_copyable = std::is_trivially_copyable<T>;
                                                        ^
                                                        ;
will be encountered.

R=danakj
BUG=555754

Review-Url: https://codereview.chromium.org/2612933003
Cr-Commit-Position: refs/heads/master@{#441985}
rune
Use master StyleEngine to evaluate MQ in html imports.
The StyleEngine for html import documents does not have a Frame which
means size media queries will always evaluate to true. We incorrectly
replaced a passed-in master document StyleEngine with the StyleEngine
from the DocumentStyleSheetCollection in https://crrev.com/90d4ea3d
That was wrong for evaluating media queries.

R=meade@chromium.org
BUG=677963

Review-Url: https://codereview.chromium.org/2618803002
Cr-Commit-Position: refs/heads/master@{#441899}
rune
Added layout test for issue 318468.
Check that adding a type selector rule only invalidates elements with
that type.

R=sashab@chromium.org
BUG=318468

Review-Url: https://codereview.chromium.org/2615713005
Cr-Commit-Position: refs/heads/master@{#441823}
rune
Revert of Don't post multiple task for executing blocked scripts. (patchset #2 id:20001 of https://codereview.chromium.org/2609763002/ )
Reason for revert:
Regression in test for time to first meaningful paint: https://crbug.com/678584

Original issue's description:
> Don't post multiple task for executing blocked scripts.
>
> We may post a lot of tasks for executing blocked scripts in the case
> where we insert multiple shadow trees each containing a style element.
> When we start parsing a style element, we mark it as blocking and
> unblock script execution after finishing parsing. Check if the previous
> task is active before posting.
>
> Found while measuring performance for issue 603621.
>
> BUG=603621
>
> Committed: https://crrev.com/26cb3bdcd2a353402b78b716862567226317dff0
> Cr-Commit-Position: refs/heads/master@{#441110}

TBR=pmeenan@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=603621

Review-Url: https://codereview.chromium.org/2617763002
Cr-Commit-Position: refs/heads/master@{#441783}
sigbjornf
eventTargetData(): pull (most of) this singleton off-heap.
Diagnose mutation of GCed object by pulling the collection
wrapper off heap also.

R=
BUG=678532

Review-Url: https://codereview.chromium.org/2616913002
Cr-Commit-Position: refs/heads/master@{#441668}
rune
Need to clear viewport dependent units when switching print mode.
Switching between print and screen changes the size of the initial
containing block. Viewport dependent lengths need to be recalculated
and the cache for matched properties cleared.

Normally, notifyResizeForViewportUnits() is called from
performPreLayoutTasks when the initial containing block size changes.
That does not happen when laying out for printing and going back to
screen layout. We skip setting m_lastLayoutSize in
sendResizeEventIfNeeded. We probably do that to avoid triggering resize
events going back and forth between the print (preview) size.

Make sure we clear the matched properties cache from StyleResolver when
updating the media type.

R=mstensho@opera.com
BUG=677799

Review-Url: https://codereview.chromium.org/2613733003
Cr-Commit-Position: refs/heads/master@{#441642}
sigbjornf
Tidy up XMLHttpRequest::endLoading().
R=tyoshino
BUG=

Review-Url: https://codereview.chromium.org/2610653002
Cr-Commit-Position: refs/heads/master@{#441618}
perja
bluetooth: bluez: Implement BluetoothRemoteGattCharacteristicBluez::SubscribeToNotifications and UnsubscribeFromNotifications.
BUG=636275

Review-Url: https://codereview.chromium.org/2613473002
Cr-Commit-Position: refs/heads/master@{#441456}
sigbjornf
Simplify WorkerGlobalScope::m_eventListeners.
Switch to using a 'mere' HashSet<> for these event listeners. Mainly
done to diagnose GC instability, but removing the use of an involved
abstraction like HeapListHashSet<> is something wanted regardless.

R=
BUG=677654

Review-Url: https://codereview.chromium.org/2609413002
Cr-Commit-Position: refs/heads/master@{#441364}
rune
Avoid unnecessary updateActiveStyle comparing shadow styles.
Found while checking performance for issue 603621.

Style sharing is done during style recalc at which point we know that
the active style is up-to-date. Instead of using the API for
document.styleSheets, compare active stylesheets in ScopedStyleResolver
directly.

BUG=603621

Review-Url: https://codereview.chromium.org/2610513003
Cr-Commit-Position: refs/heads/master@{#441357}
fs
Push attributeName handling down into SVGAnimateElement
SVGAnimateElement (and derived classes) is where 'attributeName' has any
meaning. Move setting/updating of the resolved 'attributeName' value
there. This allows setAttributeName to be devirtualized.
Storage is kept at the SVGSMILElement level because of how it's used at
schedule/unschedule time.

BUG=641437

Review-Url: https://codereview.chromium.org/2602423002
Cr-Commit-Position: refs/heads/master@{#441356}
sigbjornf
Enforce canCopyWithMemcpy constraint over TerminatedArray<T>.
R=
BUG=

Review-Url: https://codereview.chromium.org/2610113002
Cr-Commit-Position: refs/heads/master@{#441352}
fs
Use ShadowData in DropShadowFilterOperation
This replaces the "open-coded" (and somewhat compacted) version of a
ShadowData structure within DropShadowFilterOperation with an actual
ShadowData. While this makes the structure slightly larger, it allows
for some additional code-reuse - mostly around style resolution. It's
also a first step against more correct handling of the 'currentcolor'
value within the drop-shadow(...) filter function.
There's a slight change in behavior since ShadowData stores the relevant
values as 'float' rather than as 'int' like the "open-coded" version.

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2609803002
Cr-Commit-Position: refs/heads/master@{#441351}
rune
Don't post multiple task for executing blocked scripts.
We may post a lot of tasks for executing blocked scripts in the case
where we insert multiple shadow trees each containing a style element.
When we start parsing a style element, we mark it as blocking and
unblock script execution after finishing parsing. Check if the previous
task is active before posting.

Found while measuring performance for issue 603621.

BUG=603621

Review-Url: https://codereview.chromium.org/2609763002
Cr-Commit-Position: refs/heads/master@{#441110}
sigbjornf
Always adjust container size when tracing HeapVectorBacking contents.
R=haraken
BUG=677738

Review-Url: https://codereview.chromium.org/2602363002
Cr-Commit-Position: refs/heads/master@{#441107}
sigbjornf
WindowAudioWorklet: gracefully handle detached use.
R=haraken
BUG=677612

Review-Url: https://codereview.chromium.org/2607353002
Cr-Commit-Position: refs/heads/master@{#441094}
sigbjornf
Add missing HeapCompact DCHECK().
R=
BUG=

Review-Url: https://codereview.chromium.org/2604403002
Cr-Commit-Position: refs/heads/master@{#441072}
sigbjornf
No longer clean out main thread's heap for LSan's benefit.
The extra GCing that cleanupMainThread() appears to be redundant, as
LSan will have performed leak detection prior to the main thread shutting
down.

R=
BUG=677684

Review-Url: https://codereview.chromium.org/2604413002
Cr-Commit-Position: refs/heads/master@{#441068}
sigbjornf
Retire speechrecognition-restart-onend.html leak expectation.
No longer reported as leaking.

TBR=jbroman@chromium.org
BUG=670324
NOTRY=true

Review-Url: https://codereview.chromium.org/2603273002
Cr-Commit-Position: refs/heads/master@{#441066}
sigbjornf
WorkerGlobalScope: verify same-heap event listeners.
To help narrow down failures during tracing of a WorkerGlobalScope's
event listeners, verify that the listeners added belong to the
same heap as the WorkerGlobalScope itself.

R=
BUG=677654

Review-Url: https://codereview.chromium.org/2608113002
Cr-Commit-Position: refs/heads/master@{#441058}
sigbjornf
Remove ThreadState::callThreadShutdownHooks() declaration.
No longer provided and used.

R=
BUG=

Review-Url: https://codereview.chromium.org/2608933002
Cr-Commit-Position: refs/heads/master@{#441041}
hugoh
Fix for building with ancient toolchain
At Opera we test our SDK on an old MIPS device with a
peculiar toolchain. To be able to compile ImageDocument.o,
we need to call std::round(), not just round().

BUG=none

Review-Url: https://codereview.chromium.org/2548783002
Cr-Commit-Position: refs/heads/master@{#440950}
tommyt
PaymentApp: Implement nativeGetAllAppManifests
This change connects the ServiceWorkerPaymentAppBridge to the service
worker payment app code in content/browser/payments. This allows
installed service worker payment apps to show up in the Payment Request
dialog.

I also replace "String scopeUrl" with "long registrationId" as the
identifier for service worker payment apps.

This code is protected by the kServiceWorkerPaymentApps feature flag.

BUG=661608

Review-Url: https://codereview.chromium.org/2586213002
Cr-Commit-Position: refs/heads/master@{#440746}
fs
Remove SVGAnimateElement::hasValidAttributeType
Incorporate said method into its only caller - hasValidTarget - and
override that one in SVGAnimateTransformElement instead.
Also fold animatedPropertyType() into hasValidTarget and get rid of
hasInvalidCSSAttributeType() in favor of "naked" access to the
underlying boolean flag.

BUG=641437

Review-Url: https://codereview.chromium.org/2599853003
Cr-Commit-Position: refs/heads/master@{#440716}
sigbjornf
Remove unwanted declaration of storage for NeedsAdjustAndMark<>.
This rolls back the change made in

 https://codereview.chromium.org/429793003/

We shouldn't have to do this if the class type has been fully
instantiated and "used". Traits used to direct compilation won't run
into this (as the expression will clearly have to be evaluated at
compile-time), but gtest usage of traits may end up evaluating their
predicate expressions in compiled code, thus requiring that the trait
has been instantiated in the compilation unit already. Declaring one
for all uses of NeedsAdjustAndMark<> is too strong, and isn't needed
really (now) -- retire, but avoid running into the issue for the
corresponding unit test.

R=
BUG=

Review-Url: https://codereview.chromium.org/2599643004
Cr-Commit-Position: refs/heads/master@{#440618}
fs
Fold SVGAnimatedTypeAnimator into SVGAnimateElement
This folds the functionality of SVGAnimatedTypeAnimator, mostly
verbatim, into SVGAnimateElement. Some methods are renamed, and a new
interface is defined, which allows <animateTransform> to be more
isolated from the rest of the <animate> implementation.
SVGAnimateElement::m_animatedProperty is renamed to m_animatedValue, and
SVGAnimatedTypeAnimator::m_animatedProperty is renamed to
m_targetProperty.
Dial down or remove some asserts in favor of other asserts.

BUG=641437

Review-Url: https://codereview.chromium.org/2595393002
Cr-Commit-Position: refs/heads/master@{#440613}
rune
Reschedule sibling invalidations as descendant on removal.
When removing elements we schedule sibling invalidations based on
element attributes and state as descendant invalidations when
necessary. However, that didn't work correctly if we removed an
attribute and then removed the element before the sibling invalidation
for the attribute was effectuated.

For instance, if you remove a class affecting succeeding siblings
through selectors, we schedule an invalidation set for that change, but
it will be cleared right after if we remove the element (see the added
test).

Instead we reschedule sibling invalidations on the parent node before
the invalidations for the removed element are cleared.

R=esprehn@chromium.org
BUG=674326

Review-Url: https://codereview.chromium.org/2592423002
Cr-Commit-Position: refs/heads/master@{#440598}
sigbjornf
Verify that FetchEvent::m_request holds same-thread reference.
To diagnose instability seen during GCs of FetchEvents, instrument
the m_request member, checking that we only create event object containing
references to Requests that reside in the current thread's heap.

R=
BUG=655926

Review-Url: https://codereview.chromium.org/2594423002
Cr-Commit-Position: refs/heads/master@{#440475}
sigbjornf
Make use of ContextClient in modules/speech/
Switch to reusing ContextClient rather than have SpeechSynthesis{Utterance}
explicitly hold ExecutionContext member references.

R=
BUG=610176

Review-Url: https://codereview.chromium.org/2595323002
Cr-Commit-Position: refs/heads/master@{#440432}
fs
Update TODO(s) in SVGTransform.idl
Update SVGMatrix vs. DOMMatrix{,ReadOnly} references to match
https://svgwg.org/svg2-draft/coords.html#InterfaceSVGTransform.

TBR=foolip@chromium.org

Review-Url: https://codereview.chromium.org/2599753002
Cr-Commit-Position: refs/heads/master@{#440400}
sigbjornf
Verify that ExtendableMessageEvent's message ports reside on the same heap
To potentially help diagnose a GC crash (see associated bug), verify
that ExtendableMessageEvent's MessagePortArray and MessagePorts belong
to the same thread heap as the event object.

R=haraken
BUG=655926

Review-Url: https://codereview.chromium.org/2589333005
Cr-Commit-Position: refs/heads/master@{#440390}
fs
Clamp rgba(...) alpha value in the CSS fast-path parser
The general CSS parser will clamp the alpha value to the [0, 1] range,
while the fast-path parser does not. This means that large alpha values
will result in overflow in the cast to int, yielding the wrong color
value.
Add a clamp to the [0, 1] range before converting to the [0, 256) range
and converting to int. Because negative values are handled separately,
we only need to apply the clamp for the range above zero.

BUG=675158

Review-Url: https://codereview.chromium.org/2588293004
Cr-Commit-Position: refs/heads/master@{#440374}
sigbjornf
Introduce ThreadState::isOnThreadHeap() helper predicate.
Simple helper to make testing for on-thread-heap conditions easier.

R=
BUG=

Review-Url: https://codereview.chromium.org/2599533002
Cr-Commit-Position: refs/heads/master@{#440370}
mstensho
Even empty block intervals should be associated with a fragmentainer.
We need to visit the fragmentainer that a block lives in even if said block has
zero height. If we find a column set, don't perform initial bounds checking.

BUG=675943

Review-Url: https://codereview.chromium.org/2597633002
Cr-Commit-Position: refs/heads/master@{#440361}
fs
Improve separation between "SMIL times" and timestamps
The 'elapsed' time does not need to be a SMILTime in general - it can
only be non-finite in the case where the document is not active, and
then the timeline should not be running/animations updated.
Thread the double value further from SMILTimeContainer down into
SVGSMILElement. Simplify some computations.

BUG=641437,676137

Review-Url: https://codereview.chromium.org/2592103002
Cr-Commit-Position: refs/heads/master@{#440171}
mostynb
fix mojom bindings generator exception error message
Followup to https://codereview.chromium.org/2171033002

Review-Url: https://codereview.chromium.org/2591123003
Cr-Commit-Position: refs/heads/master@{#440142}
sigbjornf
SameThreadCheckedMember<>: verify same-thread usage of heap references.
In debug builds, Member<> checks that the heap references stored resides
in a heap belonging to the same thread as the Member<> itself. The check
carries some overhead, hence it is not enabled outside of checked builds.

In order to be able to diagnose and catch code that incorrectly stores
heap pointers belonging to other threads in a Member<>, add the
SameThreadCheckedMember<> variant of Member<>. A drop-in replacement
for Member<> that can be used to selectively diagnose.

R=
BUG=

Review-Url: https://codereview.chromium.org/2592063002
Cr-Commit-Position: refs/heads/master@{#440117}
fs
Use double precision in SVGLengthContext::convertValueToUserUnits
This method does a bunch of <float> * <double> operations, which tickles
UBSANs float-overflow warning when the result is stored back into the
float (single precision) local variable.
We clamp the result to a narrow enough range already at the end (and
hence won't see any effects of the overflow, at least assuming IEEE754),
but might as well use a double precision local variable, since that
actually seems to save a few instructions while also avoiding the
overflowing conversion.

BUG=675140

Review-Url: https://codereview.chromium.org/2591663003
Cr-Commit-Position: refs/heads/master@{#440056}
rune
Clear active tree scopes on StyleEngine::didDetach().
clearResolver() is not only called on didDetach(). Make it private and
name it clearResolvers to reflect that it clears scoped resolvers as
well. The comments related to style resolver reconstructruction is
removed as that does not happen anymore.

Clearing m_treeBoundaryCrossingScopes is moved into didDetach()
which was a more natural place.

Clear active and dirty tree scopes in didDetach to not unnecessarily
hang on to any memory associated with them.

These changes were done investigating issue 675533, but won't
necessarily fix anything for that issue.

BUG=567021,675533

Review-Url: https://codereview.chromium.org/2593643002
Cr-Commit-Position: refs/heads/master@{#439973}
rune
Clear CSSGlobalRuleSet on StyleEngine::didDetach().
This could free up memory sooner. Found while investigating 675533, but
not confirmed that this fixes that issue.

BUG=675533

Review-Url: https://codereview.chromium.org/2589243002
Cr-Commit-Position: refs/heads/master@{#439935}
mstensho
Need to be inside the flow thread before converting a visual point.
Before we can convert from a visual point to a flow thread point, we need the
input point to be exactly relative to the flow thread, or we might end up
mapping it to the wrong column.

In other words, we need to add the flow thread object's location before
converting into the flow thread coordinate space. While the flow thread indeed
is at 0,0 (or at least close enough to 0,0) relatively to the multicol
container in very many cases, this isn't true when the multicol container is in
rtl writing-mode, or when it's scrollable, or even when the multicol container
has borders and/or padding.

BUG=663062

Review-Url: https://codereview.chromium.org/2593633002
Cr-Commit-Position: refs/heads/master@{#439855}
sigbjornf
Disallow heap objects containing unsafe on-heap iterators.
Do not allow BlinkGC managed objects to include unsafe iterators of
other heap objects; that is, do not allow them to keep iterator
part objects as fields.

These iterators contain untraced references, which is in general
unsafe practice and breaks the general rule that all heap references
must be known to the GC infrastructure, and be marked and traced
through.

This applies to all heap collection iterators but HeapListHashSet<>'s,
which can be safely traced. It is also the only collection iterator
which is kept as a field of an on-heap object (CSSSegmentedFontFace.)

R=haraken
BUG=672030

Review-Url: https://codereview.chromium.org/2588943002
Cr-Commit-Position: refs/heads/master@{#439784}
rune
Don't update global ruleset when active style is dirty.
CSSGlobalRuleSet should always be collected as part of the active style
update. RuleSets may have been cleared from StyleSheetContents as a
result of media query changes for instance.

For the given issue, we tried to limit to a global ruleset when lazy-
loading fullscreen UA style, but as part of going fullscreen we had
already cleared rule sets for stylesheets with media queries due to the
media feature change.

BUG=675439

Review-Url: https://codereview.chromium.org/2590793003
Cr-Commit-Position: refs/heads/master@{#439781}
mstensho
Make column snapping optional when translating to flow thread coordinates.
positionForPoint() wants this, but mapAncestorToLocal() requires that no
special behavior be applied.

While this CL doesn't fix bug 663062, it is a prerequisite for fixing it
without breaking existing tests (MulticolWithAbsPosNotContained in
MapCoordinatesTest unit test).

BUG=663062

Review-Url: https://codereview.chromium.org/2590463002
Cr-Commit-Position: refs/heads/master@{#439758}
sigbjornf
Tracing HeapListHashSet<> iterators.
The HeapListHashSet<> iterators keep a pair of heap references, which
really should be traced like any other such reference during GCs. This
isn't unsafe for the stack allocated uses of these iterators, but one
Blink object (CSSSegmentedFontFace) keeps an iterator as a field on the
heap, we really have to trace these on-heap part object iterators.

Add the needed infrastructure and use it for CSSSegmentedFontFace.

R=haraken
BUG=672030

Review-Url: https://codereview.chromium.org/2583363002
Cr-Commit-Position: refs/heads/master@{#439748}
rune
Removed expected Trusty dbg failure after fix.
R=rjkroege@chromium.org
BUG=675055

Review-Url: https://codereview.chromium.org/2586393002
Cr-Commit-Position: refs/heads/master@{#439723}
fs
Stricter float-to-int conversion in SVGIntegerOptionalInteger
SVGIntegerOptionalInteger parses values as floats but stores them as
integers. Add helpers to avoid issues with overflow and to make this
conversion the same way in all places it's needed.
The "normal" parsing code would truncate the float value while the parsing
code for animation values would round. Make them both use truncation (and the
avoid duplicating the code.)

BUG=675130

Review-Url: https://codereview.chromium.org/2590433002
Cr-Commit-Position: refs/heads/master@{#439533}
fs
Use a stricter limit for the exponent range in genericParseNumber
The exponent was being checked against numeric_limits<...>::max_exponent
which is the power-of-two limit. Use max_exponent10 instead. Also make
sure to apply any exponent sign prior to the range check so that
min_exponent10 can be used as the lower bound. This means computing the
base number before checking for/parsing the exponent part. This could
be slower in some cases, but reasonably only when an error is
encountered. Also, scientific notation should be fairly scarce to begin
with.

Also move declarations of local variables closer to their first use (and
in the inner-most scope possible.) Unravel the handling of/accumulation
into 'frac' when computing the decimal part.

BUG=675174

Review-Url: https://codereview.chromium.org/2588023002
Cr-Commit-Position: refs/heads/master@{#439522}
rune
Get rid of @font-face resource leak.
Clear the StyleEngine of css connected fonts on detach().

This used to be saved by an active stylesheet update, it seems. With
the new active stylesheet update this is done more selectively and it
might have been done when document going inactive before. Clearing the
font cache on detach fixes the leak issues in css3/fonts.

TEST=css3/fonts/
BUG=674934

Review-Url: https://codereview.chromium.org/2582413002
Cr-Commit-Position: refs/heads/master@{#439510}
rune
Fixed flaky fullscreen video test.
The media controls are (at least sometimes) painted twice. The second
time after figuring out how many buttons fit into the available width.
At least one of the fullscreen tests were flaky because the first paint
was dumped instead of the second one. Adding a layoutAndPaintAsyncThen
in the full-screen-test.js framework seems to fix the issue.

Although the issue was filed after landing changes for issue 567021,
the flakiness is also seen locally without those changes running the
test with --repeat-each=30 in debug.

R=fs@opera.com
TEST=virtual/android/fullscreen/full-screen-stacking-context.html
BUG=675055

Review-Url: https://codereview.chromium.org/2586243002
Cr-Commit-Position: refs/heads/master@{#439483}
fs
Clamp radii in FEMorphology::createImageFilter
Sk{Dilate,Erode}ImageFilter::Make take the radii as integers (int), so
make sure to convert the float FEMorphology stores avoiding overflow.

BUG=675164

Review-Url: https://codereview.chromium.org/2585233002
Cr-Commit-Position: refs/heads/master@{#439474}
fs
Fix HTML parser CDATA edge-case and sync state names with spec
When encountering a sequence of ']]]' at the end of a CDATA section, we
should only buffer one ']' (the first one) and "remember" the other two.

The states exists in the spec[1][2][3] nowadays, so sync the names and remove
the comment about the states not being in the spec.

Fixes two subtests of wpt/html/syntax/parsing/html5lib_tests21.html.

[1] https://html.spec.whatwg.org/multipage/syntax.html#cdata-section-state
[2] https://html.spec.whatwg.org/multipage/syntax.html#cdata-section-bracket-state
[3] https://html.spec.whatwg.org/multipage/syntax.html#cdata-section-end-state

BUG=674496

Review-Url: https://codereview.chromium.org/2576373002
Cr-Commit-Position: refs/heads/master@{#439396}
rune
Removed resolverChanged().
This method was now empty and has been replaced by asynchronous active
stylesheet update in updateActiveStyleSheets().

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2559613002
Cr-Commit-Position: refs/heads/master@{#439142}
rune
Setting preferred stylesheet simplified.
With active stylesheets being applied asynchronously, we no longer need
to avoid the synchronous stylesheet update during link processing. We
can just mark the treeScope dirty to trigger the preferred set to be
updated as part of updateActiveStyleSheets().

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2552353003
Cr-Commit-Position: refs/heads/master@{#439115}
rune
Remove unused lazyAppend from StyleResolver.
Active stylesheet update is now asynchronous and handled from
StyleEngine::updateActiveStyleSheets().

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2557773004
Cr-Commit-Position: refs/heads/master@{#439102}
rune
Removed unused StyleSheetInvalidationAnalysis class.
R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2546343006
Cr-Commit-Position: refs/heads/master@{#439097}
rune
Remove ensureResolver before invalidation set scheduling.
ensureResolver() used to make sure the invalidation sets were up-to-
date with the currently active stylesheets. This is no longer necessary
as ruleset invalidation of changes in active stylesheets will make sure
changes are applied correctly.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2555083002
Cr-Commit-Position: refs/heads/master@{#439096}
rune
Reland: Collect active stylesheets and and apply asynchronously.
This CL enables asynchronously updating the lists of active stylesheets
applying any style changes using rule set invalidations. This means we
more often avoid full style recalcs when we add or remove stylesheets
from the document as well as when the evaluation of media queries
change.

In general, we now alway compare new and old stylesheets by comparing
their rulesets and schedule style invalidations for removed and added
rulesets.

When media queries changes, we used to give completely in and
recalculate all style once we discovered a media query changed its
evaluation. With this patch, we clear rule sets for sheets which
contain media queries which means we will invalidate rules for the sets
before and after the query change. This can be further refined by only
clearing rule sets when the sheets has a media query which actually did
change evaluation, and also just schedule invalidations for rules which
are inside @media rules.

TreeScopeStyleSheetCollectionTest.cpp is removed as it is replaced by
ActiveStyleSheetsTest.cpp which landed earlier.

updateActiveStyle() has been added a few places where
ensureStyleResolver() previously caused active stylesheets to be up-to-
date. ensureStyleResolver() is now merely a method which creates the
StyleResolver if necessary and returns it.

There are some cleanups and code removal which needs to be done after
this CL, but I have left those out to make this CL as small as
possible. For instance resolverChanged(), which synchronously updated
the active stylesheets, has an empty implementation instead of
including a lot of removals in this CL. The code for lazy-appending
stylesheets in StyleResolver is still there, but not in use.

R=meade@chromium.org
BUG=567021

Committed: https://crrev.com/9fb5b60edfb769134733009f9447bad3eaf347b0
Review-Url: https://codereview.chromium.org/2557533005
Cr-Original-Commit-Position: refs/heads/master@{#438148}
Cr-Commit-Position: refs/heads/master@{#439092}
rune
Merge setTimeout calls with same timeout for webfont tests.
Landing async stylesheet update caused a regression in font-display
tests. The values "fallback" and "optional" block display for 100ms
according to the spec. The tests had a setTimeout call to trigger font
loading and a setTimeout call to trigger notifyDone() to render before
100ms has passed with the same timeout value. However, the timer for
allowing fallback display triggers before the notifyDone triggers in
Debug builds on Mac. Calling notifyDone from the same setTimeout
callback as triggering font loading.

The intention of the test is to trigger the screen dump when 0s has
passed, so this should be OK. I have not identified what exactly changed
with the async stylesheet patch and why the timeout methods are
interleaved with the timeout for enabling fallback rendering.

Removing one of the other tests or one of the font-display values from
the test array also makes the "fallback" and "optional" start passing
without this change, so there is clearly a timing issue here.

BUG=567021

Review-Url: https://codereview.chromium.org/2584473002
Cr-Commit-Position: refs/heads/master@{#439026}
sigbjornf
ActiveScriptWrappable: GC wrappers in detached ExecutionContexts.
Blink objects that implement (Active)ScriptWrappable have the ability
to keep their corresponding v8 wrapper object alive across GCs by
overriding and implementing ScriptWrappable::hasPendingActivity().

Once an ExecutionContext has become detached, we no longer want to
retain wrappers belonging to it, as that will lead to memory leaks.
With full bi-directional tracing of references across the v8 and Blink
heaps, it is possible to make the lifetime of objects "more accurate",
but not keeping a wrapper alive once in a detached setting, has proven
to work out well in practice.

Consequently, a ScriptWrappable in a detached ExecutionContext should
not be retained, even if hasPendingActivity() return |true|. That is,
we should simply ignore hasPendingActivity()'s result, freeing the
implementations of it from having to take care of this 'detached'
detail.

This behavior is already provided by the 'standard' Blink wrapper
visitors that v8 invokes during GC, but not with wrapper tracing,
which is what this CL brings.

It does so by extending ActiveScriptWrappable with a predicate for
checking if the object's ExecutionContext has signalled destruction.

(The natural(?) way to express that is to parameterize ActiveScriptWrappable<>
over the class that implements the interface. This makes for a CL
with a larger footprint.)

R=haraken, mlippautz
BUG=468240

Review-Url: https://codereview.chromium.org/2577053002
Cr-Commit-Position: refs/heads/master@{#438967}
fs
Ignore minimum font-size for SVG text
In some circumstances, the minimum font-size would be applied to the
"scaled font", messing up rendering. Because of how the font is scaled,
this would trigger much less than one might expect.
Change the useSmartMinimumForFontSize argument to the
FontSize::getComputedSizeFromSpecifiedSize function to be about entirely
ignoring the minimum font-sizes (this function only has two callsites.)
Refactor LayoutSVGInlineText::computeNewScaledFontForStyle a bit to deal
with this new flow. Also always keep the "original" font when we compute
a scale factor of 0 - it should be invisible regardless.

BUG=232332,335725,475795,626936,664961
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2575863002
Cr-Commit-Position: refs/heads/master@{#438794}
sigbjornf
Signal no pending activity in destructed contexts.
Various hasPendingActivity() overrides weren't taking the state of the
ExecutionContext into account, only considering if event listeners were
registered. We're not interested in holding onto a script environment
after an execution context has been destroyed, so adjust the predicates
to return false if the ExecutionContext has been destructed.

The V8GCController wrapper visitors already check if hasPendingActivity()
implementations incorrectly return |true| when used inside of destroyed
ExecutionContexts, but that check is not handled by trace wrappers
(ActiveScriptWrappable.)

R=
BUG=

Review-Url: https://codereview.chromium.org/2571193002
Cr-Commit-Position: refs/heads/master@{#438787}
fs
Make LayoutSVGViewportContainer -> SVGSVGElement association obvious
This LayoutObject type is only used for non-outermost SVGSVGElements, so
no need to do runtime checks of the type.

Review-Url: https://codereview.chromium.org/2570293002
Cr-Commit-Position: refs/heads/master@{#438532}
fs
Remove unused SVGTextMetrics constructor
Review-Url: https://codereview.chromium.org/2565173007
Cr-Commit-Position: refs/heads/master@{#438523}
sigbjornf
Eagerly dispose of ScheduledActions (reland.)
The DOMTimer's ScheduledAction hold on to the script source and
state needed to execute the timer action. Let go of ShceduledAction's
resource early.

Apart from reducing the lifetime of script source, this is a speculative
fix for crashes reported in v8::PersistentValueVector::Clear() during
lazy sweeping of ScheduledAction objects.

R=
BUG=

Committed: https://crrev.com/11bd50343795ed1dc1977da91e9a1588687522fd
Review-Url: https://codereview.chromium.org/2552673002
Cr-Original-Commit-Position: refs/heads/master@{#436298}
Cr-Commit-Position: refs/heads/master@{#438503}
mstensho
Only the first layout pass needs to go deep when pagination state changes.
Since we now re-use the LayoutState object in multipass layout (caused by
either fragmentation or the PaintLayerScrollableArea::FreezeScrollbarsScope
mechanism), we need to notify the LayoutState object when we have performed the
necessary deep layout pass, so that not all subsequent passes also go deep
needlessly.

BUG=672088

Review-Url: https://codereview.chromium.org/2570643002
Cr-Commit-Position: refs/heads/master@{#438353}
tommyt
PaymentApp: Implement the JNI bridge
Add two native methods to ServiceWorkerPaymentAppBridge, and implement
them in service_worker_payment_app_bridge.cc. The two methods are
GetAllAppManifests and InvokePaymentApp. At the moment, they are just
stubs, although GetAllAppManifest contains a bit of code, mainly
for illustration and to avoid compile errors for unused @CalledFromNative
methods in ServiceWorkerPaymentAppBridge.

BUG=661608

Review-Url: https://codereview.chromium.org/2556753002
Cr-Commit-Position: refs/heads/master@{#438269}
sigbjornf
Remove PreFinalizer{Callback} type aliases from view.
Internal types, no good reason to expose these to the outside.

R=
BUG=673645

Review-Url: https://codereview.chromium.org/2573783002
Cr-Commit-Position: refs/heads/master@{#438170}
rune
Collect active stylesheets and and apply asynchronously.
This CL enables asynchronously updating the lists of active stylesheets
applying any style changes using rule set invalidations. This means we
more often avoid full style recalcs when we add or remove stylesheets
from the document as well as when the evaluation of media queries
change.

In general, we now alway compare new and old stylesheets by comparing
their rulesets and schedule style invalidations for removed and added
rulesets.

When media queries changes, we used to give completely in and
recalculate all style once we discovered a media query changed its
evaluation. With this patch, we clear rule sets for sheets which
contain media queries which means we will invalidate rules for the sets
before and after the query change. This can be further refined by only
clearing rule sets when the sheets has a media query which actually did
change evaluation, and also just schedule invalidations for rules which
are inside @media rules.

TreeScopeStyleSheetCollectionTest.cpp is removed as it is replaced by
ActiveStyleSheetsTest.cpp which landed earlier.

updateActiveStyle() has been added a few places where
ensureStyleResolver() previously caused active stylesheets to be up-to-
date. ensureStyleResolver() is now merely a method which creates the
StyleResolver if necessary and returns it.

There are some cleanups and code removal which needs to be done after
this CL, but I have left those out to make this CL as small as
possible. For instance resolverChanged(), which synchronously updated
the active stylesheets, has an empty implementation instead of
including a lot of removals in this CL. The code for lazy-appending
stylesheets in StyleResolver is still there, but not in use.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2557533005
Cr-Commit-Position: refs/heads/master@{#438148}
tsniatowski
Roll third_party/icu from 73e24736 to 9cd28287
http://chromium.googlesource.com/chromium/deps/icu.git/+log/73e24736..9cd28287

One change in the range: deprecation warning suppresion for non-clang.

BUG=21515,637001

Review-Url: https://codereview.chromium.org/2575433002
Cr-Commit-Position: refs/heads/master@{#438139}
sigbjornf
Retire ThreadState::registerPreFinalizer<T>()
The registration of the finalization callback now happens under-the-hood
and automatically.

R=haraken
BUG=673645

Review-Url: https://codereview.chromium.org/2570463005
Cr-Commit-Position: refs/heads/master@{#438136}
sigbjornf
Simple BlinkGC heap compaction.
This implements heap compaction for the Blink GC infrastructure
(Oilpan), compacting the arenas of the BlinkGC heap which are most
susceptible to becoming fragmented during actual use.

Fragmentation is a real problem and a growing one while browsing anything
but static pages: the amount of unused, but allocated, memory is
fluctuating higher over time.

To avoid leaving increasing amounts of unused holes in our heaps,
heap compaction will periodically squeeze out the unused portions,
packing together the live objects. The heap pages that are then
left as unused, are subsequently released and returned to the OS.

Due to a fortunate property of Blink heap collection types, providing
such compaction is within relatively easy reach. Experiments show that
the arenas which hold such collection objects ("backing stores") are
the ones that develop fragmentation the most & persistently. While not
a complete heap compactor of all Blink GC arenas, it addresses the
fragmentation problem where it is most pressing. More can be done, later.

Explainer / design document:

 https://docs.google.com/document/d/1k-vivOinomDXnScw8Ew5zpsYCXiYqj76OCOYZSvHkaU

R=haraken
BUG=672030

Review-Url: https://codereview.chromium.org/2531973002
Cr-Commit-Position: refs/heads/master@{#438125}
fs
Remove SVGCursorElement
This allows significant cleanup of CSSCursorImageValue, so do that too.

Intent-thread:

 https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/r0lnh5Rw23M

TBR=timvolodine@chromium.org
BUG=650598

Review-Url: https://codereview.chromium.org/2522443002
Cr-Commit-Position: refs/heads/master@{#438116}
sigbjornf
Implicit prefinalizer registration.
Switch to implicit registration of prefinalizers along with removing
the ability to dynamically unregister a prefinalizer; the latter
being an unused feature.

The requirement to manually register a prefinalizer has proven to be
a chore and a source of bugs. Case in point: HTMLCanvasElement
currently declares a prefinalizer, but doesn't register it. Simplify
the programming model by automatically registering prefinalizers.

R=haraken
BUG=673645

Review-Url: https://codereview.chromium.org/2565983002
Cr-Commit-Position: refs/heads/master@{#438110}
sigbjornf
Avoid conditional Animation prefinalizers.
Recast the conditionally-eager finalization of Animation objects - only
needed if the Animation object has a CompositorAnimationPlayer attached -
wrapping instead the player object inside an eagerly-finalized object.

By doing so, we remove the need to support explicit prefinalizer
registration.

R=haraken
BUG=673645

Review-Url: https://codereview.chromium.org/2570503002
Cr-Commit-Position: refs/heads/master@{#438089}
rune
Use hash set instead of vector for changed RuleSets.
That way, we don't have to consider the same RuleSet multiple times for
invalidation on active stylesheet update. This fixes a regression in
PerformanceTests/CSS/StyleSheetInsert.html which would have been
introduced by https://codereview.chromium.org/2557533005

This works because the same style element source text used multiple
times will make us use the same StyleSheetContents from the cache and
hence the same RuleSet for all 50 sheets added in that test. It's a bit
like cheating, but this will also make sure we don't invalidate for the
same RuleSet twice if we re-order stylesheets by removing/inserting a
style element where the CSSStyleSheet pointer will be different, but
the RuleSet stays the same.

R=sashab@chromium.org,esprehn@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2569733003
Cr-Commit-Position: refs/heads/master@{#438062}
mstensho
Disable layout optimization when column height may be non-uniform.
We have no way of telling what changes beyond the first column break, so if we
cannot guarantee that the column height *is* and *was* non-uniform, we need to
re-lay out children that may stretch into the unknown.

Review-Url: https://codereview.chromium.org/2562273003
Cr-Commit-Position: refs/heads/master@{#437928}
fs
Perform "zoom compensation" for 'transform' on <svg:text>
SVGElement::calculateTransform would not compensate for effective zoom
on 'transform' for SVG <text> elements.
Refactor the code a bit so that the different parameter configurations
are selected first, and then use the same code for both <text> and non-
<text>. This makes sure that effective zoom is factored into the
computed transform for <text> as well.

BUG=665387,369942

Review-Url: https://codereview.chromium.org/2565403002
Cr-Commit-Position: refs/heads/master@{#437927}
sigbjornf
Revert of Eagerly dispose of ScheduledActions. (patchset #2 id:20001 of https://codereview.chromium.org/2552673002/ )
Reason for revert:
Speculative revert for reported perf decrease on system_health.memory_mobile, https://crbug.com/672098

Original issue's description:
> Eagerly dispose of ScheduledActions.
>
> The DOMTimer's ScheduledAction hold on to the script source and
> state needed to execute the timer action. Let go of ShceduledAction's
> resource early.
>
> Apart from reducing the lifetime of script source, this is a speculative
> fix for crashes reported in v8::PersistentValueVector::Clear() during
> lazy sweeping of ScheduledAction objects.
>
> R=
> BUG=
>
> Committed: https://crrev.com/11bd50343795ed1dc1977da91e9a1588687522fd
> Cr-Commit-Position: refs/heads/master@{#436298}

TBR=oilpan-reviews@chromium.org,haraken@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=

Review-Url: https://codereview.chromium.org/2568103002
Cr-Commit-Position: refs/heads/master@{#437889}
tommyt
PaymentApp: Make the PaymentAppFactory asynchronous
The code for fetching and filtering payment instruments in
PaymentRequestImpl is asynchronous anyway, so this change is not too
intrusive. The main thing is to insert an extra asynchronous step to
populate the mApps list before payment instrument filtering starts.

If we want to take this further, a good next step would be to start
showing apps as they are discovered, instead of waiting until we have
received all the payment apps. It would also be a good thing to
refactor some of this functionality out of the PaymentRequestImpl, as
it is growing quite complex.

Other changes that went into this commit:

* Change the PaymentAppFactory into a singleton, rather than being a
  holder class for static functions.

* Extend the AdditionalPaymentFactory functionality, so that the
  PaymentAppFactory can have many additional factories. This lets us
  make the ServiceWorkerPaymentAppBridge an additional factory, and
  normalize the relationship between the two classes.

* Add two unit tests for testing delayed payment app creation.

BUG=661608

Review-Url: https://codereview.chromium.org/2559153002
Cr-Commit-Position: refs/heads/master@{#437843}
sigbjornf
Simple BlinkGC heap compaction.
This implements heap compaction for the Blink GC infrastructure
(Oilpan), compacting the arenas of the BlinkGC heap which are most
susceptible to becoming fragmented during actual use.

Fragmentation is a real problem and a growing one while browsing anything
but static pages: the amount of unused, but allocated, memory is
fluctuating higher over time.

To avoid leaving increasing amounts of unused holes in our heaps,
heap compaction will periodically squeeze out the unused portions,
packing together the live objects. The heap pages that are then
left as unused, are subsequently released and returned to the OS.

Due to a fortunate property of Blink heap collection types, providing
such compaction is within relatively easy reach. Experiments show that
the arenas which hold such collection objects ("backing stores") are
the ones that develop fragmentation the most & persistently. While not
a complete heap compactor of all Blink GC arenas, it addresses the
fragmentation problem where it is most pressing. More can be done, later.

Explainer / design document:

 https://docs.google.com/document/d/1k-vivOinomDXnScw8Ew5zpsYCXiYqj76OCOYZSvHkaU

R=haraken
BUG=672030

Review-Url: https://codereview.chromium.org/2531973002
Cr-Commit-Position: refs/heads/master@{#437829}
fs
Strength-reduce the "scale-factor changed" condition in LayoutSVGRoot
Spend some cycles examining the difference between the old and new
local-to-border-box transforms, and only signal scale-factor changes
if that part of the transform changed.
This also means that we now detect changes scale that we previously
didn't (like [1].)

[1] paint/invalidation/svg/absolute-sized-content-with-resources.xhtml

BUG=603956,664961

Review-Url: https://codereview.chromium.org/2559123003
Cr-Commit-Position: refs/heads/master@{#437767}
mstensho
Rebaseline paint/invalidation/resize-iframe-text.html for Mac.
BUG=672676

Review-Url: https://codereview.chromium.org/2557743008
Cr-Commit-Position: refs/heads/master@{#437567}
sigbjornf
ImageResource: remove unnecessary vector copying during iteration.
Iterations that don't update the underlying collection, can be done
in-place.

R=
BUG=

Review-Url: https://codereview.chromium.org/2555103004
Cr-Commit-Position: refs/heads/master@{#437482}
mstensho
Hopefully deflake some tests, by preloading the Ahem font.
BUG=670846

Review-Url: https://codereview.chromium.org/2560073002
Cr-Commit-Position: refs/heads/master@{#437423}
rune
Missing style invalidation for :in-range and :out-of-range.
Added pseudoStateChanged calls for those pseudos where we already did
so for :valid and :invalid.

R=tkent@chromium.org
BUG=671745

Review-Url: https://codereview.chromium.org/2556423002
Cr-Commit-Position: refs/heads/master@{#437415}
mstensho
Fix path search-replace mistakes (?) that prevented resources from being loaded.
This was introduced in https://codereview.chromium.org/2321183002

Review-Url: https://codereview.chromium.org/2558263002
Cr-Commit-Position: refs/heads/master@{#437365}
fs
Unify "contributes to" and "requires mask" for clip-path child iteration
Since contributesToClip(...) and requiresMask(...) have a lot of overlap,
refactor them into a new (set of) function(s) that return an enumeration
based on the requirements for the element in question.

Review-Url: https://codereview.chromium.org/2563613002
Cr-Commit-Position: refs/heads/master@{#437248}
mstensho
Let LayoutBlockFlow::removeFloatingObject take LayoutUnit instead of int.
Review-Url: https://codereview.chromium.org/2559443002
Cr-Commit-Position: refs/heads/master@{#437221}
mstensho
[LayoutNG] Remove unnecessary #includes
NOTRY=true
BUG=591099

Review-Url: https://codereview.chromium.org/2561553002
Cr-Commit-Position: refs/heads/master@{#437217}
rune
Make sure media query results are re-collected.
When media attributes change on style elements, we need to re-append
all sheets in the scope in order to collect the viewport and device
dependent media results correctly. This already done forced by the
FullStyleUpdate in parseAttribute, but we want to minimize the changes
here with async style update and ruleset based invalidations by marking
the treeScope dirty, and if nothing changed, invalidate no style.

However, we need to re-add global rule data, or at least the media
query results.

Example: say that we have a window width of 800px below. After the
media attribute has been changed, we don't need to recalculate any
styles, but we need to make sure we detect style changes crossing the
width of 2000px instead of 1000px.

<style media="(min-width: 1000px)"> ... </style>

<script>
  styleElement.setAttribute("media", "(min-width: 2000px");
</script>

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2554193002
Cr-Commit-Position: refs/heads/master@{#437213}
rune
Make setNeedsActiveStyleUpdate mark treescope dirty only.
Pass the treeScope instead of a stylesheet pointer and remove the
synchronous resolverChanged() call. Instead add the resolveChanged()
calls where currently necessary and mark them for removal.

This makes the setNeedsActiveStyleUpdate implementation like what we
want to end up with [1]. I've done it this way to make the following
CLs easier to review.

Also, setNeedsActiveStyleUpdate calls are removed where we call
removeStyleSheetCandidateNode() since that method already marks the
tree-scope dirty.

[1] https://codereview.chromium.org/1913833002/

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2546393002
Cr-Commit-Position: refs/heads/master@{#437212}
rune
Mark correct tree-scope dirty removing link in shadow.
Noticed while working on 567021, StyleElement found the correct
tree-scope in from of a shadow root when applicable while
HTMLLinkElement would just use the document. This is what kept us from
being able to use AnalyzedStyleUpdate for removedFrom() for link
elements.

R=meade@chromium.org
BUG=671596

Review-Url: https://codereview.chromium.org/2554873002
Cr-Commit-Position: refs/heads/master@{#437210}
mstensho
Better isPageLogicalHeightKnown() implementation.
Need to consult the flow thread, if we have one. We may run into situations
where fragmentainer groups in the first column set have got their height
calculated, while later column sets still haven't calculated it [1]. So
checking if flow thread offset 0 is in a fragmentainer of known height isn't
good enough.

Also moved the implementation from LayoutBlock to LayoutBox, since it's pretty
coincidental that we currently don't need this particular method outside of
LayoutBlock.

[1] LayoutMultiColumnSet::recalculateColumnHeight() may reset the column
heights if it detects that the column set has been moved since previous layout
pass.

BUG=670902

Review-Url: https://codereview.chromium.org/2553133002
Cr-Commit-Position: refs/heads/master@{#437063}
fs
Don't check 'visibility' in LayoutSVGResourceMasker
Since 'visibility' does not work in the same way as 'display', it's not
possible to "prune" subtrees based on non-'visible' values of the
property. Remove the check from the two methods that use it, and leave
to lower levels to handle it.

BUG=672055

Review-Url: https://codereview.chromium.org/2558793002
Cr-Commit-Position: refs/heads/master@{#436996}
fs
Don't allow <use> <text> references in clip-path fast-path
The fast-path can't handle <text>, but a <use> referencing <text> was
not properly checked resulting in an incorrect clip.
Make the requiresMask(...) helper handle <use> elements and check the
referenced element.

BUG=604677,604679

Review-Url: https://codereview.chromium.org/2560773002
Cr-Commit-Position: refs/heads/master@{#436941}
rune
Use correct document for notifying of inserted import.
Notify the root document to update active stylesheets. If the import
child contains stylesheets, the StyleEngine for the import document
will be notified correctly.

Added a couple of sanity DCHECKs.

R=meade@chromium.org
BUG=671322

Review-Url: https://codereview.chromium.org/2551973003
Cr-Commit-Position: refs/heads/master@{#436887}
mstensho
Never position a float after it has been placed.
When a float is marked as "placed" (which happens in
LayoutBlockFlow::placeNewFloats()), it means that it has been added to a float
interval tree. It is not allowed to move a float afterwards (unless we remove
and re-insert the floats somehow, e.g. by re-laying out its containing block).
Otherwise, the interval tree may get out of sync with reality, and we may fail
to find the reference to a FloatingObject in the interval tree when deleting a
FloatingObject, so that we end up deleting the FloatingObject, but not the
reference to it in the interval tree (which will remain there, pointing to a
now dead object).

This could happen when LayoutBlockFlow::removeFloatingObjectsBelow() was called
during pagination. We sometimes need to re-lay out a line because the line or
floats next to the line get pushed to the next fragmentainer. As part of that,
we also need to get rid of the floats that we thought would sit beside the
line, and re-position them.

BUG=670927

Review-Url: https://codereview.chromium.org/2553923003
Cr-Commit-Position: refs/heads/master@{#436776}
fs
Rework SVGViewSpec<->SVGSVGElement integration
This turns SVGViewSpec into a more independent component, by moving
parsing (case) logic into it, and changing adding an accessor interface
on SVGSVGElement that allows access to, and handles invalidation of the
SVGSVGElement's view properties.

The m_useCurrentView is done away with, and instead the code just checks
if there's an SVGViewSpec attached. Naturally this also means that care
needs to be taken to "detach" the old SVGViewSpec when needed.

Review-Url: https://codereview.chromium.org/2552513002
Cr-Commit-Position: refs/heads/master@{#436704}
fs
Unify predicates for elements "contributing" to a <clipPath>
LayoutSVGResourceClipper has four loops that iterate the child elements
that contribute to the clip path. They are however all subtly different.

To remedy this and make it more obvious that the same set of elements
are iterated, add a helper contributesToClip(...) that handles the
checking of if an element is considered to be contributing to the clip
path or not. This yields four loops with a very similar structure.

Also move path-extraction to a helper, use helpers from Traversal<...>
for basic iteration, drop LayoutObject/ComputedStyle related checks
from the SVGUseElement helper (now handled elsewhere) and hoist the
PaintInfo out of the loop in createContentPicture since it is invariant.

Review-Url: https://codereview.chromium.org/2560513002
Cr-Commit-Position: refs/heads/master@{#436703}
fs
Don't fail clip-paths with empty bounds
An empty nested clip-path should result in an empty clip-path (clipping
away everything.)

BUG=671543
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2555483003
Cr-Commit-Position: refs/heads/master@{#436605}
fs
Properly simulate self-closing tags when in "foreign content" mode
When background parsing, a tag that "opens" foreign content mode and had
the "self-closing" flag set (<svg/> and <math/>), would place the
simulator in foreign content mode without a chance to get out of it.
Run the "end tag" steps in this case too, to properly balance the
namespace stack.

BUG=537642

Review-Url: https://codereview.chromium.org/2546373002
Cr-Commit-Position: refs/heads/master@{#436569}
mstensho
Refactor layoutBlock() and layoutBlockFlow(). Happens to fix bugs.
Move what only needs to be done once into layoutBlock(). Rename
layoutBlockFlow() to layoutChildren(). Establish LayoutState once, and compare
with the actual previous height to properly detect height changes.

This fixes two issues with the PaintLayerScrollableArea::FreezeScrollbarsScope
mechanism. Tests added.

1. We used to push LayoutState for the same object twice when freezing
scrollbars, which confused the fragmentation machinery.

2. We failed to detect height changes when freezing scrollbars, because we were
unable to compare against the original height (we compared against the height
we had when entering the second layout pass, rather than comparing against the
one we had when entering the first layout pass). We might therefore end up
skipping necessary re-layout of absolutely positioned descendants.

BUG=669039,670660

Review-Url: https://codereview.chromium.org/2553833002
Cr-Commit-Position: refs/heads/master@{#436414}
sigbjornf
Disallow off-heap containers containing raw on-heap pointers.
R=
BUG=

Review-Url: https://codereview.chromium.org/2553673002
Cr-Commit-Position: refs/heads/master@{#436351}
sigbjornf
Eagerly dispose of ScheduledActions.
The DOMTimer's ScheduledAction hold on to the script source and
state needed to execute the timer action. Let go of ShceduledAction's
resource early.

Apart from reducing the lifetime of script source, this is a speculative
fix for crashes reported in v8::PersistentValueVector::Clear() during
lazy sweeping of ScheduledAction objects.

R=
BUG=

Review-Url: https://codereview.chromium.org/2552673002
Cr-Commit-Position: refs/heads/master@{#436298}
tommyt
PaymentApp: Add classes for supporting Web Based Payment Apps
This adds an application class, an instrument class and a skeleton
bridging class which can later be implemented to communicate with the
service worker class in C++.

The app factory class has been extended to create instances of the new
web based payment apps in addition to the existing autofill payment app.

BUG=669876

Review-Url: https://codereview.chromium.org/2526293003
Cr-Commit-Position: refs/heads/master@{#436274}
kszatan
Fix Firefox bookmarks import.
Firefox abandoned usage of the moz_bookmarks_roots table since v. 30 and
removed the table in v. 31 in favor of storing relevant info in the
'guid' column of the moz_bookmarks table.

BUG=638977

Review-Url: https://codereview.chromium.org/2296633002
Cr-Commit-Position: refs/heads/master@{#436262}
rune
Schedule layout tree update for dirty tree scopes.
In preparation for async stylesheet update, schedule a layout tree
update when marking tree scopes dirty for active style sheets. This is
necessary to trigger a beginFrame which will in turn call
updateActiveStyle as part of the lifecycle update.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2547883002
Cr-Commit-Position: refs/heads/master@{#436248}
rune
Correctly re-collect active style for html imports.
- Need to re-collect active stylesheets when inserting already cached
  import documents.

- Missing markDocumentDirty() when inserting import documents.

- Added test for missing coverage of the need for marking for re-
  collection from HTMLImportChild::ownerInserted().

The fact that we need to recollect sheets in the document scope and
recalculate style for the whole document is not a perf regression, this
is how it used to be before considering the async stylesheet update
with ruleset invalidations, but ideally we would like to do better.
It's unlikely a common use case as html imports are typically loaded in
head as script and rendering blocking.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2551473002
Cr-Commit-Position: refs/heads/master@{#436238}
mstensho
Complete layout even if a block needs relayout due to widows or column balancing.
We cannot just abort in the middle of layoutBlockFlow() when we detect that we
need another layout pass (due to new column height or because we want an
earlier break to satisfy the widows requirement). We might miss our only
opportunity to detect size changes that way, and thus skip necessary layout and
repositioning of absolutely positioned descendants.

BUG=591637

Review-Url: https://codereview.chromium.org/2471623003
Cr-Commit-Position: refs/heads/master@{#436192}
fs
Drop SVGElement::accessDocumentSVGExtensions()
This method has a single user into which it can be folded without any
issues. The comment in the method seem to no longer apply.

Also drop an unused friend declaration while at it.

Review-Url: https://codereview.chromium.org/2548573003
Cr-Commit-Position: refs/heads/master@{#436051}
rune
Returned MediaQuerySet should be const.
The MediaQuerySet is never modified outside the class. We don't have
any evidence that this fixes the mentioned issue though.

R=sigbjornf@opera.com
BUG=669757

Review-Url: https://codereview.chromium.org/2547713003
Cr-Commit-Position: refs/heads/master@{#436031}
mstensho
Don't include ComputedStyle.h where not needed.
This reduces the dependency on ComputedStyle.h from more than 2000 compilation
units to less than 1000.

Review-Url: https://codereview.chromium.org/2539363003
Cr-Commit-Position: refs/heads/master@{#435928}
mstensho
Don't include CachedUAStyle.h from StyleResolver.h
Eliminates another 40+ compilation unit dependencies on ComputedStyle.h

Review-Url: https://codereview.chromium.org/2545953003
Cr-Commit-Position: refs/heads/master@{#435925}
rune
Make updateStyleInvalidationIfNeeded() private.
It is not invoked outside of Document.

This is split out of the larger CL for 567021.

R=mstensho@opera.com
BUG=567021

Review-Url: https://codereview.chromium.org/2537863006
Cr-Commit-Position: refs/heads/master@{#435922}
rune
Remove MediaQuerySet:createOffMainThread.
The implementation is identical to MediaQuerySet::create.
Removed old cruft from the unit test from when we had two media query
parsing implementation.

R=yoav@yoav.ws,timloh@chromium.org

Review-Url: https://codereview.chromium.org/2545663005
Cr-Commit-Position: refs/heads/master@{#435920}
mstensho
Margins that start at fragmentainer boundaries should be collapsed away.
This only applies if the fragmentainer break is unforced. If it's forced, the
margin is to be preserved.
See https://drafts.csswg.org/css-break/#break-margins

Get rid of LayoutBlock::nextPageLogicalTop(), since nobody calls it anymore.

BUG=440362

Review-Url: https://codereview.chromium.org/2542723002
Cr-Commit-Position: refs/heads/master@{#435917}
fs
Avoid repeating ourselves in SVGAnimatedEnumerationBase::setBaseVal
After performing the range checks on the value, we can call our "generic"
setBaseVal and avoid repeating this code-sequence.

Review-Url: https://codereview.chromium.org/2548533003
Cr-Commit-Position: refs/heads/master@{#435715}
fs
Only communicate CSSPrimitiveValue references from SVGLength
Make asCSSPrimitiveValue() return a reference to a CSSPrimitiveValue,
rather than a pointer. The CSSPrimitiveValue contained in the SVGLength
can/should never be null.
Add a helper to SVGAnimatedLength to cut down on some boilerplate for
accessing the current CSSValue.

Review-Url: https://codereview.chromium.org/2549563002
Cr-Commit-Position: refs/heads/master@{#435688}
fs
Neuter the "screen scale factor" computation for SVG <text>
This removes the PaintLayer-factor and DSF from the "screen scale factor",
leaving only the transform to the <svg> root and the "content transform" (used
by <pattern>, <mask> and <clipPath>.)

BUG=664961

Review-Url: https://codereview.chromium.org/2492013004
Cr-Commit-Position: refs/heads/master@{#435599}
tommyt
PaymentApp: Allow multiple payment method names for one instrument.
This changes the name and signature of the
PaymentInstrument.getInstrumentMethodName method to:

    Set<String> getInstrumentMethodNames()

This is to match the "enabledMethods" field in the PaymentAppOption
dictionary in the Payment Apps specification, which is defined to be a
sequence of strings.

See: https://w3c.github.io/webpayments-payment-apps-api/#payment-app-options

I also change the name of PaymentInstrument.getInstrumentDetails to
"invokePayment" in order to convey better that this is where the payment
method specific stuff happens. For a Web Based Payment App, this method
is an appropriate point to launch the payment request event into the
service worker.

BUG=669876

Review-Url: https://codereview.chromium.org/2530793002
Cr-Commit-Position: refs/heads/master@{#435587}
fs
Cleanup after removal of the SVGViewSpec interface
With DOM requirements gone, we can turn this into something a bit simpler.
Remove the SVGFitToViewBox inheritance in favor of direct references to
the relevant objects. Similarly drop/unwrap the SVGAnimatedTransformList.

The above gets rid of the only users of SVGAnimatedProperty::setReadOnly
and associated state, as well as the corresponding state in the tear-off.

Also drop an unused methods from SVGSVGElement and rename currentView()
to ensureViewSpec(), making it private in the process.

Review-Url: https://codereview.chromium.org/2537223006
Cr-Commit-Position: refs/heads/master@{#435485}
mstensho
Introduce resetLayout(), to offload layoutBlockFlow().
Review-Url: https://codereview.chromium.org/2529423003
Cr-Commit-Position: refs/heads/master@{#435471}
mstensho
Avoid rogue line float re-layout.
We cannot just lay out an object without setting its position first. That would
confuse the fragmenation machinery. Fortunately, it's not even necessary to lay
out here. Changed the comment, as an attempt to explain why.

BUG=663942

Review-Url: https://codereview.chromium.org/2539813002
Cr-Commit-Position: refs/heads/master@{#435442}
tsniatowski
Remove android build dir nesting restriction
It appears that android builds no longer have to be nested exactly two
levels under //. A build with one level works, so the assert in gn is
no longer helpful.

BUG=412935
R=agrieve@chromium.org

Review-Url: https://codereview.chromium.org/2544493002
Cr-Commit-Position: refs/heads/master@{#435410}
sigbjornf
CSSSelectorWatch: avoid unnecessary hash table lookups.
Review-Url: https://codereview.chromium.org/2541853002
Cr-Commit-Position: refs/heads/master@{#435361}
tmoniuszko
Rename 'interface' parameter
It conflicts with define from combaseapi.h from Windows SDK.

BUG=

Review-Url: https://codereview.chromium.org/2524733003
Cr-Commit-Position: refs/heads/master@{#435169}
fs
Use the right point for marker orientation when closing a subpath
Path::apply doesn't pass a point along for the PathElementCloseSubpath
command. This would yield the wrong orientation on the last marker-mid
on the path (see crbug.com/633012#c1 for an example.)
Use m_subpathStart where needed instead.

BUG=633012

Review-Url: https://codereview.chromium.org/2539763002
Cr-Commit-Position: refs/heads/master@{#434988}
fs
Cleanup SVGMarkerData::updateFromPathElement
Make the updateFromPathElement "closure" a simple thunk-style function,
to make it a little less unwieldy. Also pass PathElement& rather than
PathElement*.

BUG=633012,450368

Review-Url: https://codereview.chromium.org/2540513005
Cr-Commit-Position: refs/heads/master@{#434987}
mstensho
[LayoutNG] Correct inline size for children of multicol containers.
This will lay out multicol containers in one single tall column, without any
support for fragmentation or column balancing.

Also had to disable creation of the anonymous LayoutMultiColumnFlowThread child
of multicol containers, since that's not going to be used in LayoutNG.

The algorithm for calculating the used values of column-width and column-count
can be found here: https://drafts.csswg.org/css-multicol-1/#pseudo-algorithm

Review-Url: https://codereview.chromium.org/2528203002
Cr-Commit-Position: refs/heads/master@{#434971}
mstensho
Position a float before laying it out.
We'll no longer perform inaccurate layout from insertFloatingObject(), but
defer all layout to positionAndLayoutFloat(). We need to do this correctly
everywhere. One crucial thing is also to pay attention to the resulting
pagination strut before the float, if any. There's only one place where we do
this, and that's in positionAndLayoutFloat().

At most call sites, insertFloatingObject() is followed by a call to
placeNewFloats(), which will call positionAndLayoutFloat(). There are
exceptions to this in line layout, though. In some cases we just insert floats
without laying them out and placing them. This happens when we need to figure
out the height of the current line before we can place floats below it. In
order to figure out if a float fits on the current line, though, we first need
to lay it out without marking it as placed.

We lacked some test coverage, so I added
float-pushed-to-next-fragmentainer-by-floats.html . This also passed prior to
this CL, but I nearly broke it while working on this.

BUG=663942

Review-Url: https://codereview.chromium.org/2532573003
Cr-Commit-Position: refs/heads/master@{#434969}
mstensho
[LayoutNG] No need to search for inline children inside a block-children block.
Also type-check that we're dealing with a LayoutBlockFlow before casting.

Review-Url: https://codereview.chromium.org/2527393002
Cr-Commit-Position: refs/heads/master@{#434968}
mstensho
No longer store page logical height in LayoutState.
That height may not be uniform throughout the entire fragmentation context
anyway, so it's not reliable to do it like this. For multicol, the value was
only used as a flag (0=unknown height, 1=known height).

Move calculation of available column height to LayoutMultiColumnFlowThread. It
no longer needs to live in LayoutBlockFlow.

Review-Url: https://codereview.chromium.org/2529073002
Cr-Commit-Position: refs/heads/master@{#434965}
fs
Update svg/wicd/test-rightsizing-b.xhtml expectations
Attempt to compensate for some recent changes to DRT output. Also try
to get some more "correct" reference images.

TBR=schenney@chromium.org
NOTRY=true
BUG=639147

Review-Url: https://codereview.chromium.org/2537083003
Cr-Commit-Position: refs/heads/master@{#434962}
rune
Introduce markAllTreeScopesDirty.
When we need to recollect active stylesheets for all scopes, have an
explicit markAllTreeScopesDirty method instead of relying on
FullStyleUpdate which will go away for async active stylesheet updates.

This CL does not contain functional changes.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2534863002
Cr-Commit-Position: refs/heads/master@{#434940}
fs
Make 'transform' a presentation attribute on SVG elements
This makes 'transform', 'gradientTransform' and 'patternTransform'
presentation attributes on SVGGraphicsElements, SVGGradientElements
and SVGPatternElements respectively.

Spec:

 http://www.w3.org/TR/css3-transforms/#svg-transform
 http://www.w3.org/TR/css3-transforms/#svg-syntax
 http://www.w3.org/TR/css3-transforms/#svg-gradient-transform-pattern-transform

Salvaged from https://codereview.chromium.org/423093014, but takes a
different approach to bridge the syntax gap and avoid crbug.com/577219.

The strategy taken here is to use the SVGTransformList to generate a
CSSValue for the presentation attribute style, and hence postponing
both support for the full transform syntax and a way around the bug
mentioned above. Essentially softening the blow. These two "features"
are expected to be implemented eventually, so this is just a "first
step".

BUG=369942
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2478233002
Cr-Commit-Position: refs/heads/master@{#434934}
sigbjornf
Fix speech-synthesis-speak-multiple.html flakiness.
Follow up on r420711 (crbug.com/589632) and adjust the expected lower
bound on ".elapsedTime" to also include zero for 'start' events.

TBR=dmazzoni
BUG=660448

Review-Url: https://codereview.chromium.org/2540623002
Cr-Commit-Position: refs/heads/master@{#434931}
sigbjornf
Handle overlapping uses of MockWebSpeechRecognizer.
More than one speech recognition object may exist at the same time,
all sharing a single MockWebSpeechRecognizer underneath when
running layout tests.

Overlapping uses of speech recognizer objects weren't something
the mock object was designed to gracefully handle, hence fuzzer
inputs would leave the mock object in an invalid state and crash,
when they attempted to do so.

Rather than try to ignore and prevent overlapping uses from going
ahed, we extend MockWebSpeechRecognizer with support for handling
them, queueing recognizer context switching tasks that will run
upon completion of the currently ongoing sequence of tasks that
a speech recognizer object expects.

R=
BUG=668019

Review-Url: https://codereview.chromium.org/2525933002
Cr-Commit-Position: refs/heads/master@{#434777}
fs
Rework the "rules for parsing dimension values" implementation
This CL reworks the current implementation of the "rules for parsing
dimension values" [1] (HTMLElement::addHTMLLengthToStyle) into a
separate function and moves it to HTMLDimension.{cpp,h}.
In general, behavior deviating from the specced version is kept with the
following exceptions:

 * Allow all of the "space characters" [2], rather than just U+0020.

 * Cases with multiple full stops (ex: "1.2.3") now parse the same as
   "1.2" rather than failing.

Comments are added where the implementation is known to deviate from the
spec.

This also makes it possible to avoid calling into the CSS parser for
actual parsing, which should reduce the amount of special-cases needed
there. This requires a mechanism for disallowing percentage values
though, to properly handle 'cellspacing' on <table>.

[1] https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-dimension-values
[2] https://html.spec.whatwg.org/multipage/infrastructure.html#space-character

BUG=668478

Review-Url: https://codereview.chromium.org/2528673003
Cr-Commit-Position: refs/heads/master@{#434678}
mstensho
[LayoutNG] Remove all mentions of NGBox and NGInlineBox.
It's called NGBlockNode and NGInlineNode now.

Also removed an old TODO about common base class for NGBlockNode and
NGInlineNode. They do have a common base class now.

Review-Url: https://codereview.chromium.org/2530083003
Cr-Commit-Position: refs/heads/master@{#434630}
mstensho
Remove spurious Ctrl+Y character from paint invalidation test.
This caused the test to fail for me, when run locally.

Review-Url: https://codereview.chromium.org/2529843002
Cr-Commit-Position: refs/heads/master@{#434579}
mstensho
[LayoutNG] Simplify NGBox::CanUseNewLayout().
Review-Url: https://codereview.chromium.org/2535533002
Cr-Commit-Position: refs/heads/master@{#434555}
mstensho
[LayoutNG] Typos in ComputeMinAndMaxContentSizes() documentation.
Review-Url: https://codereview.chromium.org/2526223004
Cr-Commit-Position: refs/heads/master@{#434525}
mstensho
[LayoutNG] Unit tests for MinAndMaxContentSizes::ShrinkToFit().
Also DCHECK in the implementation that max_content isn't less than min_content.

Review-Url: https://codereview.chromium.org/2528433006
Cr-Commit-Position: refs/heads/master@{#434458}
rune
Check for styleResolver() in preparation for async style update.
Currently, active stylesheets are appended to ScopedStyleResolver
through the StyleResolver. When we move to async stylesheet update with
ActiveStyleSheets being appended from StyleEngine, styleResolver() is
typically null the first time we update the active stylesheets.

Add a null check before accessing styleResolver() when adding
@font-face rules.

R=nainar@chromium.org,meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2522423002
Cr-Commit-Position: refs/heads/master@{#434437}
mstensho
Set the inline position of floats a bit later.
No need to do it so early, since nobody cares about its position at this point.
This means that there's also no need to update it after having been pushed down
by pagination. As long as we set it before positioning subsequent floats or
other types of content, we're good.

Also store margins as local variables. No huge gain, apart from prettier code
with fewer breaks.

No behavior changes intended.

Review-Url: https://codereview.chromium.org/2511283003
Cr-Commit-Position: refs/heads/master@{#434388}
rune
Move MediaQueryResults to RuleFeatureSet.
The existing code only cleared the query results on the StyleResolver
when the StyleResolver was cleared. That meant we could end up in a
situation where the result list was ever-growing. That wasn't a big
issue in practice as the StyleResolver would be cleared quite often on
stylesheet changes. However, that will change when the RuleSet based
style invalidation is enabled.

We move the media query results to RuleFeatureSet so that:

- Results for @media rules are stored in RuleFeatureSet instead of
  RuleSet.
- Results for media attributes are stored in the ScopedStyleResolver
  when added instead of appending them directly to StyleResolver.
- Accumulated results for all scopes are stored in CSSGlobalRuleSet
  on StyleEngine instead of StyleResolver and are accumulated with
  other rule features in ScopedStyleResolver::collectFeaturesTo().

This CL introduces StyleEngine::ruleSetForSheet() for evaluating the
media attribute of the stylesheet node and create the RuleSet if the
media attribute matches. That way we are able to make the
MediaQueryEvaluator private to StyleEngine. Also, this method is
required when we start using ActiveStyleSheets.

R=meade@chromium.org
BUG=567021,614026

Review-Url: https://codereview.chromium.org/2528633003
Cr-Commit-Position: refs/heads/master@{#434383}
rune
Force adding sheets and recalc for html import re-ordering.
When we remove an import link and re-insert it into the document, the
import Document and CSSStyleSheet pointers are persisted. That means the
comparison of active stylesheets is not able to figure out that the
order of the stylesheets have changed after insertion.

We fall back to re-add all sheets to the scoped resolver and recalculate
style for the whole document if we remove an import in case it is re-
inserted into the document. The assumption is that removing html imports
is very rare.

For re-ordering of link rel=stylesheet the CSSStyleSheet object is
cleared on removal and recreated on insertion. Since the active
stylesheet list keeps references to CSSStyleSheet, CSSStyleSheet
pointers will not be re-used.

R=meade@chromium.org
TEST=fast/html/imports/import-readd-*
BUG=567021

Review-Url: https://codereview.chromium.org/2519393002
Cr-Commit-Position: refs/heads/master@{#434374}
rune
Check explicitly for style invalidation/recalc in @font-face test.
needsLayoutTreeUpdate will return true for needing to update the global
ruleset for async style update. Even if the test only tries to add a
@font-face rule, we unconditionally recollect the CSSGlobalRuleSet when
stylesheets are added or removed.

Instead check that adding a @font-face rule in a shadow tree does not
cause style invalidation or recalc.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2520263002
Cr-Commit-Position: refs/heads/master@{#434367}
wdzierzanowski
Adjust VideoRendererAlgorithm for |frame_dropping_disabled_|
This makes video frame hashing in tests immune to timing variations that
are inherent in the rendering algorithm.

BUG=663709
TEST=media_unittests pass, new unit test VideoRendererAlgorithmTest.EffectiveFramesQueuedWithoutFrameDropping

Review-Url: https://codereview.chromium.org/2502093002
Cr-Commit-Position: refs/heads/master@{#434350}
mstensho
EDisplay enum class: Rename [Inline]Box to Webkit[Inline]Box.
The "box" and "inline-box" values (or rather: "-webkit-box" and
"-webkit-inline-box") for "display" are for an early-stage version of the
flexbox spec, which the web embraced before the flexbox spec got around to
going CR (which uses the values "flex" and "inline-flex" instead).

Furthermore: Having both EDisplay::InlineBox enum value and the InlineBox class
(in Source/core/layout/line/InlineBox.h) confuses the symbol lookup in gdb,
which causes a ~40 seconds freeze [1] when working on something that involves the
InlineBox class.

[1] For component builds with gdb_index set to true in gn

BUG=655961

Review-Url: https://codereview.chromium.org/2524903003
Cr-Commit-Position: refs/heads/master@{#434316}
mstensho
No need to force relayout of children when page logical height changes.
Also removed an ignored out-parameter hasSpecifiedPageLogicalHeight from
checkForPaginationLogicalHeightChange().

Review-Url: https://codereview.chromium.org/2509323005
Cr-Commit-Position: refs/heads/master@{#434290}
rune
Move MediaQueryEvaluator from StyleResolver to StyleEngine.
The plan is to move active stylesheet update and viewport/device-
dependent media query results from StyleResolver to StyleEngine which
means it makes sense to move the MediaQueryEvaluator there as well.
That means that the StyleResolver will temporarily ask the StyleEngine
for the evaluator when needed.

See https://codereview.chromium.org/1913833002/ for planned changes.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2521063005
Cr-Commit-Position: refs/heads/master@{#434144}
fs
Apply the font scale factor when generating stroke geometry for <text>
Because of the special font scale factor applied to <svg:text> to bring
it into a pseudo "host" transform, the stroke geometry would end up
being generated in/relative to the wrong coordinate space.
Apply the same scale to dash-related properties as was previously
applied to stroke-width.

BUG=667453
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2513343005
Cr-Commit-Position: refs/heads/master@{#434135}
mstensho
Make auto-scrollbar shrink-to-fit test more evil.
Be sure to have laid out before making style changes.

Review-Url: https://codereview.chromium.org/2521193002
Cr-Commit-Position: refs/heads/master@{#434128}
mstensho
invalidateColumnSets() doesn't need to mark anything for layout.
Review-Url: https://codereview.chromium.org/2522453003
Cr-Commit-Position: refs/heads/master@{#433952}
mstensho
Add test for line float that removes a tall unbreakable block child.
Review-Url: https://codereview.chromium.org/2521963002
Cr-Commit-Position: refs/heads/master@{#433910}
mstensho
Move stuff from layoutBlockFlow() into new method addOverhangingFloatsFromChildren().
+ some cleanup in the vicinity.

Review-Url: https://codereview.chromium.org/2515303003
Cr-Commit-Position: refs/heads/master@{#433886}
sigbjornf
Drop finalization for ElementShadows.
The empty destructor serves no purpose now, so let it go.

R=
BUG=

Review-Url: https://codereview.chromium.org/2485373003
Cr-Commit-Position: refs/heads/master@{#433844}
sigbjornf
XMLHttpRequest.abort(): follow spec wrt readyState transitions.
readyState is now only set to UNSENT if abort() is called on an object
with readyState in a DONE state.

R=tyoshino,yhirano
BUG=667294

Review-Url: https://codereview.chromium.org/2517173002
Cr-Commit-Position: refs/heads/master@{#433840}
sigbjornf
Enable precompiled headers for Blink on Windows.
One reason Blink is slow to compile is that there is a lot of code
included in every compilation unit. This is partly because everything
depends on either LayoutObject.h or Document.h and those in turn
include huge portions of the rest of Blink.

By precompiling LayoutObject.h and Document.h, the compilation of
core/ and modules/ in Blink can be considerably reduced;
some numbers:

@ r433149       config      build (mins)  size (Kb)
------------------------------------------------
master:         Debug       149:30        9410487
master:         Release     176:16        6118938

opera-pch[2]:   Debug       134:59        9337121
opera-pch[2]:   Release     160:42        6110812

opera-pch[3]:   Debug        93:06        8935714
opera-pch[3]:   Release     108:34        5029242

This for a clean build of target 'blink_tests', i.e., building
both chromium and blink parts. The gains are all local to Blink,
clearly. Host is an i7-3770 (4 phys cores); 32G + 256 SSD -
Win7 Pro.

The precompiled header file is judiciously (and forcefully) included
while compiling the core/ + web/ (and some of modules/) sources. Except
for some name disambiguation trivia when compiling the XPath grammar,
no source changes are needed to make this work out.

Note that distributed compilation system disables precompiled headers
globally so this will *not* make trybots faster. But many developers
don't have access to such super powers.

This already landed[1] in the gyp/VS2013 world some time ago but
unclear & unexplained bot failures caused a revert. Now with gn and
VS2015 the world should be a better place. This CL actually takes over
where [2] got stuck / ran out of time, extending its scope quite
considerably (i.e., 40 mins faster builds wrt the above pch numbers.)

[1] https://codereview.chromium.org/1167523007/
[2] https://codereview.chromium.org/2152783002/
[3] this CL.

Note sheriffs: should unexplained Windows build errors surface on the bots,
similar to the ones seen in crbug.com/511945, then please consider this CL a suspect.
This was with GYP and earlier MSVC toolchains; we have no reason to believe the problem
was fixed with GN and MSVC2015, we're just hoping for the best.

R=
BUG=495697
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2520863002
Cr-Commit-Position: refs/heads/master@{#433832}
fs
Repaint SVG subtree on viewport changes (resize)
When the (outermost) <svg> is sized using percentages, and an ancestor
changes size, the LayoutSVGRoot will be marked for layout (even though
the dimension/initial viewport changes.)
Since changed dimensions can imply a new scale factor (for instance from
interactions with a viewBox) or previously clipped content being
exposed, we need to issue paint invalidations for the entire SVG.

BUG=665912

Review-Url: https://codereview.chromium.org/2511353002
Cr-Commit-Position: refs/heads/master@{#433622}
sigbjornf
HashTable: bring per-table stats tracking back to life.
Recording per-hash table stats (DUMP_HASHTABLE_STATS_PER_TABLE)
broke with the introduction of Oilpan, as the feature depended
on finalizable HashTable<>s, something Oilpan heap hash tables
are not.

If the hash table resides on the Oilpan heap, arrange for the
stats object to also reside there.

While here, also unify the handling of global HashTable stats
recording and the per-table representation.

R=
BUG=

Review-Url: https://codereview.chromium.org/2511983003
Cr-Commit-Position: refs/heads/master@{#433494}
sigbjornf
DOMMatrix: add missing propagation of exceptions.
R=
BUG=659899,388780

Review-Url: https://codereview.chromium.org/2514453005
Cr-Commit-Position: refs/heads/master@{#433449}
mstensho
Force re-layout of a float when we just became unfragmented.
We need to re-lay out a float if we cease to be fragmented, in order to remove
any pagination struts that may previously have been set inside.

This is an addition to https://codereview.chromium.org/2454083002 , which fixed
something similar for regular in-flow blocks.

Review-Url: https://codereview.chromium.org/2512163002
Cr-Commit-Position: refs/heads/master@{#433221}
mstensho
If an object's containing block is in a flow thread, so is the object.
Remove harmful condition in LayoutState that the object not be out-of-flow.

Boring details:

In simplified layout of an absolutely positioned object inside a multicol
container we'd fail to realize that we were paginated, and therefore wouldn't
insert pagination struts. This was only problematic for simplified layout. In
normal non-simplified layout, we'd pass a non-zero page logical height to
LayoutState() when entering the flow thread, and, even if the LayoutState of
the absolutely positioned descendant would have no flow thread associated with
it, it would still become m_paginated, thanks to the non-zero page logical
height. Which was enough to get the machinery to insert struts.

BUG=589004

Review-Url: https://codereview.chromium.org/2516463003
Cr-Commit-Position: refs/heads/master@{#433220}
mstensho
Improve strut handling in initial column balancing pass.
Only use the pagination strut from the first object or line (in each parallel
flow [1]) that we find at a page break. When we need to break before some
content, we may end up setting the pagination strut on some ancestor of said
content, rather than on the content (layout object or line box). This happens
when there's no break opportunity (class A, B or C break point [2]) before the
content that doesn't fit in its current fragmentainer (there's no break
opportunity before the first line in a block, for instance). In such cases we
need to propagate the strut to some ancestor that comes after a valid break
opportunity. In such situations, there'll be severeal layout objects or line
boxes that start at the exact top of the next fragmentainer. Only the first
object in layout tree order will have the strut. Subsequent objects (children,
typically) or lines that also are flush with the top of the fragmentainer will
have a strut of 0. We shouldn't overwrite the actual strut with 0, or we risk
overstretching the columns. At each break we need to know the exact amount of
space that was "wasted" because of the break, and subtract it, in order to
calculate a minimal column height.

[1] https://www.w3.org/TR/css-break-3/#parallel-flows
[2] https://www.w3.org/TR/css-break-3/#possible-breaks

We also need to make sure that we associate breaks with the right column when
balancing, i.e. the former column, not the latter. This distinction matters if
the pagination strut is 0 and we're at the exact top/bottom of some column.

This CL also enables using specified column height even when balancing a
multicol container. It may be that the final column height will actually be the
same as the specified height, which means that if we set it right away, we
might be able to eliminate a subsequent layout pass [1]. Almost more importantly,
doing this will exercise code in the column balancer that was previously only
used when balancing inside nested multicol. This in turn means that it will
become less cumbersome to write tests for this code, and hopefully more
difficult for bugs to hide in there as well.

[1] LayoutTests/paint/invalidation/column-rules-fixed-height.html no longer
requires the contents of the multicol container to be relaid out when
column-rule changes.

Review-Url: https://codereview.chromium.org/2509813004
Cr-Commit-Position: refs/heads/master@{#433166}
sigbjornf
XMLHttpRequest: check if 'loadstart' handler cancelled send().
'loadstart' is dispatched to both 'download' and upload event handlers
while initiating a send() operation. Should those event handlers cause
the ongoing send operation to be aborted/stopped/cancelled, this outer
send() operation shouldn't proceed upon return.

R=yhirano
BUG=642242

Review-Url: https://codereview.chromium.org/2507773002
Cr-Commit-Position: refs/heads/master@{#433157}
mstensho
isPageLogicalHeightKnown() doesn't need a parameter.
If page logical height is (un)known, it's (un)known throughout the entire
fragmentation context, so location doesn't matter.

Review-Url: https://codereview.chromium.org/2514573002
Cr-Commit-Position: refs/heads/master@{#433145}
mstensho
Introduce adjustFloatLogicalTopForPagination(), to offload positionAndLayoutFloat().
Also renamed a variable from childBox to child in positionAndLayoutFloat().

BUG=663942

Review-Url: https://codereview.chromium.org/2513643002
Cr-Commit-Position: refs/heads/master@{#433143}
mstensho
Rename positionNewFloats() to placeNewFloats().
This will distinguish it better from the method named "positionAndLayoutFloat".

Also be explicit about the fact that we use the top margin edge when
positioning floats, as opposed to the top border edge, which is common for all
other object types. So "logicalTop" usually means the logical top of the border
edge. Therefore, use "logicalTopMarginEdge" for floats.

No behavioral changes, just cleanup.

BUG=663942

Review-Url: https://codereview.chromium.org/2505943003
Cr-Commit-Position: refs/heads/master@{#432895}
mstensho
Let lowestFloatLogicalBottom() take EClear instead of FloatingObject::Type
Review-Url: https://codereview.chromium.org/2505853004
Cr-Commit-Position: refs/heads/master@{#432801}
sigbjornf
DOMParser: handle use from contexts without an "active document".
Handle detached uses of parseFromString(), where there is no context
document to inherit the security origin from.

Relevant spec reference,

 https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring

R=
BUG=664399

Review-Url: https://codereview.chromium.org/2509813002
Cr-Commit-Position: refs/heads/master@{#432782}
rune
No forced active stylesheet recollect when pending sheets reach 0.
We forced a FullStyleUpdate which causes an active stylesheet update
for all tree scopes in the presence of placeholder style. What we need
to do for placeholder style is to trigger a full style recalc. For
instance, we don't need to update active stylesheets in shadow trees
if the last blocking resource that finishes loading is a document scope
stylesheet or import.

BUG=567021

Review-Url: https://codereview.chromium.org/2500923002
Cr-Commit-Position: refs/heads/master@{#432630}
mstensho
When placing a float, pay attention to its final logical top.
Subsequent floats may not be placed above this location.

BUG=665804

Review-Url: https://codereview.chromium.org/2504173002
Cr-Commit-Position: refs/heads/master@{#432503}
rune
Let querySelector(All) match (nth-)last with unclosed parent.
While parsing, we don't match :last*, :nth-last* etc until we finish
parsing children to avoid alternating between different computed styles
during loading. For querying selectors, however, we should. I couldn't
find this explicitly mentioned in w3c or whatwg specs for
querySelector(All), but Firefox and IE does this.

This could happen if you have:

<body>
  <p></p>
  <p></p>
  <script>document.querySelector("p:last-of-type")</script>
</body>

Adding expectations file for a wpt which now fails. The modifications
to the test has been upstreamed to the github repo. See PR [1].

[1] https://github.com/w3c/web-platform-tests/pull/4216

R=sashab@chromium.org
BUG=662036

Review-Url: https://codereview.chromium.org/2505543004
Cr-Commit-Position: refs/heads/master@{#432493}
hugoh
Add missing include of errno.h
This allows us to build the object file independently.

BUG=none

Review-Url: https://codereview.chromium.org/2501323002
Cr-Commit-Position: refs/heads/master@{#432459}
sigbjornf
Media element: avoid v8 allocations in hasPendingActivity().
Blink code is not allowed to allocate objects on the v8
heap while its GC calls out to hasPendingActivity();
re-entrancy is not supported.

Hence, disable 'officialPlaybackPosition' updates while
in hasPendingActivity(), as that will trigger v8
allocations by way of microtask allocations.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2498033002
Cr-Commit-Position: refs/heads/master@{#432453}
fs
Use an SVGElementProxy in ReferenceClipPathOperation
This transforms ReferenceClipPathOperation into using the SVGElementProxy
mechanism. Currently only for PaintLayer clients.

PaintLayerFilterInfo is generalized to PaintLayerResourceInfo and used as
the proxy/resource client for the 'clip-path' property. This enables change
notifications to flow back to the PaintLayer from the <clipPath> subtree.

The SVGElementProxySet is made a little bit generic by moving it to
SVGElementRareData, however it's still only made available for the few element
types that are used with it.

BUG=391604
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2484153003
Cr-Commit-Position: refs/heads/master@{#432193}
rune
Make updateStyleAndLayoutTree ready for async stylesheet update.
Introduce Document::updateActiveStyle() and corresponding
updateActiveStyle()/updateActiveStyleSheets() methods in StyleEngine to
prepare for doing active stylesheet updates as part of
updateStyleAndLayoutTree.

We move updateViewport() to updateActiveStyle() as the first step. This
is done by removing the synchronous calls to ViewportStyleResolver::
updateViewport() and instead schedule a layout tree update. In order to
trigger actual work to be done when the layout tree update happens, we
need to return true from Document::needsFullLayoutTreeUpdate() when we
need an active style update (for viewport atm).

BUG=567021

Review-Url: https://codereview.chromium.org/2484863003
Cr-Commit-Position: refs/heads/master@{#432182}
sigbjornf
Tidy up ScriptLoader (MIME) type matching.
MIME is case-insensitively handled within Blink, so remove some
unnecessary normalization of MIME type (and "language=") strings
in ScriptLoader.

R=
BUG=

Review-Url: https://codereview.chromium.org/2497873002
Cr-Commit-Position: refs/heads/master@{#432162}
sigbjornf
XMLHttpRequest: implement "send() flag" tracking and updating per spec.
The implementation has until now tracked/approximated the spec's
"send() flag"[1] by checking if the XMLHttpRequest object had an active
loader. That object does not have lifetime equal to what the spec
requires for the "send() flag", nor is the loader set for sync XHR
send()s.

There's no good reason to hold out on tracking this flag per spec,
so introduce it here.

[1] - https://xhr.spec.whatwg.org/#send-flag

R=yhirano
BUG=649516

Review-Url: https://codereview.chromium.org/2496933002
Cr-Commit-Position: refs/heads/master@{#432148}
sigbjornf
ContentSecurityPolicy: avoid defining static String singletons.
As CSP is used by multiple threads, we cannot define string literals
in terms of DEFINE_STATIC_LOCAL(). Follow what is done elsewhere
for ContentSecurityPolicy and resort to using plain string literals.

R=
BUG=

Review-Url: https://codereview.chromium.org/2497543003
Cr-Commit-Position: refs/heads/master@{#431956}
fs
Refactor CSS property mapping for SMIL Animation
Currently the SMIL code relies on 'attributeName' mapping 1:1 to the
CSS property name. This would not work with for instance with
'gradientTransform', which is supposed to map to the 'transform'
property.

To support this, store a CSS property id in SVGAnimatedTypeAnimator, and
use the CSS property id stored in SVGAnimatedProperty to populate it when
possible (using the current method in other cases.)

While doing this, also remove the stored 'context element' from
SVGAnimatedTypeAnimator, since it's only used in the reset(...) method,
and hence can simply be passed as an argument.

Also cleanup the uses of a CSSPropertyID in SVGAnimateElement (the sole
user of SVGAnimatedTypeAnimator) by using the stored CSS property id.

Make SVGAnimateElement::shouldApplyAnimation return bool, and use the
data from the SVGAnimatedTypeAnimator instead to determine which
animation code-path to use.

BUG=369942,641437

Review-Url: https://codereview.chromium.org/2496583002
Cr-Commit-Position: refs/heads/master@{#431862}
pmajewski
gn: Include source files outside the source root for Xcode workspace
This change unifies Xcode workspaces with projects for other IDEs.

BUG=n/a

Review-Url: https://codereview.chromium.org/2489673004
Cr-Commit-Position: refs/heads/master@{#431856}
sigbjornf
Remove Deque<>::findIf<>().
This function template is unused, and any future uses are
better served by using <algorithm>'s std::find_if().

R=
BUG=

Review-Url: https://codereview.chromium.org/2500763002
Cr-Commit-Position: refs/heads/master@{#431855}
sigbjornf
Internals.setValueForUser(): add argument type check.
R=tkent
BUG=642066

Review-Url: https://codereview.chromium.org/2500793002
Cr-Commit-Position: refs/heads/master@{#431845}
mstensho
InitialColumnHeightFinder needs to take all expected rows into account.
When a balanced multicol is nested inside another balanced multicol, it will
not be able to create any fragmentainer groups in the first layout pass, since
the height of the outer columns is still unknown.

We need to detect this situation, so that we don't limit the number of content
runs (content portions without explicit breaks) to the used value of
column-count. We are going to need ALL content runs, and group them into
imaginary rows, to figure out a minimal height of the entire inner multicol
container in the first balancing pass.

This will help set a better initial outer column height, and, more importantly,
set some sensible height on the inner multicol container right away, so that
we're not going to believe that it's super-short, which might prevent us from
marking it for re-layout when the outer coulmns have been sized.
childNeedsRelayoutForPagination() would simply fail to see that it's actually
going to cross outer column boundaries, and just bail.

We also treat tallestUnbreakableLogicalHeight() somewhat differently in such
situations. We require that the last "row" alone (rather than the entire
multicol container) be at least as tall as this.

Broke a newFragmentainerGroupsAllowed() out of
appendNewFragmentainerGroupIfNeeded(), since the column balancer code now also
needs to know when we're nested but are not allowed to create fragmentainer
groups.

Some, but not all, new tests used to fail before the code changes in this CL.
The passing ones are there to point out regressions that I nearly introduced
while working on this CL.

This is a patch in preparation for removing the relayoutChildren = true thing
in LayoutBlockFlow::layoutBlockFlow() when page logical height changes.

Review-Url: https://codereview.chromium.org/2493833004
Cr-Commit-Position: refs/heads/master@{#431844}
sigbjornf
Make FileReader.abort() (synchronously) follow the spec.
It is problematic to cancel a ThreadableLoader (by way of FileReaderLoader)
while it is on the stack, which is one of the steps involved when
abort()ing a reader (as part of the "terminate" step.) To avoid such
potential trouble, the loader termination is done asynchronously.

However, there's no good reason to delay performing the other (user
visible) abort() steps, so arrange for that to happen and align with
the spec & others.

R=jsbell
BUG=288349

Review-Url: https://codereview.chromium.org/2491363003
Cr-Commit-Position: refs/heads/master@{#431639}
rune
Match camelCased SVG attributes selectors in html documents.
Attribute names are stored lower-case in stylesheets in HTML documents.
SVG attribute names are normalized to the camelCase form in HTML
documents. That meant SVG attributes with camelCase like viewBox never
matched in HTML documents.

We had the same issue for camelCased element names in [1]. In that CL
we decided to allow insensitive matching for non-html elements in order
to avoid having to store the tag names twice in CSSSelector, even if
that is wrong according to the HTML spec. This CL does exactly the same
for attribute selectors.

[1] https://crrev.com/bab4aa7b9

R=sashab@chromium.org,esprehn@chromium.org
BUG=663798

Review-Url: https://codereview.chromium.org/2490393002
Cr-Commit-Position: refs/heads/master@{#431544}
sigbjornf
Support fetching attribute listeners from outside v8 context scopes.
A number of the <body> element's event handler attributes represent
and expose event handlers on the window object, hence the parser
will update & replace attribute event listeners while parsing the
attributes. This may well happen while executing outside any v8
context; adjust the lookup of attribute event listeners
to support such usage.

R=haraken
BUG=659911

Review-Url: https://codereview.chromium.org/2492793002
Cr-Commit-Position: refs/heads/master@{#431509}
rune
Skip independent inherited property propagation to pseudo elements.
UpdatePseudoElements and IndependentInherit conflict in the following
way. If we both have an independent inherit change on the actual dom
element, and we detect that we need to update the style for the pseudo
element we need to signal the inheritance propagation to the real dom
children and signal the pseudo element recalc to the pseudo element
children. If we return IndependentInherit, we lose the information
about the need for a pseudo element recalc, and if we return
UpdatePseudoElement, we lose the inheritance propagation for the actual
dom children.

We could introduce a new IndependentInheritAndUpdatePseudoElements, but
if there exists pseudo element, we would always return this constant,
so instead just force recalc on pseudo elements on IndependentInherit.

R=sashab@chromium.org
BUG=660735,660089,657283

Review-Url: https://codereview.chromium.org/2492783002
Cr-Commit-Position: refs/heads/master@{#431430}
mstensho
Split positionAndLayoutFloat() off positionNewFloats().
Float layout is somewhat broken when it comes to fragmentation (multicol,
printing). We're going to have to make sure that we always position the
float before laying it out, and, after layout, insert a break before it if
needed. This is a preparatory CL for that.

We currently lay out a float e.g. in insertFloatingObject() without
worrying about setting the position first.

No behavior changes intended.

BUG=663942

Review-Url: https://codereview.chromium.org/2486413002
Cr-Commit-Position: refs/heads/master@{#431422}
sigbjornf
IDBObserver does not need to be GC finalizable.
R=haraken
BUG=

Review-Url: https://codereview.chromium.org/2493713002
Cr-Commit-Position: refs/heads/master@{#431268}
fs
Reland of "Tracking reference filter mutation via SVGElementProxy"
This introduces SVGElementProxy - a new piece with the functionality of
DocumentResourceReference and the ReferenceFilterBuilder merged. It
provides the means to track clients of a certain element (only
SVGFilterElements for now, but will likely be extended to other types if
it ends up sticking.) An SVGElementProxy is created, and primarily
owned, by CSSURIValue. The proxy also handles loading of a resource
document, if requested.

Clients are SVGResourceClients, like before, with methods/callbacks
renamed. Some of the old functionality of SVGResourceClient has either
been moved to clients, to the proxy or been replaced with different
solutions.

Mutations to the element/subtree is signaled separately from any
potential changes to the actual reference (anything that might
invalidate the element reference.)

Fixed an issue from [1] where an observer would be removed too early if
there was several clients sharing it, causing crashes.

[1] https://codereview.chromium.org/2401343002

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2490163002
Cr-Commit-Position: refs/heads/master@{#431235}
fs
Store CSSPropertyID in SVGAnimatedPropertyBase
With an increasing amount of SVG attributes being "promoted" to
presentation attributes, it makes sense to try to keep the property
mapping with the other attribute related data.
To make room for these additional bits in SVGAnimatedPropertyBase, pack
some of its fields into a bitfield:

 * m_isReadOnly only needs a single bit.
 * m_type only need room for 21 different values, so 5 bits should
   suffice.

With this new field in place, plumb it through for SVG element
attributes, then, as a start, use the SVG property map to simplify the
implementations of isPresentationAttributeWithSVGDOM and
isPresentationAttribute.

This could also be used to provide storage for attribute initial values
in the future (crbug.com/225807.)

BUG=225807,369942

Review-Url: https://codereview.chromium.org/2485663002
Cr-Commit-Position: refs/heads/master@{#431229}
rune
Moved applyRuleSetChanges functions to StyleEngine.
A lot of the side effects were calls to StyleEngine, so moved the
method there instead. Also fixed the TODO for adding the call to make
CSSGlobalRuleSet dirty.

BUG=567021

Review-Url: https://codereview.chromium.org/2487653002
Cr-Commit-Position: refs/heads/master@{#431227}
mstensho
Let positionNewFloats() take a logicalTop parameter.
It seemed ugly to temporarily change the logical height before calling
positionNewFloats(), just to make the method behave.

Review-Url: https://codereview.chromium.org/2483023002
Cr-Commit-Position: refs/heads/master@{#431115}
tsniatowski
Fix a subtle proguard incremental build error
Prevent a confusing incremental build failure where proguard would
read and write to the same file accidentally, failing hard. Can
happen after switching the build from not using proguard, where the
output jar is a gn-copy hardlink to the input jar, to using proguard,
where the output is written to by a script reading from the input jar.

Fix by checking if the output is not a hardlink to the input in the
wrapper script.

NB. The build normally uses proguard on an apk, but makes it possible
to try and only proguard a single jar, and the bug potentially only
happens in this case.

Review-Url: https://codereview.chromium.org/2485663003
Cr-Commit-Position: refs/heads/master@{#430890}
mstensho
Before turning objects into spanners, check that they are not already spanners.
During style recalculation, we may end up in a situation where we think that we
go from a state where an object couldn't contain spanners, to being able to
contain them, while in reality, the object was able to contain spanners all
along.

This happens when changing the writing mode on the multicol container and all
objects in the parent chain between the spanner and the multicol container (and
there is nothing that prevents the descendant from being a spanner). The
problem is that when determining whether an object is a writing mode root, we
compare the object's writing mode to that of its parent. If they are different,
we decide that it's a writing mode root. However, if we're in styleWillChange()
for said object, and its writing mode is actually about to change to the same
value as that of the parent, there'll be no writing mode root in the end.
Still, we're going to think that we used to be a writing mode root (i.e. not be
able to contain spanners).

It would be possible to fix it for writing mode roots, to provide a reliable
implementation of isWritingModeRoot(), by using a bit in LayoutObject to
specify whether it's a writing mode root, rather than using current computed
style to determine that. Using computed style during style recalculation is
risky. That said, it's probably better to be fault-tolerant for such situations
in toggleSpannersInSubtree() instead, especially since may be other (unknown,
at the time being) scenarios where this situation may occur.

BUG=662754

Review-Url: https://codereview.chromium.org/2485173002
Cr-Commit-Position: refs/heads/master@{#430887}
rogerj
Build v8 snapshot with correct default float configuration on Linux ARM
V8 currently defaults to arm_float_abi="hard" and arm_use_neon=true but
the V8 snapshot defaults to arm_float_abi="softfp" and arm_use_neon=false
on Linux ARM builds.

This patch makes both targets default to hard + neon by changing the
"is simulator build" check from comparing current_cpu with v8_current_cpu
to comparing target_cpu with v8_target_cpu instead. Similarly to how it is
checked in v8/BUILD.gn.

BUG=662856

Review-Url: https://codereview.chromium.org/2483153004
Cr-Commit-Position: refs/heads/master@{#430776}
fs
Tracking reference filter mutation via SVGElementProxy
This introduces SVGElementProxy - a new piece with the functionality of
DocumentResourceReference and the ReferenceFilterBuilder merged. It
provides the means to track clients of a certain element (only
SVGFilterElements for now, but will likely be extended to other types if
it ends up sticking.) An SVGElementProxy is created, and primarily owned,
by CSSURIValue. The proxy also handles loading of a resource document, if
requested.

Clients are SVGResourceClients, like before, with methods/callbacks
renamed. Some of the old functionality of SVGResourceClient has either
been moved to clients, to the proxy or been replaced with different
solutions.

Mutations to the element/subtree is signaled separately from any
potential changes to the actual reference (anything that might invalidate
the element reference.)

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2401343002
Cr-Commit-Position: refs/heads/master@{#430550}
mstensho
There should never be unplaced floats from other blocks.
When positioning new floats in a block, all unplaced floats should belong to
said block. If we find unplaced floats from other blocks, someone somewhere
must have forgotten to place them on their own.

No need for code to skip such floats. DCHECK instead.

Review-Url: https://codereview.chromium.org/2479173002
Cr-Commit-Position: refs/heads/master@{#430544}
fs
Use range-based for in toCompositorTransformOperations
Avoids the awkward-looking indexing expressions. Make casted operations
const while at it.

Review-Url: https://codereview.chromium.org/2473013002
Cr-Commit-Position: refs/heads/master@{#430247}
rune
Don't use url from ImageResource for computed style.
ImageResource objects are shared between urls which only differ in
fragment identifier. The fragment identifier of the first requested url
is stored on ImageResource. That gave incorrect results when requesting
computed style values of backgroundImage for pseudo elements.

Use the url which is stored on StyleFetchedImage instead.

R=timloh@chromium.org
BUG=661998

Review-Url: https://codereview.chromium.org/2474093003
Cr-Commit-Position: refs/heads/master@{#430246}
mstensho
Don't include LayoutObject-derived headers where not needed.
Or, if a LayoutObject-derived header is still required, pick the most generic
one possible.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2474603002
Cr-Commit-Position: refs/heads/master@{#430165}
mstensho
Descendants may become or cease to be spanners when an ancestor changes style.
When building the tree, when inserting something that looks like a
column spanner, we first examine all the parents all the way up to the
multicol container, to make sure that they are all valid spanner
containers. This already works fine.

In our implementation, a valid column spanner container is, roughly, a
"regular" in-flow block. Among other things, it may not establish a
new block formatting context. Nor transforms. And a few other
things.

If the style of a valid column spanner container changes, it may end
up as no longer being a valid spanner container, and vice versa: an
invalid spanner container may become a valid spanner container, all of
a sudden.

Detect this during style change. If a block ceases to be a valid
spanner container, we need to check its subtree for spanners, and turn
them into regular column content. And, vice versa, if a block is
turned into a valid spanner container, we need to check its subtree
for column-span:all objects, which may have to be changed from regular
column content into spanners.

BUG=661761

Review-Url: https://codereview.chromium.org/2479873002
Cr-Commit-Position: refs/heads/master@{#430005}
rune
Link stylesheets in shadow trees do not belong to document scope.
We have incorrectly kept DCHECKs checking that stylesheets in shadow
trees come from style elements. That is no longer true, and modifying
link elements in shadow trees would trigger some of these DCHECKs.

Also, we simply used Document as the TreeScope handling link elements.
Always use the treeScope() from the associated node instead. Using the
wrong TreeScope in these cases would cause missing updates of active
stylesheets in ShadowTreeStyleSheetCollections for AnalyzedStyleUpdate.
I have not been able to find a triggering test case for this.

R=hayato@chromium.org,kochi@chromium.org
BUG=661914

Review-Url: https://codereview.chromium.org/2472973002
Cr-Commit-Position: refs/heads/master@{#429877}
tmoniuszko
Add missing web_contents.h include
BUG=

Review-Url: https://codereview.chromium.org/2473793002
Cr-Commit-Position: refs/heads/master@{#429853}
fs
Mark TranslateTransformOperation final
Nothing derives from it. This also allows devirtualization of the call
to apply() for the 'translate' (independent) property.

BUG=369942

Review-Url: https://codereview.chromium.org/2468303005
Cr-Commit-Position: refs/heads/master@{#429840}
rune
Remove ShadowRoot::numberOfStyles().
This probably used to be an optimization which made sense when we had
<style scoped> implemented. Now, it should be equally cheap to just
check the ScopedStyleResolver member. The ScopedStyleResolver is null
when there are no active stylesheets in the tree-scope.

This also caused issue 659596 because we only registered style elements
and not link elements, which lead the code to believe there were no
rules to match from the scope when there were only link stylesheets
present.

R=kochi@chromium.org,hayato@chromium.org
BUG=659596

Review-Url: https://codereview.chromium.org/2472613004
Cr-Commit-Position: refs/heads/master@{#429824}
mstensho
Properly avoid breaking inside a float's top margin.
We used to depend on stumbling upon unbreakable content (such as lines) at
column boundaries for this to work, but we failed in the really simple cases
(where there was no content at all, for instance).

Move the logic for this to float-specific code, so that we don't have to be
aware of it at several other locations in the code.

Doing this correctly during layout also helps the balancer find the right
column height. Added a test for something that used to fail in this area.

Review-Url: https://codereview.chromium.org/2479483002
Cr-Commit-Position: refs/heads/master@{#429641}
mstensho
Don't let a column spanner affect the self-margin-collapsing state of the parent.
When a spanner is removed from the tree, we mark the container chain for
layout, just like we do when removing any other kind of object. The container
of a spanner is the multicol container, though, so the direct parent of the
spanner may not be marked for layout. And that should not be necessary either,
since the spanner is essentially taken out of normal flow.

We get some marking for layout for free in layoutBlockFlow(), if
pageLogicalHeightChanged, but that only goes one level deep. Eliminate the need
for layout in situations like this.

Prior to this change, we'd fail on an assert that required that the cached
state of self-collapsing be in sync with reality.

Review-Url: https://codereview.chromium.org/2473953003
Cr-Commit-Position: refs/heads/master@{#429638}
mstensho
logicalHeightWithVisibleOverflow() needs to include overhanging floats.
Otherwise we might end up skipping layout of blocks that contain floats
that really need to be relaid out.

We get some marking for layout for free in layoutBlockFlow(), if
pageLogicalHeightChanged, but that only goes one level deep.

Review-Url: https://codereview.chromium.org/2474883002
Cr-Commit-Position: refs/heads/master@{#429611}
fs
Tidy up ComputedStyle::applyTransform
Use range-based for-loops when iterating transform operations (also in
ComputedStyle::requireTransformOrigin), since it's both tidier and
avoids unnecessary index-checks (in operator[].)
Move computation of offsetX/offsetY closer to their point of usage.
Extract the size of the bounding box once, and also drop some unneeded
qualifications of enumeration values.

BUG=369942

Review-Url: https://codereview.chromium.org/2474043002
Cr-Commit-Position: refs/heads/master@{#429598}
karlo
Make offsetTop/Left handle a relative positioned inline offsetParent correctly.
offsetTop and offsetLeft happily ignored the fact that offsetParent could
be a relative positioned inline.

I used the opportunity to change some variable names in
LayoutBoxModelObject::adjustedPositionRelativeTo() in order to hopefully
make it clearer what's going on.

BUG=638184

Review-Url: https://codereview.chromium.org/2414683002
Cr-Commit-Position: refs/heads/master@{#429571}
tsniatowski
Fix a bunch of generated file build flakes in //extensions
Several files in //extensions could randomly fail to build due to
missing dependencies on header generator targets, mostly mojo
and grit. Add the dependencies so builds are not flaky.

BUG=655123

Review-Url: https://codereview.chromium.org/2452943003
Cr-Commit-Position: refs/heads/master@{#429543}
karlo
adjustedPositionRelativeTo() couldn't find offsetParent.
LayoutBoxModelObject::adjustedPositionRelativeTo() could get confused
by inline continuations, and could fail if offsetParent itself was a split
continuation.  If the child belongs to the second part of the continuation,
we'll instead race to the root of the tree.  By comparing with the node instead,
we correctly identify the offsetParent and stop the search.

BUG=638187

Review-Url: https://codereview.chromium.org/2454693003
Cr-Commit-Position: refs/heads/master@{#429541}
fs
Simplify SVG pending resource (re)validation
The contents of the m_pendingResourcesForRemoval map has a lifespan that
does not extend beyond the scope of SVGElement's
buildPendingResourcesIfNeeded() method.
So instead of passing through the map in SVGDocumentExtensions, just
take the corresponding set for the pending 'id' and iterate that
directly, avoiding indirection and complicated removal sequence.
This also allow SVGDocumentExtensions::removeElementFromPendingResources
to be simplified, so do that, and then remove the
m_pendingResourcesForRemoval map from SVGDocumentExtensions.

BUG=661598

Review-Url: https://codereview.chromium.org/2473483004
Cr-Commit-Position: refs/heads/master@{#429539}
mstensho
Remove pageLogicalHeightChanged() from LayoutState.
It was only used from insertFloatingObject(), and in a bogus manner at that.
Added a TODO instead. We haven't even positioned the float at this point, so
attempting layout for pagination here is essentially bad.

We make sure to relayout correctly for pagination when we get to
positionNewFloats() later, anyway.

Review-Url: https://codereview.chromium.org/2467353003
Cr-Commit-Position: refs/heads/master@{#429533}
mstensho
Reland of Improve how the column balancer handles top margins on floats. (patchset #1 id:1 of https://codereview.chromium.org/2468193002/ )
Reason for revert:
csspaint/invalidation-background-image.html was also failing (flaky) before landing this CL.

Original issue's description:
> Revert of Improve how the column balancer handles top margins on floats. (patchset #3 id:40001 of https://codereview.chromium.org/2465363003/ )
>
> Reason for revert:
> Speculative revert to fix csspaint/invalidation-background-image.html failure on "WebKit Win7 (dbg)" bot.
>
> Failed build:
> https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win7%20%28dbg%29/builds/7961
>
> Original issue's description:
> > Improve how the column balancer handles top margins on floats.
> >
> > Float margins do not collapse with column boundaries, so we should make room
> > for them after the break, if the border box of the float starts in the next
> > column.
> >
> > Let the balancer work on the margin box of the float (and the border box for
> > all other objects). For floats, we want to insert breaks before the
> > margin-before edge, not the border-before edge. This lets us remove
> > some special-code for unbreakable floats in InitialColumnHeightFinder, which
> > was the only place that previously bothered about this.
> >
> > Changed how we determine which objects to process. We used to include the
> > overflow both before and after the border box, but we really don't have to
> > bother with content preceding it, since that shouldn't undergo fragmentation
> > anyway.
> >
> > Discovered (one test regressed) that logicalHeightIncludingOverflow() also
> > included clipped overflow, which certainly wasn't the intention. This didn't
> > make much of a difference as long as the method was only called to check if we
> > could skip re-layout. But now we also use it to determine the column height.
> > Fixed it to only include visible overflow and renamed it to
> > logicalHeightWithVisibleOverflow().
> >
> > Committed: https://crrev.com/7c82da727f64121aa34aa1decf82452c37ef7a2d
> > Cr-Commit-Position: refs/heads/master@{#429245}
>
> TBR=eae@chromium.org,mstensho@opera.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://crrev.com/58f81484437d367285de9f0fc1fdd4034eb5c333
> Cr-Commit-Position: refs/heads/master@{#429265}

TBR=eae@chromium.org,rouslan@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2471933002
Cr-Commit-Position: refs/heads/master@{#429415}
mstensho
Move LayerHitTestRects to a separate file.
This way, ScrollingCoordinator.h doesn't need to include LayoutObject.h
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2468073002
Cr-Commit-Position: refs/heads/master@{#429311}
mstensho
Move MapCoordinatesMode and MapCoordinatesFlags to a separate header.
This way, LayoutGeometryMap.h doesn't need to include LayoutObject.h

Review-Url: https://codereview.chromium.org/2472573002
Cr-Commit-Position: refs/heads/master@{#429294}
mstensho
Improve how the column balancer handles top margins on floats.
Float margins do not collapse with column boundaries, so we should make room
for them after the break, if the border box of the float starts in the next
column.

Let the balancer work on the margin box of the float (and the border box for
all other objects). For floats, we want to insert breaks before the
margin-before edge, not the border-before edge. This lets us remove
some special-code for unbreakable floats in InitialColumnHeightFinder, which
was the only place that previously bothered about this.

Changed how we determine which objects to process. We used to include the
overflow both before and after the border box, but we really don't have to
bother with content preceding it, since that shouldn't undergo fragmentation
anyway.

Discovered (one test regressed) that logicalHeightIncludingOverflow() also
included clipped overflow, which certainly wasn't the intention. This didn't
make much of a difference as long as the method was only called to check if we
could skip re-layout. But now we also use it to determine the column height.
Fixed it to only include visible overflow and renamed it to
logicalHeightWithVisibleOverflow().

Review-Url: https://codereview.chromium.org/2465363003
Cr-Commit-Position: refs/heads/master@{#429245}
rune
Make siblingRules and uncommonAttributeRules private.
These vectors only need to be modified inside the RuleFeatureSet class.
Added methods for const access.

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2469143002
Cr-Commit-Position: refs/heads/master@{#429220}
mstensho
Don't always have to relayout a child when fragmentainer height is unknown.
Fragmentainer height is unknown in the first multicol layout pass, before
the initial balancing attempt. It also happens when we have to restart the
column balancing algorithm (due to dynamic content change, containing block
logical width change, etc.). In this case we only need to relayout if the child
did previously break (because then there may be pagination stuts inside that we
need to clear).

Review-Url: https://codereview.chromium.org/2473433002
Cr-Commit-Position: refs/heads/master@{#429135}
mstensho
Avoid unnecessary relayout of floats when not paginated.
Made a mistake when excluding floats from being considered for pagination
relayout skipping, by ALWAYS marking them for layout, EVEN WHEN NOT PAGINATED.
Make sure that we check that we're paginated first. No need to slow down layout
when not paginated.

Broke the logic for determining whether we need layout or not into a separate
method, so that we don't need a quarter of a dozen calls to
setChildNeedsLayout(). The logic is now reversed; rather than checking if we
don't need layout, we check if we DO need layout. Tried to make the code a bit
clearer, and document what goes on at each step.

Review-Url: https://codereview.chromium.org/2459293004
Cr-Commit-Position: refs/heads/master@{#429051}
rune
Reduce CSSStyleSheet size by moving bool member.
Grouping bool members together saved 8 bytes from 120 to 112 on 64 bit
Linux.

Also started using class initializers, removed unnecessary nullptr
initialization of Member<>, and a 0 -> nullptr.

R=mstensho@opera.com

Review-Url: https://codereview.chromium.org/2469693002
Cr-Commit-Position: refs/heads/master@{#428977}
fs
Rewrite css3/filters/effect-reference-delete.html
Make sure we get a layout+paint before removing the <svg> (w/ descendant
filter) so that we test a proper transition.

Review-Url: https://codereview.chromium.org/2453403002
Cr-Commit-Position: refs/heads/master@{#428706}
fs
Make sure to always reset the cached filter in ReferenceFilterOperation
BUG=658305
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2453033004
Cr-Commit-Position: refs/heads/master@{#428678}
mstensho
Be more restrictive about forcing relayout of children for pagination.
Avoid full subtree re-layouts that could especially occur in tables. This could
slow down printing and multicol by a lot.

This change makes PerformanceTests/Layout/multicol/deeply-nested-tables.html
about 1300 times faster (from 5.1 runs/s to 6813 runs/s when tested
locally). The test in bug 487026 will now show print preview instantly, rather
than taking a couple of minutes to finish.

Store the amount of space used (including the trailing strut) before the first
break (if any) instead of the offset from the top of the first fragmentainer.
We'll use this information in markChildForPaginationRelayoutIfNeeded() to
determine if we really need to force re-layout of some child. We really only
need to force re-layout of a child if there's a chance that it needs to
recalculate its pagination struts. It won't need to recalculate anything if we
know that there were no fragmentainer breaks AND that there won't be any if
we re-lay out. Even if there ARE fragmentainer breaks in there, we can still
skip layout if we know that the breaks will remain at the exact same locations
relative to the child. Store this information after layout by calling
updateFragmentationInfoForChild(). We need to include the overflow portion
after the bottom border edge of the child, since overflow also gets fragmented.

The old implementation of markChildForPaginationRelayoutIfNeeded() re-laid out
everything as long as LayoutState's pageLogicalHeightChanged() was true.
However, this flag is only set when entering layout of some fragmentation
context. Some objects, such as tables, requires multi-pass layout. If the flag
was true the first time the object was laid out, it's going to be true in all
subsequent re-layouts as well, potentially resulting in numerous deep layouts.

BUG=487026

Review-Url: https://codereview.chromium.org/2462643002
Cr-Commit-Position: refs/heads/master@{#428626}
tsniatowski
Add missing generator dependencies in content/renderer/mus
Building //content/renderer/mus could fail due to transitive
dependencies on header generators pulled in via render_frame_impl.h
and render_thread_impl.h (building render_widget_mus_connection.cc
or compositor_mus_connection.cc could fail).

Unfortunately //content/renderer deps on //content/renderer/mus,
so there's no easy way to get these deps for free (cyclic dep).

BUG=655123

Review-Url: https://codereview.chromium.org/2461643002
Cr-Commit-Position: refs/heads/master@{#428428}
tsniatowski
Add a //chrome/common dep to //chrome/browser/devtools
Devtools include chrome/common headers which include the generated
features header, so without the dep the build is flaky.

BUG=655123

Review-Url: https://codereview.chromium.org/2454943004
Cr-Commit-Position: refs/heads/master@{#428413}
rune
Move Document global rule data to CSSGlobalRuleSet.
This CL is split out from [1] with some modifications.

Instead of storing these data in the StyleResolver, create a new class
to store them in StyleEngine instead. See the design document linked
from issue 401359 which talks about moving this content off of
StyleResolver. Also made a note that we should further try to contain
as much of this data as possible per TreeScope to avoid the need for
constantly having to update these meta data for shadow tree
modifications.

We get rid of some of the duplicate storing of some of these features.
See what was previously set on StyleEngine (resetCSSFeatureFlags()).

This is also in preparation for async stylesheet update (issue 567021).
There are few places where we synchronously update this new rule set
directly after marking it as dirty which will happen later when all
parts of [1] lands.

Another synchronous update we will be able to remove later is making
the RuleFeatureSet up-to-date when scheduling style invalidations
(marked as TODOs for sync calls to ensureResolver()). The need for
these calls is supported by the added invalidation tests which would
otherwise fail.

[1] https://codereview.chromium.org/1913833002/

BUG=401359,567021

Review-Url: https://codereview.chromium.org/2451893003
Cr-Commit-Position: refs/heads/master@{#428327}
rune
Missing document null pointer check in Internals.
updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks did not check
if the document was null before using it.

R=nainar@chromium.org
BUG=657443

Review-Url: https://codereview.chromium.org/2461633002
Cr-Commit-Position: refs/heads/master@{#428312}
rune
Use StyleEngine::resetAuthorStyle instead of clearScopedStyleResolver.
The former will make sure the shadow root is removed from
treeBoundaryCrossingScopes appropriately.

This code is not in production yet, so there were no observable bug.

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2456753003
Cr-Commit-Position: refs/heads/master@{#428275}
mstensho
Provide a dedicated getter for the offset to a repeatable THEAD.
pageLogicalOffset() is otherwise only used as an optimization during layout,
and the way we're optimizing for fragmenting is soon going to change.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2455733003
Cr-Commit-Position: refs/heads/master@{#428203}
mstensho
Don't establish LayoutState for LayoutTableRow objects.
Table rows are not the containing block of anything. The real containing block
of a table cell is their table section, not the table row.

With this change, we no longer need to pass the object's location to
LayoutState(). Just call locationOffset() on the object in the constructor
instead, rather than doing it at all call sites.

Review-Url: https://codereview.chromium.org/2458823002
Cr-Commit-Position: refs/heads/master@{#428190}
mstensho
Need to remove line pagination struts when no longer fragmented.
We only used to recalculate pagination struts on lines when we were inside a
fragmentation context, but if said fragmentation context ceases to be one, we
need one final strut recalculation pass, to get rid of them all.

BUG=658019

Review-Url: https://codereview.chromium.org/2460673002
Cr-Commit-Position: refs/heads/master@{#428161}
mstensho
Add a couple of regression tests for float fragmentation.
These tests change the fragmentainer heights, so that the float will fit in the
first fragmentainer afterwards, rather than in the second one.

Review-Url: https://codereview.chromium.org/2445193007
Cr-Commit-Position: refs/heads/master@{#428160}
mstensho
Need a deep layout pass when becoming (un)fragmented.
When an object ceases to be fragmented (e.g. when leaving print preview), there
may be pagination struts that need to be removed. Therefore, we need to lay out
all descendants of a block that ceased to establish a fragmentation context.

Similarly, when becoming fragmented (e.g. when entering print preview), we need
to go through every descendant. There may both be implicit and forced breaks to
insert.

BUG=658019

Review-Url: https://codereview.chromium.org/2454083002
Cr-Commit-Position: refs/heads/master@{#428062}
mstensho
Allow pagination struts to push objects below the exact top of the next column.
The top margin of a float may push its border box below the top of the next
column.

Similarly, a repeated table header may do the same to the first row in the next
column, to make room for itself above it.

The column balancer had assertions to boom at such situations, but it's pretty
clear now that it's an unreasonable requirements that sturts take us to the
exact top of the next column.

Added visual tests that crashed before (in debug). No behavioral changes here,
apart from the fact that the tests no longer crash.

Review-Url: https://codereview.chromium.org/2456003002
Cr-Commit-Position: refs/heads/master@{#428047}
rune
Removed unused StyleEngine::didRemoveShadowRoot().
Also tried to figure out and document why we are clearing
ScopedStyleResolvers for shadow trees in clearResolver().

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2454903002
Cr-Commit-Position: refs/heads/master@{#427950}
rune
Removed unnecessary rule feature reset when no ScopedStyleResolver.
Resetting rule features when a shadow tree did not contain any
stylesheets, and hence didn't have a ScopedStyleResolver, caused a
performance regression in the select-single-remove performance test.

UA shadow trees typically don't have any stylesheets.

This is a regression from [1].

[1] https://codereview.chromium.org/2443933002

R=meade@chromium.org
BUG=659535
TEST=PerformanceTests/DOM/select-single-remove.html

Review-Url: https://codereview.chromium.org/2452733004
Cr-Commit-Position: refs/heads/master@{#427949}
mstensho
LayoutState doesn't need to store both layout and pagination offset.
We only ever used those two in combination to figure out how far away we were
from the start of the pagination context. So, let's just store that directly instead.
This allows us to clean up quite a bit. Also changed LayoutState() to do more
early returns, when we have no more work left to do.

Also consolidated two sections that disabled pagination for unsupported content
(one for SVG and one for other unbreakable content).

Review-Url: https://codereview.chromium.org/2444193009
Cr-Commit-Position: refs/heads/master@{#427945}
rune
Clear m_treeBoundaryCrossingScopes when reconstructing StyleResolver.
When m_treeBoundaryCrossingScopes were part of StyleResolver, they were
cleared when the StyleResolver was cleared. Now that they outlive the
StyleResolver, they need to be cleared separately.

R=meade@chromium.org
BUG=659653

Review-Url: https://codereview.chromium.org/2450353002
Cr-Commit-Position: refs/heads/master@{#427912}
tsniatowski
Fix a large number of missing dependencies in the blink gn build
Make all blink_core_sources targets public_dep on all the code
generators in core to ensure required headers are always generated first
and a successful build does not depend on lucky ordering. Manually fix
similar dep issues in core/inspector.

There are now more dependencies than strictly necessary, but they will
only trigger the generators with no effect on build commands (tested by
checking that the patch doesn't trigger a rebuild of any c++ code).

The end result is that the total number of targets that don't have proper
deps in the 'chrome' target build goes down from over 1800 to about 40,
and no missing dependencies on gen/blink files exist.

BUG=655123
R=dpranke@chromium.org

Review-Url: https://codereview.chromium.org/2452473004
Cr-Commit-Position: refs/heads/master@{#427856}
mstensho
The column balancer needs to look inside inlines.
There may be floats there.

Split traverseSubtree() into traverseLines() and traverseChildren(), so that
traverseChildren() can easily be called directly when at inlines.

BUG=586956

Review-Url: https://codereview.chromium.org/2453743002
Cr-Commit-Position: refs/heads/master@{#427724}
tsniatowski
Fix some mojo dependencies in blink
Several places in blink were using mojo headers without a dependency on
mojo targets that generate said headers, causing build flakiness.

BUG=655123

Review-Url: https://codereview.chromium.org/2453653003
Cr-Commit-Position: refs/heads/master@{#427659}
mstensho
No longer mark two tests in ietestcenter/css3/multicolumn as failing.
They pass now, probably because of the fix for bug 291616.

BUG=396940

Review-Url: https://codereview.chromium.org/2446023003
Cr-Commit-Position: refs/heads/master@{#427370}
wdzierzanowski
Call willInsertBody() in MediaDocument::createDocumentStructure()
Follow up on https://codereview.chromium.org/1343493002 and add the same
willInsertBody() call that ImageDocument has.

Review-Url: https://codereview.chromium.org/2427563002
Cr-Commit-Position: refs/heads/master@{#427312}
wonko
Don't assume python is in /usr/bin in js_minify.py
BUG=658218

Review-Url: https://codereview.chromium.org/2438293002
Cr-Commit-Position: refs/heads/master@{#427304}
jb
Deal with canceled requests when flushing deferred messages.
Flushing deferred messages might lead to a request being canceled
(e.g. when an ImageResource loads a corrupt image). The code didn't
fully take this into account which would cause crashes (and resource
leaks if it would have survived).

BUG=

Review-Url: https://codereview.chromium.org/2425173003
Cr-Commit-Position: refs/heads/master@{#427298}
rune
Move TreeBoundaryCrossingScopes to StyleEngine.
This is split out of the work for async stylesheet updates [1], but is
also part of the work on componentized style resolving in general.

The moved resetAuthorStyle method on StyleEngine may soon be gone
altogether as it does so in [1].

The plan is that TreeBoundaryCrossingScopes will also be completely
gone when we remove support for Shadow DOM v0. For Shadow DOM v1 we can
look up the scoped resolvers for the affecting scopes directly like we
already do in StyleResolver::matchScopedRules for the pure v1 case.

The documentation of the special casing of VTT and custom pseudo
elements is updated to not suggest that these rules are handled as part
of boundary crossing scopes as the current solution is better once v0
shadows go away.

[1] https://codereview.chromium.org/1913833002

R=meade@chromium.org
BUG=567021,401359

Review-Url: https://codereview.chromium.org/2443933002
Cr-Commit-Position: refs/heads/master@{#427284}
fs
Fix more null-checks in SVGLengthContext::convertValueFrom*
The following methods in SVGLengthContext:

 convertValueFromUserUnitsToCHS
 convertValueFromUserUnitsToEXS
 convertValueFromEXSToUserUnits

needs the same treatment as convertValueFromCHSToUserUnits got in
https://chromiumcodereview.appspot.com/2445463002.

R=pdr@chromium.org,eae@chromium.org
BUG=657438,658585,658613

Review-Url: https://codereview.chromium.org/2449433002
Cr-Commit-Position: refs/heads/master@{#427080}
mstensho
Remove unused hasPendingResourceUpdate bit from LayoutObject.
Also recounted, updated and corrected total bit count.

Review-Url: https://codereview.chromium.org/2442283002
Cr-Commit-Position: refs/heads/master@{#427050}
rune
Rename collectTreeBoundaryCrossingRules.
Include V0Cascade order to reflect that this is the legacy code for
Shadow DOM V0 cascading order in pure V0 documents.

R=kochi@chromium.org

Review-Url: https://codereview.chromium.org/2445673002
Cr-Commit-Position: refs/heads/master@{#427042}
fs
Use a converter for building style value for 'transform'
Also change TransformBuilder::createTransformOperations to return the
TransformOperations rather than use an out argument.

Review-Url: https://codereview.chromium.org/2435413002
Cr-Commit-Position: refs/heads/master@{#427036}
fs
Avoid copying value in ComputedStyle CoW comparions (compareEqual)
Because of the cast of the RHS, |u|, a copy would be generated, with
code and cycle bloat as the result. In some cases this can even have
prevented inlining. Particularly nasty examples:

 bool compareEqual(const Vector<LengthPoint>&, const Vector<LengthPoint>&) [210 bytes]
 bool compareEqual(const Vector<CSSPropertyID>&, const Vector<CSSPropertyID>&) [274 bytes]
 bool compareEqual(const Vector<GridTrackSize>&, const Vector<GridTrackSize>&) [182 bytes]
 bool compareEqual(const HashMap<String, GridArea>&, const HashMap<String, GridArea>&) [308 bytes]
 bool compareEqual(const TransformOperations&, const TransformOperations&) [441 bytes]
 bool compareEqual(const LengthBox&, const LengthBox&) [249 bytes]

Remove the U->T cast in compareEqual to avoid the copies. Nothing seems
to require this coercion (anymore?) This eliminates the above symbols
entirely. A total binary size reduction of >30k (x86-64; non-official) also
indicates even the simpler cases/types may have benefited.

Review-Url: https://chromiumcodereview.appspot.com/2438353002
Cr-Commit-Position: refs/heads/master@{#426990}
rune
Always evaluate media features to true without MediaValues.
Having a constructor taking bool made it possible to construct a
MediaQueryEvaluator passing a pointer to an object of an arbitrary
type as the pointer was converted to a bool without a warning.

By closer inspection, the use of the m_expectedResult value had two
purposes. One was to return true for matching media type ignoring the
rest of the media query. The other cases were for testing purposes
where there was no media rules to match, so the result didn't matter.

Since there are no useful applications for returning false for media
queries containing expressions in addition to type, we can safely
return true for all query expression when no MediaValues object is
present.

There is one place we change the behavior. The StyleResolver
constructor has a fallback evaluator when we have no FrameView. That
should never happen, though, and it would yield incorrect results
regardless of whether we would always return true or false for media
query expressions.

R=timloh@chromium.org,meade@chromium.org

Review-Url: https://chromiumcodereview.appspot.com/2432153005
Cr-Commit-Position: refs/heads/master@{#426752}
jb
Fix NULL pointer dereference in FinishedAsyncCopyRequest()
Due to undefined (favorably right to left) argument evaluation order,
the tracker might have been passed and set to NULL before the window
is looked up which results in a NULL pointer dereference.

BUG=

Review-Url: https://chromiumcodereview.appspot.com/2435033002
Cr-Commit-Position: refs/heads/master@{#426748}
rune
MediaValuesInitialViewport passed to MediaQueryEvaluator as bool.
The test coverage for [1] was not good enough. We tried to pass a
MediaValues pointer into the MediaQueryEvaluator constructor, but since
none of the constructors took such a type, it was converted into a bool
for which there was a constructor.

I'm planning to change the bool parameter to an enum in a follow-up CL
to avoid such mistakes in the future.

[1] https://codereview.chromium.org/2414343002/

R=timloh@chromium.org
BUG=332763

Review-Url: https://chromiumcodereview.appspot.com/2430923005
Cr-Commit-Position: refs/heads/master@{#426747}
mstensho
Pay attention to tall rowspanned cells in the first layout pass.
If a rowspanned cell gets fragmented, and this cell needs to stretch the table
rows in order to fit, only stretch the last row (i.e. the one we're currently
laying out). That's the only thing we can do if we don't want mess up
fragmentation (pagination struts) of earlier content.

Furthermore, to leave those rows completely alone, don't let a subsequent
rowspanned cell that shares at least one row with the previous rowspanned cell
stretch those rows, either, as that would lead to unfair height distribution
anyway (since the last row has already got all the extra space).
table-overlapping-rowspan.html tests this.

BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2433403002
Cr-Commit-Position: refs/heads/master@{#426590}
mstensho
Clean up LayoutTableSection::calcRowLogicalHeight() a bit.
Since nobody apparently wants to deal with a rowspanned cell unless we're at
its first row, just skip that cell for subsequent rows, instead of having
checks for this everywhere.

Also removed a debug hashmap that was just used to assert that we didn't add
duplicate cells to a vector. Check the vector directly instead.

Review-Url: https://chromiumcodereview.appspot.com/2434033003
Cr-Commit-Position: refs/heads/master@{#426555}
mstensho
Remove last-minute row height stretching for pagination.
This code no longer has any effect, since we now fragment and set the correct
row heights way BEFORE cell alignment and flexing. It was also buggy, in that
it didn't recalculate intrinsic padding after resizing the row.

BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2433413002
Cr-Commit-Position: refs/heads/master@{#426512}
mstensho
Performance test for deeply nested tables inside multicol.
This is similar to printing deeply nested tables, and we have serious
performance issues with this.

Landing the performance test separately from the actual fix, so that we can
observe the improvement when the fix eventually lands.

BUG=487026

Review-Url: https://chromiumcodereview.appspot.com/1695193006
Cr-Commit-Position: refs/heads/master@{#426461}
mstensho
Specified row height should be applied during initial section layout.
BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2434543004
Cr-Commit-Position: refs/heads/master@{#426441}
mstensho
Remove first-line-in-cell strut subtraction workaround.
This is no longer needed. In fact, it was causing some trouble.

BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2438613004
Cr-Commit-Position: refs/heads/master@{#426435}
fs
Simplify SVGAnimated* initialization
In several cases, all initial values are the same, so callers of
SVGAnimated<TYPE>::create can be relieved of the duty of calling
SVG<TYPE>::create() explicitly.

This affects:

  SVGAnimatedBoolean,
  SVGAnimatedNumberList,
  SVGAnimatedPreserveAspectRatio,
  SVGAnimatedString and
  SVGAnimatedTransformList

These should hopefully also all reset to the correct value when
encountering an invalid (string) value.

BUG=225807

Review-Url: https://chromiumcodereview.appspot.com/2436793002
Cr-Commit-Position: refs/heads/master@{#426429}
rune
Collect @viewport before constructing RuleSets.
- Move ViewportStyleResolver to StyleEngine.

- Only create a ViewportStyleResolver for top level documents.

- Collect @viewport rules via the DocumentStyleSheetCollection.

- Use the initial viewport size for resolving viewport relative
  lengths.

- Introduce initialViewportChanged() and viewportRulesChanged() in
  StyleEngine to trigger re-collection and resolution of the actual
  viewport. These currently trigger an immediate call to updateViewport
  which will later be a part of the document lifecycle phase for
  updating active stylesheets.

This finally fixes issues 332763, 455136, and 463098.

R=timloh@chromium.org
BUG=567021,463098,455136,332763

Review-Url: https://chromiumcodereview.appspot.com/2420413005
Cr-Commit-Position: refs/heads/master@{#426427}
rune
Initial viewport is not the same as FrameView rect.
FrameView rect is also changed by the visual viewport.

Set the initial viewport size on FrameView whenever it changes in
WebViewImpl and use it for matching media queries when collecting
@viewport rules. See [2] for spec reference.

This is fixing what was introduced in [1].

[1] https://codereview.chromium.org/2414343002/
[2] https://www.w3.org/TR/css-device-adapt-1/#media-queries

R=bokan@chromium.org,timloh@chromium.org
BUG=332763

Review-Url: https://chromiumcodereview.appspot.com/2431613002
Cr-Commit-Position: refs/heads/master@{#426424}
mstensho
Move table row pagination strut insertion to the first layout pass.
Pagination struts are inserted before a table row, when we should avoid
breaking inside it, and it doesn't fit as a whole in its current fragmentainer.
We should avoid breaking inside rows when their break-inside is "avoid", or
when there are repeating table headers (which turns on break-inside:avoid for
all rows in the table).

This CL also includes the code that deals with repeating headers, since it
proved hard to separate it from the rest.

We need to make sure to subtract the struts from previous rows' height now;
just like we don't include border spacing in the rows, we should also omit the
pagination strut of the next row. In order to be consistent about this,
layoutRows() in LayoutTableSection now uses the rows' logical heighs more
extensively than before (rather than using the m_rowPos array to calculate
heights). This has an implication for rowspanned cells. We now need to wait
until we are at their last row before processing them, since we calculate row
heights on the fly. There's a small fix here. Previously, the strut wasn't
baked into the logical top of a table row, unlike all other layout objects.
This resulted in wrong offsets for table rows after fragmentainer breaks,
but the cells in there still had correct offsets, so it wasn't possible
to observe this bug in any visual test. It does affect a couple of
dump-render-tree printing tests, though. Added a couple of tests for this
on my own, which use offsetTop and offsetHeight.

table-disable-fragmentation.html is just a regression test. We need to be
careful to ignore struts when not fragmented. It passed before and it passes
now, but I nearly broke it while working on this.

BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2433473002
Cr-Commit-Position: refs/heads/master@{#426265}
mstensho
Clean up break-inside restriction propagation from table headers.
If a table header has break-inside:avoid, our implementation currently
propagates that to all table rows in the table. Make this more obvious (and
consistent) with a getPaginationBreakability() override in LayoutTableRow,
rather than checking it at only one place (paginationStrutForRow()), although
that may very well have been the only place that needed to care.

No behavioral changes expected.

Review-Url: https://chromiumcodereview.appspot.com/2426553004
Cr-Commit-Position: refs/heads/master@{#426020}
mstensho
Set logical top and height of table rows and cells in the first layout pass.
This gives the fragmentation machinery an opportunity to insert breaks at the
right places. We previously assumed that all cells were at the top of their
table section, so break insertion was completely bogus. While we'd get a second
chance to break correctly in the second layout pass, this doesn't always work
too well. There's currently some code in layoutRows() in LayoutTableSection
that attempts to adjust the row height when we change where we break inside a
table cell, but it doesn't re-align cells vertically after this adjustment.
That code must die, and this CL is a preparatory step.

BUG=534751

Review-Url: https://chromiumcodereview.appspot.com/2423403002
Cr-Commit-Position: refs/heads/master@{#426015}
rune
Removed unused includes from Internals.cpp.
R=mstensho@opera.com

Review-Url: https://codereview.chromium.org/2428543004
Cr-Commit-Position: refs/heads/master@{#425945}
rune
Implement collection of @viewport rules from DocumentStyleCollection.
The @viewport rules will be recollected and re-resolved from a new
updateViewport() method. Rule will need to be re-collected when
stylesheets are added, or when media queries change. Re-resolution
needs to happen when the viewport descriptors contain vh/vw units, or
after a re-collection of rules.

Store the viewport and device dependent mq results on the
ViewportStyleResolver as these may be different from the results
collected when constructing the rulesets because of the initial/actual
viewport difference. The device dependent will not be different, but
nested media queries may cause some media queries to be skipped for
ruleset construction which would not be skipped for @viewport rule
collection.

We also change the existing code to lazily reset() in preparation for
the re-collect/re-resolve distinction.

R=timloh@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2424823002
Cr-Commit-Position: refs/heads/master@{#425942}
mstensho
Separate method for calculating logical height based on CSS properties.
Move it out of LayoutTable::layout(), since that method is more than crowded
enough as it is.

Had to make convertStyleLogicalHeightToComputedHeight() a const method, since I
decided to make the new method const. Constified
convertStyleLogicalWidthToComputedWidth() as well, for the sake of consistency.

Review-Url: https://codereview.chromium.org/2422103003
Cr-Commit-Position: refs/heads/master@{#425757}
mstensho
Disable row stretching for tables crossing fragmentainer boundaries.
Edge also does this.

Allowing rows to be stretched and thus moved after fragmentation would require
us to re-fragment (since the fragmentainer boundaries would be elsewhere, due
to row stretching), then re-stretch, the re-re-fragment, and so on (cyclic
dependencies).

BUG=534751

Review-Url: https://codereview.chromium.org/2421133002
Cr-Commit-Position: refs/heads/master@{#425705}
tmoniuszko
Add missing exclusive_access_manager.h includes
BUG=

Review-Url: https://codereview.chromium.org/2424773002
Cr-Commit-Position: refs/heads/master@{#425670}
rune
Spell-checking and proof-reading WhitespaceLayoutObjects.md.
R=nainar@chromium.org,bugsnash@chromium.org

Review-Url: https://codereview.chromium.org/2423963002
Cr-Commit-Position: refs/heads/master@{#425663}
rune
Removed incorrect comment about raw pointer.
LocalFrame now traced as Member of MediaValuesDynamic.

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2417973002
Cr-Commit-Position: refs/heads/master@{#425629}
rune
Implement MediaValues for initial viewport.
Viewport-dependent media queries evaluate in the context of the initial
viewport when collecting @viewport rules as specified in [1]. Implement
a MediaValuesInitialViewport which returns the initial viewport
dimensions instead of the actual viewport. This change doesn't fix
issue 332763 until we start collecting author @viewport rules before
creating RuleSets.

[1] https://www.w3.org/TR/css-device-adapt-1/#media-queries

R=timloh@chromium.org
BUG=332763

Review-Url: https://codereview.chromium.org/2414343002
Cr-Commit-Position: refs/heads/master@{#425628}
mstensho
Lay out table children in visual order, and set position and size.
Set caption and section positions before the first layout pass, and set the
logical height right after. This will help the fragmentation code break at the
right places.

By doing it in visual order right away we can also get rid of some code that
dealt with sections being moved after layout.

BUG=534751

Review-Url: https://codereview.chromium.org/2421613002
Cr-Commit-Position: refs/heads/master@{#425425}
mstensho
Correctly check if we have a valid page height before checking remaining space.
LayoutState::pageLogicalHeight() is bogus, and the sooner we convince it to
take a long walk on the short pier, the better. :(

Additionally, bail out earlier from fragmentation-specific code. No need to
waste time on calling crossesPageBoundary() when not fragmented.

BUG=655911

Review-Url: https://codereview.chromium.org/2413413003
Cr-Commit-Position: refs/heads/master@{#425420}
rune
Simpler viewportAndroid.css setup for WebFrameTests.
Enable use of viewportAndroid.css by setting WebViewportStyle::Mobile
instead of explicitly parsing the sheet as part of the tests.

Also corrected some typos.

R=bokan@chromium.org

Review-Url: https://codereview.chromium.org/2423463002
Cr-Commit-Position: refs/heads/master@{#425355}
fs
Clean up SVGViewSpec::parseViewSpecInternal
Make this function slightly more readable by partitioning it as:
  1) Parse outer function ("svgView")
  2) For all functions:
  2.1) Match/parse "function name"
  2.2) Parse arguments to said function

This gets rid of a lot of the parameter list boilerplate that every case
shares. (I.e handling '(' and ')'.)

Also change to use skipExactly and skipUntil from ParsingUtilities.h.

Review-Url: https://codereview.chromium.org/2421863002
Cr-Commit-Position: refs/heads/master@{#425315}
rune
Don't generate RuleSets for viewport UA sheets.
Start collecting UA @viewport rules from the StyleSheetContents instead
of the RuleSet. The reason is that we need to collect viewport rules
before creating the RuleSet in order to use the correct actual viewport
for evaluating media queries. This is split out from [1].

Also introducing a separate MediaQueryEvaluator in the
ViewportStyleResolver which should eventually be based on the initial
viewport and not the actual viewport as described in the CSS Device
Adaptation spec.

[1] https://codereview.chromium.org/2405143003

R=timloh@chromium.org
BUG=463098

Review-Url: https://codereview.chromium.org/2410283005
Cr-Commit-Position: refs/heads/master@{#425284}
rune
Add hasViewportRule() flag to StyleSheetContents.
This is a pre-requisite for collecting viewport rules before generating
the RuleSet. The RuleSet contents depends on media query evaluation,
which in turn depends on viewport size resolution, which means we are
currently may generate the RuleSet, and recalculate style, twice in the
presence of both @media and @viewport.

This CL is split out from [1] which in turn is split out from [2].

[1] https://codereview.chromium.org/2405143003/
[2] https://codereview.chromium.org/1913833002/

R=timloh@chromium.org
BUG=463098

Review-Url: https://codereview.chromium.org/2408353003
Cr-Commit-Position: refs/heads/master@{#425273}
karlo
Support margin-top for legend in fieldset.
The implementation aligns with Edge, Gecko centers the legend+margins, which
looks undesirable to me.  The specs say nothing about this.

The new behaviour causes two tests to change, both have been rebaselined. One
was additionally modified to not trigger the scrollbar, which in turn would
render differently on various platforms.

BUG=554077
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2396813002
Cr-Commit-Position: refs/heads/master@{#425127}
mstensho
Top-align table cells in rows that cross fragmentainer boundaries.
Ignore whatever vertical-align says and force everything to be top aligned in
those cases. Edge also behaves like this.

Doing both fragmentation and vertical alignment for table parts could cause
unresolvable situations (cyclic dependencies).

Two tests that depended on vertical alignment working under such circumstances
are now invalid, and were therefore removed.

BUG=534751

Review-Url: https://codereview.chromium.org/2412923002
Cr-Commit-Position: refs/heads/master@{#425112}
jb
Make HarfBuzzFace release SimpleFontData.
HarfBuzzFace did a retained look up of SimpleFontData from the
FontDataCache but never released the SimpleFontData. This caused the
SimpleFontData to remain in the cache, indefinitely holding on to
SkFontFaces and all associated data. This fix makes HarfBuzzFace
release the SimpleFontData when deleted.

BUG=617568

Review-Url: https://codereview.chromium.org/2411643002
Cr-Commit-Position: refs/heads/master@{#424993}
mostynb
Add the Ahem font license
Review-Url: https://codereview.chromium.org/2397303003
Cr-Commit-Position: refs/heads/master@{#424769}
rune
documentStyleSheetCollection() is always non-null.
Return a reference instead of a pointer to make that clear.

R=meade@chromium.org

Review-Url: https://codereview.chromium.org/2405793002
Cr-Commit-Position: refs/heads/master@{#424706}
fs
Push hasValidAttributeName/Type down into SVGAnimateElement
Introduce a new "validator" method for SVGSMILElements - hasValidTarget.
With this new method in place, the hasValidAttributeType and
hasValidAttributeName methods can be pushed down the hierarchy to where
they belong, namely SVGAnimateElement.
As a bonus, some conditions and assertions can be simplified.

BUG=641437

Review-Url: https://codereview.chromium.org/2408913002
Cr-Commit-Position: refs/heads/master@{#424389}
fs
Consolidate FilterOperation and FilterEffect mapRect implementations
The FilterOperations and FilterEffects for drop-shadow and gaussian blur
has very similar but slightly different implementations.
Restructure the code a bit so that the entire thing can be shared/reused
between the two different code-paths. The new canonical location is the
corresponding FilterEffect (FEGaussianBlur and FEDropShadow.)

Review-Url: https://codereview.chromium.org/2393993004
Cr-Commit-Position: refs/heads/master@{#424263}
davve
Remove davve@ from OWNERS files
Recently I haven't had, and don't expect to get, much time to
contribute to Blink.

NOTRY=true
BUG=none

Review-Url: https://codereview.chromium.org/2406823002
Cr-Commit-Position: refs/heads/master@{#424130}
rune
Document LayoutObject generation for whitespace nodes.
R=eae@chromium.org,esprehn@chromium.org,mstensho@opera.com

Review-Url: https://codereview.chromium.org/2402653002
Cr-Commit-Position: refs/heads/master@{#423947}
mstensho
Don't break before a first in-flow block container.
There's no break opportunity there, but break-inside:avoid used to trick us
into inserting a break there anyway in some cases.

As part of this work, we need allowsPaginationStrut() to check better if a
strut is allowed, or it might just end up getting eaten and forgotten about by
a first in-flow block further up in the tree. This matters for monolithic
content [1], such as lines and image blocks. We should never break inside
those, so allow breaking before them, even if they are the first piece of
content inside some block (just like we did before this change).
break-before-first-line-in-first-child.html and image-block-as-first-child.html
test that we don't regress in this regard.

Also removed a FIXME about checking for sufficient height. This would be
incorrect to fix. If there's no break point here, we have to propagate the
strut, if we're allowed to.

Had to update some tests, and even rename one, because they relied on the old
buggy behavior.

[1] https://drafts.csswg.org/css-break-3/#possible-breaks

BUG=653690

Review-Url: https://codereview.chromium.org/2400083003
Cr-Commit-Position: refs/heads/master@{#423926}
mstensho
A forced break inside a break-inside:avoid object may make it fit where it is.
If an object with break-inside:avoid is taller than what fits in the current
fragmentainer, but it has a forced break before we get to the end of the
fragmentainer, we don't have to push the object to the next one, since what's
before the forced break fits fine where it is.

BUG=533736

Review-Url: https://codereview.chromium.org/2401753002
Cr-Commit-Position: refs/heads/master@{#423884}
fs
Move isTargetAttributeCSSProperty to SVGAnimateElement
SVGAnimateElement is the only user. Move it and make it a free function.

BUG=641437

Review-Url: https://codereview.chromium.org/2395793004
Cr-Commit-Position: refs/heads/master@{#423817}
rune
Apply RuleSet changes for active stylesheet changes.
Introduce an applyRuleSetChanges method which will take the old and new
ActiveStyleSheetVector use the existing comparison method and apply the
RuleSet diff to invalidate style for the document.

The normal mode for style rules is to schedule RuleSet invalidations
which will decide what to recalculate based on the invalidation sets.
Universal selectors, the presence of Shadow DOM v0 combinators, or
@font-face rules for the document scope, will cause a subtree recalc
for the TreeScope.

@keyframes rules utilizes the existing functionality for invalidating
style in the TreeScope and the host TreeScope for running and
unresolved animations.

This CL introduces appendActiveStyleSheets which will eventually
replace the combination of the lazy appending of sheets in
StyleResolver and appending pending sheets into the ScopedStyleResolver
through appendCSSStyleSheet.

This CL is split out of https://codereview.chromium.org/1913833002 and
re-worked a bit.

The functionality is not yet in use.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2394353003
Cr-Commit-Position: refs/heads/master@{#423810}
rune
Allow active sheets to have nullptr for RuleSet.
CSSStyleSheets which have a non-matching media attribute may have a
nullptr for RuleSet since it's not needed. Handle that in active style-
sheet diffing. That means adding a sheet with non-matching media should
not cause any style recalculations.

R=meade@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2401573002
Cr-Commit-Position: refs/heads/master@{#423804}
rune
Skip reflowed comments css/parser for git-blame.
R=thakis@chromium.org
BUG=563793

Review-Url: https://codereview.chromium.org/2396433006
Cr-Commit-Position: refs/heads/master@{#423712}
fs
Adjust some includes around SVGResourceClient and FilterOperation
Also drop an unused include of ReferenceFilterBuilder.h.

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2400663002
Cr-Commit-Position: refs/heads/master@{#423708}
mstensho
Store physical location in LayoutTableRow, just like in all other objects.
BUG=652496

Review-Url: https://codereview.chromium.org/2399633002
Cr-Commit-Position: refs/heads/master@{#423701}
ckulakowski
Add missing dependencies to extensions BUILD.gns
Some files from guest_view include (not directly) file
extensions/common/api/events.h which is generated by target
//extensions/common/api. This dependency is missing and
sometimes it causes compilation errors. Build will fail if
no target which depends on //extensions/common/api is built
before guest_view. It happens quite rarely: it failed once
on ~10 rebuilds on my mac.

BUG=

Review-Url: https://codereview.chromium.org/2402453002
Cr-Commit-Position: refs/heads/master@{#423613}
rune
Skip reflowed comments css/invalidation for git-blame.
R=meade@chromium.org
BUG=563793

Review-Url: https://codereview.chromium.org/2393393002
Cr-Commit-Position: refs/heads/master@{#423503}
rune
Reflow comments in core/css/parser
R=timloh@chromium.org
BUG=563793

Review-Url: https://codereview.chromium.org/2398013002
Cr-Commit-Position: refs/heads/master@{#423482}
fs
Move handling of 'attributeType' to SVGAnimateElement
Another animation property that applies only to the SVGAnimateElement
part/subtree of the element hierarchy. Move it down for continued
"unlocking" of the structure.

BUG=641437

Review-Url: https://codereview.chromium.org/2391993006
Cr-Commit-Position: refs/heads/master@{#423467}
rune
Reflow comments in core/css/invalidation.
R=meade@chromium.org
BUG=563793

Review-Url: https://codereview.chromium.org/2398833004
Cr-Commit-Position: refs/heads/master@{#423441}
mstensho
Move table cell height flexing into a separate method.
TableSection::layoutRows() is long enough as it is. :)

Review-Url: https://codereview.chromium.org/2392353002
Cr-Commit-Position: refs/heads/master@{#423248}
fs
Move shouldApplyAnimation to SVGAnimateElement
Only used by SVGAnimateElement.

BUG=641437

Review-Url: https://codereview.chromium.org/2394583002
Cr-Commit-Position: refs/heads/master@{#422935}
fs
Hoist target element null-checks out of SVGAnimateElement::calculate*
The calculateFromAndToValues, calculateFromAndByValues and
calculateDistance share a common entrypoint (startedActiveInterval), so
we can tighten this code-path a bit checking for a target element up
front. (No target element makes for pretty useless animations anyway...)
calculateAnimatedValue gets similar treatment in its updateAnimation
(sole) entrypoint.

Also refill comments to 80 columns in SVGAnimateMotionElement.cpp.

BUG=641437

Review-Url: https://codereview.chromium.org/2386013002
Cr-Commit-Position: refs/heads/master@{#422484}
fs
Push animation value 'inherit' handling into SVGAnimateElement
Handling of 'inherit' doesn't need to live on SVGAnimationElement,
because only SVGAnimateElement makes use of it. Move it down the
class structure and simplify.

Also refill/wrap comments in the files touched to 80 columns.

BUG=641437

Review-Url: https://codereview.chromium.org/2384013002
Cr-Commit-Position: refs/heads/master@{#422446}
mostynb
remove obsolete(?) git attributes from old top-level WebKit settings
It is a little surprising (for automated scripts, mostly) for files to
be export-ignore'd from subdirectories.  This patch removes some old WebKit
export-ignore attributes that I suspect are no longer useful.

This was the original patch that added the attributes, I have not been able
to locate details of the review or why it was originally required:
https://chromium.googlesource.com/chromium/src.git/+/20706fd0c00d214a264439277e0bc8e90ccba203

Review-Url: https://codereview.chromium.org/2387033002
Cr-Commit-Position: refs/heads/master@{#422412}
mharanczyk
Add WebRange test for explicit empty ranges creation.
This is followup of https://codereview.chromium.org/2373613005/.

Review-Url: https://codereview.chromium.org/2385643002
Cr-Commit-Position: refs/heads/master@{#422405}
mstensho
Use ceil() when integerizing pagination struts before table rows.
Subpixel rendering is not supported in table parts, so everything needs to be
integers. However, instead of rounding the pagination strut down to the nearest
integer, round it up. This way we at least make sure that we manage to push all
the content over to the designated fragmentainer, rather than leaving one tiny
strip behind in the previous fragmentainer. There'll still be off-by-one
errors, but at least all the content is in the right fragmentainer.

Updated some tests to not use subpixel multicol heights, since what they
required cannot really be satisfied without adding full subpixel support to
tables.

Also added a new test that *does* use subpixel multicol height. This test
merely makes sure that nothing is left behind in the previous fragmentainer at
breaks, without worrying about the exact top position of the objects.

This problem was discovered while working on bug 487026, which is about
reducing the amount of forced re-layouts that we do for fragmentation, and it
turns out that table layout in general, and perhaps strut calculation there in
particular, tends to need more layout passes it explicitly asks for (so it
depends on other parts of the system dealing out layout passes for free). Added
body { overflow:hidden; } declarations to some tests, to reduce the number of
layout passes you get for free, i.e. make the tests more evil.

BUG=487026

Review-Url: https://codereview.chromium.org/2382043003
Cr-Commit-Position: refs/heads/master@{#422312}
fs
Fold bits of SVGAnimatedTypeAnimator into SVGAnimateElement
This folds non-property-construction methods from
SVGAnimatedTypeAnimator into SVGAnimateElement and gets rid of simple
forwarding methods. This leaves SVGAnimatedTypeAnimator as a property-
value factory.

BUG=641437

Review-Url: https://codereview.chromium.org/2387513002
Cr-Commit-Position: refs/heads/master@{#422188}
fs
Don't allow form-feed (U+000C) as a WebVTT signature separator
Per the WebVTT parser algorithm [1], only space, tab or newline (after
normalization) are allowed to follow the "WEBVTT" signature.

[1] https://w3c.github.io/webvtt/#webvtt-parser-algorithm

BUG=651777

Review-Url: https://codereview.chromium.org/2382173002
Cr-Commit-Position: refs/heads/master@{#422093}
fs
Don't use absolute bounding boxes in LayoutVTTCue
LayoutVTTCue was using absoluteContentBox()/absoluteBoundingBoxRect()
during overlap resolution. This would mean that boxes were computed
relative to the containing frame. The former also doesn't take
transforms into account, which would mean that the basic overlap check
against the title area would fail if a transform was present.

Instead compute the various bounding boxes relative to a common
ancestor, namely the text track container (which is also the containing
block of the cues.) Adjust the controls rect similarly to get it into the
same coordinate space.

BUG=647253

Review-Url: https://codereview.chromium.org/2377193003
Cr-Commit-Position: refs/heads/master@{#422072}
mstensho
Introduce markChildForPaginationRelayoutIfNeeded().
No behavioral changes intended.

This replaces markForPaginationRelayoutIfNeeded(). Since the method was always
called when it was the container that was being laid out, this is more
"correct", and in the same spirit as e.g.
updateBlockChildDirtyBitsBeforeLayout(), adjustBlockChildForPagination(), and
so on.

This is a preparatory patch to allow for calling
offsetFromLogicalTopOfFirstPage(), which uses LayoutState more heavily.
When using LayoutState, you generally need to be laying out the very same
object as the one LayoutState points to.

BUG=487026

Review-Url: https://codereview.chromium.org/2382733002
Cr-Commit-Position: refs/heads/master@{#421815}
fs
Move FilterOperation*.{cpp,h} to core/style/
Move the FilterOperation(s) structures to core/style to make them a
"style type". This is in preparation for an improved mechanism for
signaling mutations to "reference" filters.

This is essentially a pure move, with only minor modifications to fix
some presubmit issues and to facilitate (fix) building.
(ASSERT -> DCHECK; PLATFORM_EXPORT -> CORE_EXPORT)

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2375453002
Cr-Commit-Position: refs/heads/master@{#421796}
rune
Avoid creating consecutive whitespace renderers.
In textLayoutObjectIsNeeded(), return false if we are a whitespace-only
text node, and our previous LayoutObject sibling is a whitespace
renderer. This avoids for instance creating a consecutive list of
whitespace renderers when we have multiple display:none sibling
elements.

This change makes [1] take ~900ms instead of ~2600ms on my computer.

[1] https://bugs.chromium.org/p/chromium/issues/attachmentText?aid=8037

BUG=399816

Review-Url: https://codereview.chromium.org/2369963005
Cr-Commit-Position: refs/heads/master@{#421794}
rune
Adding @keyframes rules only affects TreeScope plus host.
@keyframes rules may apply to animations in the same TreeScope as the
rule and the host element if the TreeScope is a shadow tree. Instead of
invalidating all keyframe animations or recalculating every element in
the document, limit such changes to the relevant TreeScopes.

Currently, this doesn't have an effect since analyzed style update only
happens in the document TreeScope, but that will change with RuleSet
invalidation for crbug.com/567021

R=alancutter@chromium.org,suzyh@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2361733004
Cr-Commit-Position: refs/heads/master@{#421781}
mstensho
Support for multiple block fragments in getClientRects().
Objects crossing column boundaries, for instance, should create one rectangle
for each column they live in.

Two old tests had to be updated, because they depended on the old and incorrect
behavior (pick the bigger / center column and create one huge rectangle there).

Add fragmentainerInFlowThread() to FragmentainerIterator. Removed the
updateOutput() thing. Instead, have the getters compute what they need on the
fly. This makes more sense now, since none of the (2) FragmentainerIterator
users need to calculate everything. Also don't require a clip rectangle.

Some extra attention is required when processing objects with a zero-height
bounding box now. Previously, we didn't need to worry about those, since no
bounding box means no painting, hit-testing, etc. But now, with
getBoundingClientRect(), life is different.

BUG=362232

Review-Url: https://codereview.chromium.org/2360913004
Cr-Commit-Position: refs/heads/master@{#421643}
fs
Add use counters for SVGCursorElement
This adds one counter for presence of an SVGCursorElement, and one for
if any ComputedStyle references the element (==the SVGCursorElement has
a client.)

BUG=650598

Review-Url: https://codereview.chromium.org/2376613004
Cr-Commit-Position: refs/heads/master@{#421630}
rune
Speculative fix for SelectorFilter crash.
It looks from the crash log that the string impl() is nullptr. Found no
possible way for a null string to be added to the SpaceSplitString, but
let's add a null check to see if it helps.

R=eae@chromium.org,timloh@chromium.org
BUG=646026

Review-Url: https://codereview.chromium.org/2376703002
Cr-Commit-Position: refs/heads/master@{#421492}
mharanczyk
Update DCHECK in WebRange constructor.
Currently creating empty range (0,0) triggers it, judging by
the comment it was intende to check null range only.

Review-Url: https://codereview.chromium.org/2373613005
Cr-Commit-Position: refs/heads/master@{#421252}
tmoniuszko
Reland of Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest
Reverted in
https://codereview.chromium.org/2349253002

Reason for revert:
Tests are failing on Mac ASAN builder. See details here:
https://uberchromegw.corp.google.com/i/chromium.memory/builders/Mac%20ASan%2064%20Tests%20(1)

BUG=633136

Review-Url: https://codereview.chromium.org/2353333002
Cr-Commit-Position: refs/heads/master@{#421191}
rchlodnicki
Fix GDI leak in NativeThemeWin::PaintIndirect
There was a GDI leak when hovering input elements. Reaching 10000 GDI objects
would cause process to crash.

Fixed by deleting HBITMAP that was selected onto the HDC. Deleting HDC does not
take care of that.

The skia utility function was removed and replaced with a custom scoped object
at call site as it was used only in one place and making it safe to use for
others would be a bit tricky as bitmap needs to be deleted before HDC and there
is no easy access to the bitmap after utility function returns HDC.

R=pkasting@chromium.org,fmalita@chromium.org,tomhudson@google.com

BUG=649712

Review-Url: https://codereview.chromium.org/2365903002
Cr-Commit-Position: refs/heads/master@{#421142}
rune
Missing sibling invalidation across removed element.
When removing B from siblings A B C, we scheduled invalidations for
features of A requiring two adjacent combinators to schedule an
invalidation at all. That is fine for rules already affecting C, but
for rules kicking in after B is removed, a single combinator is enough.
For instance ".a + .c".

R=ericwilligers@chromium.org
BUG=647780

Review-Url: https://codereview.chromium.org/2362463004
Cr-Commit-Position: refs/heads/master@{#421124}
fs
Make SVGAnimatedBoolean.h less popular
SVGAnimatedBoolean is only used by/for SVGFEConvolveMatrix, but was
being included in a lot of places. Remove the unnecessary includes of
SVGAnimatedBoolean.h, and also remove some other obvious unnecessary
includes in the vicinity.

Review-Url: https://codereview.chromium.org/2371593002
Cr-Commit-Position: refs/heads/master@{#420993}
fs
Reduce includes of some SVG*TearOff types
SVG*TearOff types are only of real interest to the bindings, so don't
need to be included in something that isn't direclty interacting with
bindings. Shuffle declarations and definitions to reduce the impact of
SVGPointTearOff and SVGRectTearOff.

Review-Url: https://codereview.chromium.org/2361973003
Cr-Commit-Position: refs/heads/master@{#420920}
fs
Move buildFilterOperations to FilterEffectBuilder
This puts all FilterOperations conversions (to FilterEffect and
CompositorFilterOperations) in one spot - FilterEffectBuilder.
This allows folding the functionality of resolveReferenceFilters into
FilterEffectBuilder, and hence get rid of the explicit extra step to
update the "cached" Filter chain in ReferenceFilterOperation.

This is one step on the way to turning FilterOperations into a core
style type, to allow for more straight-forward interaction with other
parts of the style system.

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2357633003
Cr-Commit-Position: refs/heads/master@{#420844}
mostynb
unbreak builds with webrtc disabled
https://codereview.chromium.org/2123863004 broke non-webrtc non-android
builds.  Let's fix that.

BUG=487935

Review-Url: https://codereview.chromium.org/2370583002
Cr-Commit-Position: refs/heads/master@{#420832}
fs
Make SVG*StringList and SVGStringListTearOff scarcer
(Primarily) because of their inclusion in the SVGTests interface, these
two make their way into a lot more compilation units than has use for
them. The principal access to this data is the SVGTests::isValid()
method, so only the actual bindings should need any deeper insight into
these. Shuffle declarations and definitions to make their inclusion more
scarce. (From ~194 -> ~13 total dependencies for the latter, based on
"ninja -t deps".)

Review-Url: https://codereview.chromium.org/2360383003
Cr-Commit-Position: refs/heads/master@{#420614}
fs
Fold DisplayItem creation into paintFilteredContent in SVGFilterPainter
Brings uses of any form of "filter bounds" closer together.
Rename |filterRegion| and |boundaries| to |filterBounds|.

BUG=109224
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2367463002
Cr-Commit-Position: refs/heads/master@{#420397}
fs
Fix effect mapping computation for displacement-map w/ negative scale
When scale is negative, the displacement will be in the opposite
direction. Hence we need to only use the magnitude of the scale when
computing the effect of the filter.

BUG=641854

Review-Url: https://codereview.chromium.org/2359133003
Cr-Commit-Position: refs/heads/master@{#420396}
mstensho
Content that starts before the first fragmentainer should stay where it is.
It should not undergo pagination, but rather remain in the underflow area of
the first fragmentainer. There's no reason to pull everything into the content
area of the first fragmentainer.

BUG=591694

Review-Url: https://codereview.chromium.org/2360253002
Cr-Commit-Position: refs/heads/master@{#420353}
rune
Document* -> Document& for loadSubimages and friends.
Document* should never be nullptr in these places. Also made them const
and propagated the const-ness where necessary.

R=sashab@chromium.org

Review-Url: https://codereview.chromium.org/2352193004
Cr-Commit-Position: refs/heads/master@{#420319}
fs
Harmonize FilterEffect::mapRect and mapPaintRect
This CL terminates the FilterEffect::determineAbsolutePaintRect codepath,
replacing the last user (SVGFilterPainter) with mapRect().
A new structure for FilterEffect::mapRect is introduced (taking some
hints from the SkImageFilter implementation), where mapRect is the entry-
point (replacing mapRectRecursive), which in turn calls: 1) mapInputs,
2) mapEffect and 3) applyBounds. The last simply applies any clip bounds
set on the effect, while also adjusting for affectsTransparentPixels().
mapInputs() computes the contribution from inputs to the current effect,
while mapEffect() applies the contribution from the current effect
itself. The notion of forward/reverse is not retained since only forward
mapping is used.

BUG=642035, 640264, 611674, 600430
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2341923002
Cr-Commit-Position: refs/heads/master@{#420293}
fs
Remove SVGSVGElement dependency from SVGTransformListTearOff
Rather than having the latter depend on the former for code-sharing,
have them both depend on the underlying primitive (SVGTransformTearOff.)

Review-Url: https://codereview.chromium.org/2360083002
Cr-Commit-Position: refs/heads/master@{#420278}
rune
Implemented scoped invalidation for added/removed RuleSets.
Async stylesheet update will schedule invalidation sets based on the
RuleFeatureSets for added/removed stylesheets. Implement the
functionality in StyleEngine for scheduling invalidations in the
stylesheet's TreeScope, including host and slotted elements if
applicable.

R=ericwilligers@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2333693002
Cr-Commit-Position: refs/heads/master@{#420192}
fs
Drop the SVGLengthType enumeration
After the transition to using CSSPrimitiveValue, this enumeration is
not used by anything but the DOM-side of SVGLength (SVGLengthTearOff),
and for that we might as well use the interface constants directly.

The LengthTypeREMS and LengthTypeCHS values are dropped entirely because
they are not referenced by anything.

Review-Url: https://codereview.chromium.org/2354283002
Cr-Commit-Position: refs/heads/master@{#420150}
mstensho
Stay put at the top of the current page when inserting a forced break.
If we attempt to insert a forced break, and we're already at the top of a page
or column, we should stay right there, instead of leaving an entire page or
column blank. We used to ensure this by calling nextPageLogicalTop() with
AssociateWithFormerPage.

But it was broken, because AssociateWithFormerPage could take us to a column
set preceding a column spanner that we had actually moved past. This would
confuse various parts of the machinery, and could, among other things, find
unused space in the last column preceding a spanner, and use this as a
pagination strut on an object *following* the spanner.

Remove PageBoundaryRule from nextPageLogicalTop(), and let the forced break
insertion code handle this on its own instead, and do it correctly, without
looking back at preceding columns.

BUG=647475

Review-Url: https://codereview.chromium.org/2356183002
Cr-Commit-Position: refs/heads/master@{#420072}
mstensho
Need to consider the need for a soft break even when inserting a forced break.
A forced break will just take us to the next fragmentainer. However, the next
fragmentainer may not be tall enough to fit any part of the block we're laying
out, which means that we may have to skip to a fragmentainer further ahead -
one that is tall enough. This situation may arise in nested multicol, because
then we may get inner fragmentainers of variable height.

Another reason why we need this is that a forced break on an object is inserted
before we apply clearance. After we have applied clearance, we may have ended
up at a position where there's not enough space left to fit any part of the
block we're laying out. So, again, we may need to skip to the next
fragmentainer.

BUG=647475

Review-Url: https://codereview.chromium.org/2359733002
Cr-Commit-Position: refs/heads/master@{#420041}
fs
Widen Mac expectations for move_backward_line_import_crash.html
editing/selection/modify_move/move_backward_line_import_crash.html
appears to also Crash on Mac Debug.

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.11%20%28dbg%29/builds/4772

TBR=xiaochengh@chromium.org
BUG=648547,646323
NOTRY=true

Review-Url: https://codereview.chromium.org/2360593002
Cr-Commit-Position: refs/heads/master@{#420040}
rune
Make stylesheet owner node a reference instead of pointer.
The CSSStyleSheet owner node is always non-null when passed in on
sheet creation. Make it a reference in various APIs.

The real change here that triggered this was the realization that
StyleEngine::createSheet is always called with an owner node which
belongs to the very same Document/StyleEngine. So we can turn:

  e->document().styleEngine().addPendingSheet(context);

into:

  addPendingSheet(context);

Also made parseSheet non-static as it needed the StyleEngine pointer
anyway.

R=sashab@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2354773003
Cr-Commit-Position: refs/heads/master@{#420018}
fs
Consolidate read-only exception throwing for SVG*TearOffs
Where possible, use the "standard" message for read-only objects from
ExceptionMessages. Move the setup of the ExceptionState with this
message to SVGPropertyTearOffBase and reuse. It also saves a small chunk
of code-space.

Also drop a bunch of vspace, reorder checks in
SVGPreserveAspectRatioTearOff to check for immutability first and do
less work on error in SVGMatrixTearOff.

Review-Url: https://codereview.chromium.org/2357463002
Cr-Commit-Position: refs/heads/master@{#419875}
mstensho
Don't include LayoutObject.h from FrameView.h
This reduces the LayoutObject.h dependency by about 50 compilation units.

Needed to move data of DepthOrderedLayoutObjectList into a forward-declared
struct, since HashSet members need their T defined, even if it's a pointer.
This due to oilpan. See https://codereview.chromium.org/1999343002 for details.

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2348993002
Cr-Commit-Position: refs/heads/master@{#419728}
rune
Prepare to use invalidation set for adding/removing RuleSets.
Currently, we sometimes use StyleSheetInvalidationAnalysis to be smart
about recalculating affected element when adding/removing a stylesheet.

The plan is to start using the StyleInvalidator to trigger style
recalculations When adding/removing stylesheets. We will then use the
invalidation sets from the stylesheet RuleSet and schedule them on
elements in the stylesheet's document or shadow tree.

We fall back to a full recalc for the document / shadow tree for if we
find selectors which don't have simple selectors for which we have an
invalidation set we can use. This is similar to what we do with the
universalSiblingInvalidationSet for DOM mutations.

This first implementation supports id, class, attribute, and type
selectors in the rightmost compound[1]. We could later support to use
invalidation sets for universal pseudo class rules like ":hover".

The invalidations are to be scheduled for elements in the same
TreeScope as the stylesheet, including the host element.

Rules which are boundary crossing have their features collected in
ScopedStyleResolver::addTreeBoundaryCrossingRules() and not in their
respective stylesheet's RuleSet. We fall back to full style recalc
for rules containing ::content, ::shadow, and /deep/. ::slotted rules
are currently also collected on the ScopedStyleResolver, but in order
to avoid full recalcs, we do LocalStyleChange on slot-distributed
elements for RuleSet invalidations when there are ::slotted rules in
the RuleSet.

As mentioned earlier we will schedule invalidations on the host element
as well, which means we will schedule the invalidation set for ".a" for
":host(.a)". :host-context() do also support RuleSet invalidation as
long as there are features in addition to the ones inside the
:host-context() pseudo.

As for sibling invalidations on DOM mutations, negated selectors like
":not(.a)" are considered universal.

This CL is split out of [2]. The next step is to land the invalidation
code in StyleEngine from the same CL.

[1] Even though we don't have invalidation sets for tag names, we can
check the presence of rules in the tag name hash map for the RuleSet.
This means "body *" will cause a full recalc, but "body" won't. Also
note that "div.enabled" will cause every div element to be invalidated
because the rule would end up in the class rule hashmap.

[2] https://codereview.chromium.org/1913833002/

R=ericwilligers@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2326033002
Cr-Commit-Position: refs/heads/master@{#419704}
fs
Replace FilterData::filter with lastEffect
This brings the FilterData+SVGFilterPainter (etc)  "complex" closer to
the PaintLayer+PaintLayerFilterInfo structure by keep the last effect
in the chain and accessing the Filter through that when needed.
In general we want these two "complexes" to closely resemble each other
as possible - because they are supposed to implement the same thing, with
only a difference in the parametrization (like which bounding-box to use.)
This also brings one tiny (tiny tiny) step closer to being able to get
shorthand filters working in the SVG code-path.

Also try to reduce dependencies a bit in the surrounding code.

BUG=439970,109224
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2350063002
Cr-Commit-Position: refs/heads/master@{#419700}
mstensho
Don't include LayoutBlock.h from MediaControlElementTypes.h
Reduces the dependencies on LayoutBlock.h by 5 compilation units.

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2341423002
Cr-Commit-Position: refs/heads/master@{#419699}
fs
Turn FilterEffectBuilder into a stack-allocated helper
This moves the FilterEffect reference out of FilterEffectBuilder and
into the owner (PaintLayerFilterInfo), and then turns
FilterEffectBuilder into a more proper builder-style object that is
configured by the client and then has build...() called upon it to
construct the filter.
Rename the old build() method to buildFilterEffect().
Fix up PaintLayer to remove the indirection, and similarly adjust the
other users (CanvasRenderingContext2DState, SVGFilterPainter).

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2349183002
Cr-Commit-Position: refs/heads/master@{#419697}
rune
Remove unused StyleElement::clearDocumentData().
Review-Url: https://codereview.chromium.org/2350743002
Cr-Commit-Position: refs/heads/master@{#419556}
tmoniuszko
Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest
BUG=633136

Review-Url: https://codereview.chromium.org/2197113002
Cr-Commit-Position: refs/heads/master@{#419454}
fs
Reland of Evacuate ComputedStyle references from the CSS*Value hierarchy
Fold uses of:

  CSSPrimitiveValue::create(..., const ComputedStyle&)
  CSSValuePair::create(..., const ComputedStyle&)

into the (few) users. Handle the fall-out.

Review-Url: https://codereview.chromium.org/2345893004
Cr-Commit-Position: refs/heads/master@{#419390}
fs
ConvolverOptions.buffer should be nullable
TBR=rtoy@chromium.org,foolip@chromium.org
BUG=626449,647693

Review-Url: https://codereview.chromium.org/2352463002
Cr-Commit-Position: refs/heads/master@{#419388}
fs
Slim includes in CSSValue.h
This drops includes from CSSValue.h that are not directly used by it.
Downstream dependents are fixed up as needed. Also strip some includes
from StyleImage.h and other places that includes CSSValue.h while
there.

Review-Url: https://codereview.chromium.org/2345223002
Cr-Commit-Position: refs/heads/master@{#419384}
fs
Evacuate ComputedStyle references from the CSS*Value hierarchy
Fold uses of:

  CSSPrimitiveValue::create(..., const ComputedStyle&)
  CSSValuePair::create(..., const ComputedStyle&)

into the (few) users. Handle the fall-out.

Review-Url: https://codereview.chromium.org/2345893004
Cr-Commit-Position: refs/heads/master@{#419382}
fs
Revert of Show ancestor hierarchy in accessibility panel (patchset #10 id:180001 of https://codereview.chromium.org/2322413003/ )
Reason for revert:
Fails the compile step on Linux ChromiumOS GN (headless_unittests)

Original issue's description:
> Show ancestor hierarchy in accessibility panel
>
> BUG=560525
>
> Committed: https://crrev.com/3558706c1b2a630557929b61fefc74e28975f3a6
> Cr-Commit-Position: refs/heads/master@{#419369}

TBR=dmazzoni@chromium.org,dgozman@chromium.org,pfeldman@chromium.org,aboxhall@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=560525

Review-Url: https://codereview.chromium.org/2351443003
Cr-Commit-Position: refs/heads/master@{#419371}
fs
Let clients of FilterEffectBuilder compute/provide the reference-box
Rather than having code to compute the reference box for the various
clients that use FilterEffectBuilder in the class itself, let clients
compute the desired reference box themselves and pass it along.
This separates concerns, and makes code for computing the reference box
less defensive. It also eliminates the need to add even more cases in
the future (like for SVG shorthand support.)

Also push calls to resolveReferenceFilters() in PaintLayer closer to the
filter-building calls, and rename computeFilterOperations to
addReflectionToFilterOperations. This allows us to eliminate a redundant
call to resolveReferenceFilters() in the mapRectForFilter() code-path.

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2343173002
Cr-Commit-Position: refs/heads/master@{#419290}
mstensho
Don't include LineLayoutItem.h from SVGTextContentElement.h.
Review-Url: https://codereview.chromium.org/2342203004
Cr-Commit-Position: refs/heads/master@{#419274}
fs
Don't treat shorthand filters as errors on SVG content
We don't support filter shorthands yet, so we shouldn't treat them as
errors. Fix up the hasFilter() condition to also check if it's a filter
that we pretend we can handle.

Also straighten out the code-flow in applyFilterIfNecessary.

BUG=645995
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2349743003
Cr-Commit-Position: refs/heads/master@{#419267}
mstensho
Don't include LayoutViewItem.h from StyleResolverState.h
This reduces the number of compilation units that depend on files like
LayoutBlock.h by more than 200 (from around 500 to around 280).

Review-Url: https://codereview.chromium.org/2348853003
Cr-Commit-Position: refs/heads/master@{#419202}
fs
Clean up includes in SVGFE*Element and thereabouts
Drop inclusion of SVGParserUtilities.h in a number of places since it's
no longer used. Push FE*.h inclusion into the implementation where
possible, and don't include FilterEffect.h in those cases.
Also simplify a loop in SVGFEMergeElement::build.

Review-Url: https://codereview.chromium.org/2342353002
Cr-Commit-Position: refs/heads/master@{#419187}
rune
Setting the link title may change the preferred set.
Make sure we set the preferred style sheet set when setting the title
attribute as long as the preferred set name is not already set.

This used to somehow work if the title was set during loading of a
stylesheet since the preferred set name was set during active
stylesheet collection. In other cases, it didn't work until another
stylesheet operation caused a re-collection of active stylesheets.

When setting the preferred name was moved into the LinkStyle::process()
code, it didn't work at all to set the title after the stylesheet
starts loading.

Make sure we set the preferred set name and trigger an active
stylesheet update when the title is changed.

BUG=645699

Review-Url: https://codereview.chromium.org/2337193004
Cr-Commit-Position: refs/heads/master@{#419107}
fs
Push CompositorFilterOperations creation out of GraphicsLayer
Push knowledge of FilterOperations out of GraphicsLayer and into
PaintLayer. This eliminates one dependency from platform/ code to the
FilterOperations structure. The motivation is to try and make
FilterOperation(s) a core (style) type, to make interaction with the
style system and other parts of core easier. It will also aid in
enabling a more layered structure on the various filter-related data
structures.

Also change the various generator functions to return a
CompositorFilterOperations by-value rather than through a out-variable.

BUG=439970
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2335253002
Cr-Commit-Position: refs/heads/master@{#419029}
mstensho
Add PageBoundaryRule parameter to fragmentainerGroupAtFlowThreadOffset().
If it's an exclusive end offset, we need to know this, so that we map to the
former fragmentainer group, rather than the latter, if the offset is at a
column row boundary.

Review-Url: https://codereview.chromium.org/2345583004
Cr-Commit-Position: refs/heads/master@{#418958}
mstensho
Correct flowThreadTranslationAtOffset() for vertical-rl writing mode.
The problem was that a rectangle was shifted by offsetFromColumnSet() after
having been made physical. However, offsetFromColumnSet() is semi-logical
(flipped block direction coordinate, like e.g. LayoutBox::m_frameRect), so we
need to add it in before flipping the rectangle.

This caused all fragmentainer groups but the first one to be translated
incorrectly.

Review-Url: https://codereview.chromium.org/2344813003
Cr-Commit-Position: refs/heads/master@{#418870}
mstensho
Add PageBoundaryRule parameter to columnSetAtBlockOffset().
If it's an exclusive end offset, we need to know this, so that we map to the
former column set, rather than the latter, if the offset is at a column set
boundary.

Review-Url: https://codereview.chromium.org/2340213003
Cr-Commit-Position: refs/heads/master@{#418839}
fs
Unprefix -webkit-clip-path
This CL renames '-webkit-clip-path' to 'clip-path', and makes the former
an alias of the latter.
For LayoutSVGRoot, clip-path is now applied only by the PaintLayer and
not by SVGPaintContext.

Intent-to-ship:

https://groups.google.com/a/chromium.org/d/topic/blink-dev/FBE05hzCmPo

BUG=633028
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2312713002
Cr-Commit-Position: refs/heads/master@{#418827}
mstensho
Handle exclusive end offsets when translating from flow thread coordinates.
If we're in flipped blocks writing mode (i.e. vertical-rl), the flow thread
block offset we're dealing with may be a logical end point, and end points are
exclusive. This means that we need to pick the previous column, not the next,
if the offset is exactly at a column boundary.

Let flowThreadTranslationAtOffset() and columnIndexAtOffset() take a
PageBoundaryRule argument to handle this.

This makes offsetLeft and offsetTop work properly in vertical-rl writing mode
for elements that end at column boundaries. Added a test for that, and threw in
a vertical-lr test too, for good measure.

Remove ColumnIndexCalculationMode from columnIndexAtOffset(). It was partially
and inaccurately used to make sure we didn't escape the valid column range in
case an exclusive end offset was passed. Have the call sites that really need
to clamp the column index do it themselves. It's up to the callers to decide
how to treat offsets outside the range of columns anyway.

Review-Url: https://codereview.chromium.org/2339973002
Cr-Commit-Position: refs/heads/master@{#418800}
mostynb
//device/media_transfer_protocol depends on dbus
The build should fail early if //device/media_transfer_protocol is included with dbus explicitly disabled.

BUG=632297

Review-Url: https://codereview.chromium.org/2333573003
Cr-Commit-Position: refs/heads/master@{#418744}
fs
Add support for <basic-shape> to 'clip-path' on SVG elements
Use ClipPathOperation as storage for the property in SVGComputedStyle,
and add support for <basic-shape>s where needed. This also means that
nesting a <clipPath> with a <basic-shape> is added.
Since SVGPaintContext::applyClipIfNecessary can't fail in a useful way,
just drop the returned bool (test added.) An invalid clip-path will
just be ignored (per spec.)

BUG=633028
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2322343003
Cr-Commit-Position: refs/heads/master@{#418387}
fs
Fix baselines for media/video-zoom-controls.html
Attempt to tidy up after mid-flight collision.

TBR=mlamouri@chromium.org,kdsilva@google.com
BUG=601247

Review-Url: https://codereview.chromium.org/2328353002
Cr-Commit-Position: refs/heads/master@{#417973}
rune
Simplified compound feature extraction.
Started to return the last simple selector in the compound instead of
the pointer to the next compound from
extractInvalidationSetFeaturesFromCompound. That means we can update
feature flags for the combinator from updateInvalidationSets, which
also means we can get rid of the duplicated code for updating the
nthInvalidationSet(). Additionally, we can use the siblingFeatures as
initialized by updateFeaturesFromCombinator().

Removed unused UseFeatureTypes.

There should be no functional changes.

R=ericwilligers@chromium.org

Review-Url: https://codereview.chromium.org/2326783002
Cr-Commit-Position: refs/heads/master@{#417915}
mstensho
[LayoutNG] Remove unnecessary #inclusions of LayoutObject and derived class definitions.
That reduces the number of compilation units that depend on LayoutObject.h by 9
when building content_shell.

R=eae@chromium.org

Review-Url: https://codereview.chromium.org/2328243002
Cr-Commit-Position: refs/heads/master@{#417909}
fs
Drop FilterEffect::m_absolutePaintRect
This rect is a remnant of the old ImageBuffer-based implementation of
FilterEffect, and is likely doing more harm than good at this point in
time. If we want to cache the result of a call to
determineAbsolutePaintRect(), that can be done equally well by the
client code.

Since removing this state removes the last side-effect from the
determineAbsolutePaintRect() methods we can mark it and related methods
(affectsTransparentPixels) as const.

BUG=642035

Review-Url: https://codereview.chromium.org/2329803002
Cr-Commit-Position: refs/heads/master@{#417908}
mstensho
A container of out-of-flow positioned descendants should be an offsetParent.
This reflects a recent spec change [1]. Previously, the condition was that the
position property be different from 'static', but it's unreasonable that we
shouldn't also include other objects that serve as containing blocks for fixed
and absolutely positioned descendants, such as "transform". Gecko and Edge
already have this behavior.

[1] https://github.com/w3c/csswg-drafts/commit/180b348a1ac0931043cd195651fc5164463d2bce

BUG=645397

Review-Url: https://codereview.chromium.org/2328633003
Cr-Commit-Position: refs/heads/master@{#417903}
mstensho
Walk the entire offsetParent chain in fast/forms/resources/common.js utility functions.
They used to assume that the only offsetParent was the root node, but that's no
longer going to be true when https://codereview.chromium.org/2328633003/ lands.
One test that calls searchCancelButtonPosition() is inside a transformed
element, which will become an offsetParent.

R=tkent@chromium.org

Review-Url: https://codereview.chromium.org/2332553002
Cr-Commit-Position: refs/heads/master@{#417893}
fs
Revert of Make canceling Timers fast. (patchset #10 id:180001 of https://codereview.chromium.org/2319053004/ )
Reason for revert:
Wreaks havoc on the ASAN bots:

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20ASAN

STDERR: =================================================================
STDERR: ==4==ERROR: AddressSanitizer: use-after-poison on address 0x7ed9a5616190 at pc 0x00000768b0da bp 0x7fff4bbca630 sp 0x7fff4bbca628
STDERR: READ of size 8 at 0x7ed9a5616190 thread T0 (content_shell)
STDERR:     #0 0x768b0d9 in operator-> third_party/WebKit/Source/wtf/RefPtr.h:68:50
STDERR:     #1 0x768b0d9 in revokeAll third_party/WebKit/Source/wtf/WeakPtr.h:146:0
STDERR:     #2 0x768b344 in ?? third_party/WebKit/Source/platform/Timer.cpp:124:22
STDERR:     #3 0x47a4461 in Run base/callback.h:56:12
STDERR:     #4 0x47a4461 in RunTask base/debug/task_annotator.cc:54:0
STDERR:     #5 0x79e2381 in ProcessTaskFromWorkQueue third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc:316:19
...
STDERR: AddressSanitizer can not describe address in more detail (wild memory access suspected).
STDERR: SUMMARY: AddressSanitizer: use-after-poison

Appears to be accessing a "user-poison" area, so maybe a timer in something that was swept? (Wild guess.)

Original issue's description:
> Make canceling Timers fast.
>
> base::Closure recently got an IsCancelled method. Taking advantage of
> that the scheduler can short circuit a bunch of logic for cancelled
> tasks and avoid running them and the rest of the task selection
> machinery.
>
> On the new TimerPerfTest benchmark this makes running 10000 cancelled
> tasks aprox 50x - 60x faster (measured on Android and Linux).
>
> Note this patch reverts many of the changes made in
> https://codereview.chromium.org/2258713004 in favor of
> WeakPtr based cancellation as favored by the base owners.
>
> BUG=605718, 638542
>
> Committed: https://crrev.com/e4e5868c5f32b015bf0d07a6eeace892d6a789a1
> Cr-Commit-Position: refs/heads/master@{#417621}

TBR=jochen@chromium.org,haraken@chromium.org,skyostil@chromium.org,alexclarke@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=605718, 638542

Review-Url: https://codereview.chromium.org/2326313003
Cr-Commit-Position: refs/heads/master@{#417846}
fs
Mark */fast/canvas/canvas-hit-regions-*-test.html are timing out on Win
Timing out on win_chromium_rel_ng. Maybe just Slow?

BUG=645389
TBR=junov@chromium.org
NOTRY=true

Review-Url: https://codereview.chromium.org/2324333003
Cr-Commit-Position: refs/heads/master@{#417840}
fs
Update leak expectations after https://codereview.chromium.org/2321183002
Moved to paint/invalidation/japanese-rl-selection-clear.html from
fast/repaint/.

TBR=wangxianzhu@chromium.org
NOTRY=true

Review-Url: https://codereview.chromium.org/2331723002
Cr-Commit-Position: refs/heads/master@{#417839}
mstensho
[LayoutNG] Handle border and padding when sizing a block and when placing its children.
BUG=635619

Review-Url: https://codereview.chromium.org/2325073002
Cr-Commit-Position: refs/heads/master@{#417827}
mstensho
Translate the clip rect correctly when iterating over fragmentainers.
The clip rect is visual, so we need to shift each fragmentainer group by its
visual translation. This matters for nested multicol.

BUG=642325

Review-Url: https://codereview.chromium.org/2321333002
Cr-Commit-Position: refs/heads/master@{#417563}
mstensho
Let LayoutNG handle childless block flows.
The fact that they are marked with childrenInline() doesn't matter if they have
no children.

BUG=635619

Review-Url: https://codereview.chromium.org/2320393002
Cr-Commit-Position: refs/heads/master@{#417543}
fs
Replace FilterEffect::maxEffectRect() with absoluteBounds()
This removes maxEffectRect(), determineMaximumEffectRect() and the
associated state (m_maxEffectRect) from FilterEffect. The replacement is
the new method absoluteBounds() that computes bounds for the node in
question using the filter primitive (sub)region and the filter region.
This should match what determineMaximumEffectRect() was computing for
use from SVGFilterPainter.

BUG=642035
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2319293004
Cr-Commit-Position: refs/heads/master@{#417530}
rune
Corrected variable name to not contain "Tag".
Incorrectly named. We don't include type selectors.

R=ericwilligers@chromium.org

Review-Url: https://codereview.chromium.org/2321013002
Cr-Commit-Position: refs/heads/master@{#417456}
ddyndo
Fixed access to `constraint_flags` array in ParseHEVCCodecId function.
This patch adds necessary offset when accessing this array.
`constraint_flags` is an array of 6 elements, however in
`for` loop it can be accessed with indices from 4 to 9
instead of indices from 0 to 5.

Review-Url: https://codereview.chromium.org/2320063002
Cr-Commit-Position: refs/heads/master@{#417351}
rune
Removed m_isSettingStyleSheetText from InspectorCSSAgent.
The variable supressed an unnecessary re-collection of inspector
stylesheets when the stylesheet text is modified from the inspector. If
the text added contains an @import rule with a data: uri, it also
suppresses the collection of that sheet, which is wrong.

R=pfeldman@chromium.org,lushnikov@chromium.org
BUG=644719

Review-Url: https://codereview.chromium.org/2319533004
Cr-Commit-Position: refs/heads/master@{#417290}
mstensho
Replace collectLayerFragments() with FragmentainerIterator.
No functional changes intended.

The way collectLayerFragments() and PaintLayer::collectFragments() cooperated
to populate the PaintLayerFragments was rather messy. collectLayerFragments()
set two members, and then, later on, PaintLayer::collectFragments() would set
the remaining members, translate and clip. With this change, the layout code no
longer uses PaintLayerFragments.

It should also be mentioned that collectLayerFragments() was a bad name,
because this functionality shouldn't be strictly for layers. We're soon going
to need it for getClientRects() as well.

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2314763002
Cr-Commit-Position: refs/heads/master@{#417271}
mstensho
Don't include headers from the layout API from other headers needlessly.
Including layout API headers involves including some LayoutObject derivate,
which takes a lot of time to compile.

R=bashi@chromium.org,dsinclair@chromium.org,haraken@chromium.org,bokan@chromium.org,pilgrim@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2316533004
Cr-Commit-Position: refs/heads/master@{#417265}
rune
Store a single inspector stylesheet hidden from CSSOM.
Custom style rules can be added via the inspector. These were stored in
a stylesheet appended to <head>. That meant it was visible to the
document via CSSOM. Also, enabling/disabling the inspector would not
remember that a stylesheet was added, so the inspector started out with
a new blank stylesheet for editing, yet the existing rules still
applied.

This CL introduces a single inspector stylesheet in the StyleEngine
which takes part in the document collection to apply the rules, but it
is not appended to the document.styleSheets list. Neither is it
accessible through a <style> element in the DOM.

The stylesheet ends up after the author stylesheets in the order of
appearance. That is similar to how it was, but previously, sheets in
<body> would appear after the inspector sheet while sheets in <head>
would appear before.

The inspector sheet source is stored in a resource container like
changes for author stylesheets. This means the inspector sheet source
will persist across inspector enable/disable.

R=pfeldman@chromium.org,lushnikov@chromium.org
BUG=624139
TEST=http/tests/inspector-enabled/reattach-after-editing-styles.html

Review-Url: https://codereview.chromium.org/2312953002
Cr-Commit-Position: refs/heads/master@{#417021}
mstensho
Fix typo in enable-blink-features command line switch.
This one doesn't disable features, it *enables* them.

R=jochen@chromium.org

Review-Url: https://codereview.chromium.org/2319503002
Cr-Commit-Position: refs/heads/master@{#416968}
rune
Refactored invalidation set extraction.
Refactor into smaller more descriptive methods.

Implemented InvalidationSetFeatures::add() and hasFeatures() to add
features conditionally for selector lists like in :-webkit-any() instead
of tracking non-feature compounds using a foundFeatures variable.

Review-Url: https://codereview.chromium.org/2305593002
Cr-Commit-Position: refs/heads/master@{#416912}
fs
Remove dead uses of FilterEffect::determineMaximumEffectRect
Said method only computes m_maxEffectRect. The only users of this data
is SVGFilterPainter, directly and via determineAbsolutePaintRect (which
in turn uses mapPaintRect which uses maxEffectRect in one case.) Hence
all other callsites are calling determineMaximumEffectRect() without
making use of the side-effect is has. Remove those uses.
This also mean that we can tailor the method for the one remaining
user by cleaning up, and removing, the flags argument.

TBR=senorblanco@chromium.org
BUG=642035
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2307343002
Cr-Commit-Position: refs/heads/master@{#416888}
mstensho
Correct multicol dirty rect for scrolled and flipped blocks writing mode.
Calling LayoutBox::location() to make a physical rectangle relative to the
multicol container instead of the flowthread isn't going to work if writing
mode is with flipped blocks direction (vertical-rl), because location() returns
a semi-logical offset. It would have worked with topLeftLocation(), though.
But since we'd still have issues with scrolling, make the dirty rectangle
relative to the multicol container right away on the PaintLayer side instead,
since layers know how they have been scrolled. This also happens to be in line
with the comment there, so now we're actually doing what we say that we're
doing. :)

This makes fast/repaint/paged-with-overflowing-block-rl.html pass.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2310233002
Cr-Commit-Position: refs/heads/master@{#416859}
fs
Update expectations for css3/filters/effect-reference-hw.html
TBR=pdr@chromium.org
BUG=642035

Review-Url: https://codereview.chromium.org/2310993002
Cr-Commit-Position: refs/heads/master@{#416563}
fs
New Win10 baselines for css3/filters/effect-reference-hw.html
TBR=pdr@chromium.org
BUG=642035

Review-Url: https://codereview.chromium.org/2311933002
Cr-Commit-Position: refs/heads/master@{#416555}
fs
Win10 needs new baselines for css3/filters/effect-reference-hw.html
TBR=pdr@chromium.org
NOTRY=true
BUG=642035

Review-Url: https://codereview.chromium.org/2311943002
Cr-Commit-Position: refs/heads/master@{#416546}
fs
Reland of Revamp filter primitive region calculations for Filter Effects
This moves the filter primitive region calculation to
SVGFilterPrimitiveStandardAttributes::setStandardAttributes, folding in
FilterEffect::applyEffectBoundaries and getting rid of
FilterEffect::m_effectBoundaries and related flags.
What's left of FilterEffect::determineFilterPrimitiveSubregion() is
renamed to determineMaximumEffectRect(), and callsites updated.

BUG=642035
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2303703002
Cr-Commit-Position: refs/heads/master@{#416537}
rune
Implemented RuleSet diff for active stylesheets.
This is an implementation of the diffing of active stylesheets outlined
in [1] to replace the current compareStyleSheets method in
TreeScopeStyleSheetCollection which currently cause a "Reconstruct" if
you both have insertions and removals. With async stylesheet update we
will more likely end up in those situations as changes to the list can
happen in a batches.

An important new aspect here is that together with each stylesheet keep
a traced pointer to the RuleSet it had reference last time the active
stylesheet list was updated. That way we can figure out what changed on
media query and CSSOM changes.

The comparison algorithm works like this:

INPUTS: The new and old active stylesheet vectors
OUTPUTS: A vector of added and removed RuleSets.
         Also a return value saying if we only appended stylesheets at
         the end. Given that sheets were only appended we can do certain
         optimizations updating rule data.

* First linearly walk the old and new active list as long as the
  stylesheet pointers are the same. If the ruleset changed for the
  given sheet, add the old and new rulesets to the list of changed
  rulesets.

* If we are finished walking any of the active lists, we have either
  appended a set of sheets to the end, or we have removed a set from
  the tail. Add the added/removed rulesets to the changed list and we
  are finished.

* If we have remaining sheets in both the old and new active list,
  merge the remaining items from both lists and sort the merged vector
  on stylesheet pointers. For stylesheet pointers occuring in pairs, if
  the rulesets are different for the two entries, the ruleset changed
  so we add them to the changed list. For stylesheets which do not occur
  in pairs, they are either added or removed and we add the ruleset to
  the changed list.

The time complexity for the algorithm is O(k) for the common prefix
and the complexity for std::sort for the m + n remaining sheets in the
new and old active lists. Note that each scope has its active list, so
the larger n's will be for the document scope as shadow trees most
often have a single stylesheet (I measured a max of three running some
Polymer apps).

An assumption here is that we will do ensureRuleSet() including media
query evaluation for the media attribute as we collect active
stylesheets. Currently, the analysis of which elements needs a style
recalc happens synchronously while updating the active sheets while the
rulesets are (re-)created asynchronously/on-demand via
lazyAppendAuthorStyleSheets in StyleResolver. The idea is that since
the active stylesheet update will be async, we can drop the lazyAppend
things from StyleResolver and add the stylesheets directly to the
ScopedStyleResolvers during the active stylesheet update.

Creating the RuleSets as we collect active stylesheets means we have
invalidation sets readily available to use style invalidation to
trigger style recalcs only on elements affected by the added/removed
stylesheets.

[1] http://bit.ly/25uxtnU

R=esprehn@chromium.org,timloh@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/1889993002
Cr-Commit-Position: refs/heads/master@{#416520}
fs
Revamp filter primitive region calculations for Filter Effects
This moves the filter primitive region calculation to
SVGFilterPrimitiveStandardAttributes::setStandardAttributes, folding in
FilterEffect::applyEffectBoundaries and getting rid of
FilterEffect::m_effectBoundaries and related flags.
What's left of FilterEffect::determineFilterPrimitiveSubregion() is
renamed to determineMaximumEffectRect(), and callsites updated.

BUG=642035
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2303703002
Cr-Commit-Position: refs/heads/master@{#416472}
fs
Compute better reference/visual boxes for clip-path in columns
clip-path's are applied before fragmentation, which means that we need
to adjust the coordinate space for the clip-path and its reference box
"manually" to get the correct visual coordinate space.

Also fix the origin used for clip-path to be the top-left corner of the
reference box. This only applies when SVG <clipPath> elements with
clipPathUnits='userSpaceOnUse' is referenced.

BUG=626097
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2300383002
Cr-Commit-Position: refs/heads/master@{#416451}
fs
css3/masking/clip-path-reference-userSpaceOnUse.html no longer fails
TBR=schenney@chromium.org
NOTRY=true
BUG=397255

Review-Url: https://codereview.chromium.org/2307063002
Cr-Commit-Position: refs/heads/master@{#416308}
fs
Tweak css3/masking/clip-path-reference-userSpaceOnUse.html
Turn the <svg> into a block to avoid having to compensate for the
baseline of an inline.

BUG=397255

Review-Url: https://codereview.chromium.org/2303043003
Cr-Commit-Position: refs/heads/master@{#416271}
fs
Align reference box computation for inline boxes with Gecko
For inline boxes, the reference box should be computed per-fragment, and
be subject to box-decoration-break. We're not quite there yet though, so
go for "local compat" for now and align with Gecko. This way we're
slightly closer to "correct" (the "single line" case ought to be fairly
correct for instance), and hopefully avoid getting sucked into a compat
"sinkhole".
Adjust css3/masking/clip-path-reference-box-inline.html to match.

BUG=641907
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2303773002
Cr-Commit-Position: refs/heads/master@{#416264}
davve
Simplify contain constraint calculation
We're selecting between two rectangles given by the intrinsic aspect ratio:
(defaultWidth / aspect ratio, defaultHeight) or (defaultWidth, defaultHeight x
aspect ratio). One rectangle is 'contained' and the other one 'covers'. Select
the 'contained' rectangle by trying out the first to see if its width fit, and
if so we're done. Otherwise compute and select the other rectangle.

Due to how floating point math works, it's possible that both computed
rectangles, or neither computed rectangle, will fit the case when the two ratios
are equal. See https://bugs.chromium.org/p/chromium/issues/detail?id=641221 for
one example. However, in this case it doesn't matter much which rectangle we
choose, the contained and and cover rectangle would be the same rectangle and
the floating point discrepancy has no known practical implication.

BUG=641221

Review-Url: https://codereview.chromium.org/2294683002
Cr-Commit-Position: refs/heads/master@{#416238}
rune
Don't cache matched properties for elements without a flat-tree parent.
When there's not flat tree parent for the element we are computing
style for, setHasExplicitlyInheritedProperties will not be set on the
ComputedStyle during property application. Without that flag set
correctly we allowed to add to the matched properties cache even though
we shouldn't.

There are some open questions here:

* How should body -> html propagation work when html has a shadow tree?
* Do children of a shadow host have a computed style at all when not
  distributed/slotted?

It should be noted that attachShadow is not allowed on the <html>
element. That is why the test case uses a v0 shadow tree.

R=andersr@opera.com,esprehn@chromium.org,hayato@chromium.org
BUG=636500

Review-Url: https://codereview.chromium.org/2283933003
Cr-Commit-Position: refs/heads/master@{#416200}
fs
Use LayoutSVGResourceClipper::resourceBoundingBox() in ClipPathClipper
Use the reference box to compute the clip-path bounds in ClipPathClipper,
using the resourceBoundingBox() method from LayoutSVGResourceClipper. This
should give reasonably tight-fitting bounds for the clip-as-mask code-path
which uses these bounds. It also means one less item to pass around.

This means that the clip-path code in PaintLayerPainter no longer needs
the |rootRelativeBounds| and associated bool, so that code can be pushed
down into FilterPainter with additional plumbing simplifications.

Also straighten out the code-flow in ClipPathClipper for less indented,
and hopefully easier to follow, code.

BUG=633028, 626097
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2279823002
Cr-Commit-Position: refs/heads/master@{#416073}
fs
Synthesize preserveAspectRatio='none' for non-viewBoxed <img>
For SVGs embedded in an image context, we will synthesize a viewBox that
matches the intrinsic dimensions of the SVGs, if no viewBox is
specified. This would result in an image where the aspect ratio
expressed by the intrinsic dimensions would be preserved.
This does not appear to match author expectations - they rather see that
the behavior in these cases match that of a "regular" raster-based
image. To achieve this, also synthesize a preserveAspectRatio-value of
"none" in these cases. This will result in the original image being
stretched in the most common cases. Any percentage dimensions will be
resolved against the computed dimensions (replaced size), and can hence
also produce a useful viewBox.

The implemented behavior is not currently specced (neither was the old
synthesizing of a viewBox), but matches Gecko.

BUG=110195

Review-Url: https://codereview.chromium.org/2290173005
Cr-Commit-Position: refs/heads/master@{#416059}
tommyt
We will not update the cached characteristic value when writing, nor will we call the observers' GattCharacteristicValueChanged method.
Update the documentation for WriteRemoteCharacteristic and change the name of the "new_value" parameter to "value".

See http://crbug.com/614534

BUG=551634

Review-Url: https://codereview.chromium.org/2287273002
Cr-Commit-Position: refs/heads/master@{#416028}
tmoniuszko
Clear HTTP auth data on clearing cache
BUG=108291

Review-Url: https://codereview.chromium.org/2097043002
Cr-Commit-Position: refs/heads/master@{#415919}
fs
Resolve percentage in <use> against the instance's viewport element
In LayoutSVGTransformableContainer::calculateLocalTransform, 'x' and 'y'
were resolved against the original (corresponding) element. For a <use>
nested within a <symbol>, this would mean that when were going to look
up the viewport element, we'd return the outer <symbol> element and thus
fail to get a viewport.
Use the instance element to setup the SVGLengthContext instead.

BUG=642524

Review-Url: https://codereview.chromium.org/2298783002
Cr-Commit-Position: refs/heads/master@{#415910}
fs
Move SVGAnimateElement::findElementInstances to SVGElement.cpp
There's now only a single user of this function, so fold the function
into that one.

BUG=640676

Review-Url: https://codereview.chromium.org/2293173003
Cr-Commit-Position: refs/heads/master@{#415901}
mstensho
Fragment blocks with non-visible overflow as normally when printing.
Splitting scrollbars into multiple fragmentainers is only problematic in
interactive media. We don't need to impose any such pagination restrictions
when printing, since printing is non-interactive,

BUG=641983

Review-Url: https://codereview.chromium.org/2298193002
Cr-Commit-Position: refs/heads/master@{#415645}
perja
bluetooth: Added script for converting the Web Bluetooth blacklist.
BUG=570121

Review-Url: https://codereview.chromium.org/2285663002
Cr-Commit-Position: refs/heads/master@{#415594}
fs
Don't add redundant references to animated target element
SVGSMILElement adds a reference to its target, and any instances of the
target should never be mutated, so the registration of reference to the
extended target element set in SVGAnimateElement::resetAnimatedType does
not add any value.

BUG=640676

Review-Url: https://codereview.chromium.org/2292983002
Cr-Commit-Position: refs/heads/master@{#415393}
fs
Stricter treatment of SVGSVGElement::m_useCurrentView
m_useCurrentView being true implies that m_viewSpec is non-null. Perhaps
defensively, most code that checks it is written in a way such that it
expects that m_viewSpec can be null if m_useCurrentView is true - which
is not the case, and adds unnecessary code.
Instead change the code to adhere to the rule above, and assert that in
the various places instead.
Also add some checks of the invariant in methods that set the flag and
m_viewSpec. Refactor SVGSVGElement::setupInitialView to avoid the need
to sprinkle invariant checks "all over" it.

BUG=110195

Review-Url: https://codereview.chromium.org/2290293003
Cr-Commit-Position: refs/heads/master@{#415346}
fs
Simplify SVGAnimatedTypeAnimator interface
The two methods startAnimValAnimation and resetAnimValToBaseVal share
the same implementation, but are called in two different branches of the
same if-statement. Fold the two and add a new method
createAnimatedValue() to provide the animated value, to make this appear
as straight-forward as it is. Also fold the stopAnimValAnimation()
method since it's only used once, and because this makes the start/stop
action somewhat symmetric.
Rename the constructFromString(...) method to
createAnimatedValueFromString() to illustrate its relation to the newly
minted method and make it a bit more clear what it does.

BUG=640676

Review-Url: https://codereview.chromium.org/2284263002
Cr-Commit-Position: refs/heads/master@{#415271}
fs
Don't use substring() for a simple prefix match
The language code match in SVGTests::isValid() uses String::substring()
to limit the match to the primary language subtag. In the case where the
defaultLanguage() only contains the/a primary language subtag, this will
not require a copy, but otherwise it would.

Using startsWith() and a length-check guarantees that no copies will be
made. (A valid primary language subtag is always 2 letter long, so
checking only for length == 2 should be enough, although previously the
code could theoretically match a 1 letter, or even a zero-length tag.)

Review-Url: https://codereview.chromium.org/2284273002
Cr-Commit-Position: refs/heads/master@{#415255}
fs
Tighten SVGAnimationElement::shouldApplyAnimation
Fold the targetIsUsable(...) helper from SVGAnimateElement into said
method, and then replace the uses of the former with the corresponding
'should apply' predicate.

BUG=640676

Review-Url: https://codereview.chromium.org/2287983002
Cr-Commit-Position: refs/heads/master@{#415253}
rune
Removed unused parentStyle in StyleAdjuster.
Parent style not used for HTML element adjustment.

Review-Url: https://codereview.chromium.org/2290623002
Cr-Commit-Position: refs/heads/master@{#415235}
fs
Tidy up some loops in SMILTimeContainer::updateAnimations
Use for-range style loops and get rid of the local 'size' variable.
Also move the sort() call down after the early-out when there are no
animations to apply.

BUG=641437

Review-Url: https://codereview.chromium.org/2287973002
Cr-Commit-Position: refs/heads/master@{#415165}
fs
Reorder the AnimatedPropertyType enumeration
By moving AnimatedUnknown first (giving it the ordinal value 0), we can
simplify SVGElement::animatedPropertyTypeForCSSAttribute by removing
the contains() call (avoiding a double hash/lookup for the common case.)

Review-Url: https://codereview.chromium.org/2288583002
Cr-Commit-Position: refs/heads/master@{#415069}
fs
Hoist updateAnimation() calls from SVGSMILElement::progress
The updateAnimation() calls in SVGSMILElement::progress() corresponds
to the timed element contributing to the animation "sandwich", so it's
trivial to hoist it out into the caller. Well there, the |resultElement|
logic can be replaced with a vector onto contributing timed elements are
appended. When all contributing timed elements are collected the value
is computed.

BUG=641437

Review-Url: https://codereview.chromium.org/2283843002
Cr-Commit-Position: refs/heads/master@{#414937}
rune
Allow multiple type and id selectors in invalidation set features.
:-webkit-any allows for more than one type selector in a compound
selector. Likewise, it may also allow for disjunct id selectors. Make
them vectors in InvalidationSetFeatures like we do for classes and
attributes to make style invalidation work for multiple id and type
selectors in :-webkit-any.

R=ericwilligers@chromium.org,sashab@chromium.org
BUG=641296

Review-Url: https://codereview.chromium.org/2284633002
Cr-Commit-Position: refs/heads/master@{#414933}
fs
Reduce 'iterate self and instances' helper-count in SVGElement.cpp
Generalizing updateInstancesAnimatedAttribute{,NoInvalidate} to one
higher-level helper to get rid of the subtle differences brought on
by the differences in invalidation semantics.

BUG=640676

Review-Url: https://codereview.chromium.org/2280923002
Cr-Commit-Position: refs/heads/master@{#414845}
fs
Fold SMIL animation value application helpers and simplify
Folds the following helper functions:

  applyCSSPropertyToTargetAndInstances
  removeCSSPropertyFromTargetAndInstances
  notifyTargetAndInstancesAboutAnimValChange

into their users, hoisting common predicates and simplifies
accordingly.

BUG=640676

Review-Url: https://codereview.chromium.org/2285473002
Cr-Commit-Position: refs/heads/master@{#414808}
fs
svg/animations/use-animate-width-and-height.html no longer time out
TBR=schenney@chromium.org
NOTRY=true
BUG=641398

Review-Url: https://codereview.chromium.org/2279263003
Cr-Commit-Position: refs/heads/master@{#414801}
fs
Move onclick handler in svg/animations/use-animate-width-and-height.html
We can no longer listen after events on something that is an instance in
a <use>. Move the executeTest() call to the <use> element instead.

Since the mentioned file is almost a stub, the actual change is in
svg/animations/script-tests/use-animate-width-and-height.js.

BUG=641398

Review-Url: https://codereview.chromium.org/2283893002
Cr-Commit-Position: refs/heads/master@{#414776}
fs
Fix clip-path reference box/coordinate space setup for hit-testing
Synchronize hit-testing code with rendering code with regards to how the
coordinate space is handled (for userSpaceOnUse <clipPath>s), and how
the reference boxes is computed.

Also "straighten" out code-flow a bit while here.

BUG=418484
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2280963002
Cr-Commit-Position: refs/heads/master@{#414730}
wdzierzanowski
Bundle fake Widevine component manifest for stub CDM
Encrypted media browser tests involving Widevine use the stub CDM when
branding != Chrome.  This change allows them to register the
preinstalled component containing the stub CDM.

BUG=622273

TEST=Widevine browser tests 'browser_tests --gtest_filter=*Widevine*' pass

Review-Url: https://codereview.chromium.org/2136983002
Cr-Commit-Position: refs/heads/master@{#414706}
jwalczak
Fix channel mapping for 8-ch audio in ffmpeg_aac_bitstream_converter
FFmpeg's AVCodecContext->channels contains "raw number of channels"
(e.g. "2" for 2 channels, "8" for 8 channels). The change ensures that:
- the value of "8" is correctly mapped to 0b111 ADTS channel
config (aka MPEG-4 Channel Configuration),
- the value of "7" becomes unsupported.

BUG=640610

Review-Url: https://codereview.chromium.org/2273203003
Cr-Commit-Position: refs/heads/master@{#414685}
rune
Use AnalyzedStyleUpdate for non-blocking sheets.
For no apparent reason we were always doing a full document recalc when
finishing loading a non-blocking stylesheet.

From webkit: https://bugs.webkit.org/show_bug.cgi?id=119236

BUG=284142

Review-Url: https://codereview.chromium.org/2278803002
Cr-Commit-Position: refs/heads/master@{#414682}
fs
Move animVal invalidation from SVGAnimateElement to SVGElement
BUG=640676

Review-Url: https://codereview.chromium.org/2281643003
Cr-Commit-Position: refs/heads/master@{#414543}
fs
Remove temporary file that was accidentally checked in
This file was added as part of https://codereview.chromium.org/2211473003
but looks like it was done so by mistake. Remove it again.

TBR=fdoray@chromium.org
BUG=616447

Review-Url: https://codereview.chromium.org/2276423002
Cr-Commit-Position: refs/heads/master@{#414467}
rune
Use LocalStyleChange for insertion point inheritance propagation.
For shadow dom v0, we used a SubtreeStyleChange for propagating
inherited style changes through insertion points to distributed nodes.
LocalStyleChange should suffice. We already use LocalStyleChange in the
HTMLSlotElement case.

We still need to use SubtreeStyleChange where we have a
SubtreeStyleChange/Force from further up the tree like:

<host>
  <:shadow-root>
    <style>.a::content * { background: green }</style>
    <div id="a">
      <content></content>
    </div>
  </:shadow-root>
  <div>Green when #a gets class a.</div>
</host>

R=kochi@chromium.org
BUG=638869

Review-Url: https://codereview.chromium.org/2258793003
Cr-Commit-Position: refs/heads/master@{#414386}
fs
Refactor SMIL animation value updates
Push updating of the animation value into SVGElement. This resembles the
Web Animations code-path to some degree and maybe we can make them even
more similar eventually. This is the first CL in a series that will
remove knowledge of <use>/shadow trees from the SMIL animation code.

BUG=640676

Review-Url: https://codereview.chromium.org/2272033002
Cr-Commit-Position: refs/heads/master@{#414366}
fs
Simplify SMIL animation CSS property updates
After https://codereview.chromium.org/2251073002 we should no longer
need to walk any <use> instances "manually", since setNeedsStyleRecalc
does that already. This should also avoid the potential double-work
because of this.

TEST=svg/W3C-SVG-1.1/animate-elem-30-t.svg
TEST=svg/W3C-SVG-1.1/animate-elem-40-t.svg

BUG=166438,355359,484552,637310

Review-Url: https://codereview.chromium.org/2270363004
Cr-Commit-Position: refs/heads/master@{#414358}
ingemara
Move JNI bindings for url_formatter from chrome to //components/url_formatter
By moving the url_formatter methods out of
org.chromium.chrome.browser.UrlUtilities to it's component, other emdedders than
Chrome can benefit from the Java version.

This CL removes the tests originally written for a Java implementation of the
methods replaced by FormatUrlForSecurityDisplay in
https://codereview.chromium.org/1357563002. It's not trivial to move the tests
over to the component as they depend on native library initialization performed
by //content which is disallowed in components/url_formatter/DEPS. Also, the
tests are redundant as the code is thoroughly tested by other means.

Currently there are no users of formatUrlForDisplay() in Chromium, but Opera
would like it exposed.

BUG=624407

Review-Url: https://codereview.chromium.org/2110543004
Cr-Commit-Position: refs/heads/master@{#414356}
rune
Consider pseudo classes as matching for shared style rejection.
The user action pseudo classes rely on affectedBy bits to be correctly
set on ComputedStyle in order to recalculate style for such changes
later on. If two elements may otherwise share style, but will have the
affectedBy bits set differently, they may not share style.

Example:

  <style>[attr]:hover {}</style>
  <div></div>
  <div attr></div>

The second div may share style with the first one when none of them is
hovered. However, matching the selector against the first div will fail
on the attribute selector before we try to match :hover, hence the flag
for affectedByHover will not be set. If we share that ComputedStyle
object with the second div, hovering the second div later will have no
effect.

Instead we always match :hover/:active/:focus/:-webkit-drag when
matching rules for style sharing (attribute and sibling rules). That
will lead to the attribute selector in the example above to match which
will cause style sharing to be rejected for the second div.

R=meade@chromium.org
BUG=639561

Review-Url: https://codereview.chromium.org/2272683002
Cr-Commit-Position: refs/heads/master@{#414221}
fs
Use border-box as the reference box for (-webkit-)clip-path
The 'clip-path' property should use the border box as the reference box
(per default; <geometry-box> not yet supported) [1].
The new behavior matches WebKit and Gecko (except for inline boxes,
see below.)

For inline boxes that span multiple lines we use the union of all the
lines. The test css3/masking/clip-path-reference-box-inline.html added
to track this behavior.

[1] https://drafts.fxtf.org/css-masking-1/#the-clip-path

BUG=418484
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2273733002
Cr-Commit-Position: refs/heads/master@{#414118}
mstensho
Don't skip column set interval tree search for flow thread offset == 0.
We cannot assume that offset 0 is in the first column set, since the first
column set may be empty.

Review-Url: https://codereview.chromium.org/2274683002
Cr-Commit-Position: refs/heads/master@{#413939}
mstensho
Update test that rendered incorrectly because orphans and widows are now 2 by default.
The test and the ref were rendered identically (so no failure was reported),
but the result was wrong according to the pass condition text.

Change the ref to not use multicol, to reduce the risk of something like this
going unnoticed in the future.

BUG=473509

Review-Url: https://codereview.chromium.org/2271633002
Cr-Commit-Position: refs/heads/master@{#413789}
markuso
Implement device::BatteryStatus support for UPower daemon 0.99.x
The org.freedesktop.UPower API was changed when upgrading the UPower daemon
from version 0.9.23 to 0.99.x. The BatteryStatusManagerLinux used the
"Changed" signal which was replaced by the "PropertyChanged" signal.

Change the BatteryStatusManagerLinux to use the new UPower API
(and keep compatibility with the 0.9.23 version, which is still used in
Ubuntu 14.04 LTS).

1. use dbus::PropertySet: the dbus::PropertySet provides simple access to
the properties and connection to the property-changed notifications.

2. Use UPower method GetDisplayDevice:
The 'DisplayDevice' is a composite battery device. That was added in UPower
version 0.99.0. If we don't get that device or if it is no battery, then we
continue to enumerate all devices.

3. Listen to 'DeviceAdded' and 'DeviceRemoved' signals:
Re-enumerate battery devices if a device is added/removed.

4. Compatibility with UPower version < 0.99
Only old UPower versions need to connect to the 'Changed' signal.

5. Rewrite the existing unittests to use a BatteryStatusManagerLinux instance
with a dbus::MockBus and mock the dbus-methods/properties for the test.
Add more unittests:
- for changing device properties
- for the DisplayDevice
- for enumerating devices
- for the DeviceAdded and DeviceRemoved signals

Review-Url: https://codereview.chromium.org/2066503002
Cr-Commit-Position: refs/heads/master@{#413745}
fs
Refactor ClipPathHelper in PaintLayerPainter.cpp for reuse
Separate out client concerns and move the helper class to a new file and
rename it to ClipPathClipper. This will allow sharing this code between
the PaintLayerPainter and SVGPaintContext code-paths.

BUG=633028
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2265123002
Cr-Commit-Position: refs/heads/master@{#413518}
landell
Use base::SizeTToString instead of std::to_string
std::to_string is disallowed by the chromium code style and we get into trouble with a custom mips toolchain that lacks support.

BUG=

Review-Url: https://codereview.chromium.org/2264993002
Cr-Commit-Position: refs/heads/master@{#413513}
fs
More const LayoutObject references in SVGLayoutSupport
BUG=633028

Review-Url: https://codereview.chromium.org/2265113002
Cr-Commit-Position: refs/heads/master@{#413501}
fs
Drop outdated comment in SVGClipPainter.h
This FIXME/comment can no longer be considered relevant. (Dates back
to when similar methods to prepareEffect/finishEffect lived in the
LayoutSVGResourceContainer hierarchy.)
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2261173003
Cr-Commit-Position: refs/heads/master@{#413479}
tommyt
Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt
This change enables the stopNotifications function for remote GATT
characteristics on Android. In order to do so, two distinct refactorings have been done;

1) The session classes have been simplified so that platform specific versions are no longer required. All code that previously used BluetoothGattNotifySession[Mac|Win|BlueZ] now simply use the base BluetoothGattNotifySession class.

2) BluetoothRemoteGattCharacteristic::StartNotifySession and StopNotifySession have been rewritten so that all the code for keeping track of the different session objects and the notification state sits in the base class. Inheriting classes should no longer override these two functions, but instead override the much simpler SubscribeToNotifications and UnsubscribeFromNotifications.

BUG=584370

Committed: https://crrev.com/d41af3adfd8500c81c827ab03ed2736909cf1ee8
Review-Url: https://codereview.chromium.org/2051333004
Cr-Original-Commit-Position: refs/heads/master@{#412498}
Cr-Commit-Position: refs/heads/master@{#413417}
fs
Replace SMILTime with double for elapsed time in SMILTimeContainer
We don't really make use of of the special properties of SMILTime for
this case, and using double means slightly less impedance mismatching.

BUG=631879

Review-Url: https://codereview.chromium.org/2261443002
Cr-Commit-Position: refs/heads/master@{#413345}
fs
Don't schedule a wake-up if the timeline hasn't started
Before the timeline has started we shouldn't update animations. This
makes resume() symmetric with pause().

BUG=631879

Review-Url: https://codereview.chromium.org/2254303005
Cr-Commit-Position: refs/heads/master@{#413336}
fs
Refactor SMILTimeContainer can-schedule-frame predicate
begin() and updateAnimationsAndScheduleFrameIfNeeded() use the same
predicate to check if they should schedule an animation frame - although
they phrase it slightly differently (because of local knowledge.)
Move the generic version to a canScheduleFrame() method and use that in
both cases.

BUG=631879

Review-Url: https://codereview.chromium.org/2257803002
Cr-Commit-Position: refs/heads/master@{#413328}
fs
Simplify time tracking in SMILTimeContainer
Instead of 5 difference time fields, use two - one to track the last
seek/pause time in the container ("presentation time"), and one to
track the document time corresponding to that.
Use two bool flags for tracking 'paused' and 'started' state.

Also straighten out code-flow in SMILTimeContainer::begin() to make it
a bit more obvious that we're essentially mirroring the contents of
updateAnimationsAndScheduleFrameIfNeeded. begin() is also renamed into
start(). Pass double to SMILTimeContainer::scheduleAnimationFrame, do
some ASSERT->DCHECK transformations when touching code and touch up
some comments.

BUG=631879

Review-Url: https://codereview.chromium.org/2248643003
Cr-Commit-Position: refs/heads/master@{#413283}
sigbjornf
Avoid stack allocating StyleSheetCollections.
StyleSheetCollection is a GarbageCollected<>-derived object, which ideally
shouldn't be allocated on the stack (== outside the heap), as it leaves
the door open for it being attempted marked (and traced), which it the
allocation doesn't support (the allocation has no header information
preceeding it.)

R=
BUG=

Review-Url: https://codereview.chromium.org/2096653004
Cr-Commit-Position: refs/heads/master@{#413088}
rune
Remove unused StyleChangeReasons.
The removed reasons are no longer used because they have been replaced
by using invalidation sets.

R=kouhei@chromium.org

Review-Url: https://codereview.chromium.org/2256233002
Cr-Commit-Position: refs/heads/master@{#413034}
fs
Avoid setting timers from SVGImage::resetAnimation()
When resetting the timeline to t=0, we may up generating syncbase
notification, which sets up a timer (to update any possibly dependent
intervals.) Since resetAnimation() is what's called when the (SVG)Image
no longer has any clients, we should try to make sure it is indeed
idle after that happens. This avoids trying to update animation state
while the image is otherwise dead, leaving "reactivation" to the time
it is next painted.

BUG=627418

Review-Url: https://codereview.chromium.org/2247783003
Cr-Commit-Position: refs/heads/master@{#412798}
tsniatowski
gn: make gn gen preserve import statements passed in --args
Previously, gn gen would expand all imports and only record the final
arg keyvalue pairs in args.gn, if called as gn gen --args='import...'.

Now the actual import statement will be recorded. This allows avoiding
a manual args.gn edit of you want an actual import statement there, for
example if the imported gni houses a predefined set of default args
that you want to follow, and want to re-gn when it changes.

R=brettw@chromium.org,dpranke@chromium.org
BUG=588513

Review-Url: https://codereview.chromium.org/2250623004
Cr-Commit-Position: refs/heads/master@{#412687}
mostynb
remove duplicate atk GN config
The atk GN configs were moved to a separate GN file in
https://codereview.chromium.org/1909273002 but it appears
that the original configs were not removed, and are still
referenced.  Let's remove the old configs and just use
the new ones.

And while we're at it, add an assertion to check that glib
is enabled when atk is.

BUG=632297

TBR=agrieve@chromium.org

Review-Url: https://codereview.chromium.org/2251673004
Cr-Commit-Position: refs/heads/master@{#412680}
rchlodnicki
Make sure there is no crash on parsing empty manifest
Changes match the logic in SourceHighlighter in the same file and will
result in UI showing message akin to 'No source file available'. This is fine
as already the same happens for other source files in bundled extensions.

BUG=627896

Review-Url: https://codereview.chromium.org/2245143004
Cr-Commit-Position: refs/heads/master@{#412556}
mstensho
"Inline" auto-positioned out-of-flow objects are affected by pagination struts.
An out-of-flow positioned object that "belongs" to a line may need to adjust
its block position after the line has been laid out, since the line may have
been pushed to the next fragmentainer by a pagination strut.

BUG=291616

Review-Url: https://codereview.chromium.org/2249853007
Cr-Commit-Position: refs/heads/master@{#412546}
tommyt
Implement BluetoothGattNotifySession::Stop on Android
This change enables the stopNotifications function for remote GATT
characteristics on Android. In order to do so, two distinct refactorings have been done;

1) The session classes have been simplified so that platform specific versions are no longer required. All code that previously used BluetoothGattNotifySession[Mac|Win|BlueZ] now simply use the base BluetoothGattNotifySession class.

2) BluetoothRemoteGattCharacteristic::StartNotifySession and StopNotifySession have been rewritten so that all the code for keeping track of the different session objects and the notification state sits in the base class. Inheriting classes should no longer override these two functions, but instead override the much simpler SubscribeToNotifications and UnsubscribeFromNotifications.

BUG=584370

Review-Url: https://codereview.chromium.org/2051333004
Cr-Commit-Position: refs/heads/master@{#412498}
mstensho
Handle auto-positioned out-of-flow objects inside multicol containers correctly.
We used to get it all wrong for out-of-flow children of multicol containers
whose containing block were on the outside of the multicol container. Those
do not live in the flow thread coordinate space, so we have to convert their
location to visual coordinates.

BUG=291616

Review-Url: https://codereview.chromium.org/2250713002
Cr-Commit-Position: refs/heads/master@{#412375}
mostynb
-fno-auto-profile is only available beginning with stock GCC 5
This followup to https://codereview.chromium.org/2198253002
unbreaks stock GCC 4.8/4.9 builds.

(We suspect that the chromeos GCC 4.9 toolchain has a local patch for this feature.)

BUG=629593

Review-Url: https://codereview.chromium.org/2244983002
Cr-Commit-Position: refs/heads/master@{#412267}
mstensho
Correct offsetLeft and offsetTop calculation for column-span:all.
adjustedPositionRelativeTo() handled multicol incorrectly (the calls to
columnOffset()), which was especially hurtful for spanners. We should only call
it on objects in our containing block chain. This means that we need to walk
the ancestry using container() instead of parent(). The container() of a
spanner is the multicol container. We need to skip the inbetween flow thread,
since it only contains column content, and not spanners.

We also had bugs here with absolutely positioned objects inside multicol
containers whose containing block are on the outside of the multicol container,
but that's not really going to matter until we're able to lay out such objects
correctly. That's bug 291616. As such, this CL is also a preparatory patch for
fixing that bug.

This CL will also make it possible to write check-layout.js tests for spanners,
instead of having to resort to reftest or something even lesser.

BUG=563446

Review-Url: https://codereview.chromium.org/2251443002
Cr-Commit-Position: refs/heads/master@{#412255}
rune
Corrected :nth-child invalidation test description.
R=ericwilligers@chromium.org

Review-Url: https://codereview.chromium.org/2242113002
Cr-Commit-Position: refs/heads/master@{#411950}
rune
Ignored title in shadow should cause StyleSheet.title = null.
https://github.com/w3c/webcomponents/issues/535#issuecomment-239437022

R=hayato@chromium.org

Review-Url: https://codereview.chromium.org/2239353002
Cr-Commit-Position: refs/heads/master@{#411942}
rune
Use invalidation sets for nth invalidations.
Invalidate siblings of inserted/removed elements for :nth type changes
by scheduling a descendant invalidation set on the parent node of the
inserted element.

There is currently one such set for all structural pseudo classes with
the exception of :first-child, :last-child, and :only-child, which have
their own sets and may have so since they can't affect arbitrary
siblings.

The descendant set never has invalidatesSelf since it's scheduled on
the parent node of where the actual change happens.

Structural pseudo classes in the righmost compound adds rightmost
compound features to the descendant set:

  .a:nth-child(3n) {} => adds ".a" to the descendant set.

Righmost compound structural pseudo classes where there are no other
features makes the descendant set have wholeSubtreeInvalid since all
siblings where the mutation happens have to be invalidated:

  :nth-child(3n) {} => setWholeSubtreeInvalid()

Sibling selectors turns into descendant features:

  :nth-child(3n) + .a {} => adds ".a" to the descendant set.

Descendant selectors causes features to be added as normal:

  :nth-child(3n) .a {} => adds ".a" to the descendant set.

This approach isn't super optimal since having a rightmost structural
pseudo without other features in the compound will cause nth-
invalidations to still be full subtree invalidations, but it should be
a good first iteration.

What we could do is something along the lines of what sibling
invalidations do where they have a maximum number of siblings a set
applies to. The nth-invalidation where the pseudo is in the rightmost
compound really needs to invalidation all siblings and not their
descendants. We could have some notion of removing descendant sets
which should no longer apply walking down the tree.

Traversing siblings scheduling invalidation sets on them was not chosen
for the same reason we schedule siblings invalidations as descendant
invalidations on the parent node for sibling mutations already.

R=esprehn@chromium.org,ericwilligers@chromium.org
BUG=624277

Review-Url: https://codereview.chromium.org/2235723002
Cr-Commit-Position: refs/heads/master@{#411647}
mstensho
Need to roll back the multicol machinery state when re-laying out a block child.
If a block child contains a column spanner, and we need to re-lay it out
because the initial logical top estimate turned out to be wrong, we need to
roll back to the first column set that "contains" the block child.

Otherwise, LayoutMultiColumnFlowThread::columnSetAtBlockOffset() may return the
wrong column set.

BUG=633411

Review-Url: https://codereview.chromium.org/2231383002
Cr-Commit-Position: refs/heads/master@{#411352}
sigbjornf
Elide LifecycleObserver<T,O>::Context type alias.
No longer a need to bind LifecycleObserver<T, O>'s T parameter to a
separate alias/name; simplify to LifecycleObserver<Context, O>.

R=
BUG=

Review-Url: https://codereview.chromium.org/2238503002
Cr-Commit-Position: refs/heads/master@{#411271}
sigbjornf
ASan-exempt CrossThreadPersistentRegion::shouldTracePersistentNode().
CrossThreadPersistent<T>s can reside on heap objects which are lazily
swept. Consequently, when a (per-)thread GC runs and it iterates over the
CrossThreadPersistentRegion to determine what nodes point into its heaps,
it can in the general case also touch lazily sweepable heap objects.

This is a benign read access to a region of memory that Oilpan has poisoned;
therefore, shouldTracePersistentNode() must be exempt from ASan checks to
prevent false negatives from being caught and reported.

R=
BUG=635574

Review-Url: https://codereview.chromium.org/2230623002
Cr-Commit-Position: refs/heads/master@{#410980}
rune
Use elementAfter/Before, not nodeAfter/Before for nth-invalidation.
If the node after/before the inserted element is a text node, and that
text node is the last/first sibling, then it shouldn't prevent the
optimization for skipping recalc for nth/nth-last selectors.

R=esprehn@chromium.org

Review-Url: https://codereview.chromium.org/2228933002
Cr-Commit-Position: refs/heads/master@{#410758}
mstensho
There's no class A break point before or after a float.
LayoutBox::classABreakPointValue() should only be called at class A break
points. Document the assertion there, and make sure that
needsForcedBreakBefore() only calls it when at in-flow objects.

BUG=619152
R=eae@chromium.org

Review-Url: https://codereview.chromium.org/2228803003
Cr-Commit-Position: refs/heads/master@{#410703}
rune
Style invalidation support for :first/last/only-child.
Got rid of SubtreeStyleChanges for those pseudo classes. Also fixed
issue 245914 by looking at next/previous element, not node, to figure
out if we are the first. The code in checkForSiblingStyleChanges could
be restructured quite a bit and made simpler now have changedElement
(changedNode => changeElement since the input is always an element).

BUG=245914

Review-Url: https://codereview.chromium.org/2229503002
Cr-Commit-Position: refs/heads/master@{#410472}
rune
Cached style element sheets may not have an owner node.
The assert for cacheability of shared StyleSheetContents required the
ownerNode to be a non-null style element. Referring to and modify a
stylesheet is however possible after the style element has been removed
and the ownerNode set to null. Change the assert to just check for the
two types of cacheability.

This was not triggered by stylesheets not having @media rules since the
cacheability of linked resources would be true and made the assert
true.

Also, made the ASSERT a DCHECK along with the other ASSERTs in the
modified file.

R=meade@chromium.org
BUG=635022

Review-Url: https://codereview.chromium.org/2220863002
Cr-Commit-Position: refs/heads/master@{#410305}
ckulakowski
Initialize MaterialDesignController in NativeThemeMacTest
This is fix for crash (CHECK) in NativeThemeMacTest.SystemColorsExist:
FATAL:material_design_controller.cc(66)] Check failed: is_mode_initialized_

BUG=625642

Review-Url: https://codereview.chromium.org/2120273002
Cr-Commit-Position: refs/heads/master@{#410108}
rune
Revert of Add a fast-path for independent inherited properties (patchset #13 id:240001 of https://codereview.chromium.org/2117143003/ )
Reason for revert:
Caused issues 634254 and 633859.

Original issue's description:
> Add a fast-path for independent inherited properties
>
> Add a fast-path for inherited properties which do not depend on and do
> not affect any other properties on ComputedStyle. When these properties
> are modified in a parent element, set them directly on ComputedStyle and
> skip doing a full recalc for elements only affected by this change.
>
> Also implemented two of these properties: visibility and pointer-events,
> storing an extra 2 bits per ComputedStyle. This increases the size of
> ComputedStyle by 1 byte on Windows and some Android builds (due to
> aligned fields), which increases the memory usage for a standard page
> with ~1000 elements by up to 1kb (although potentially up to 4/8kb on
> 32/64 bit builds due to packing, although this depends on the allocator
> implementation details) but realistically less since style sharing only
> creates one ComputedStyle object for each unique style.
>
> Benchmarks show a speed increase of up to 2x for setting these
> properties on the root element of a typical web page (Facebook, Twitter,
> Pinterest, Amazon, Wikipedia) and letting the change propagate directly
> onto the child ComputedStyle objects, rather than doing a full style
> recalc.
>
> Initial Benchmarks:
> https://docs.google.com/spreadsheets/d/1mUuJEs8cPWyNTR7tQw27oxq6fDTvWiAwgatf_g--B4w/edit#gid=1597242813
>
> Follow-up Benchmarks:
> https://docs.google.com/spreadsheets/d/1mUuJEs8cPWyNTR7tQw27oxq6fDTvWiAwgatf_g--B4w/edit#gid=918856082
>
> BUG=622138
>
> Committed: https://crrev.com/f24dba9f04dd093aac4298378c671ecd44d0fe97
> Cr-Commit-Position: refs/heads/master@{#409143}

TBR=esprehn@chromium.org,meade@chromium.org,timloh@chromium.org,sashab@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=622138

Review-Url: https://codereview.chromium.org/2213223004
Cr-Commit-Position: refs/heads/master@{#410030}
ljagielski
SSLPolicy::OnCertError: expired_previous_decision might be used uninitialized.
BUG=

Review-Url: https://codereview.chromium.org/2219463002
Cr-Commit-Position: refs/heads/master@{#409918}
hugoh
Remove unused includes of shell::InterfaceRegistry
This is a follow-up to:
https://codereview.chromium.org/2201183003/

Review-Url: https://codereview.chromium.org/2207873002
Cr-Commit-Position: refs/heads/master@{#409776}
rune
Use weak members to cache StyleSheetContents.
We used the client count to detect if we could remove a
StyleSheetContents from the StyleEngine cache or not. The problem is
that the client references are removed when the element is removed from
the DOM, but the StyleSheetContents is still referenced from the
CSSStyleSheet which is accessible from CSSOM. That caused bugs with
StyleSheetContents being marked as mutable without removing it from the
cache causing assertions, and mutating the sheet without copy-on-write
because we thought we only had a single client for the contents.

Instead use weak members in the cache and let garbage collection delete
the StyleSheetContents when no longer referenced. Also, add a flag to
StyleSheetContents to say that it is referenced by multiple sheets when
we use and already cached object instead of incorrectly relying on
client count.

R=timloh@chromium.org,haraken@chromium.org
BUG=633210,628488

Review-Url: https://codereview.chromium.org/2205843003
Cr-Commit-Position: refs/heads/master@{#409495}
tmoniuszko
Add option to not generate VS projects for targets deps
BUG=589099

Review-Url: https://codereview.chromium.org/2200123002
Cr-Commit-Position: refs/heads/master@{#409489}
rune
Removed unused accessor for StyleResolver::m_features.
R=timloh@chromium.org

Review-Url: https://codereview.chromium.org/2207693003
Cr-Commit-Position: refs/heads/master@{#409458}
mostynb
make use of existing gn args in net/BUILD.gn
BUG=632297

Review-Url: https://codereview.chromium.org/2188043002
Cr-Commit-Position: refs/heads/master@{#409209}
mostynb
make use of the use_gio gn arg
BUG=632297

Review-Url: https://codereview.chromium.org/2190793002
Cr-Commit-Position: refs/heads/master@{#409204}
mostynb
make use of existing gn args in ui build config
BUG=632297

Review-Url: https://codereview.chromium.org/2185163003
Cr-Commit-Position: refs/heads/master@{#409203}
sigbjornf
Have ResizeViewportAnchor derive from GarbageCollected<> only.
Drop use of GarbageCollectedFinalized<>; not needed for this
class.

R=
BUG=

Review-Url: https://codereview.chromium.org/2192373002
Cr-Commit-Position: refs/heads/master@{#408888}
sigbjornf
Remove unused function template overloads.
Leftover from r408135, remove the generated isT(*RefPtr<T>)
overloads also.

R=
BUG=

Review-Url: https://codereview.chromium.org/2201633002
Cr-Commit-Position: refs/heads/master@{#408887}
sigbjornf
Move DOMConvenienceAPI to stable.
Move ChildNode.{before,after,replaceWith}() +
ParentNode.{prepend,append}() to stable.

R=
BUG=255482

Review-Url: https://codereview.chromium.org/2184223004
Cr-Commit-Position: refs/heads/master@{#408582}
sigbjornf
Remove unnecessary eager finalization of PingLoaders.
A PingLoader instance controls its own lifetime, releasing its
self-keepalive reference upon completion of the load request. At that
time it also lets go of its loader object (and stops the timer), hence
there's no need to eagerly finalize this object -- it serves no real
purpose.

R=
BUG=

Review-Url: https://codereview.chromium.org/2180423005
Cr-Commit-Position: refs/heads/master@{#408417}
sigbjornf
Update and fix sendBeacon() redirect behavior.
Refresh the implementation to follow the specification changes in

 https://github.com/w3c/beacon/pull/33
 https://github.com/w3c/beacon/pull/34

In particular, correctly flag a CORS-disallowed redirect as not to
be followed by WebURLLoader.

R=
BUG=628762

Review-Url: https://codereview.chromium.org/2177383006
Cr-Commit-Position: refs/heads/master@{#408380}
mostynb
harfbuzz-ng: make use of the use_glib gn arg
BUG=632297

Review-Url: https://codereview.chromium.org/2187163002
Cr-Commit-Position: refs/heads/master@{#408370}
mostynb
make use of use_gconf & use_glib gn args in content/browser/
Review-Url: https://codereview.chromium.org/2191733002
Cr-Commit-Position: refs/heads/master@{#408362}
mostynb
power_save_blocker_x11.cc depends on dbus
Review-Url: https://codereview.chromium.org/2189523004
Cr-Commit-Position: refs/heads/master@{#408275}
fs
Move platform/ParsingUtilities.h to wtf/text/
Review-Url: https://codereview.chromium.org/2175123002
Cr-Commit-Position: refs/heads/master@{#408249}
mostynb
(gcc) fix compilation of os_exchange_data_provider_aurax11.cc
This fixes a gcc compilation error in os_exchange_data_provider_aurax11.cc:
error: cannot convert 'ret' from type 'std::unique_ptr<ui::OSExchangeDataProviderAuraX11>'
    to type 'std::unique_ptr<ui::OSExchangeDataProviderAuraX11>&&'

Tested with gcc 4.8.4.

Followup to https://codereview.chromium.org/2179813003

BUG=614037

Review-Url: https://codereview.chromium.org/2192533002
Cr-Commit-Position: refs/heads/master@{#408233}
sigbjornf
Remove unused function template overloads.
R=
BUG=

Review-Url: https://codereview.chromium.org/2182213005
Cr-Commit-Position: refs/heads/master@{#408135}
mostynb
(gyp): breakpad_host should push include_dirs to dependents
Followup to https://codereview.chromium.org/2169063002

BUG=internal b/30003601
TBR=thestig@chromium.org

Review-Url: https://codereview.chromium.org/2183613003
Cr-Commit-Position: refs/heads/master@{#407758}
fs
Disable svg/parser/whitespace-length-invalid-1.html
TBR=mpearson@chromium.org
BUG=630967

Review-Url: https://codereview.chromium.org/2178993003
Cr-Commit-Position: refs/heads/master@{#407580}
sigbjornf
Simplify ElementVisibilityObserver implementation.
Recast ElementVisibilityObserver's VisibilityCallback in a more
Blink-like manner by way of a Client interface. Thereby also addressing
on-off-heap cycle, a leak source.

Similarly, simplify the connection between ElementVisibilityObserver and
IntersectionObserver -- have the former directly implement the
IntersectionObserverCallback instead of indirectly using closure callbacks.

R=
BUG=627539

Review-Url: https://codereview.chromium.org/2173353002
Cr-Commit-Position: refs/heads/master@{#407450}
sigbjornf
Remove unnecessary finalization of IDBObserver classes.
Re-apply r402117 which r404283 accidentally reverted.

R=
BUG=609934

Review-Url: https://codereview.chromium.org/2177083002
Cr-Commit-Position: refs/heads/master@{#407418}
fs
Don't resolve non-local -webkit-clip-path references as local
Whether the reference was local or not was disregarded, meaning that
any URL with a valid fragment part could potential result in a valid
clip - regardless of whether it was local or not. I.e foo.svg#bar would
reference an element with the id 'bar' in the local document.

Check if the URL reference resolver flagged the reference as being local,
and only pass a non-null fragment if it was.

BUG=629826

Review-Url: https://codereview.chromium.org/2174813003
Cr-Commit-Position: refs/heads/master@{#407300}
fs
Make fragment-only URLs always be document-local references
This implements the 'local url' handling per:

  https://drafts.csswg.org/css-values/#local-urls

which is also referenced from:

  https://svgwg.org/svg2-draft/linking.html#linkRefAttrs

Most of the logic is handled by a new helper class named
SVGURLReferenceResolver, which keeps state, resolves the URL
and extracts the fragment identifier as needed.

BUG=470608

Review-Url: https://codereview.chromium.org/2174833002
Cr-Commit-Position: refs/heads/master@{#407299}
fs
Reland of Remove platform/text/ParserUtilities.h
platform/ParsingUtilities.h caters to the same needs, so transition
users of skipString(...) to skipToken(...) and remove
platform/text/ParserUtilities.h.

Review-Url: https://codereview.chromium.org/2176623003
Cr-Commit-Position: refs/heads/master@{#407259}
fs
Remove platform/text/ParserUtilities.h
platform/ParsingUtilities.h caters to the same needs, so transition
users of skipString(...) to skipToken(...) and remove
platform/text/ParserUtilities.h.

Review-Url: https://codereview.chromium.org/2176623003
Cr-Commit-Position: refs/heads/master@{#407187}
fs
Resolve URL/target reference at a single point in SVGUseElement
The <base> URL can change between the attribute (href) is updated and
the shadow tree constructed. This causes confusion in the target
resolving code since it can produce different results at different
points in time.
Only resolve the URL on changes (to 'href'), extract the fragment
identifier and store whether the reference is local or not.
Refactor the SVGUseElement target element lookup with an eye to
future handling of "fragment-only" (local) URLs.
This makes the externalDocument in
SVGURIReference::targetElementFromIRIString unused, so remove that
codepath and simplify the function accordingly.

This changes behavior from resolving the URL and target element when
needed (depending on when layouts happen), to only when the 'href' is
mutated. This new behavior matches Edge, but not Gecko.

BUG=601203, 470608

Review-Url: https://codereview.chromium.org/2173453002
Cr-Commit-Position: refs/heads/master@{#407128}
fs
Merge CSSSVGDocumentValue with CSSURIValue
These two CSSValue classes are used to represent the same semantic,
which is a reference to an element by means of a "url(...)" function.
CSSSVGDocumentValue carries additional state to be able to handle
references to external documents, by caching a DocumentResource.

Move all the DocumentResource state to CSSURIValue, while also keeping
the naming of the URL string (m_url). Also do some minor cleanup, for
instance by removing "SVG" from the cachedSVGDocument() method name and
dropping some unnecessary .get()s.

This bloats CSSURIValue a bit for the cases where the DocumentResource
is not utilized, but this bloat will be reduced (in relative terms) with
future developments. On the "pro"-side is naturally that we now don't
have to extend two CSSValue classes with additional functionality and
state.

BUG=470608, 405315

Review-Url: https://codereview.chromium.org/2165833006
Cr-Commit-Position: refs/heads/master@{#407126}
tsniatowski
Use absolute namespace references in //base/logging.h macros
Macros can be used in various namespace contexts, and macros that expand
to "logging::Something" can end up choosing some_namespace::logging
if used in a context wher ethere exists a nested namespace logging with
a conflicting name like LogMessage. It's fixable by using "::logging::"
instead of "logging::" in the macros.

No examples of such issues in chrome, but this can help downstream and
seems a good thing to do consistently.

BUG=

Review-Url: https://codereview.chromium.org/2045203004
Cr-Commit-Position: refs/heads/master@{#406910}
mostynb
rebaseline huge-image-viewport-scale.html
This test was not being run with correctly initialized
preferences, and an invalid baseline.  This fixes the
initialization, and rebaselines the test.

This is a prerequisite of https://codereview.chromium.org/2155273002/

BUG=331654, 464295

Review-Url: https://codereview.chromium.org/2163953002
Cr-Commit-Position: refs/heads/master@{#406679}
mostynb
Remove WebContents::InsertCSS since it is unused
This looks like it hasn't been used since CL923463003 landed
over a year ago.

BUG=331654

Review-Url: https://codereview.chromium.org/2157153002
Cr-Commit-Position: refs/heads/master@{#406656}
fs
Simplify URL-resolving in targetElementFromIRIString
Use Document::completeURL for URL resolving, rather than using
String::substring et.c to reproduce essentially the same code.
Use KURL::fragmentIdentifier and friends to extract the fragment
identifier.

Fold urlFromIRIStringWithFragmentIdentifier into its only user.
Open-code isExternalURIReference in targetElementFromIRIString, since we
already have the URL resolved and ready.

BUG=470608

Review-Url: https://codereview.chromium.org/2170453002
Cr-Commit-Position: refs/heads/master@{#406578}
fs
Simplify "is external URL" in filter operations resolving
We've already resolved the URL, so we might as well just use
equalIgnoringFragmentIdentifier on that rather than potentially
re-resolve and compare. No functional change.
Eventually we'll need to have the URL resolved before style resolution.

BUG=470608, 405315

Review-Url: https://codereview.chromium.org/2167733002
Cr-Commit-Position: refs/heads/master@{#406574}
mharanczyk
Fix uninitialized variable in PrefServiceSyncable class.
Review-Url: https://codereview.chromium.org/2165943002
Cr-Commit-Position: refs/heads/master@{#406571}
fs
Only flag the LayoutObject on CSP error if one is attached
When instantiating a plugin through the (somewhat special) code-path
that does not require a LayoutObject to be present, we would end up
dereferencing a null-pointer if a CSP error was flagged, failing the
plugin load sequence.

BUG=627694

Review-Url: https://codereview.chromium.org/2162473003
Cr-Commit-Position: refs/heads/master@{#406295}
rchlodnicki
[net-internals] Fix JS exception on stopping capturing while in Capture view
Store a map of link enabled states so that we can use it to enable next
visibile view on hidding active view. Map is ordered so it works to iterate it.

BUG=616382
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2121763002
Cr-Commit-Position: refs/heads/master@{#405942}
mostynb
gyp: url_mojom should be a hard_dependency
The url/url.gyp:url_mojom target depends on url_interfaces_mojom,
which generates header files, and sets itself as a
hard_dependency.  Thhat hard_dependency status is not propagated
to url_mojom. Let's add it explicitly.

Review-Url: https://codereview.chromium.org/2153093002
Cr-Commit-Position: refs/heads/master@{#405794}
tmoniuszko
Fix TouchSelectionControllerImpl tests failing with DPI=125%
Make textfield a bit larger so text fits it when system DPI is set to 125%.

Fixes following tests:
TouchSelectionControllerImplTest.DoubleTapInTextfieldWithCursorHandleShouldSelectText
TouchSelectionControllerImplTest.SelectRectCallbackTest
TouchSelectionControllerImplTest.SelectRectInBidiCallbackTest
TouchSelectionControllerImplTest.SelectionInBidiTextfieldTest
TouchSelectionControllerImplTest.SelectionInTextfieldTest

BUG=626264

Review-Url: https://codereview.chromium.org/2120353003
Cr-Commit-Position: refs/heads/master@{#405743}
mfiglarowicz
Fix invalidating the text track indexes after append or remove text track from the list
There was a trivial bug in 'for' loop which iterates through the array
indexes but always uses the initialisation value of the iterator instead of
real value of the iterator.

BUG=

Review-Url: https://codereview.chromium.org/2144543002
Cr-Commit-Position: refs/heads/master@{#405709}
kolczyk
In ChromeVox Next, create a text edit handler on "LoadComplete" if there is already a focused text field in order not to miss the initial value change on such.
BUG=628110
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2151763003
Cr-Commit-Position: refs/heads/master@{#405704}
wdzierzanowski
Reland of "Fix build of Widevine CDM stub on Mac"
The combination of 'branding=Chromium' and 'enable_widevine=1' causes
'widevinecdm' to be a 'shared_library' build of the CDM stub.
Additionally combined with 'mac_strip_release=1', this triggers
'strip_save_dsym', which fails, because it doesn't support
'product_dir'.

This fix does to 'widevinecdm' what has already been done to
'clearkeycdm': Split the target into 'widevinecdm_binary' which builds
and strips the stub binary, and 'widevinecdm' which just copies the
binary.

This CL relands https://codereview.chromium.org/2117343005/ with the
following change:

The new 'widevinecdm_binary' target is now defined conditionally for the
case when it is really needed, to fix the ninja error "multiple rules
generate WidevineCdm/_platform_specific/win_x86/widevinecdm.dll".

BUG=622282

TEST='build/gyp_chromium -Gconfig=Release -Dbranding=Chromium -Denable_widevine=1 -Dmac_strip_release=1 && ninja -C out/Release widevinecdm' is successful

Review-Url: https://codereview.chromium.org/2149233003
Cr-Commit-Position: refs/heads/master@{#405635}
sigbjornf
Drop unnecessary finalization of NavigatorShare::ShareClientImpl.
R=
BUG=

Review-Url: https://codereview.chromium.org/2151803002
Cr-Commit-Position: refs/heads/master@{#405488}
wdzierzanowski
Fix build of Widevine CDM stub on Mac
The combination of 'branding=Chromium' and 'enable_widevine=1' causes
'widevinecdm' to be a 'shared_library' build of the CDM stub.
Additionally combined with 'mac_strip_release=1', this triggers
'strip_save_dsym', which fails, because it doesn't support
'product_dir'.

This fix does to 'widevinecdm' what has already been done to
'clearkeycdm': Split the target into 'widevinecdm_binary' which builds
and strips the stub binary, and 'widevinecdm' which just copies the
binary.

BUG=622282

TEST='build/gyp_chromium -Gconfig=Release -Dbranding=Chromium -Denable_widevine=1 -Dmac_strip_release=1 && ninja -C out/Release widevinecdm' is successful

Review-Url: https://codereview.chromium.org/2117343005
Cr-Commit-Position: refs/heads/master@{#405371}
mostynb
fix gyp build after proto_zero_plugin skeleton landed
Followup to https://codereview.chromium.org/2147613002 / crrev.com/2147613002

BUG=608721

Review-Url: https://codereview.chromium.org/2146063003
Cr-Commit-Position: refs/heads/master@{#405330}
mharanczyk
Expose final download URL (actual url after redirects) in the extension API.
BUG=620630

Review-Url: https://codereview.chromium.org/1706193002
Cr-Commit-Position: refs/heads/master@{#404619}
fs
Drop the adding and removing of the 'running' class in SVGTestCase.js
This class will trigger layouts that could hide the intended effects of
the tests using this "framework". Since the same elements are marked as
being hidden, this will not affect the graphical output.

BUG=231560

Review-Url: https://codereview.chromium.org/2104943005
Cr-Commit-Position: refs/heads/master@{#404380}
davve
Fallback to 300x150 instead of 0x0 size for SVG inside content()
Prior to r379801, the fallback 300x150 in SVGImage::dataChanged() was
used. Post r379801 we instead used the empty rect as fallback. Both
are probably wrong but 300x150 matches what we did previously more
closely and we are less likely to end up with an empty image.

BUG=623528

Review-Url: https://codereview.chromium.org/2121973002
Cr-Commit-Position: refs/heads/master@{#404374}
fs
Allow 'alphabetic' for alignment-baseline and dominant-baseline
This keyword is not included in any of the ranges used, so needs to be
mentioned specifically.

BUG=620618

Review-Url: https://codereview.chromium.org/2131483003
Cr-Commit-Position: refs/heads/master@{#404338}
fs
Refine cull rect for SVGInlineTextBox painting
The PaintInfo cull rect can (will) change between paints, so use
the moral equivalent of logicalOverflowRect() to compute a more
accurate cull rect instead.

This fixes under-invalidation in the following tests:

 svg/dynamic-updates/SVGTextElement-dom-lengthAdjust-attr.html,
 svg/dynamic-updates/SVGTextElement-dom-textLength-attr.html,
 svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop.html and
 svg/dynamic-updates/SVGTextElement-svgdom-textLength-prop.html

Exposed by https://codereview.chromium.org/2104943005

BUG=231560

Review-Url: https://codereview.chromium.org/2124553002
Cr-Commit-Position: refs/heads/master@{#404265}
fs
Use the outermost SVG as base when computing offsetX/Y for SVG elements
This reverts the behavior back to what it was prior to
https://codereview.chromium.org/1747223002. In short, the closest
ancestor CSS layout box is used for any SVG element. This will always
be the outermost SVG root (LayoutSVGRoot.)

BUG=624996

Review-Url: https://codereview.chromium.org/2124283002
Cr-Commit-Position: refs/heads/master@{#404217}
fs
Update FilterEffect colorspace on color-interpolation-filters changes
Changes to the 'color-interpolation-filters' property would not get
propagated to any built (cached) filter chains, and hence any future
paints would still use the old chain.
Add support for updating this FilterEffect property down in the filter
primitive element base-class setFilterEffectAttribute, and then make
sure any derived classes forward to it.

BUG=625732

Review-Url: https://codereview.chromium.org/2128193004
Cr-Commit-Position: refs/heads/master@{#404200}
mostynb
gyp: don't build gamepad_platform_data_fetcher_linux.cc when udev is disabled
Fixup after https://codereview.chromium.org/2081583002

BUG=612330

Review-Url: https://codereview.chromium.org/2125223003
Cr-Commit-Position: refs/heads/master@{#404168}
fs
Use the correct bounding rect in SVGInlineTextBox::nodeAtPoint
When writing-mode was unprefixed, SVGInlineTextBoxes started getting the
same treatment as their base-class, and hence we need to be careful when
we consider sizes for the inline boxes.
Use logicalWidth() and logicalHeight() instead of size().

BUG=587455

Review-Url: https://codereview.chromium.org/2124793002
Cr-Commit-Position: refs/heads/master@{#403913}
fs
Consider 'order' when updating feConvolveMatrix 'target*'
SVGFEConvolveMatrixElement's 'targetX' or 'targetY' attribute depend on
'order' for their initial value. When updating the target value of
an instantiated FEConvolveMatrix, order would however not be considered,
instead using the initial value of the attribute (zero.)

Refactor the code a bit to make it easy to consider the correct initial
value even when updating an existing FEConvolveMatrix, introducing
new methods matrixOrder() and targetPoint(). Clean up and simplify
as appropriate.

This fixes the following tests:

 svg/dynamic-updates/SVGFEConvolveMatrixElement-dom-targetX-attr.html
 svg/dynamic-updates/SVGFEConvolveMatrixElement-dom-targetY-attr.html
 svg/dynamic-updates/SVGFEConvolveMatrixElement-svgdom-targetX-prop.html
 svg/dynamic-updates/SVGFEConvolveMatrixElement-svgdom-targetY-prop.html

with https://codereview.chromium.org/2104943005 applied.

BUG=231560

Review-Url: https://codereview.chromium.org/2124583002
Cr-Commit-Position: refs/heads/master@{#403814}
mostynb
remove duplicate friend declaration
This unbreaks GCC builds after https://codereview.chromium.org/2036403002

BUG=587025
TBR=lfg@chromium.org, dcheng@chromium.org

Review-Url: https://codereview.chromium.org/2121953003
Cr-Commit-Position: refs/heads/master@{#403795}
rune
Don't schedule wholeSubtreeInvalid sets.
The StyleInvalidator asserts if we scheduled such sets. Mark element
for SubtreeStyleChange instead.

R=esprehn@chromium.org,ericwilligers@chromium.org
BUG=624607

Review-Url: https://codereview.chromium.org/2106063007
Cr-Commit-Position: refs/heads/master@{#403663}
rune
Skip scheduling sibling invalidation based on direct adjacent count.
When scheduling sibling invalidation sets for sibling insertion/removal
we schedule sets for N preceding siblings where N is the maximum number
of consecutive direct adjacent combinators, or infinite for indirect
adjacent combinators.

However, the further left of the mutation we schedule, the more direct
adjacent combinators are required to affect siblings following the
mutation. The maximum adjacent number is stored for every sibling
invalidation set, which means we can drop scheduling the set if that
count is too low.

Example:

Selectors:

  .a + div + div + span {}
  .b + span {}
  .c + span {}

Siblings:

  div.x div.a div.b div.c div#remove span

When removing #remove we start scheduling sibling invalidations for
div.c which needs at least one adjacent combinator to reach the span or
any subsequent elements. div.b needs at least two, and so on. For the
case above, we schedule the set for .c, but not for .b since the max
adjacent combinator count for .b is 1 and it needs to be at least 2.
.a needs to have at least 3, which is the case, so we schedule the set
for .a. We never consider the div.x element because the max adjacent
combinator count for the document is 3.

R=esprehn@chromium.org
BUG=624782

Review-Url: https://codereview.chromium.org/2116503002
Cr-Commit-Position: refs/heads/master@{#403530}
fs
Relocate tests from fast/svg/ to svg/
Some files are renamed to avoid name clashes on case-insensitive
file-systems:

 svgangle.html  => svgangle-units.html
 svglength.html => svglength-units.html
 svglist.html   => svglist-basic-interface.html

(The last one did not actually clash, but was renamed for easier
 differentiation.)

BUG=625231

Review-Url: https://codereview.chromium.org/2118903003
Cr-Commit-Position: refs/heads/master@{#403511}
fs
Fold fast/svg/script-tests/animation-events.js into the test using it
There's only one test using this "framework", so fold it into the test
itself. Move the result to svg/animation/.

Straight copy of the .js file into the .html file. Whitespace is adjusted
and some redundant things are removed (';' and <div>.)

BUG=625231

Review-Url: https://codereview.chromium.org/2112373002
Cr-Commit-Position: refs/heads/master@{#403510}
sigbjornf
Robustify Internals entry points against detached uses.
Fuzzers generate pointless overhead using these test-only methods from
frame-detached contexts. Add required nullchecks throughout.

Simple test case for each of these entry points (w/ --run-layout-test):

 <a href="javascript:'replaced'" id=anchor>click</a>
 <script>
 anchor.click();
 internals.someMethod();
 console.log('no crash');
 </script>

R=
BUG=624549

Review-Url: https://codereview.chromium.org/2109613007
Cr-Commit-Position: refs/heads/master@{#403421}
rune
0 -> nullptr for UseCounter pointer in CSSParserContext.
I repeatedly find myself looking for constructors taking flags through
unsigned before realizing this is actually a pointer.

Review-Url: https://codereview.chromium.org/2101143005
Cr-Commit-Position: refs/heads/master@{#403256}
fs
Use a converter for -webkit-clip-path
Add StyleBuilderConverter::convertClipPath and use it for computing
the ClipPathOperation.

BUG=610854

Review-Url: https://codereview.chromium.org/2105383002
Cr-Commit-Position: refs/heads/master@{#403153}
rune
Optimize style recalc when adding @keyframes.
We only need to recalculate the elements with running animations unless
we tried to find an @keyframes rule and couldn't, for which we fall
back to a full document recalc.

The motivation for doing this is that the current WIP for issue 567021
shows that we're still getting full document recalcs due to the
presence of @keyframes rules.

R=dstockwell@chromium.org,alancutter@chromium.org
BUG=623911,567021

Review-Url: https://codereview.chromium.org/2105743002
Cr-Commit-Position: refs/heads/master@{#403118}
fs
Wire up invalidation for flood-{color,opacity} on <feDropShadow>
Make sure to call primitiveAttributeChanged() for this element and
property combination. Implement the required infrastructure in
SVGFEDropShadowElement::setFilterEffectAttribute and FEDropShadow.

Because of an issue with SVGTestCase.js the tests below would not
previously fail as expected. That is being addressed by the CL at
https://codereview.chromium.org/2104943005.

TEST=svg/dynamic-updates/SVGFEDropShadowElement-dom-shadow-color-attr.html
TEST=svg/dynamic-updates/SVGFEDropShadowElement-dom-shadow-opacity-attr.html
TEST=svg/dynamic-updates/SVGFEDropShadowElement-svgdom-shadow-color-prop.html
TEST=svg/dynamic-updates/SVGFEDropShadowElement-svgdom-shadow-opacity-prop.html
BUG=231560

Review-Url: https://codereview.chromium.org/2112563002
Cr-Commit-Position: refs/heads/master@{#403025}
fs
Notify context element after changes in SVGPreserveAspectRatioTearOff
Without this the associated LayoutObject will not be notified of the
change.

TEST=svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop.html
TEST=svg/dynamic-updates/SVGImageElement-svgdom-preserveAspectRatio-prop.html
BUG=231560

Review-Url: https://codereview.chromium.org/2108333002
Cr-Commit-Position: refs/heads/master@{#402960}
fs
Move ClipPathOperation.h to core/style/
This is stored as part of ComputedStyle, so style/ seems a better fit
than layout/.

BUG=610854

Review-Url: https://codereview.chromium.org/2108213002
Cr-Commit-Position: refs/heads/master@{#402935}
sigbjornf
Tidy CrossThreadCopier.h inclusion.
This header file declares a set of types as being cross-copiable; avoid
bringing in all of Oilpan for its two cross-thread persistent types.

Tidy up some downstream header files which were implicitly depending on
Oilpan being included here.

R=
BUG=597856, 624419

Review-Url: https://codereview.chromium.org/2104283002
Cr-Commit-Position: refs/heads/master@{#402823}
rune
Schedule sibling invalidation sets for sibling insert/remove.
Invalidation sets have been used only for changes which do not alter the
tree structure, like changing id, class names, other attributes, and
pseudo states. For dom tree changes, style invalidation relies on attach
and detach of the layout tree for the inserted/removed element. For
subsequent siblings of inserted/removed elements, we have been marking
siblings for subtree recalc (when we know we have tried to match
adjacent combinators on one of the siblings before) based on the maximum
number of consecutive direct adjacent combinators or all subsequent
siblings for indirect adjacent combinators.

This CL starts using sibling invalidation sets on siblings instead of
doing subtree recalcs.

The following properties of invalidation sets affected how this
implementation was done:

* Even though we invalidate descendants/siblings based on tag names, we
  don't have invalidation sets for tag names as elements do not change
  tag names dynamically. For inserted/removed elements, we could have
  used invalidation sets for tag names. Take the selector "div + span".
  If we remove a div we could have scheduled an invalidation set for div
  which invalidates a span sibling.

* Invalidation sets for simple selectors and their negated versions, for
  instance ".a" and ":not(.a)", share invalidation sets and they may do
  so because invalidation sets have been applied when they change. That
  is, "a" is either part of old or the new class attribute when the
  invalidation set needs to be scheduled. When removing/inserting
  elements, a selector like ":not(.a) + .b" will need to schedule a
  sibling for ".a" for all elements not having the class "a".

* Consider the selector "* + .a". We have to schedule a sibling
  invalidation for any inserted/removed element to invalidate a sibling
  with class "a". However, invalidation set construction has only
  created an invalidation set for ".a" with the invalidateSelf flag set.

For this CL, we create a single universal sibling invalidation set to
handle the cases above. In fact this CL only do sibling invalidations on
element insert/remove for id, class, and attribute in addition to
scheduling the universal sibling invalidation set. Also, we skip
selector lists (that is, :not() and :-webkit-any() as :host()
:host-context() and :slotted() never match when followed by an adjacent
combinator).

For the following set of selectors:

  :not(.a) + .b + .c
  #x:not(.a) + .d
  div + span
  :-webkit-any(.x) + .f .g

We end up with the following universal sibling invalidation set with the
descendant invalidation set, containing ".g", to the right.

  { .c, span, .f, invalidatesSelf } => { .g }

Note that if a compound contains both :not() and for instance an id
selector, we will not add it to the universal sibling invalidation set
as we can properly invalidate ".d" siblings above using the invalidation
set for "#x".

== Scheduling sibling invalidations

For changes not modifying the tree, we schedule sibling invalidation
sets on the changed element and invalidate the siblings with descendant
sets during the invalidation process. When removing an element, however,
the element is not left in the tree, so we need to associate the
invalidation set with another element.

When we remove an element, we instead schedule the sibling invalidation
set, and the sibling invalidation set's descendant set, as descendant
invalidation sets on the parent element or shadow root.

Likewise for inserting an element. When inserting an element, we have
elements to schedule the sibling sets on, but the sets would need to be
scheduled on elements further to the right in the sibling list in order
to reach the siblings we needed to invalidate. Also, they would have to
be moved further right on subsequent insertions.

== The effect on amazon.com

This CL gets rid of all post-page-load full recalcs before you start
interacting with the page. The full recalcs after you start interacting
needs to be investigated further.

R=esprehn@chromium.org,ericwilligers@chromium.org
BUG=542082

Review-Url: https://codereview.chromium.org/2089063005
Cr-Commit-Position: refs/heads/master@{#402770}
rune
Mark stylesheet as having media queries at consume time.
Marking the stylesheet as having media queries for @media at insertion
time meant we didn't mark the stylesheet when @media was a child rule
of another @-rule like @supports. Instead do the marking from the
consume method like we already did for @font-face rules.

Removed unnecessary marking from insertion methods and an unnecessary
boolean parameter which was always true.

R=timloh@chromium.org
BUG=621502

Review-Url: https://codereview.chromium.org/2081893003
Cr-Commit-Position: refs/heads/master@{#402766}
ckulakowski
Fix for cross compiling 32bit linux on 64bit host machine
Right now when custom sysroot is provided as gn parameter (target_sysroot)
only 32 bit custom sysroot will be used. 64 bit sysroot (which is also needed
by 32 bit build by - for example - protobuf) is expected to be found in default
location. This change adds possibility to provide path to directory containing
both sysroots for linux (32 bit and 64 bit).

BUG=622616

Review-Url: https://codereview.chromium.org/2096323002
Cr-Commit-Position: refs/heads/master@{#402742}
sigbjornf
Handle cross-thread weak persistents during global weak processing.
r401880 changed the handling of weak persistents, clearing
and releasing their underlying PersistentNodes once their
weak references point to otherwise unreferenced objects.

However, performing that weak processing step cannot reliably
be done as part of thread-local weak processing if the
weak persistent is a CrossThreadWeakPersistent<T> (CTWP) as the
object it refers to may reside on a different thread's heap than
where the CTWP resides. If both locations need to be accessed,
doing that as part of thread-local weak processing is too
late and unsafe.

Instead we process the cross-thread weak persistents along with the
'weak cells' during global weak processing. WeakPersistent<>s are
still handled during thread-local weak processing.

R=
BUG=623985

Review-Url: https://codereview.chromium.org/2106863003
Cr-Commit-Position: refs/heads/master@{#402734}
sigbjornf
Disable HeapTest.TraceDeepEagerly for Android targets.
This test is heavy on allocation and considered too slow to be
running w/ asserts enabled. Disable it entirely for Android,
as the overhead is bogging down bots too much.

R=
BUG=623779

Review-Url: https://codereview.chromium.org/2101363002
Cr-Commit-Position: refs/heads/master@{#402470}
sigbjornf
Allow lazy removal of (context) lifecycle observers while stopping.
r402141 imposed the restriction on ContextLifecycleObservers behavior
during stop() notifications of no longer being allowed to remove
observers while handling stop(). That constraint enables iteration
to be handled without allocating a snapshot of the observer set.

That restriction proves too constraining for media elements indirectly
holding onto AssociatedURLLoader objects while being stopped
(see associated bug for info.) Consequently, we allow observer removals
while keeping observer set iteration safe & allocation-free -- removals
are recorded while iterating, and removed in one go afterwards.

This is only done for notifyStoppingActiveDOMObjects(), as the other
notifications over context lifecycle observers do not require this
flexibility.

R=
BUG=623755

Review-Url: https://codereview.chromium.org/2109553002
Cr-Commit-Position: refs/heads/master@{#402445}
sigbjornf
Fix DUMP_NODE_STATISTICS compilation.
R=
BUG=

Review-Url: https://codereview.chromium.org/2099183003
Cr-Commit-Position: refs/heads/master@{#402406}
sigbjornf
Retire http/tests/htmlimports/redirect.html leak exemption.
Back to normal, retire expectation.

TBR=yoichio
BUG=366477
NOTRY=true

Review-Url: https://codereview.chromium.org/2096373002
Cr-Commit-Position: refs/heads/master@{#402152}
sigbjornf
Avoid snapshotting ContextLifecycleObservers when iterating.
To allow safe iteration over the set of ExecutionContext observers,
a snapshot of the set was taken before iterating over it. So as to
allow observers to unregister themselves while being notified.

Apart from PostMessageTimer unregistering itself while being stop()ed,
the ContextLifecycleObservers do not mutate the observer set, hence
we can avoid the snapshot step and iterate directly over the observers.
Attempts to remove an observer while iterating is caught and
asserted for.

As the observer set is a set of weak references, some care is needed
to keep those references strong while iterating. That and other details
surrounding observer iteration is now handled by the auxiliary scope object
LifecycleNotifier<>::IterationScope.

Should the constraint of not being allowed to remove observers while
iterating prove too cumbersome, supporting lazy removal of observers
(post iteration) would be straightforward.

R=
BUG=451132

Review-Url: https://codereview.chromium.org/2094143002
Cr-Commit-Position: refs/heads/master@{#402141}
rune
Move preferred stylesheet set out of active sheet update.
There are two reasons for this:

1. In preparation for async active stylesheet update, in which case
   setting the preferred stylesheet set would otherwise be happening
   too late.

2. Doing it during the active stylesheet update means only the
   alternate stylesheets following the link with the title setting the
   preferred sheet set would be enabled appropriately. crbug.com/621479

This CL is split out of https://codereview.chromium.org/1913833002

R=timloh@chromium.org
BUG=567021,621479

Review-Url: https://codereview.chromium.org/2079303002
Cr-Commit-Position: refs/heads/master@{#402139}
sigbjornf
Remove unnecessary finalization of IDBObserver classes.
IDBObserver and IDBObserverChanges do not need to be finalized,
nor have user-defined empty destructors.

R=
BUG=609934

Review-Url: https://codereview.chromium.org/2098243002
Cr-Commit-Position: refs/heads/master@{#402117}
rune
Don't create m_style for option element in display:none subtree.
Instead create a ComputedStyle on demand in rare data like we do for
other display:none elements. This caused out-of-date computed style for
option elements in display:none subtrees because recalcOwnStyle is
skipped for elements without a parentComputedStyle().

R=tkent@chromium.org
BUG=621965

Review-Url: https://codereview.chromium.org/2095973002
Cr-Commit-Position: refs/heads/master@{#402095}
perja
On Android there is no notification when a device is lost. This change keeps track of when a device was last seen and removes outdated devices.
This was already implemented for OSX and the code has been moved to make it accessible to Android as well.

BUG=581544

Review-Url: https://codereview.chromium.org/1842223003
Cr-Commit-Position: refs/heads/master@{#401940}
sigbjornf
Completely clear weak persistent references.
If weak processing determines that a WeakPersistent<T> is now pointing
to an otherwise unreferenced object, clear out and deallocate its
underlying PersistentNode.

We previously would only clear the persistent reference, but keep the
PersistentNode. This would lead to imprecise counts of live persistents,
potentially triggering false asserts of leaking persistents during thread
termination GCs.

R=
BUG=

Review-Url: https://codereview.chromium.org/2094973002
Cr-Commit-Position: refs/heads/master@{#401880}
fs
Update baselines for svg/text/text-viewbox-rescale.html
Incorporate changes from https://codereview.chromium.org/1920833002.

TBR=pdr@chromium.org
BUG=603956

Review-Url: https://codereview.chromium.org/2085413003
Cr-Commit-Position: refs/heads/master@{#401584}
sigbjornf
gn: add Blink GC plugin options
The Blink GC clang plugin supports a couple of extra options which the
Blink GN configuration does not currently expose. Do so here, but without
depending on the 'flags' script used by the gyp build system
(tools/clang/scripts/blink_gc_plugin_flags.py).

Specifically, this adds the following Blink GN variables:

 - blink_gc_plugin_option_do_dump_graph [ = false ]
     emit JSON-serialized representation of class graph.
 - blink_gc_plugin_option_warn_unneeded_finalizer [ = false ]
     warn of unnecessary destructor usage.

TBR=thakis
BUG=

Review-Url: https://codereview.chromium.org/2097433002
Cr-Commit-Position: refs/heads/master@{#401568}
fs
Update expectations for crbug.com/621915
These tests no longer appear flaky:

 svg/custom/createImageElement2.xhtml
 svg/custom/pointer-events-image.svg
 svg/custom/pointer-events-image-css-transform.svg

TBR=pdr@chromium.org
BUG=621915

Review-Url: https://codereview.chromium.org/2097443002
Cr-Commit-Position: refs/heads/master@{#401566}
sigbjornf
gn: define and use clang_base_path
Replace uses of "//third_party/llvm-build/Release+Asserts"
with the configurable option clang_base_path.

TBR=thakis
BUG=

Review-Url: https://codereview.chromium.org/2088373002
Cr-Commit-Position: refs/heads/master@{#401551}
fs
Fix Mac10.9 baselines for two svg/custom/ tests
Remove incorrect baselines for:

 svg/custom/createImageElement2.xhtml
 svg/custom/pointer-events-image.svg

TBR=pdr@chromium.org
NOTRY=true
BUG=621915

Review-Url: https://codereview.chromium.org/2082253004
Cr-Commit-Position: refs/heads/master@{#401387}
sigbjornf
Add ASan exemption when iterating cross-thread-persistents.
When running a termination GC or tracing, the set/region of live
CrossThreadPersistent nodes are iterated over, checking if the objects
they point to belong to the current thread.

As heap objects can have CrossThreadPersistent<> fields, it is possible
for there to be CrossThreadPersistent nodes which point back to heap
objects about to be swept. When ASan is enabled, the page sweeping takes
care of poisioning all to-be-swept objects first.

The combination of the above two means that persistent iteration can
try to inspect one of these poisoned objects, which will trigger an
ASan error. The persistent will not be further used, as it doesn't
belong to the thread. To accommodate this, we do disable ASan while
performing the object lookup while iterating the CrossThreadPersistent
node set.

R=
BUG=620754

Review-Url: https://codereview.chromium.org/2087253002
Cr-Commit-Position: refs/heads/master@{#401354}
fs
Deflake svg/custom/createImageElement2.xhtml
Need to wait for the image to load before ending the test.

BUG=621915

Review-Url: https://codereview.chromium.org/2086383002
Cr-Commit-Position: refs/heads/master@{#401347}
fs
Deflake svg/custom/pointer-events-image*.svg
Rewrite these two tests (which are essentially the same, modulo a
transform) to first wait for all the images to load, and then perform
all the clicks.

BUG=621915

Review-Url: https://codereview.chromium.org/2088733006
Cr-Commit-Position: refs/heads/master@{#401343}
fs
Update/tighten expectations for crbug.com/552433
Passing after getting updated baselines:

 svg/dom/length-list-parser.html
 svg/transforms/text-with-pattern-with-svg-transform.svg

Failing (a few pixels differ) on Win7 Debug:

 svg/W3C-SVG-1.1/coords-units-02-b.svg

TBR=schenney@chromium.org
BUG=552433

Review-Url: https://codereview.chromium.org/2090553002
Cr-Commit-Position: refs/heads/master@{#401270}
perja
bluetooth: android: removed duplicate restart of scanning.
This is a followup fix to commit 3a38a46. There is no need to restart the search in this callback as this will be done from native code (BluetoothChooserAndroid::SetAdapterPresence).

BUG=543060

Review-Url: https://codereview.chromium.org/2065893002
Cr-Commit-Position: refs/heads/master@{#401257}
mostynb
content/public/common should depend on the mojo_bindings target
Rather than the mojo_bindings_mojom target, which exports sources, and
causes multiple definition errors in component builds.

Followup to https://codereview.chromium.org/2089823002

BUG=622076
TBR=jam@chromium.org,rockot@chromium.org

Review-Url: https://codereview.chromium.org/2088163002
Cr-Commit-Position: refs/heads/master@{#401230}
fs
Common up SVG transform "change detection" (classification)
This moves the transform change classification to a helper class
(SVGTransformChangeDetector) and move
LayoutSVGContainer::TransformChange along with it, renaming it to
SVGTransformChange.

BUG=603956

Review-Url: https://codereview.chromium.org/2086583004
Cr-Commit-Position: refs/heads/master@{#401111}
sigbjornf
Stop PingLoader's cancellation timer early.
If the ping completed, stop the loader's cancellation timer.

R=japhet
BUG=

Review-Url: https://codereview.chromium.org/2083023002
Cr-Commit-Position: refs/heads/master@{#401068}
fs
Reland of "Remove redundant "layout size changed" state from LayoutSVGRoot"
In LayoutSVGRoot::layout, two slightly different "layout size changed"
values are computed - one which is used for propagation to children
via SVGLayoutSupport::layoutSizeOfNearestViewportChanged
(|m_isLayoutSizeChanged|), and one which is used to mark direct
descendant children (local |layoutSizeChanged|).
Ultimately their use is the same though, so only using the more narrow
predicate for both of these cases should yield the same result.
It also has the side-effect of making it more obvious that changes to
layout-size is only of interest when there exist clients of the SVG
root that have relative lengths.

BUG=603956

Review-Url: https://codereview.chromium.org/2065093002
Cr-Commit-Position: refs/heads/master@{#400987}
fs
Rebaseline svg/dom/length-list-parser.html
TBR=schenney@chromium.org
BUG=552433

Review-Url: https://codereview.chromium.org/2083983003
Cr-Commit-Position: refs/heads/master@{#400976}
fs
Rebaseline svg/W3C-SVG-1.1/coords-units-02-b.svg
TBR=schenney@chromium.org
BUG=552433

Review-Url: https://codereview.chromium.org/2088733003
Cr-Commit-Position: refs/heads/master@{#400971}
fs
Rebaseline svg/transforms/text-with-pattern-with-svg-transform.svg
TBR=schenney@chromium.org
BUG=552433

Review-Url: https://codereview.chromium.org/2080243004
Cr-Commit-Position: refs/heads/master@{#400970}
fs
Rebaseline svg/hixie/perf/006.xml
TBR=schenney@chromium.org
BUG=552433

Review-Url: https://codereview.chromium.org/2082963002
Cr-Commit-Position: refs/heads/master@{#400961}
fs
Avoid using forced layout to trigger paint invalidation for SVG containers
Currently, SVG containers in the LayoutObject hierarchy force layout of
their children if the transform changes. The main reason for this is to
trigger paint invalidation of the subtree. In some cases - changes to the
scale factor - there are other reasons to trigger layout, like computing
a new scale factor for <text> or re-layout nodes with non-scaling stroke.

Compute a "scale-factor change" in addition to the "transform change"
already computed, then use this new signal to determine if layout should
be forced for the subtree. Trigger paint invalidation using the
LayoutObject flags instead.

The downside to this is that paint invalidation will walk into "hidden"
containers which rarely require repaint (since they are not technically
visible). This will hopefully be rectified in a follow-up CL.

For the testcase from 603850, this essentially eliminates the cost of
layout (from ~350ms to ~0ms on authors machine; layout cost is related
to text metrics recalculation), bumping frame rate significantly.

BUG=603956,603850

Review-Url: https://codereview.chromium.org/1996543002
Cr-Commit-Position: refs/heads/master@{#400950}
sigbjornf
Delay resetting image animation, if possible.
When the last client of an ImageResource removes itself, the animations
of the image is explicitly reset. That resetting can happen either while
finalizing objects after a GC or as part of other explicit removals of
ImageObserver clients.

Having that reset happen as part of a garbage collection is interacting badly
with code in the middle of updating animations (which happen to trigger a
conservative GC.) So, to avoid introducing such abrupt & harmful resets, delay
the reset'ing until back at the event loop (and the animations update step
having completed.)

R=
BUG=613709, 581546

Review-Url: https://codereview.chromium.org/2004263003
Cr-Commit-Position: refs/heads/master@{#400934}
sigbjornf
Clean up WeakIdentifierMap<> implementation.
Avoid (literal) code duplication between (non)GC versions
of WeakIdentifierMap<>.

Other changes (for the GC version):

  - Do not separately allocate the HeapHashMap<>s, but keep these
    as part objects on WeakIdentifierMap<> instead.
  - Support explicit removal (via notifyObjectDestroyed()).

R=
BUG=

Review-Url: https://codereview.chromium.org/2086643002
Cr-Commit-Position: refs/heads/master@{#400907}
rune
Reject invert for outline-color at parse time.
We don't support invert as outline-color, so we should drop it at parse
time as per spec[1]. Added test to check that the initial value of
outline-color is the computed value of currentColor.

Gecko also drops declarations with invert for outline-color.

[1] https://drafts.csswg.org/css2/ui.html#value-def-invert

R=timloh@chromium.org
BUG=620399

Review-Url: https://codereview.chromium.org/2081633002
Cr-Commit-Position: refs/heads/master@{#400902}
fs
Update baselines for svg/filters/filter-refresh.svg
TBR=pdr@chromium.org
NOTRY=true
BUG=613441

Review-Url: https://codereview.chromium.org/2086713002
Cr-Commit-Position: refs/heads/master@{#400818}
fs
Unprefix the CSS 'filter' property
Parse 'filter' in the same way as '-webkit-filter', and make the latter
an alias of the former.
For SVG content, only the "url(...)" function is allowed still, with the
exception of the outermost <svg> (LayoutSVGRoot), since that "has a box".

Update tests to use 'filter' where reasonable and applicable.

Intent to Ship: https://groups.google.com/a/chromium.org/d/topic/blink-dev/ZVT2kxuFMaA/discussion

Based on https://codereview.chromium.org/1987943002 by noel@chromium.org.

BUG=613441,618160,550249,535786,244295,109224

Review-Url: https://codereview.chromium.org/2065593002
Cr-Commit-Position: refs/heads/master@{#400752}
mostynb
add some missing power_save_blocker gyp deps
Followup to https://codereview.chromium.org/2075153002

BUG=612337, 612563, 257943

Review-Url: https://codereview.chromium.org/2073393002
Cr-Commit-Position: refs/heads/master@{#400723}
mostynb
skip neon intrinsics in libpng when neon is not available
Followup to https://codereview.chromium.org/2021403002

BUG=599917, 618061

Review-Url: https://codereview.chromium.org/2074363002
Cr-Commit-Position: refs/heads/master@{#400714}
sigbjornf
GC plugin: improve error reporting when tracing illegal fields.
Add detection of trace() calls over smart pointer types that either do not
wrap up references to heap objects, or are otherwise not meant to be traced
over. In particular, CrossThread(Weak)Persistent<T> fields are now detected
as being illegal to trace over. Also consider OwnPtr<T>, RefPtr<T> and
std::unique_ptr<T> as illegal to trace over & emit a more concise error
messages for these.

R=
BUG=619149

Committed: https://crrev.com/3ba6089cd6a901b62ff5a0d8f08a2bd818edcbe8
Review-Url: https://codereview.chromium.org/2060553002
Cr-Original-Commit-Position: refs/heads/master@{#399861}
Cr-Commit-Position: refs/heads/master@{#400653}
fs
Revert of Remove redundant "layout size changed" state from LayoutSVGRoot (patchset #1 id:1 of https://codereview.chromium.org/2065093002/ )
Reason for revert:
Possible cause of crbug.com/620228

Original issue's description:
> Remove redundant "layout size changed" state from LayoutSVGRoot
>
> In LayoutSVGRoot::layout, two slightly different "layout size changed"
> values are computed - one which is used for propagation to children
> via SVGLayoutSupport::layoutSizeOfNearestViewportChanged
> (|m_isLayoutSizeChanged|), and one which is used to mark direct
> descendant children (local |layoutSizeChanged|).
> Ultimately their use is the same though, so only using the more narrow
> predicate for both of these cases should yield the same result.
> It also has the side-effect of making it more obvious that changes to
> layout-size is only of interest when there exist clients of the SVG
> root that have relative lengths.
>
> BUG=603956
>
> Committed: https://crrev.com/30770a70834c73670884f0de91bb7624df0ba003
> Cr-Commit-Position: refs/heads/master@{#399791}

TBR=pdr@chromium.org,schenney@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=603956

Review-Url: https://codereview.chromium.org/2071953004
Cr-Commit-Position: refs/heads/master@{#400411}
mostynb
remove leftover forward declaration of OnscreenDisplayClient
BUG=487471
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/2079513002
Cr-Commit-Position: refs/heads/master@{#400267}
sigbjornf
Remove unnecessary MemberHash<> templates.
Directly define the hash traits of all heap reference template types
(Member<T> - or Persistent<T>-derived) in terms of MemberHash<T>,
and avoid introducing ad-hoc templates for these.

Add missing (CrossThread)WeakPersistent<T> hash traits also.

R=
BUG=

Review-Url: https://codereview.chromium.org/2067223005
Cr-Commit-Position: refs/heads/master@{#400155}
joleksy
Align the Mac Omnibox items vertically again
OmniboxViewMac::GetBoldFieldFont() needs to request a bold font, then make it larger. Resource bundle will do the opposite, which makes a large system normal font a non-system bold font. That gives a different baseline to making the non-system bold font larger. And while the omnibox locks the baseline in ApplyTextStyle(), OmniboxPopupCellData does not.

BUG=617144

Review-Url: https://codereview.chromium.org/2068163002
Cr-Commit-Position: refs/heads/master@{#400144}
sigbjornf
GC plugin: improve error reporting when tracing illegal fields.
Add detection of trace() calls over smart pointer types that either do not
wrap up references to heap objects, or are otherwise not meant to be traced
over. In particular, CrossThread(Weak)Persistent<T> fields are now detected
as being illegal to trace over. Also consider OwnPtr<T>, RefPtr<T> and
std::unique_ptr<T> as illegal to trace over & emit a more concise error
messages for these.

R=
BUG=619149

Review-Url: https://codereview.chromium.org/2060553002
Cr-Commit-Position: refs/heads/master@{#399861}
sigbjornf
Allow prolonged CanvasAsyncBlobCreator lifetime, avoid indirect leaks.
Weakly keeping this async object to avoid resource leaks is problematic
(r399445 + r399675), as the object must remain alive until completed.

Undo that experiment and instead keep the object alive until all its
posted tasks have been processed. But for the task that wins and
is processed first, have it clear out the heap references that
would otherwise keep heavy objects alive.

R=
BUG=

Review-Url: https://codereview.chromium.org/2065913003
Cr-Commit-Position: refs/heads/master@{#399856}
fs
Remove redundant isLayoutSizeChanged check in LayoutSVGText::layout
SVGLayoutSupport::layoutChildren takes care to propagate the needs for
metrics updates via the |screenScalingFactorChanged| and
|layoutSizeChanged| arguments.

BUG=603956

Review-Url: https://codereview.chromium.org/2061793003
Cr-Commit-Position: refs/heads/master@{#399796}
fs
Remove redundant "layout size changed" state from LayoutSVGRoot
In LayoutSVGRoot::layout, two slightly different "layout size changed"
values are computed - one which is used for propagation to children
via SVGLayoutSupport::layoutSizeOfNearestViewportChanged
(|m_isLayoutSizeChanged|), and one which is used to mark direct
descendant children (local |layoutSizeChanged|).
Ultimately their use is the same though, so only using the more narrow
predicate for both of these cases should yield the same result.
It also has the side-effect of making it more obvious that changes to
layout-size is only of interest when there exist clients of the SVG
root that have relative lengths.

BUG=603956

Review-Url: https://codereview.chromium.org/2065093002
Cr-Commit-Position: refs/heads/master@{#399791}
asaka
gn BUILD fixes for disabling enable_extensions and use_ash feature flags.
BUG=

Review-Url: https://codereview.chromium.org/1950003002
Cr-Commit-Position: refs/heads/master@{#399693}
sigbjornf
Revert of Remove ineffective PendingScript prefinalizer (2nd attempt.) (patchset #1 id:1 of https://codereview.chromium.org/2060853002/ )
Reason for revert:
Canary crashes reported,

 https://bugs.chromium.org/p/chromium/issues/detail?id=615977#c12

Original issue's description:
> Remove ineffective PendingScript prefinalizer (2nd attempt.)
>
> With the missing case from r397106 aboard, retire the prefinalizer
> for PendingScript. Script loader and runner objects are expected
> to explicitly dispose of these upon success or failure.
>
> R=
> BUG=
>
> Committed: https://crrev.com/fbf7f01ae80f666a5b37acf0ef38fd174443787f
> Cr-Commit-Position: refs/heads/master@{#399504}

TBR=haraken@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.chromium.org/2069573002
Cr-Commit-Position: refs/heads/master@{#399691}
sigbjornf
Have CanvasAsyncBlobCreator's delayed task keep a weak |this| also.
Followup r399445 and dually have the delayed task that's
posted to check if the idle task has gone ahead, also keep
a weak |this| reference. The non-winning CanvasAsyncBlobCreator
posted main thread tasks can safely be cancelled & dropped if
a GC happens to go ahead.

R=
BUG=

Review-Url: https://codereview.chromium.org/2069533002
Cr-Commit-Position: refs/heads/master@{#399675}
robertn
Clear the SharedBuffer when clearing the image
Previously, in the case of the image failing to be decoded, the buffer
was cleared because error() was called. This was changed in the
following patch:

 https://chromium.googlesource.com/chromium/src/+/61e34ff7dd4ac48b8c4275eb3f541ebfb8a50266%5E%21/

The patch changes it so that only clear() is called, which does not
clear the m_data buffer. This patch changes clear() to also clear the
buffer.

BUG=

Review-Url: https://codereview.chromium.org/2060193002
Cr-Commit-Position: refs/heads/master@{#399668}
sigbjornf
gc plugin: remove ScriptWrappable destructor special case.
With Blink having exited its Oilpan transition phase, no need for the
plugin to catch & allow GarbageCollected<>-derived classes that also
derive from ScriptWrappable (but could safely not provide a destructor.)

Remove the unused IsRawPtr(name), IsDummyBase(name) predicates, as well.

R=
BUG=

Review-Url: https://codereview.chromium.org/2061143002
Cr-Commit-Position: refs/heads/master@{#399667}
fs
Rename StyleLayoutData to StyleGeometryData
The term 'geometry' better matches what is stored here (and is also more
in line with the SVG spec chapter [1] that defines most of the properties
here.)
Rename the SVGComputedStyle::layout field to 'geometry' to match.

This is a mechanical rename-only CL, with the exception of some
additional whitespace fixups.

[1] https://svgwg.org/svg2-draft/geometry.html ("Geometry Properties")

BUG=603956

Review-Url: https://codereview.chromium.org/2066563002
Cr-Commit-Position: refs/heads/master@{#399649}
sigbjornf
Remove ineffective PendingScript prefinalizer (2nd attempt.)
With the missing case from r397106 aboard, retire the prefinalizer
for PendingScript. Script loader and runner objects are expected
to explicitly dispose of these upon success or failure.

R=
BUG=

Review-Url: https://codereview.chromium.org/2060853002
Cr-Commit-Position: refs/heads/master@{#399504}
sigbjornf
Have CanvasAsyncBlobCreator speculative idle tasks keep a weak 'this'.
If image encoding should be attempted done via idle tasks,
CanvasAsyncBlobCreator schedules an idle task along with a delayed
task on the main thread to check if the idle task has been scheduled
before too long. If not, the delayed task will handle the encoding
instead (still on the main thread.)

The idle tasks represent opportunistic work, and should not keep the
CanvasAsyncBlobCreator alive until they eventually do get to run.
Consequently, make them keep a weak 'this' reference.

This addresses leaks exposed by r399181.

R=
BUG=
NOTRY=true

Review-Url: https://codereview.chromium.org/2060153002
Cr-Commit-Position: refs/heads/master@{#399445}
sigbjornf
Promptly release cross-thread websocket bridge/proxy references
To prevent other threads using cross-thread persistents from accessing
to-be-finalized websocket Peer and Bridge abstractions, promptly free
them on becoming garbage. Delaying this until lazy sweeping runs risks
(benignly) touching poisoned objects.

R=
BUG=619373

Review-Url: https://codereview.chromium.org/2064633002
Cr-Commit-Position: refs/heads/master@{#399442}
sigbjornf
Move SourceRange and CSSPropertySourceData classes off-heap.
SourceRange is a value/POD class that has no complex
sharing or lifetime handling associated with it. It does not
meet minimal requirements that we've now settled on for when
an object ought to be Oilpan managed -- doesn't have other
heap references nor sharing&lifetime issues that would benefit
from Oilpan use -- hence, we should move it off-heap.

With SourceRange off-heap, a number of classes that package up
SourceRanges in various ways can be converted to off-heap
classes also.

R=
BUG=

Review-Url: https://codereview.chromium.org/2060433002
Cr-Commit-Position: refs/heads/master@{#399428}
sigbjornf
Make trace() over persistents private.
Persistent references register a trace callback with the underlying persistent
node, allowing the Blink GC to trace the persistent root set when marking.

Consequently, there's no need to expose their trace() methods as public
methods. Make them private and thereby disallow calling trace() from
Blink code.

R=
BUG=

Review-Url: https://codereview.chromium.org/2060683002
Cr-Commit-Position: refs/heads/master@{#399423}
sigbjornf
Fix unsafe handling of part object in RuleFeatureSetTest.
The part object needs to be traced; the ad-hoc and unused
trace method used prevented GC plugin detection.

R=
BUG=
NOTRY=true

Review-Url: https://codereview.chromium.org/2063603002
Cr-Commit-Position: refs/heads/master@{#399416}
sigbjornf
Rename and improve "traceable" templates.
The NeedsTracing<T>::value expression would previously return true
if T had a trace() method or T == Member<U>. It would not be
true if T == WeakMember<U>; something that was convenient when
using NeedsTracing<> in connection with hash table backing stores,
needing to determine whether to trace the elements of the table, but
not if they were weak references & delegate that to weak processing.

As NeedsTracing<T> has grown an increasing number of uses besides
the handling of backing store tracing, where exempting WeakMember<>
makes no great sense, it is time to alter its meaning to accommodate
those uses better. And at the same time rename it to follow the various
other predicate templates we provide over types. So,

 NeedsTracing<T> => IsTraceable<T> (includes weak)
 NeedsTracingLazily<T> => IsTraceableInCollection<T> (excludes weak)
 NeedsTracingTrait<Trait> => IsTraceableInCollectionTrait<T>

Along with these changes, tidy up the static_assert() error messages in
a few places.

R=
BUG=

Review-Url: https://codereview.chromium.org/2065443002
Cr-Commit-Position: refs/heads/master@{#399389}
fs
Add use counter for parsing of filter functions with no arguments
Count before deciding the future for this, and related, "features".

BUG=618960

Review-Url: https://codereview.chromium.org/2051233003
Cr-Commit-Position: refs/heads/master@{#399378}
rune
Removed unnecessary mutable in SiblingData.
Seemingly no reason for this mutable anymore.

R=ericwilligers@chromium.org

Review-Url: https://codereview.chromium.org/2057093002
Cr-Commit-Position: refs/heads/master@{#399354}
sigbjornf
Drop unecessary use of CrossThreadPersistent by CanvasAsyncBlobCreator.
The callback object that the CanvasAsyncBlobCreator passes along to a
background thread can be kept as a simple Member<>; no need to
involve CrossThreadPersistent<> and risk inadvertently introducing
leaks.

R=
BUG=

Review-Url: https://codereview.chromium.org/2051993002
Cr-Commit-Position: refs/heads/master@{#399181}
fs
Clamp filter functions {grayscale, invert, opacity, sepia} to 100%
The spec says the following for these functions:

 "Values of amount over 100% are allowed but UAs must clamp the values
  to 1."

So do that rather than failing. This matches the behavior of Gecko and
Edge.

This fixes

http://test.csswg.org/suites/filters-1_dev/nightly-unstable/html/filter-grayscale-005.htm

from the CSS WG Filter Effects testsuite (w/ the property unprefixed.)

BUG=618607

Review-Url: https://codereview.chromium.org/2052883002
Cr-Commit-Position: refs/heads/master@{#399144}
fs
Clean up script-tests in css3/filters
Rewrite the parsing tests using
css-parser/resources/property-parsing-test.js and also use testharness
for the computed style test.

Drop css3/filters/filter-property.html since that is already covered by
the wider parsing tests. Also remove the template html file and inline
the scripts for effect-reference-reset-style-delete-crash.html [1] and
effect-reference-delete-crash.html, clearing out the script-tests sub-
directory.

[1] This test was actually referencing the
    effect-reference-delete-crash.js file, meaning it was a duplicate.

BUG=618607

Review-Url: https://codereview.chromium.org/2055733002
Cr-Commit-Position: refs/heads/master@{#399136}
sigbjornf
Remove unnecessary use of CrossThreadPersistent<>.
The CompositorMutatorImpl object that WebFrameWidgetImpl creates and
controls the lifetime of, should be referenced as a normal Member<>

R=
BUG=

Review-Url: https://codereview.chromium.org/2056833003
Cr-Commit-Position: refs/heads/master@{#399125}
fs
Move ReferenceFilterBuilder::build to FilterEffectBuilder
This function resolves a filter reference and then builds a filter
(sub)DAG for painting. Split it into the two fairly distinct parts,
leaving ReferenceFilterBuilder as a class that only does element
lookup/resolution, while the DAG-building takes place in
FilterEffectBuilder (with a little help from SVGFilterBuilder.)
Use the new function in SVGFilterPainter.

Also pass Element& to ReferenceFilterBuilder::build, and remove a
redundant null-check of ComputedStyle in
PaintLayer::updateOrRemoveFilterEffectBuilder (already checked by
paintsWithFilters and assumed later in the function.)

BUG=109224,533457

Review-Url: https://codereview.chromium.org/2044153002
Cr-Commit-Position: refs/heads/master@{#398866}
sigbjornf
Limit live Document tracking to debug builds.
liveDocumentSet() is only used by a debug entry point, so only extend
it on Document creation in debug builds.

R=
BUG=611702

Review-Url: https://codereview.chromium.org/2052583003
Cr-Commit-Position: refs/heads/master@{#398839}
rune
Make sure CSS agent messages flush before testing.
While working on updating active stylesheets as part of the style and
layout tree update in [1], two inspector tests started failing. The
reason was these tests rely on a console message to trigger a step in
the test after the active stylesheets have been pushed to the inspector
client. But even if the stylesheets were updated in InspectorCSSAgent
before the console message was sent, the console message arrived in the
client before the new active stylesheets. The reason was that the
console message is immediately flushed, while the messages from the
InspectorCSSAgent are lazily flushed from WebDevToolsAgentImpl::
didProcessTask.

I tried to force the active stylesheet update with a forced layout tree
update like this:

  document.documentElement.offsetTop;
  console.log(...);

But, due the console.log message being dispatched first as described
above, I ended up postponing the console.log with a rAF which means it
will run in a later task and the didProcessTask will trigger in between
to flush the active stylesheet message(s).

Note that this was not currently causing any failures. It's done in
preparation for landing changes for 567021 without breaking anything.

Looking at TestExpectations, I noticed crbug.com/597572, which might be
a similar issue.

[1] https://codereview.chromium.org/1913833002/

R=pfeldman@chromium.org,dgozman@chromium.org
BUG=567021

Review-Url: https://codereview.chromium.org/2049283002
Cr-Commit-Position: refs/heads/master@{#398825}
sigbjornf
Mark shouldMarkObject(), arenaForNormalPage() accessors as const.
Also remove some redundant checkHeader() asserts while doing a code
tidying pass.

R=
BUG=

Review-Url: https://codereview.chromium.org/2054673002
Cr-Commit-Position: refs/heads/master@{#398813}
sigbjornf
Simplify contextDestroyed() notifications.
With all lifetime observers now being managed by Oilpan, the
handling of the destruct notification can be made simpler.

R=
BUG=

Review-Url: https://codereview.chromium.org/2045703004
Cr-Commit-Position: refs/heads/master@{#398490}
fs
Drop FilterEffectBuilder::m_referenceFilters
The job of this Vector used to be to keep a reference to the nested
"reference" filters, to avoid them being destroyed. The entire filter
graph/chain is now on the GC heap, and traced via
FilterEffectBuilder::m_lastEffect, so this additional reference is of no
use.

Review-Url: https://codereview.chromium.org/2043013002
Cr-Commit-Position: refs/heads/master@{#398341}
sigbjornf
Clean up markClientsAndObserversFinished().
Simplify transferring a counted element entry from one set to another.

To do so, add generalized version of add() over HashCountedSet that lets
the caller specify a count.

R=
BUG=

Review-Url: https://codereview.chromium.org/2045883002
Cr-Commit-Position: refs/heads/master@{#398275}
mboc
Support underline on Linux again.
BUG=617055

https://codereview.chromium.org/1819753003/ accidentally removed
UNDERLINE style support on Linux. This CL fixes the issue.

Review-Url: https://codereview.chromium.org/2031223003
Cr-Commit-Position: refs/heads/master@{#398102}
rune
Remove unused InspectorFrontend declarations.
There seems to be nothing called InspectorFrontend. Removed unused
forward declarations for it and changed comments to say "frontend"
instead.

R=pfeldman@chromium.org,dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2046433002
Cr-Commit-Position: refs/heads/master@{#398080}
sigbjornf
Remove pre-Oilpan protections from LocalFileSystem.
R=
BUG=

Review-Url: https://codereview.chromium.org/2039713002
Cr-Commit-Position: refs/heads/master@{#398000}
sigbjornf
Improve the HeapListHashSet no-weakness static assert message.
Mention the alternate HeapLinkedHashSet<> if WeakMember<>s are
attempted used with HeapListHashSet<>; for non-trivial reasons,
we only support weakness with the former.

R=
BUG=614112

Review-Url: https://codereview.chromium.org/2034423002
Cr-Commit-Position: refs/heads/master@{#397999}
sigbjornf
Add documentation of SafePointBarrier internal state.
Renamed |m_canResume| to |m_parkingRequested| while doing so,
its (inverted) meaning seems clearer imho in this context.

R=
BUG=

Review-Url: https://codereview.chromium.org/2039793002
Cr-Commit-Position: refs/heads/master@{#397988}
fs
SVGFE{Spot,Distant,Point}LightElement can have non-SVGFE*Lighting parent
Replace ASSERT_NOT_REACHED with a return statement. We already
thoroughly check for valid parent type and only notify them if so.

BUG=518649

Review-Url: https://codereview.chromium.org/2031353002
Cr-Commit-Position: refs/heads/master@{#397941}
fs
Fix Win baselines for r397915
https://chromium.googlesource.com/chromium/src/+/81c0fc6d4

BUG=24826
TBR=robhogan@gmail.com

Review-Url: https://codereview.chromium.org/2040713002
Cr-Commit-Position: refs/heads/master@{#397927}
fs
Fix Win baselines for r397912
https://chromium.googlesource.com/chromium/src/+/59fd991c4

BUG=416535
TBR=chrishtr@chromium.org

Review-Url: https://codereview.chromium.org/2041613002
Cr-Commit-Position: refs/heads/master@{#397926}
sigbjornf
Update thread-local weak processing comments following r397904.
R=haraken
BUG=611702
NOTRY=true

Review-Url: https://codereview.chromium.org/2040703002
Cr-Commit-Position: refs/heads/master@{#397925}
fs
Updated Win10 baselines for SVG shape-rendering tests
 svg/custom/use-referencing-nonexisting-symbol.svg
 svg/custom/shape-rendering.svg

Baselines are the same as the Win7 ones.

TBR=pdr@chromium.org
BUG=614063

Review-Url: https://codereview.chromium.org/2036163002
Cr-Commit-Position: refs/heads/master@{#397923}
sigbjornf
Reset ThreadState weak callback stack before GCing.
In the event a thread gets to participate in more than
one GC before it manages to leave its safe point, clear
out its weak callback stack before initiating a new
GC. Otherwise we risk keeping around weak callbacks to
duplicate or dead objects.

R=
BUG=611702

Review-Url: https://codereview.chromium.org/2036803004
Cr-Commit-Position: refs/heads/master@{#397904}
fs
Reduce LayoutSVGResource*Gradient building dependency on GradientData
The buildGradient() method can just create and return a Gradient instead
of populating the GradientData struct it's being passed.
Also make calculateGradientTransform() use the return value rather than
an out variable, and make it const qualified. Make
platformSpreadMethodFromSVGType static and use Traversal<> sugar in
SVGGradientElement::buildStops.

BUG=614368

Review-Url: https://codereview.chromium.org/2031053004
Cr-Commit-Position: refs/heads/master@{#397763}
rune
Clear media query rulesets on page zoom changes.
Otherwise, resolution media queries won't update properly when page
zoom changes. Changing the deviceScaleFactor already did this. Also,
matchMedia listeners already worked.

BUG=617095

Review-Url: https://codereview.chromium.org/2038793002
Cr-Commit-Position: refs/heads/master@{#397697}
fs
Update Win7 baseline for fast/text/emoji-web-font.html
TBR=bashi@chromium.org
BUG=616969

Review-Url: https://codereview.chromium.org/2033403002
Cr-Commit-Position: refs/heads/master@{#397687}
sigbjornf
Shrink weak hash tables when adding elements, if needed.
Hash tables containing weak references tend to be asymmetrically
handled -- Blink "user code" will add elements to the hash table,
with the garbage collector taking care of removing references
to elements that have no other strong references to keep them
alive. The weak processing of hash tables isn't capable of
shrinking and allocate a new hash table backing store while
running, hence the table entries are only cleared.

Blink code will rarely do manual removals from these
collections, which gives the hash table no opportunity
to actually shrink the capacity of the backing store.
This can lead to hash tables with a very low load factor,
the majority of the entries be deleted and empty slots.

To allow for shrinking to happen over hash tables with
weak references, add() will check if shrinking is required.

R=
BUG=

Review-Url: https://codereview.chromium.org/2034883002
Cr-Commit-Position: refs/heads/master@{#397667}
fs
Revert of Switch WTF::find on LChar to use memchr. (patchset #1 id:1 of https://codereview.chromium.org/1948543004/ )
Reason for revert:
LSAN and MSAN bots appear unhappy:

http/tests/media/media-source/mediasource-is-type-supported.html

crash log for renderer (pid <unknown>):
STDOUT: <empty>
STDERR: =================================================================
STDERR: ==4==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000982af at pc 0x00000045811f bp 0x7fff2f309830 sp 0x7fff2f308fe0
STDERR: READ of size 5006 at 0x6030000982af thread T0 (content_shell)
STDERR:     #0 0x45811e in memchr ??:0
STDERR:     #1 0x3c5c419 in find third_party/WebKit/Source/wtf/text/StringImpl.h:532:9
STDERR:     #2 0x3c5c419 in find third_party/WebKit/Source/wtf/text/StringImpl.h:660:0
STDERR:     #3 0x3c5c419 in find third_party/WebKit/Source/wtf/text/WTFString.h:214:0
STDERR:     #4 0x3c5c419 in find third_party/WebKit/Source/wtf/text/WTFString.h:215:0
STDERR:     #5 0x3c5c419 in parameter third_party/WebKit/Source/platform/ContentType.cpp:50:0
STDERR:     #6 0x8d64b7d in isTypeSupported third_party/WebKit/Source/modules/mediasource/MediaSource.cpp:244:33
STDERR:     #7 0x9251198 in isTypeSupportedMethod ./out/Release/gen/blink/bindings/modules/v8/V8MediaSource.cpp:234:32
STDERR:     #8 0x9251198 in isTypeSupportedMethodCallback ./out/Release/gen/blink/bindings/modules/v8/V8MediaSource.cpp:239:0
STDERR:     #9 0x444b759 in Call v8/src/api-arguments.cc:16:3

(https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Linux_ASAN/24421/layout-test-results/results.html)

Original issue's description:
> Switch WTF::find on LChar to use memchr.
>
> BUG=607208
>
> Committed: https://crrev.com/c9f9af30569ac2cd353e234f569052db6ab436f4
> Cr-Commit-Position: refs/heads/master@{#397568}

TBR=thakis@chromium.org,jbroman@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=607208

Review-Url: https://codereview.chromium.org/2036993002
Cr-Commit-Position: refs/heads/master@{#397664}
fs
Revert of ImageCapture: move mojom from WebKit/public to media/ (patchset #4 id:60002 of https://codereview.chromium.org/2027023002/ )
Reason for revert:
Appears to cause:

imagecapture/getphotocapabilities.html
imagecapture/takephoto.html

to timeout.

(https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Win7/42976/layout-test-results/results.html)

Original issue's description:
> ImageCapture: move mojom from WebKit/public to media/
>
> This CL moves image_capture.mojom from
> {third_party/WebKit/public/platform/modules => media/mojo/interfaces}
> so the generated data types (e.g. PhotoCapabilities{Ptr})
> can be used from both Blink and media/capture locations.
>
> Also capture.gypi is trivially relocated to capture/ folder.
>
> Note that gyp files are -yay!- close to being finally
> removed.
>
> BUG=518807
> CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel,mac_blink_rel,win_blink_rel
>
> Committed: https://crrev.com/64aec45d94682ae3b38c0f1c18ff74cd937ff9b5
> Cr-Commit-Position: refs/heads/master@{#397644}

TBR=dcheng@chromium.org,avi@chromium.org,haraken@chromium.org,rockot@chromium.org,xhwang@chromium.org,dalecurtis@chromium.org,esprehn@chromium.org,mcasas@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=518807

Review-Url: https://codereview.chromium.org/2034003002
Cr-Commit-Position: refs/heads/master@{#397663}
sigbjornf
Sync LeakExpectations following r397405.
TBR=guidou,pkasting
BUG=589802
NOTRY=true

Review-Url: https://codereview.chromium.org/2037613003
Cr-Commit-Position: refs/heads/master@{#397493}
sigbjornf
Adjust representation of liveDocumentSet() to help diagnose instability.
The liveDocumentSet singleton keeps a

 Persistent<HeapHashSet<WeakMember<Document>>,

collection of all the currently live documents. Some crashes are
being reported when this HeapHashSet<>'s weak references are
being processed, indicating that the pointer to the hash table
is misshapen.

To potentially throw some light on how that could come to be,
switch representation to PersistentHeapHashSet<WeakMember<Document>>,
which will keep the hash table wrapper off-heap. That could
help determine if we're dealing with an (Oilpan) heap object
overwrite here.

R=
BUG=611702

Review-Url: https://codereview.chromium.org/2033643003
Cr-Commit-Position: refs/heads/master@{#397436}
sigbjornf
Delay leak reporting until worker in-process proxies have been finalized.
If a document creates a number of workers, terminating these and having
their destruction ripple all the way back to the in-process proxy objects
isn't immediate. But something that needs to complete before the leak
detector can initiate reporting -- an in-process proxy object maintains a
strong reference to the document, and would generate a leak if not
destructed and its garbage having been collected afterwards.

Address the reliability of multi worker shutdown by maintaining a
counter of how many in-process proxy objects are still alive and run
GCs until it drops to zero. Do that at most two times around.

R=haraken,kouhei
BUG=589802, 616714

Review-Url: https://codereview.chromium.org/2026993004
Cr-Commit-Position: refs/heads/master@{#397405}
sigbjornf
Avoid unnecessary uses of GarbageCollectedFinalized<>.
R=
BUG=

Review-Url: https://codereview.chromium.org/2027333003
Cr-Commit-Position: refs/heads/master@{#397402}
mboc
Allow various font weights in gfx. These changes make Chromium's gfx::Font more closely match native font APIs &
capabilities.

BUG=597533
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/1819753003
Cr-Commit-Position: refs/heads/master@{#397368}
fs
Remove expectation for svg/W3C-SVG-1.1/struct-frag-02-t.svg
No longer appears to exhibit the behavior described. Give it a try
again.

TBR=davve@opera.com
BUG=518005,463358

Review-Url: https://codereview.chromium.org/2033663002
Cr-Commit-Position: refs/heads/master@{#397342}
sigbjornf
Delay leak reporting until worker in-process proxies have been finalized.
If a document creates a number of workers, terminating these and having
their destruction ripple all the way back to the in-process proxy objects
isn't immediate. But something that needs to complete before the leak
detector can initiate reporting -- an in-process proxy object maintains a
strong reference to the document, and would generate a leak if not
destructed and its garbage having been collected afterwards.

Address the reliability of multi worker shutdown by maintaining a
counter of how many in-process proxy objects are still alive and run
GCs until it drops to zero. Do that at most two times around.

For documents not creating any workers, monitoring this proxy count
avoids having to perform a third GC, something that was conservatively
done before to address worker shutdown (but not reliably.)

R=haraken,kouhei
BUG=589802

Review-Url: https://codereview.chromium.org/2026993004
Cr-Commit-Position: refs/heads/master@{#397333}
fs
Don't use hasAttribute in SVGFilterPrimitiveStandardAttributes
Use isSpecified() to query for existance in setStandardAttributes. This
avoids triggering unnecessary attribute synchronizations.

While here, drop the "double precondition" checking since the only caller
of this function checks this already.

BUG=235256

Review-Url: https://codereview.chromium.org/2026343002
Cr-Commit-Position: refs/heads/master@{#397202}
sigbjornf
Have detached ScriptLoaders detach their PendingScripts.
A ScriptLoader that has become detached from its document will not
execute the script once the script resource has loaded.

If in such a detached state, make sure the ScriptLoader lets go
of its PendingScript promptly.

R=
BUG=

Review-Url: https://codereview.chromium.org/2028613002
Cr-Commit-Position: refs/heads/master@{#397106}
rune
Adjust color for printing list-item markers as we do for text.
BUG=459022

Review-Url: https://codereview.chromium.org/2027653004
Cr-Commit-Position: refs/heads/master@{#397099}
mostynb
remove unused courgette dep from the content layer
Review-Url: https://codereview.chromium.org/2024693002
Cr-Commit-Position: refs/heads/master@{#396968}
sigbjornf
Restore PendingScript prefinalizer.
Under some as yet unknown conditions, PendingScript objects can become garbage
without having been explicitly detached/disposed of first. Hence restore the
prefinalizer that r396656 removed.

R=
BUG=615977

Review-Url: https://codereview.chromium.org/2021773004
Cr-Commit-Position: refs/heads/master@{#396813}
sigbjornf
Address ThreadHeap::willObjectBeLazilySwept() corner case.
If willObjectBeLazilySwept(object) was used when finalizing an object on a
lazily swept page, and |object| happened to reside on the same heap page,
the predicate would return the wrong result if the object had been swept
past (and it had been deemed to be alive.)

Addressed by adding a special case for querying objects on the same page,
making willObjectBeLazilySwept() precisely determine liveness in the
face of lazy sweeping.

R=
BUG=

Review-Url: https://codereview.chromium.org/2015173003
Cr-Commit-Position: refs/heads/master@{#396798}
sigbjornf
Statically disallow delete' over heap collection objects.
Explicitly deleting heap-allocated heap collection objects isn't
allowed nor meaningful, the garbage collector handles their lifetimes
precisely. The implementation of 'delete' over these collection objects
delegate to a allocator-trait class's free() method, so by not providing
it for heap collection objects, compilation fails if 'delete' is ever
attempted instantiated & used over these objects.

As MSVC performs method instantiation more eagerly, we're unable to
statically catch such inappropriate uses of 'delete' at compile time.
Rely on a run-time NOTREACHED() instead.

R=
BUG=

Review-Url: https://codereview.chromium.org/2021103002
Cr-Commit-Position: refs/heads/master@{#396788}
sigbjornf
Make reallocation of large objects reliable.
If ThreadHeap::reallocate<T>() is called with a size that's
equal or greater to the large object threshold (64k, currently),
make sure it ends up being allocated as a large object.

Large objects would previously be attempted allocated on a normal arena,
hoping that the allocation couldn't be serviced by bump allocation, but
fall into an out-of-line allocation.

R=
BUG=

Review-Url: https://codereview.chromium.org/2019273002
Cr-Commit-Position: refs/heads/master@{#396712}
davve
Tune down debugging emergency for clearAnimatedType() a notch
Fixing re-entrancy into the animation code through the garbage
collector is proving to be a non-trivial task. Since we now know more
about the issue, downgrade the RELEASE_ASSERT to a DCHECK to not
affect more users than necessary while getting this bug sorted out.

BUG=613709

Review-Url: https://codereview.chromium.org/2019223003
Cr-Commit-Position: refs/heads/master@{#396705}
fs
Win7 baseline for svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr.html
TBR=wkorman@chromium.org
BUG=614425

Review-Url: https://codereview.chromium.org/2008553009
Cr-Commit-Position: refs/heads/master@{#396702}
tmoniuszko
Fix Visual Studio warning on single file compilation
BUG=615402

Review-Url: https://codereview.chromium.org/2018733003
Cr-Commit-Position: refs/heads/master@{#396693}
sigbjornf
(Heap)TerminatedArrayBuilders are stack allocated.
HeapTerminatedArrayBuilder is currently only safe if kept on the stack,
restrict it accordingly + have it keep a Member<> reference to the
HeapTerminatedArray it is constructing.

R=tkent,haraken
BUG=

Review-Url: https://codereview.chromium.org/2021713002
Cr-Commit-Position: refs/heads/master@{#396677}
sigbjornf
Turn ResourceLoaderSet into a part object.
The abstraction is really a derived HashSet, so make it
a part object.

(Change done in part to diagnose what appears to be a
heap overwrite involving ResourceLoaderSet.)

R=
BUG=615673

Review-Url: https://codereview.chromium.org/2019903002
Cr-Commit-Position: refs/heads/master@{#396657}
sigbjornf
Tidy PendingScript.
No need for a prefinalizer as ScriptLoader is careful to eagerly and
explicitly dispose of PendingScripts already.

Remove unwanted copy constructor; not needed after PendingScript stopped
being a part object.

R=
BUG=

Review-Url: https://codereview.chromium.org/2023683002
Cr-Commit-Position: refs/heads/master@{#396656}
sigbjornf
Revert of Expand WTF::StringView's API to be more like StringPiece. (patchset #12 id:220001 of https://codereview.chromium.org/2007103003/ )
Reason for revert:
Many a heap-buffer-overflow ASan failures,

 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20ASAN/builds/24329

Original issue's description:
> Expand WTF::StringView's API to be more like StringPiece.
>
> StringView no longer owns the string passed into it, and can now wrap
> a raw ptr to some characters.
>
> This allows us to leverage the inline strlen optimization where the
> compiler will embed the length of literal strings into the binary. It
> also allows the deletion many overloaded methods that used to take
> an LChar*, UChar* or String and can now just take a StringView instead.
>
> For example the two constructors in TextRun are now a single one that
> takes a StringView. This needed to be done in this patch to avoid
> ambiguous constructors.
>
> Future patches will replace CSSParserString with StringView, and also
> vastly simplify the huge number of overloads on various methods. We'll
> also expand the API surface of StringView to include the many useful
> operations that StringPiece has.
>
> BUG=615174
>
> Committed: https://crrev.com/330deea56e27bc760fa52101040a51428bb7f582
> Cr-Commit-Position: refs/heads/master@{#396493}

TBR=haraken@chromium.org,jyasskin@chromium.org,yutak@chromium.org,esprehn@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=615174

Review-Url: https://codereview.chromium.org/2025503002
Cr-Commit-Position: refs/heads/master@{#396641}
sigbjornf
Revert of Remove StringBuilder::appendLiteral. (patchset #1 id:1 of https://codereview.chromium.org/2017053003/ )
Reason for revert:
Will unfortunately have to back out this one so that the revert https://codereview.chromium.org/2025503002/ will cleanly apply.

(Don't want a tree with this many ASan failures over the long weekend.)

Original issue's description:
> Remove StringBuilder::appendLiteral.
>
> We can just rely on the append(StringView) version instead. This does
> mean we have to take 2 branches in some cases, but it should be
> very minimal and since the code is inline the compiler can also
> likely eliminate it.
>
> BUG=615174
>
> Committed: https://crrev.com/04157e8b89881d033f9eeca4466d9dd0c4e9aaea
> Cr-Commit-Position: refs/heads/master@{#396601}

TBR=haraken@chromium.org,yutak@chromium.org,esprehn@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=615174

Review-Url: https://codereview.chromium.org/2017303002
Cr-Commit-Position: refs/heads/master@{#396640}
sigbjornf
Lock CrossThreadPersistentRegion until end of weak processing.
Allocating & releasing a CrossThread(Weak)Persistent is something that
all threads are currently allowed, even those not attached to Oilpan and
having no heap of their own. It is however not safe for the set of
CrossThreadPersistents to be altered while a garbage collection is
underway.

Not just while the set of registered persistents are being marked and
traced, but up until and including the processing of weak (persistent)
references that happen after marking. If not, a thread would be able to
release a CrossThreadWeakPersistent node which the weak processing separately
maintains a pointer to, clearing & freeing its allocation. Which would
cause havoc, hence we impose a lock on CrossThreadPersistentRegion while
the marking and global weak processing is being performed -- any thread
attempting to create or free cross-thread persistents will be locked out
for the duration.

Following r396432, the use of CrossThreadPersistents from non-attached threads
has been reduced greatly and is slight.

R=
BUG=610477

Review-Url: https://codereview.chromium.org/2013173002
Cr-Commit-Position: refs/heads/master@{#396540}
sigbjornf
Move MainThreadTaskRunner off Oilpan heap to simplify posting.
Having the Document's MainThreadTaskRunner on the Oilpan heap
is preferable for three reasons:

 - Correctly accounts for the MainThreadTaskRunner::m_context
   back reference, by having it be traced Member<>.
 - The MainThreadTaskRunner must not perform tasks when
   it (and the Document) is in the process of being swept.
   By having the posted tasks keep a weak persistent reference
   to MainThreadTaskRunner, the Oilpan GC will ensure that
   the weak references will be cleared once MainThreadTaskRunner
   has been deemed garbage.
 - Similarly for the timer-initiated running of a
   MainThreadTaskRunner's pending tasks. The Timer<> abstraction
   takes care of not firing a timer if its owner is an
   Oilpan heap object that's about to be swept.

But it is not without downsides:

 - A CrossThreadWeakPersistent<> has to be created for every
   task closure posted to the main thread, and copying that
   persistent reference around while creating the closure,
   something that is not without overhead.
 - Threads not attached to Oilpan needing to post tasks to
   the main thread will have to create these persistents also.
   Having that happen when a GC is in progress is hard to support,
   as it risks introducing and removing persistent heap references
   in ways that interfere with the GC processing the heap.

The latter point is sufficient reason not to require the
allocation of CrossThreadWeakPersistent<>s when posting main
thread tasks, hence MainThreadTaskRunner is moved off the
Oilpan heap. By doing so, the benefits above that the Oilpan GC
infrastructure provided "for free" have to be taken care of
manually. C'est la vie.

R=
BUG=610477

Review-Url: https://codereview.chromium.org/1938313003
Cr-Commit-Position: refs/heads/master@{#396432}
rogerj
network_time_tracker: Add missing gyp dependencies
Fixup for https://codereview.chromium.org/1835823002.

That CL only added the required dependencies to BUILD.gn. This CL adds
the dependencies to the gyp target as well.

BUG=589700

Review-Url: https://codereview.chromium.org/2006733007
Cr-Commit-Position: refs/heads/master@{#396420}
sigbjornf
Test that failed sync scripts do not block later ones.
If an async=false script fails to load, it must not block later
sync scripts from executing; add missing test coverage.

R=
BUG=614855, 581425

Review-Url: https://codereview.chromium.org/2010983002
Cr-Commit-Position: refs/heads/master@{#396253}
sigbjornf
Tidy up MediaStreamSource details.
Follow up on r396039, undoing some inconsistencies.

R=
BUG=

Review-Url: https://codereview.chromium.org/2010963002
Cr-Commit-Position: refs/heads/master@{#396231}
mstensho
Don't explicitly initialize LayoutUnit to 0.
The default LayoutUnit() constructor sets it to 0. Explicitly passing 0 means
that LayoutUnit::setValue() will be involved, which performs (in this case:
very pointless) saturation checks.

Review-Url: https://codereview.chromium.org/2015523004
Cr-Commit-Position: refs/heads/master@{#396223}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in web/
BUG=614015
TBR=aelias@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2016673002
Cr-Commit-Position: refs/heads/master@{#396162}
mstensho
Remove unnecessary includes from Document.h
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2007343002
Cr-Commit-Position: refs/heads/master@{#396148}
fs
Attempt to deflake svg/custom/animate-initial-pause-unpause.html
The timeout could race with load and that animation timeline start.
Happened at least once in 1000 runs.

Make sure to wait for an animation frame before setting the timer (the
animation timeline has its zero at the time of 'load'.) Also, rewrite
the test to use testharness.js. No failures in 1000 runs.

BUG=350828

Review-Url: https://codereview.chromium.org/2009263002
Cr-Commit-Position: refs/heads/master@{#396147}
mstensho
Remove assorted unnecessary includes in core/paint/
I was mainly looking at inclusions of LayoutObject-derived header files, but
removed some others as well, while I was at it.

BUG=614015
TBR=chrishtr@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2010823002
Cr-Commit-Position: refs/heads/master@{#396037}
fs
Rework timeline/frame scheduling logic for SVGImage
This CL provides the SVGImage/SVGImageChromeClient complex with the
capability of suspending and resuming the frame/animation tick.
This gives us the mechanism required to respond to
ImageObserver::shouldPauseAnimation, as well as stopping the animation
timer from running after the animation has been reset (via
Image::resetAnimation.)
In the context of the bug referenced this means an animating SVG image
will no longer cause wakeups because of (unnecessary) timer activity,
saving power (and CPU time.)

Implement willRenderImage() for the CrossfadeSubimageObserverProxy of
CSSCrossfadeValue so that it will not (falsely) claim that it won't
render its images.

While doing this, try to make a decent functional split between SVGImage
and the associated SVGImageChromeClient by putting all timeline/frame tick
related code in the latter, while keeping code related to the actual
animation/document lifecycle update in the former.

BUG=612540

Review-Url: https://codereview.chromium.org/2000483003
Cr-Commit-Position: refs/heads/master@{#396009}
mstensho
Move ScrollBehavior to ScrollTypes.h, so that ComputedStyle.h doesn't need to include ScrollableArea.h.
BUG=614015

Review-Url: https://codereview.chromium.org/2008343002
Cr-Commit-Position: refs/heads/master@{#395994}
mstensho
Remove assorted unnecessary includes in core/layout/
I was mainly looking at inclusions of LayoutObject-derived header files, but
removed some others as well, while I was at it.

BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2015583003
Cr-Commit-Position: refs/heads/master@{#395993}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/html/
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2008843004
Cr-Commit-Position: refs/heads/master@{#395984}
mstensho
Enums recently moved to separate files should still be in the blink namespace.
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2007423002
Cr-Commit-Position: refs/heads/master@{#395978}
mstensho
ComputedStyle.h doesn't need CSSPrimitiveValue.h if adjustForAbsoluteZoom(int, float) isn't inline.
BUG=614015

Review-Url: https://codereview.chromium.org/2013833002
Cr-Commit-Position: refs/heads/master@{#395943}
mstensho
Move CSSPropertyID templates instantiations to a separate file.
core/CSSPropertyNames.h is needed a lot of places, but the template part there
was only required at a few places.

BUG=614015

Review-Url: https://codereview.chromium.org/2007073003
Cr-Commit-Position: refs/heads/master@{#395941}
mstensho
Move ContentChangeType enum to a separate file, so that WebGLRenderingContextBase.h doesn't need LayoutBoxModelObject.h
BUG=614015
TBR=bajones@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2013603003
Cr-Commit-Position: refs/heads/master@{#395934}
fs
Update baseline for svg/animations/smil-leak-element-instances.svg
This updates the baseline after the change made by
https://codereview.chromium.org/1992663003 (line number added to error
output.)

TBR=pdr@chromium.org
BUG=356900

Review-Url: https://codereview.chromium.org/2007323002
Cr-Commit-Position: refs/heads/master@{#395925}
mstensho
Remove unnecessary includes of LayoutBlock-derived headers.
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2007133003
Cr-Commit-Position: refs/heads/master@{#395904}
mstensho
Remove unnecessary includes from ComputedStyle.h and from its includes.
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2008263002
Cr-Commit-Position: refs/heads/master@{#395889}
mstensho
Remove unnecessary includes from LayoutBox.h, LayoutBoxModelObject.h and LayoutObject.h
Also removed a couple of unnecessary includes from files included via LayoutObject.h

BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2010713002
Cr-Commit-Position: refs/heads/master@{#395877}
mstensho
Move BorderEdgeFlags out of LayoutBoxModelObject.h, so that BoxBorderPainter.h doesn't have to include it.
BUG=614015
TBR=chrishtr@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2010613003
Cr-Commit-Position: refs/heads/master@{#395875}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/frame/
BUG=614015
TBR=dcheng@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2011883002
Cr-Commit-Position: refs/heads/master@{#395872}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/animation/
BUG=614015
TBR=alancutter@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2009583003
Cr-Commit-Position: refs/heads/master@{#395871}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in modules/accessibility/
BUG=614015
TBR=dmazzoni@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2012723003
Cr-Commit-Position: refs/heads/master@{#395870}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/dom/
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2008053002
Cr-Commit-Position: refs/heads/master@{#395864}
mstensho
SnapCoordinator.h doesn't need to include LayoutBox.h
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2010513004
Cr-Commit-Position: refs/heads/master@{#395859}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/editing/
BUG=614015
TBR=yosin@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2009013002
Cr-Commit-Position: refs/heads/master@{#395855}
mstensho
SVGTextContentElement.cpp doesn't need to include LayoutObject.h
BUG=614015
TBR=fs@opera.com,eae@chromium.org

Review-Url: https://codereview.chromium.org/2011603002
Cr-Commit-Position: refs/heads/master@{#395854}
mstensho
HitRegion.cpp doesn't need to include LayoutBoxModelObject.h
BUG=614015
TBR=junov@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2010633002
Cr-Commit-Position: refs/heads/master@{#395852}
mstensho
StyleGeneratedImage.cpp doesn't need to include LayoutObject.h
BUG=614015
TBR=eae@chromium.org

Review-Url: https://codereview.chromium.org/2005353002
Cr-Commit-Position: refs/heads/master@{#395851}
mstensho
WebGLRenderingContext.cpp doesn't need to include LayoutBox.h
BUG=614015
TBR=bajones@chromium.org,eae@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2010623002
Cr-Commit-Position: refs/heads/master@{#395846}
mstensho
Eliminate unnecessary includes and pointless forward declarations in LayoutBlock.h
BUG=614015
TBR=eae@chromium.org,szager@chromium.org,wkorman@chromium.org

Review-Url: https://codereview.chromium.org/2010473002
Cr-Commit-Position: refs/heads/master@{#395845}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/inspector/
BUG=614015
TBR=dgozman@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2002153004
Cr-Commit-Position: refs/heads/master@{#395838}
mstensho
Remove unnecessary inclusions of LayoutObject-derived headers in core/animation/
BUG=614015
TBR=alancutter@chromium.org,eae@chromium.org

Review-Url: https://codereview.chromium.org/2006223003
Cr-Commit-Position: refs/heads/master@{#395832}
sigbjornf
Remove unnecessary HelperResultType trait.
Leftover from Oilpan transition.

R=
BUG=

Review-Url: https://codereview.chromium.org/2015453003
Cr-Commit-Position: refs/heads/master@{#395831}
fs
Attempt to deflake svg/text/obb-paintserver.html
Use the ahem.js script to provide the "Ahem" font.

BUG=362501

Review-Url: https://codereview.chromium.org/2005253002
Cr-Commit-Position: refs/heads/master@{#395819}
mstensho
Move TextAutosizer::Cluster::Cluster() implementation to .cpp.
This way we won't have to include LayoutObject.h in the header.

Also need an explicit ~TextAutoSizer() in the .cpp file now, because
ComputedStyle is only forward-declared in the header file, and TextAutoSizer
has a ComputedStyle RefPtr Vector. The need for this was presumably introduced
by https://codereview.chromium.org/1999343002

BUG=614015

Review-Url: https://codereview.chromium.org/2004313005
Cr-Commit-Position: refs/heads/master@{#395773}
mstensho
Move BackgroundBleedAvoidance definition to a separate file.
This way BoxDecorationData.h doesn't need to include LayoutBoxModelObject.h

BUG=614015

Review-Url: https://codereview.chromium.org/2007673004
Cr-Commit-Position: refs/heads/master@{#395745}
mstensho
Add ScrollEnums.h, so that PaintLayerScrollableArea.h doesn't have to include LayoutBox.h
BUG=614015

Review-Url: https://codereview.chromium.org/2008063002
Cr-Commit-Position: refs/heads/master@{#395702}
sigbjornf
Drop unique audio thread ID requirement.
r391848 introduced the requirement that, once set, the audio thread ID
could not be changed. This is proving too burdensome a constraint to
keep, in case audio device threads do end up being stopped and new
ones created.

While r395182 took care of some cases where audio threads end up
stopping, carefully resetting the recordeed audio thread ID, other
cases remain (see associated bug.) While those could be similarly
handled, precisely tracking the current audio thread ID is proving
to not be worth the overhead. Hence, retire the constraint and let
the audio thread processing a render quantum set its thread ID as
part of executing, irrespective of what audio thread executed
the previous quantum.

This effectively reverts r395182.

R=
BUG=613902

Review-Url: https://codereview.chromium.org/2008903002
Cr-Commit-Position: refs/heads/master@{#395682}
mstensho
Move continuation getter and setter down to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1997033002
Cr-Commit-Position: refs/heads/master@{#395681}
sigbjornf
Gracefully handle dirtying of audio nodes while processing current set.
When processing the set of dirty output nodes, nodes further down the
chain may be marked as dirty as a result. Take that into account
when iterating over the current set.

R=hoch
BUG=610643, 613902

Review-Url: https://codereview.chromium.org/2006883002
Cr-Commit-Position: refs/heads/master@{#395643}
mstensho
Only re-use an anonymous block for continuations if it's contained by a block flow.
Be more strict about what kind of anonymous blocks we allow to be re-used for
continuations. The deprecated flex box implementation would actually let items
of a flexbox form a continuation chain. Continuations should only exist in
block formatting contexts.

This was discovered while attempting to land
https://codereview.chromium.org/1997033002/ , which, it turns out, made some
invalid assumptions about objects being block flows.

BUG=302024

Review-Url: https://codereview.chromium.org/2004363003
Cr-Commit-Position: refs/heads/master@{#395614}
mpawlowski
net::AddressList no longer privately inherits from std::vector
The private inheritance was not only against the style guide, it also
forbade anyone from using a standalone std::vector<net::IPEndPoint>,
since the manually defined AddressList ctor/dtor conflicted with
automatically generated ones for vector<T> instantiation.

This should be considered a first step of refactoring that class.
AddressList is neither a list, nor does it store addresses,
it's a vector of endpoints, so the name is misleading. It
should be changed.

The canonical_name_ member is only currently used in
PepperHostResolverMessageFilter, it's probably not the best idea to keep
it around in a generic class like this. Grepping AddressList reveals 500+
instances in the codeebase, and ony one use of canonical_name() outside
of unit tests. Perhaps a pair<AddressList, string> should be used for
that one particular use-case and a bare AddressList without that extra
member should be used everywhere else.

This "conservative" approach, with employing composition instead of
inheritance and delegating method calls was suggested by Nico Weber and
indeed that meant not having to change anything but the header.

Review-Url: https://codereview.chromium.org/2003973002
Cr-Commit-Position: refs/heads/master@{#395605}
fs
Fix typo in svg/dynamic-updates/SVGFEBlendElement-dom-in2-attr.html
This test is not intended to test error-handling, so add the missing '#'.

https://bugs.webkit.org/show_bug.cgi?id=158017

BUG=614306

Review-Url: https://codereview.chromium.org/2004023002
Cr-Commit-Position: refs/heads/master@{#395597}
rune
Rewrote :empty tests to avoid list-item bug.
Run :empty tests as js-tests instead of layout tree dumps. The issue
causing the original test to be flaky is reported as crbug.com/613957.

R=bugsnash@chromium.org
BUG=610180

Review-Url: https://codereview.chromium.org/2006633002
Cr-Commit-Position: refs/heads/master@{#395582}
ckulakowski
Added missing include to profile_helper.h
profile_helper.h uses ProfileMetrics::ProfileDelete defined in
profile_metrics.h so it should be included. Lack of this include
causes compilation error in our product.

BUG=

Review-Url: https://codereview.chromium.org/2002073003
Cr-Commit-Position: refs/heads/master@{#395573}
mstensho
Declare methods defined in LayoutObjectInlines.h as inline.
This way we'll detect a failure to include LayoutObjectInlines.h during
compilation, rather than during linking.

Test case: Remove inclusion of LayoutObjectInlines.h from LayoutBR.cpp.

See https://codereview.chromium.org/2008503003/ - I initially tried
to simply remove LayoutView.h from LayoutBR.cpp's include list, but
got "strange" linker errors in release builds, since the compiler
thought styleRef(bool) was an actual function, and not an inline.

BUG=614015

Review-Url: https://codereview.chromium.org/2007723002
Cr-Commit-Position: refs/heads/master@{#395558}
sigbjornf
Remove unwanted copyToVector() uses.
If a collection is being cleared while creating an iterable
view of its current contents, swap in an empty collection
rather than copy out the current contents into a temporary
vector (by way of copyToVector().)

R=tkent
BUG=

Review-Url: https://codereview.chromium.org/2004343002
Cr-Commit-Position: refs/heads/master@{#395547}
mstensho
Eliminate unnecessary includes of LayoutBlockFlow-derived headers.
BUG=614015

Review-Url: https://codereview.chromium.org/2008503003
Cr-Commit-Position: refs/heads/master@{#395472}
sigbjornf
Revert InstrumentingAgents back to being GarbageCollected<>.
Unnecessary to have this class be finalized, so switch back to
GarbageCollected<>.

R=
BUG=

Review-Url: https://codereview.chromium.org/2003033002
Cr-Commit-Position: refs/heads/master@{#395446}
tsniatowski
Fix a generated header build flake in //media/base/android
BUG=

Review-Url: https://codereview.chromium.org/2004813003
Cr-Commit-Position: refs/heads/master@{#395421}
mstensho
Move LineLayoutState forward declaration to LayoutBlockFlow.
And the friend declaration was unnecessary.

BUG=302024

Review-Url: https://codereview.chromium.org/2007543002
Cr-Commit-Position: refs/heads/master@{#395352}
mstensho
Move LayoutInline forward-declaration to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/2005813003
Cr-Commit-Position: refs/heads/master@{#395350}
davve
Apply scoped_ptr -> std::unique_ptr conversion to comment
date_time_picker_client_ is a std::unique_ptr now.

R=avi
NOTRY=true

Review-Url: https://codereview.chromium.org/2003963002
Cr-Commit-Position: refs/heads/master@{#395331}
sigbjornf
Split out Members, Persistents and SelfKeepAlive in separate headers.
Complete the migration of definitions out of Handle.h, adding new
header files for the family of Member<> types that Oilpan supports.
Similarly for Persistent<> and its variants, and the SelfKeepAlive<>
abstraction.

To further prune Handle.h, let go of the unused ScopedDisposal (light)
abstraction.

R=
BUG=

Review-Url: https://codereview.chromium.org/1999363002
Cr-Commit-Position: refs/heads/master@{#395318}
sigbjornf
Revert of MediaCaptureFromElement: add support for audio captureStream(). (patchset #6 id:760001 of https://codereview.chromium.org/1599533003/ )
Reason for revert:
The layout tests added are flakily crashing on various bots,

 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Leak/builds/19683
 https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux/builds/65000

Original issue's description:
> MediaCaptureFromElement: add support for audio captureStream().
>
> This CL extends support for capturing the audio part of
> a <video> or <audio> tags ( "capture" here means creating
> a MediaStream out of the HTMLElement)
>
> It introduces an HtmlAudioCapturerSource is-a AudioCapturerSource
> wrapped into an ExternalMediaStreamAudioSource to produce data
> towards the audio track.
>
> HtmlAudioCapturerSource also plugs into the
> WebMediaPlayer's WebAudioSourceProviderImpl to get
> a copy of the audio being rendered.
>
> Unit tests are added, and the existing LayouTests
> revamped (and split into several files for clarity).
>
> BUG=569976, 575492
>
> TEST= run chromium with
>  --enable-blink-features=MediaCaptureFromVideo
>  against e.g.
> https://rawgit.com/Miguelao/demos/master/videoelementcapture.html
>
> Committed: https://crrev.com/77d0d446e58afbf7fab215113fcf9fe9c97e94e3
> Cr-Commit-Position: refs/heads/master@{#395205}

TBR=esprehn@chromium.org,avi@chromium.org,dalecurtis@chromium.org,haraken@chromium.org,miu@chromium.org,mcasas@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=569976, 575492
NOTRY=true

Review-Url: https://codereview.chromium.org/2007433002
Cr-Commit-Position: refs/heads/master@{#395298}
sigbjornf
Unify and provide one IsGarbageCollectedType<T> implementation.
Phase out the need and use of the older blink::IsGarbageCollected<T>
template, and go with the "marker-based" implementation that WTF
provides. But extended slightly to handle mixins without ambiguity +
it will now insist on T's definition being in scope when used so as to be
able to function reliably.

That latter change requires a few uses of collection types (vectors,
hash maps) to be adjusted so that the full element type of the collection
is in scope when code using the collection is compiled. The reason for
this constraint is that the collection types stringently checks that
Blink GCed objects aren't kept in off-heap collections.

R=
BUG=

Review-Url: https://codereview.chromium.org/1999343002
Cr-Commit-Position: refs/heads/master@{#395287}
sigbjornf
Tidy AutoplayExperimentHelper.
Remove unused and undefineds.

R=
BUG=

Review-Url: https://codereview.chromium.org/2000023002
Cr-Commit-Position: refs/heads/master@{#395286}
tposluszny
Exclude unit tests depending on FFMPEG, when FFMPEG is not used.
BUG=612164

Review-Url: https://codereview.chromium.org/1978263002
Cr-Commit-Position: refs/heads/master@{#395267}
sigbjornf
Clear DeferredTaskHandler's audio thread ID upon the thread going away.
Tracking the thread ID of the (current) audio thread is needed to both
sanity check that code paths and methods are performed on the expected
thread, and ensure safe operation.

In the rare cases where the recorded audio thread is stopped and
terminated by the embedder, first clear out the associated thread
ID. This is needed should a new thread be subsequently created.

R=
BUG=612127

Review-Url: https://codereview.chromium.org/2001533002
Cr-Commit-Position: refs/heads/master@{#395182}
mstensho
Remove LayoutInline::createAnonymous() - no callers
Review-Url: https://codereview.chromium.org/2001723002
Cr-Commit-Position: refs/heads/master@{#395132}
mstensho
LayoutInline continuation unit test.
Review-Url: https://codereview.chromium.org/2001623002
Cr-Commit-Position: refs/heads/master@{#395111}
mstensho
Keep writing-mode in sync between a column spanner and its placeholder.
Don't exclude LayoutMultiColumnSpannerPlaceholder (which is just a LayoutBox)
in propagateStyleToAnonymousChildren(). There was an optional requirement for
the child to be LayoutBlock or better, but there really doesn't seem to be
any point in doing this. We no longer create anonymous LayoutInline objects,
ever, anyway (will file a separate CL to remove some unneeded support code
for that in LayoutInline).

All we need to do now is to steer clear of such anonymous objects that have
custom ways of inheriting style. LayoutFullScreen and
LayoutFullScreenPlaceholder were already taken care of. Now that we always
try to propagate style to non-LayoutBlock objects as well, we need to avoid
LayoutListMarker too.

BUG=608123

Review-Url: https://codereview.chromium.org/2000683002
Cr-Commit-Position: refs/heads/master@{#395107}
mostynb
only use kAccessibilityEnabled inside USE_GCONF ifdef blocks
Followup to:
https://codereview.chromium.org/1990453002
https://codereview.chromium.org/1988213002

BUG=486077

Review-Url: https://codereview.chromium.org/1989233002
Cr-Commit-Position: refs/heads/master@{#395047}
sigbjornf
Sync LeakExpectations.
Retire some entries that are no longer leaking.

R=
BUG=506757, 538524, 546132
NOTRY=true

Review-Url: https://codereview.chromium.org/2001563002
Cr-Commit-Position: refs/heads/master@{#395042}
sigbjornf
Eagerly remove disposed DOMTimers as observers upon completion.
Once the coordinator lets go of a timer, no need to keep it
around as an observer of the ExecutionContext.

The previous, reverted, attempt (r392309) detached the DOMTimer too
soon, causing DOMTimer nesting levels to grow without being reset.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/1972663002
Cr-Commit-Position: refs/heads/master@{#395012}
sigbjornf
Graceful idle callback cancellation with invalid IDs.
R=
BUG=613073

Review-Url: https://codereview.chromium.org/1989363005
Cr-Commit-Position: refs/heads/master@{#394768}
mharanczyk
Clean up code and logic related to platform accessibility node destruction.
Review-Url: https://codereview.chromium.org/1987213002
Cr-Commit-Position: refs/heads/master@{#394733}
mstensho
Move m_lineBoxes and its getters down to LayoutBlockFlow.
Added SameSizeAsLayoutBlockFlow, since it was missing.

BUG=302024

Review-Url: https://codereview.chromium.org/1993943002
Cr-Commit-Position: refs/heads/master@{#394728}
davve
Lock animated property type of result animation during processing
There seems to be a crash due to the animated property type being
cleared too early. To catch this crash at the point of error, lock the
animated property type of the result animation during processing, and
guard for clearing the animation property while the lock is held (in
clearAnimatedType()).

This can potentially be removed when the source of the bug is found.

BUG=581546

Review-Url: https://codereview.chromium.org/1991513003
Cr-Commit-Position: refs/heads/master@{#394726}
davve
Move clearAnimatedType() up the stack
This is in preparation for locking the animated property type for the
resulting animation while the accumulated animation is computed. There
seems to be a crash due to the animated property type being cleared
too early. To catch this crash at the point of error, the plan is to
lock the animated property type of the result animation during
processing, and guard for clearing the animation property while the
lock is held (in clearAnimatedType()).

For SMILTimeContainer::updateAnimations() to have a chance of
unlocking the animated property _before_ clearAnimatedType() is
called, we need to move the call up to
SMILTimeContainer::updateAnimations(). (The assumption is that moving
the call shouldn't make a difference since
SMILTimeContainer::updateAnimations() is the only call-site for
SVGSMILElement::progress() and the intermediate code shouldn't depend
on the animated property.)

Since the clearing of property type and nullifying of resultElement
seems tied together, grouping them makes sense regardless of the crash
chase.

BUG=581546

Review-Url: https://codereview.chromium.org/1989033003
Cr-Commit-Position: refs/heads/master@{#394698}
mstensho
Move line painting to BlockFlowPainter.
Removed some unnecessary includes, since I had to modify the list of includes
anyway.

Also got rid of LayoutBlock(Flow)::paintFloats() in the process.

BUG=302024

Review-Url: https://codereview.chromium.org/1993713002
Cr-Commit-Position: refs/heads/master@{#394581}
mstensho
Remove LayoutBlock::deleteLineBoxTree().
The one in LayoutBlockFlow is all we need now.

BUG=302024

Review-Url: https://codereview.chromium.org/1991763002
Cr-Commit-Position: refs/heads/master@{#394467}
mstensho
Move dirtyLinesFromChangedChild() to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1987233002
Cr-Commit-Position: refs/heads/master@{#394463}
fs
Use SVGInlineTextMetricsIterator in updateLayoutAttributes
This reuses a pre-existing piece to do the "dual offset/variable"
iteration, hiding (and sharing) the complexity.

BUG=607906

Review-Url: https://codereview.chromium.org/1988063002
Cr-Commit-Position: refs/heads/master@{#394412}
sigbjornf
Limit WTF::getPtr() to native pointer types.
Remove Member<> and Persistent<> specializations, the generated bindings
code (only real user of getPtr()) use it to coerce references into
pointers only, nothing else.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/1989153003
Cr-Commit-Position: refs/heads/master@{#394371}
rune
Rename Pending to PendingScriptBlocking.
Pending sheets in StyleEngine are either script blocking or render
blocking (when they are render blocking they are simultaneously script
blocking). Rename methods and members to reflect that pending sheets are
script blocking where appropriate.

No functional changes.

R=pmeenan@chromium.org,esprehn@chromium.org
BUG=481122

Review-Url: https://codereview.chromium.org/1978083002
Cr-Commit-Position: refs/heads/master@{#394364}
mharanczyk
Destory base class when win platform accessibily node is destroyed.
Review-Url: https://codereview.chromium.org/1978223002
Cr-Commit-Position: refs/heads/master@{#394219}
mstensho
Move inlineElementContinuation() to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1974323002
Cr-Commit-Position: refs/heads/master@{#394167}
fs
Reland of Simplify LoadableTextTrack::trackElementIndex
Count preceding sibling <track> elements in a more straight-forward way.

Also clean-up null-checks of m_trackElement while here (should be non-
null on construction and then keeps a strong reference.)

Review-Url: https://codereview.chromium.org/1980013002
Cr-Commit-Position: refs/heads/master@{#394166}
fs
Remove mode-transition in TextTrack::setKind
This mode-transition gives rise to inconsistent state-updates, and isn't
specified [1]. Remove it, and with it the setKind override.

Also move all the mutators to TextTrack since that's the only type of
track where these fields can be mutated (and only if sourced via a
HTMLTrackElement.)

[1] https://html.spec.whatwg.org/multipage/embedded-content.html#attr-track-kind

BUG=460923,608772

Review-Url: https://codereview.chromium.org/1984663002
Cr-Commit-Position: refs/heads/master@{#394122}
tsniatowski
Use clang "--target=x" rather than "-target x" for icecc
Icecc is confused by the two-argument -target form and ends up compiling
everything locally. It works with the equivalent single argument form, so prefer
this in GN compiler configs.

Previously done just for android in https://codereview.chromium.org/1871813003

Review-Url: https://codereview.chromium.org/1977733003
Cr-Commit-Position: refs/heads/master@{#394065}
mstensho
Move line/continuation specific parts of willBeDestroyed() into LayoutBlockFlow.
Also moved beingDestroyed() down to LayoutBlockFlow, since it was no longer
called on other types.

Note that dirtyLinesFromChangedChild() is now called regardless of the object
having line boxes or not at the time of destruction. This should be safer and
more correct. If we're an inline-block, for instance, we definitely want to
notify our parent that we're going away, since that will affect the line box
tree in the parent. I assume that the reason why this hasn't been a problem
(use-after-free crashes, typically), is that the condition that previously
could block this from happening is never true. Looks like line boxes are always
deleted before we reach willBeDestroyed(). Added a TODO to investigate further.
We hopefully don't need that code.

BUG=302024

Review-Url: https://codereview.chromium.org/1977083002
Cr-Commit-Position: refs/heads/master@{#393939}
fs
Revert of Simplify LoadableTextTrack::trackElementIndex (patchset #1 id:1 of https://codereview.chromium.org/1980013002/ )
Reason for revert:
Seems "WebKit Win Builder (dbg)" didn't approve:

e:\b\build\slave\webkit-win-latest-dbg\build\src\third_party\webkit\source\core\html\track\loadabletexttrack.cpp(70) : warning C4706: assignment within conditional expression

Original issue's description:
> Simplify LoadableTextTrack::trackElementIndex
>
> Count preceding sibling <track> elements in a more straight-forward way.
>
> Also clean-up null-checks of m_trackElement while here (should be non-
> null on construction and then keeps a strong reference.)
>
> Committed: https://crrev.com/0537a6d11bf2ebefcf90fbfec7081e37ef78081a
> Cr-Commit-Position: refs/heads/master@{#393825}

TBR=davve@opera.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/1985643003
Cr-Commit-Position: refs/heads/master@{#393828}
fs
Simplify LoadableTextTrack::trackElementIndex
Count preceding sibling <track> elements in a more straight-forward way.

Also clean-up null-checks of m_trackElement while here (should be non-
null on construction and then keeps a strong reference.)

Review-Url: https://codereview.chromium.org/1980013002
Cr-Commit-Position: refs/heads/master@{#393825}
davve
Remove workaround for multiple svg onload events
The bug referred to has been fixed. Let's see if the flakiness stays
away when removing the workaround.

BUG=372946

Review-Url: https://codereview.chromium.org/1983813002
Cr-Commit-Position: refs/heads/master@{#393818}
fs
Add TextTrack::isVisualKind helper
It's quite common to check for a text track being one of the kinds
'subtitles' or 'captions'. Add a helper to TextTrack and use that
in a bunch of places to simplify code.
Also convert one open-coded version of TextTrack::canBeRendered() with a
call to that method.

Review-Url: https://codereview.chromium.org/1976183002
Cr-Commit-Position: refs/heads/master@{#393814}
the_jk
Make SQL in DownloadDatabase SQLite pre 3.8.3 compatible
printf() was added in SQLite 3.8.3 so need to use other older
methods to generate the GUID.
third_party/sqlite/sqlite.gyp lists 3.6.1 as required version at the
time of writing

BUG=606772

Review-Url: https://codereview.chromium.org/1897153005
Cr-Commit-Position: refs/heads/master@{#393813}
fs
Clean up HTMLTrackElement.kind invalid/missing value default handling
Get rid of the isValidKind(...) and invalidValueDefaultKind() virtual
methods on TrackBase and do any required checking "up front" instead
as required. This should present less surprises and work in a less
side-effectful way.

Also start setting the 'kind' directly in the constructor rather than
invoking setKind() in (all) the constructor body (bodies).
Drop some redundant parenthesis and fix some obviously "wrong" names
in TextTrack.cpp.

BUG=608772

Review-Url: https://codereview.chromium.org/1973343002
Cr-Commit-Position: refs/heads/master@{#393812}
sigbjornf
With LSan, run initial heap cleaning GCs during shutdown.
Clean out as much as garbage as possible before releasing a
thread's static persistents, in preparation for LSan leak
detection. By doing so, finalizers for itinerant garbage
may access these static local persistents without restrictions,
_but_ any object kept alive by a static persistent may
not when the second phase of cleaning GCs are performed.

As collectAllGarbage() stops on reaching a fixed point,
extra overhead of having to perform GCs before and after
the static persistents isn't a concern.

R=
BUG=611333

Review-Url: https://codereview.chromium.org/1977343002
Cr-Commit-Position: refs/heads/master@{#393809}
kolczyk
Fix a typo in the gn gen help for QtCreator generator (introduced in https://codereview.chromium.org/1883093002/)
BUG=

Review-Url: https://codereview.chromium.org/1979813002
Cr-Commit-Position: refs/heads/master@{#393795}
sigbjornf
Remove C::swap(C*) where C = Hash{Map,Set}<T>.
Remove the swap() method over non-reference hash sets and
map arguments, along with their curious OtherType indirection,
the methods aren't of real use.

R=
BUG=

Review-Url: https://codereview.chromium.org/1979843002
Cr-Commit-Position: refs/heads/master@{#393770}
sigbjornf
Simplify HeapVectorBacking<> usage.
Reorder HeapAllocator.h declarations to let the compiler handle
supplying the default trait argument to HeapVectorBacking<>.

R=
BUG=

Review-Url: https://codereview.chromium.org/1985473002
Cr-Commit-Position: refs/heads/master@{#393749}
mstensho
LayoutFullScreen::m_placeholder is LayoutBlockFlow.
The code calls m_placeholder->beingDestroyed(), which is a method that
I believe belongs down in LayoutBlockFlow, not in LayoutBlock.

No need for the setter, BTW, so replaced it with resetPlaceholder().

BUG=302024

Review-Url: https://codereview.chromium.org/1975163002
Cr-Commit-Position: refs/heads/master@{#393545}
mstensho
Move makeChildrenNonInline() and childBecameNonInline() to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1977823002
Cr-Commit-Position: refs/heads/master@{#393543}
mstensho
Move collapseAnonymousBlockChild() to LayoutBlockFlow, and make it non-static.
Some cleanup in collapseLoneAnonymousBlockChild(). Specify a parent rather than
working it out on our own. Both callers have the parent readily available
anyway.

Remove canCollapseAnonymousBlockChild(), since nobody calls it anymore.

BUG=302024

Review-Url: https://codereview.chromium.org/1980473002
Cr-Commit-Position: refs/heads/master@{#393542}
kolczyk
Add support for generating QtCreator projects from GN.
This adds a new command line argument "--ide=" value to "gn gen"
which, when specified, generates a QtCreator project.

QtCreator is a quite powerful general-purpose (despite Qt in the name)
IDE when developing on Linux system with code completion and navigation.

Some interest in it has been demonstrated in the following thread:
https://groups.google.com/a/chromium.org/forum/#!topic/gn-dev/9U4_ytjrah8

BUG=

Review-Url: https://codereview.chromium.org/1883093002
Cr-Commit-Position: refs/heads/master@{#393514}
fs
Minor SVGFilterPainter cleanups
Simplify GraphicsContext handling in SVGFilterRecordingContext by
getting rid of the paintingContext() calls, since we'll promptly replace
that GraphicsContext with the recording context anyway. Get rid of the
|context| local and use m_context instead.

Drop the LayoutObject argument to paintFilteredContent(...) since it
isn't used.

Review-Url: https://codereview.chromium.org/1977793003
Cr-Commit-Position: refs/heads/master@{#393511}
sigbjornf
Avoid race on uninitializing CrossThreadPersistent nodes.
R=
BUG=611593, 611594

Review-Url: https://codereview.chromium.org/1974233002
Cr-Commit-Position: refs/heads/master@{#393488}
mstensho
Move makeChildrenInlineIfPossible to LayoutBlockFlow
It's now possible to move makeChildrenInlineIfPossible() to LayoutBlockFlow.

BUG=302024

Review-Url: https://codereview.chromium.org/1969203003
Cr-Commit-Position: refs/heads/master@{#393390}
mstensho
Don't use canCollapseAnonymousBlockChild() to determine whether to truncate text.
Doing that happened to do exactly what we wanted, but that seems like a rather
haphazard way of determining it.

We want to truncate text for block containers [1]. That's LayoutBlockFlow.
Additionally, in Blink, HTML button is implemented using LayoutFlexibleBox
(although the web insists that it too is a block container).

[1] https://www.w3.org/TR/css-ui-3/#propdef-text-overflow

Rather than manually testing for isLayoutBlockFlow() || isLayoutButton()
directly when deciding to truncate or not, I went and hijacked
canHaveFirstLineOrFirstLetterStyle(), and renamed it to behavesLikeBlockContainer().

Review-Url: https://codereview.chromium.org/1970183002
Cr-Commit-Position: refs/heads/master@{#393354}
mstensho
Move some reparenting and anonymous block merge functionality down to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1968413002
Cr-Commit-Position: refs/heads/master@{#393350}
fs
Don't store an SkPicture in the SourceGraphic FilterEffect
Instead of storing the SkPicture in the SourceGraphic FilterEffect, just
create a filter and pre-populate all the image filter "slots" when we've
recorded the content that should be filtered.
This avoids keeping an explicit reference to the SkPicture, and thus
avoids keeping this object alive when the Filter and it's associated
filter-chain is in limbo waiting for a Oilpan GC sweep.

BUG=610158

Review-Url: https://codereview.chromium.org/1961083006
Cr-Commit-Position: refs/heads/master@{#393280}
mstensho
LayoutBox (not LayoutBlock) is the common base for floats and out-of-flow objects.
We need to react on going out-of-flow or becoming floated in
LayoutBox::styleDidChange(), or we'll misbehave if the object in question is
e.g. an image.

Review-Url: https://codereview.chromium.org/1973843003
Cr-Commit-Position: refs/heads/master@{#393270}
mstensho
LayoutBlock::removeChild() override no longer needed.
It was all about anonymous block merging and collapsing, which is a thing that
only LayoutBlockFlow needs to do. So move everything there.

BUG=302024

Review-Url: https://codereview.chromium.org/1968403002
Cr-Commit-Position: refs/heads/master@{#393267}
mstensho
Move block container specific parts of addChild() to LayoutBlockFlow.
LayoutBlock still needs some basic support for anonymous block insertion, for
flexbox, and possibly others.

BUG=302024

Review-Url: https://codereview.chromium.org/1974753002
Cr-Commit-Position: refs/heads/master@{#393266}
rune
Unreachable code fixes in SelectorChecker.
Unknown selectors and pseudo page selectors should be dropped at parse
time for element selectors. Also did some simplifications for
ASSERT_NOT_REACHED code and consistently fail matching for such code.

R=timloh@chromium.org,rob.buis@samsung.com

Review-Url: https://codereview.chromium.org/1969203002
Cr-Commit-Position: refs/heads/master@{#393216}
sigbjornf
Remove dated NavigationScheduler TODO.
Task closures created by CancellableTaskFactory keep a weak reference back
to their owning GCed object, allowing the object to be garbage collected
without the task keeping it alive.

Retire the TODO in the NavigationScheduler suggesting otherwise along with
adding a unit test to verify the weakness property.

R=
BUG=585328

Review-Url: https://codereview.chromium.org/1976433003
Cr-Commit-Position: refs/heads/master@{#393210}
mstensho
Helper method for non-direct beforeChild in LayoutBlock::addChild().
A lot of what's in LayoutBlock::addChild() will eventually be moved down to
LayoutBlockFlow::addChild(), but both classes are expected to handle insertion
of children before a non-direct beforeChild.

One difference, compared to how it used to work when all of this was inside
addChild(), is that it's no longer allowed to continue if we fail to find a
suitable direct beforeChild replacement. Will always RELEASE_ASSERT() in such
situations now.

BUG=302024

Review-Url: https://codereview.chromium.org/1964203004
Cr-Commit-Position: refs/heads/master@{#393201}
mstensho
Helper for interesting things to do when a block becomes a float or out-of-flow.
Also added some requirements for the blocks involved to be LayoutBlockFlow. We
don't want to touch anything else.

BUG=302024

Review-Url: https://codereview.chromium.org/1966223002
Cr-Commit-Position: refs/heads/master@{#393121}
rune
Multiple :hover/:active incorrectly matching in quirks mode.
:hover and :active should only match links when not accompanied by
other simple selectors in quirks mode. We failed to adhere for
combinations of :hover and :active. Instead of just checking there is
either a selector preceding or following in the compound, check if
there is a selector preceding or a selector following in the compound
which is neither :hover nor :active.

R=rob.buis@samsung.com
BUG=611090

Review-Url: https://codereview.chromium.org/1972713002
Cr-Commit-Position: refs/heads/master@{#393090}
mstensho
Move updateDragState() override to LayoutBlockFlow.
Only continuations stuff there.

BUG=302024

Review-Url: https://codereview.chromium.org/1969103002
Cr-Commit-Position: refs/heads/master@{#393071}
mstensho
Move hoverAncestor() override to LayoutBlockFlow.
Only continuations stuff going on there.

BUG=302024

Review-Url: https://codereview.chromium.org/1970653004
Cr-Commit-Position: refs/heads/master@{#392963}
mstensho
Turn mergeContiguousAnonymousBlocks() into a proper method.
Some clean-up on the way, such as refactoring
canMergeContiguousAnonymousBlocks() into a function that deals with one object
at a time.

BUG=302024

Review-Url: https://codereview.chromium.org/1966153002
Cr-Commit-Position: refs/heads/master@{#392942}
sigbjornf
Simplify SVGSMILElement::notifyDependentsIntervalChanged loop breaker.
To catch out recursive notifications, notifyDependentsIntervalChanged()
keeps track of the SVGSMILElements that are on the stack and being
notified, so as to bail early in case of loops.

There's no need for that set of SVGSMILElements to be recorded using
a persistent static local as the objects are stack reachable should
a conservative GC be needed, so an 'ordinary' hash set will do.

Not using a persistent reference also addresses a bad interaction with
LSan (Blink has to release all static persistents before shutting
down to prevent false leaks w/ LSan enabled), but SVGImages containing
animations may end up in this code path as part of an image resource
being finalized. Which would then encounter an empty persistent
static reference and fail (see associated bug and stack trace.)

R=haraken
BUG=610855

Review-Url: https://codereview.chromium.org/1968683003
Cr-Commit-Position: refs/heads/master@{#392919}
sigbjornf
Move tracking of ActiveScriptWrappables to V8PerIsolateData.
R=
BUG=

Review-Url: https://codereview.chromium.org/1966743004
Cr-Commit-Position: refs/heads/master@{#392916}
fs
Change "invalid value default" for HTMLTrackElement 'kind' to "metadata"
Rename TrackBase::defaultKind() to invalidValueDefaultKind() to better
reflect its semantics. Also make sure that the "missing value default"
is set appropriately (in TextTrack constructors and on removal in
HTMLTrackElement parseAttribute) now that it differs from the "invalid
value default".

The test media/track/track-kind.html is adjusted so that it doesn't
check if a cue is displayed, since that depends on unspecified behavior
wrt how 'mode' changes when 'kind' does. (See comment in
TextTrack::setKind.)

The WPT tests will eventually get updated via Mozilla's automatic sync,
so adding expectations for now.
(Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1269712)

Intent: https://groups.google.com/a/chromium.org/d/topic/blink-dev/6-oPQN4lZ2o/discussion

https://github.com/whatwg/html/issues/293
https://html.spec.whatwg.org/multipage/embedded-content.html#attr-track-kind

BUG=608772

Review-Url: https://codereview.chromium.org/1947033002
Cr-Commit-Position: refs/heads/master@{#392911}
sigbjornf
Revert of Eagerly remove disposed DOMTimers as observers. (patchset #1 id:1 of https://codereview.chromium.org/1959013002/ )
Reason for revert:
Caused issue 610606, reverting to locally investigate how/why.

Original issue's description:
> Eagerly remove disposed DOMTimers as observers.
>
> Once the coordinator lets go of a timer, no need to keep it
> around as an observer of the ExecutionContext.
>
> R=
> BUG=
>
> Committed: https://crrev.com/0a297738301705d02f57968334bd6f7c7dc95f4c
> Cr-Commit-Position: refs/heads/master@{#392309}

TBR=oilpan-reviews@chromium.org,keishi@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=

Review-Url: https://codereview.chromium.org/1968963002
Cr-Commit-Position: refs/heads/master@{#392901}
fs
Use the right TextRun length when checking for surrogate pairs
The isValidSurrogatePair helper in LayoutSVGInlineText.cpp operates on a
TextRun and an index, and checks if the character at the index is part
of a valid surrogate pair.
To check the trailing character, the next index is checked against the
length of the TextRun (to see if the character exists).
The TextRun used is a "sub run" of the entire text node, which means
that the operator[] implementation expects accesses to be within the sub
run rather than the "full run".
Since this function is always used for runs that are sub runs, it should
use TextRun::length() rather than TextRun::charactersLength() to stay
consistent with the iteration and the code using it.

BUG=610641

Review-Url: https://codereview.chromium.org/1961953004
Cr-Commit-Position: refs/heads/master@{#392880}
rune
Corrected assert for cacheable stylesheets.
We have two different caches for StyleSheetContents. One process-wide
for resources, and one document-wide for parsed text of style elements.
The cacheability differ between the two caches since for instance
sheets with @media rules may be shared between elements in the same
document as the media query evaluation will be the same, while we can't
do that for sheets cached across documents as they may have different
viewports.

The assert in CSSStyleSheet::willMutateRules triggered because we
checked for the resource cacheability of a style element sheet which
was shared even though it had a media query. Renamed the cacheability
method to make clear which cache we're referring to.

Removed the ASSERT in StyleSheetContents::copy(), as that really didn't
have anything to do with copy, only the fact that it is only called
from where cached stylesheets are cloned for rule mutation. The ASSERT
in willMutateRules right before we copy() should suffice.

R=timloh@chromium.org
BUG=551674

Review-Url: https://codereview.chromium.org/1961173003
Cr-Commit-Position: refs/heads/master@{#392859}
mstensho
Only LayoutInline needs to implement addChildIgnoringContinuation().
LayoutTable had to do it because LayoutBlock did it. But LayoutBlock really
doesn't have to do it anymore. This was probably some relic from the old
multicol implementation, which used *block* continuations to implement column
spanners. We no longer need or support block continuations.

Review-Url: https://codereview.chromium.org/1967823002
Cr-Commit-Position: refs/heads/master@{#392856}
sigbjornf
Remove redundant GC mixin instance decl for AudioBufferSourceNode.
R=
BUG=

Review-Url: https://codereview.chromium.org/1969453003
Cr-Commit-Position: refs/heads/master@{#392747}
mstensho
Move nodeForHitTest() to LayoutBlockFlow.
LayoutBlock shouldn't have to deal with continuations.

BUG=302024

Review-Url: https://codereview.chromium.org/1966713002
Cr-Commit-Position: refs/heads/master@{#392742}
mstensho
Move continuation and line box specific stuff to LayoutBlockFlow::removeChild().
BUG=302024

Review-Url: https://codereview.chromium.org/1970453002
Cr-Commit-Position: refs/heads/master@{#392730}
sigbjornf
Prevent audio thread access to finished, non-active AudioNodes.
Follow up r392110 and have the audio thread skip over m_activeSourceNodes
nodes it has already deemed to be finished & removable by the main thread.
Accessing these cannot be safely done.

R=
BUG=610643

Review-Url: https://codereview.chromium.org/1958333006
Cr-Commit-Position: refs/heads/master@{#392720}
mstensho
Turn adjacent out-of-flow sibling reparenters into proper methods.
This will make it possible to gradually move callers of these methods (and the
methods themselves) down to LayoutBlockFlow, which is where they belong, since
only LayoutBlockFlow may parent floats and out-of-flow objects.

BUG=302024

Review-Url: https://codereview.chromium.org/1964983002
Cr-Commit-Position: refs/heads/master@{#392696}
mstensho
Move invalidateDisplayItemClients() override into LayoutBlockFlow and eat the static helper.
It was only dealing with continuations, and that doesn't belong in LayoutBlock.

BUG=302024

Review-Url: https://codereview.chromium.org/1964083002
Cr-Commit-Position: refs/heads/master@{#392690}
sigbjornf
Handle overlapping CrossThreadPersistent<> releases.
When a CrossThreadPersistent<> is cleared, the associated PersistentNode is
freed. In the case when multiple threads attempt to do such clearing at
the same time, the freeing protocol ensured atomicity but failed to check
if the PersistentNode had been freed already.

This follows up on the freeing of PersistentNodes that r392263 added
for CrossThreadPersistent<>s.

R=haraken
BUG=

Review-Url: https://codereview.chromium.org/1964013002
Cr-Commit-Position: refs/heads/master@{#392689}
mstensho
Move absoluteRects() and absoluteQuads() overrides to LayoutBlockFlow.
They only deal with continuations.

BUG=302024

Review-Url: https://codereview.chromium.org/1968553002
Cr-Commit-Position: refs/heads/master@{#392685}
mostynb
IWYU: errno.h in third_party/webrtc_overrides
Without this, some toolchains may fail to build
third_party/webrtc/base/checks.cc because errno is undefined.

BUG=468375

Review-Url: https://codereview.chromium.org/1967643002
Cr-Commit-Position: refs/heads/master@{#392677}
mstensho
Adjust constness to avoid const_cast.
Review-Url: https://codereview.chromium.org/1961343002
Cr-Commit-Position: refs/heads/master@{#392642}
sigbjornf
Drop unnecessary uses of GarbageCollectedFinalized<>.
Objects with Member<> fields can derive from the non-finalized
GarbageCollected<> instead.

R=
BUG=389343

Review-Url: https://codereview.chromium.org/1961173004
Cr-Commit-Position: refs/heads/master@{#392641}
mstensho
nodeAtPoint(): Perform the early-check EARLY.
Hit-testing overflow controls before checking if we need to do anything at all
affected performance, so just remove the LayoutBlock override for nodeAtPoint()
and hit test overflow controls there, but do so AFTER we have made sure that
the point is within bounds.

Fixes 15% performance regression for
PerformanceTests/Events/hit-test-lots-of-layers.html

BUG=610250

Review-Url: https://codereview.chromium.org/1960373002
Cr-Commit-Position: refs/heads/master@{#392626}
mstensho
Set orphans and widows to 1 in lots-of-text-balanced multicol performance test.
https://codereview.chromium.org/1909233002 changed the initial values for
orphans and widows to match the spec. This could very well affect performance
slightly, although I cannot reproduce it myself. Speculatively set
orphans/widows to 1 and see if that helps. Add a new test that uses higher
values for orphans and widows, so that we still get to test that too.

BUG=606262

Review-Url: https://codereview.chromium.org/1964473003
Cr-Commit-Position: refs/heads/master@{#392625}
mstensho
Assert that continuations be either LayoutBlockFlow or LayoutInline.
Exploring the possibility of moving all continuation handling from LayoutBlock
down to LayoutBlockFlow.

BUG=302024

Review-Url: https://codereview.chromium.org/1958413003
Cr-Commit-Position: refs/heads/master@{#392621}
sigbjornf
Make ActiveScriptWrappable the GC mixin it is.
By switching it to derive from GarbageCollectedMixin, and
have the per-thread set of live wrappables keep WeakMember<>
references, the Oilpan GC takes care of pruning the live
set as part of its weak processing.

R=
BUG=

Review-Url: https://codereview.chromium.org/1962113003
Cr-Commit-Position: refs/heads/master@{#392618}
mstensho
Relayout an object that becomes a spanner.
It may be possible to collapse margins through a zero-height regular block, but
if it is turned into a spanner, this is no longer possible, because it then
becomes a BFC root.

An object that becomes a spanner also gets a new containing block, which may
affect its size.

In other words, there are good reasons to make sure that objects that become
spanners get relaid out.

Note that we already had code in place (in willBeRemovedFromTree()) that
scheduled for relayout in the opposite case, i.e. when an object ceased to be a
spanner.

BUG=610033

Review-Url: https://codereview.chromium.org/1962623002
Cr-Commit-Position: refs/heads/master@{#392438}
mstensho
Remove ColumnFill runtime setting.
It's been enabled by default for almost three months now.

BUG=492297

Review-Url: https://codereview.chromium.org/1956373002
Cr-Commit-Position: refs/heads/master@{#392389}
sigbjornf
Remove older and unused ScriptState methods.
R=
BUG=

Review-Url: https://codereview.chromium.org/1958963002
Cr-Commit-Position: refs/heads/master@{#392316}
mstensho
Move hit testing of lines and floats to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1956033002
Cr-Commit-Position: refs/heads/master@{#392311}
sigbjornf
Eagerly remove disposed DOMTimers as observers.
Once the coordinator lets go of a timer, no need to keep it
around as an observer of the ExecutionContext.

R=
BUG=

Review-Url: https://codereview.chromium.org/1959013002
Cr-Commit-Position: refs/heads/master@{#392309}
sigbjornf
Trim ResourceTimingInfoMap of non-relevant entries.
If the resource fetch fails or is otherwise uninteresting to report a
ResourceTimingInfo for, remove it (also) from the set of pending
map of such ResourceTimingInfos.

R=
BUG=608543

Review-Url: https://codereview.chromium.org/1955243002
Cr-Commit-Position: refs/heads/master@{#392307}
sigbjornf
Upon clearing, release PersistentNode of cross-thread-persistent also.
Persistent<>s will only allocate an associated PersistentNode when the
heap reference is non-null. And, dually, free the PersistentNode
when the reference is cleared out and set to null.

Extend that freeing of a PersistentNode upon clearing to also apply to
CrossThreadPersistent<>s, making the behavior and lifetimes of
PersistentNodes consistent across both variants of persistent references.

R=haraken
BUG=483380
NOTRY=true

Review-Url: https://codereview.chromium.org/1962513002
Cr-Commit-Position: refs/heads/master@{#392287}
sigbjornf
Accurately measure current persistent count while running termination GC.
Follow up on r392263 and have it really behave as wanted -- when measuring
|currentCount|, the live persistent count, while cleaning out the worker's
heap in ThreadState::runTerminationGC(), we need to initially sample it
_after_ having released thread-local static persistents. Otherwise the count
would be overestimated first time around, which could lead to prematurely
reaching a fixed point. And at a fixed point that would falsely indicate
that persistents were leaking.

R=haraken
BUG=
NOTRY=true

Review-Url: https://codereview.chromium.org/1963453002
Cr-Commit-Position: refs/heads/master@{#392272}
sigbjornf
Cleanly release thread-local static persistents during termination GCs.
Should worker termination GCs instantiate static persistent singletons
while running finalizers, ensure that these are released.

Also, for PersistentHeapCollectionBase<>s registered as such thread-local
singletons, clear out their collection backing store along with the
persistent reference when they are released. The contents and backing
store of the collection should not be accessible after such a forceful
release operation.

R=haraken
BUG=
NOTRY=true

Review-Url: https://codereview.chromium.org/1957523007
Cr-Commit-Position: refs/heads/master@{#392263}
mstensho
Move line-specific code into LayoutBlockFlow::positionForPoint().
BUG=302024

Review-Url: https://codereview.chromium.org/1957633003
Cr-Commit-Position: refs/heads/master@{#392251}
mstensho
Move line-specific parts of addOutlineRects() into LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1959623002
Cr-Commit-Position: refs/heads/master@{#392137}
mstensho
Less duplicated code between nodeAtPoint() in LayoutBox and LayoutBlock.
This is a preparatory patch for moving line/float-specific parts of
LayoutBlock::hitTestChildren() into LayoutBlockFlow.

BUG=302024

Review-Url: https://codereview.chromium.org/1957673002
Cr-Commit-Position: refs/heads/master@{#392116}
mstensho
LineBreaker doesn't need LayoutBlock(Flow) as a friend.
Review-Url: https://codereview.chromium.org/1956433003
Cr-Commit-Position: refs/heads/master@{#392115}
sigbjornf
Update AbstractAudioContext::m_activeSourceNodes on the main thread only.
Avoid mutating m_activeSourceNodes on the audio thread, leave the
main thread in control of that heap object.

R=haraken,rtoy
BUG=581660

Review-Url: https://codereview.chromium.org/1958583002
Cr-Commit-Position: refs/heads/master@{#392110}
sigbjornf
Initialize DeferredTaskHandler's audio thread ID once.
Avoid repeatedly recording the audio thread's ID, along with assertedly
verifying that this is done off the main thread.

R=
BUG=590108

Review-Url: https://codereview.chromium.org/1954663002
Cr-Commit-Position: refs/heads/master@{#391848}
mstensho
Move showLineTreeAndMark() to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1952763002
Cr-Commit-Position: refs/heads/master@{#391757}
mstensho
Move parts of baseline calculation over to LayoutBlockFlow.
LayoutBlock shouldn't deal with line boxes.

BUG=302024

Review-Url: https://codereview.chromium.org/1952753002
Cr-Commit-Position: refs/heads/master@{#391663}
mstensho
Move computeSelfHitTestRects() to LayoutBlockFlow.
BUG=302024

Review-Url: https://codereview.chromium.org/1946343002
Cr-Commit-Position: refs/heads/master@{#391639}
mstensho
Move LayoutDeprecatedFlexibleBox-specific line handling.
This is sort-of exotic functionality, in that it checks if the blocks have
visibility:visible and auto height, so it fits better together with the
LayoutDeprecatedFlexibleBox implementation. Nobody else needs this.

The pagination code also needs to count lines, though, so I kept lineCount(),
but moved it from LayoutBlock to LayoutBlockFlow, and threw away the parts that
weren't needed (visibility check, recursing into child block flows, among other
things).

On the LayoutDeprecatedFlexibleBox, there are some changes. The functions now
operate on LayoutBlockFlow instead of LayoutBlock, since it's dealing with
lines. As a result, we need to replace some former isLayoutBlock() checks with
isLayoutBlockFlow(). A similar change landed in WebKit years ago [1], so it
should be safe.

[1] https://bugs.webkit.org/show_bug.cgi?id=122969

BUG=302024

Review-Url: https://codereview.chromium.org/1952613002
Cr-Commit-Position: refs/heads/master@{#391492}
mstensho
Improve multicol overflow rect calculation when column width is 0.
If column-gap is larger than the content box width of the multicol container,
we'll end up with zero-width column boxes (that are allowed to overflow into
neighboring gaps).

BUG=607597

Review-Url: https://codereview.chromium.org/1927283002
Cr-Commit-Position: refs/heads/master@{#391477}
mstensho
Correct ietestcenter/css3/multicolumn/column-width-applies-to-010-expected.htm
Need to paint a red list item marker under the green one for it to match the
actual test perfectly.

BUG=396941

Review-Url: https://codereview.chromium.org/1947003002
Cr-Commit-Position: refs/heads/master@{#391467}
rune
Make sure computed style is up-to-date for custom properties.
For custom properties, we didn't call updateLayoutTreeForNode which
meant the computed style object might return out-of-date values for
custom properties.

Did some cleanup in getPropertyCSSValue for known properties.

R=shans@chromium.org
BUG=608690

Review-Url: https://codereview.chromium.org/1945623002
Cr-Commit-Position: refs/heads/master@{#391368}
fs
Simplify logical iteration in SVGTextLayoutEngine
By replacing m_logicalCharacterOffset == logicalTextNode->textLength()
by the corresponding metrics list equivalent, it becomes obvious that
we're just checking the same thing twice in succession. Remove the first
check and block of code.
Also reverse the test in the loop and refactor to avoid the 'continue'
when skipping whitespace.
The second part of the disjunction (w/ logicalMetrics.isEmpty()) does
not do anything useful, so is removed. This makes the condition match
what SVGTextLayoutAttributesBuilder does (which is the intention.)

BUG=607906

Review-Url: https://codereview.chromium.org/1941303003
Cr-Commit-Position: refs/heads/master@{#391281}
fs
Make servicing of SMIL animations require a FrameView
SMIL animations are not running (or even started) in inactive documents,
and scheduling frames requires a FrameView. Hence it makes sense to move
the call to SVGDocumentExtensions::serviceOnAnimationFrame into the
block that requires a FrameView.
Drop unused timestamp argument to SMILTimeContainer::serviceAnimations,
and let that propagate all the way out to PageAnimator.

Review-Url: https://codereview.chromium.org/1941403002
Cr-Commit-Position: refs/heads/master@{#391244}
sigbjornf
Deflake media/track/media-element-move-to-new-document-assert.html
R=fs@opera.com
BUG=518995

Review-Url: https://codereview.chromium.org/1943823002
Cr-Commit-Position: refs/heads/master@{#391224}
sigbjornf
Implement DOM methods: prepend, append, after, before and replaceWith.
As per https://dom.spec.whatwg.org/#childnode ChildNode interface
should contain after(), before() and replaceWith() API.

As per https://dom.spec.whatwg.org/#parentnode ParentNode interface
should contain append(), prepend() API.

Intent to Implement and ship link: https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/paritosh/blink-dev/efUPtYm1PP8/MGoTi17AYpcJ

( From paritosh.in@samsung.com's original CL https://codereview.chromium.org/1085843002 )

R=mkwst
BUG=255482

Review-Url: https://codereview.chromium.org/1934123002
Cr-Commit-Position: refs/heads/master@{#391196}
rune
Avoid style recalc and layout when not necessary for client size.
The clientWidth and clientHeight values do not rely on style recalc for
the documentElement in strict mode, and the body element in quirks mode
when we use overlay scrollbars. Skip the forced layout update in those
cases.

BUG=481412

Review-Url: https://codereview.chromium.org/1935043002
Cr-Commit-Position: refs/heads/master@{#391187}
fs
Remove the LayoutSVGInlineText* context in SVGTextLayoutAttributes
Most uses of the SVGTextLayoutAttributes* in vector owned by
LayoutSVGText, actually ends up doing ...->context() and dereferencing
the owning LayoutSVGInlineText rather than the attributes object itself.
It's also slightly more obvious what's going on when considering the
iteration over "text nodes" rather than their associated attributes.
Make LayoutSVGText collect the descendant LayoutSVGInlineTexts rather
than the "parts object" SVGTextLayoutAttributes, and rename as
appropriate to reflect that change.
Since removing the context pointer makes SVGTextLayoutAttributes a simple
wrapper around a SVGCharacterDataMap, just store the latter directly.
Rename SVGTextLayoutAttributes.h to SVGCharacterData.h
Also replace a HashMap::find+conditional copy with a HashMap::get.

BUG=607906

Review-Url: https://codereview.chromium.org/1937043002
Cr-Commit-Position: refs/heads/master@{#391052}
sigbjornf
Completely detach failed script loader before dispatching error event.
In case of failure, a ScriptLoader needs to be detached from its ScriptRunner
and associated Resource (if any) at the same time, and before dispatching
the corresponding error event. If the error event handler triggers cancellation
of the Resource, the ScriptLoader should not be notified of that again --
it isn't interested nor prepared. A speculative fix.

R=
BUG=602516

Review-Url: https://codereview.chromium.org/1939743002
Cr-Commit-Position: refs/heads/master@{#390955}
rune
Don't cache parsed stylesheet if it wasn't added to the memory cache.
The code expects the StyleSheetContents to be in the memory cache when
pointed to by m_parsedStyleSheetCache. Set m_parsedStyleSheetCache to
nullptr initially when the StyleSheetContents could not be added to the
memory cache.

R=sigbjornf@opera.com
BUG=606248

Review-Url: https://codereview.chromium.org/1941733002
Cr-Commit-Position: refs/heads/master@{#390949}
davve
Add test for zoomed -webkit-mask-box-image
BUG=607414

Review-Url: https://codereview.chromium.org/1937903002
Cr-Commit-Position: refs/heads/master@{#390935}
mstensho
LayoutBlock::m_descendantsWithFloatsMarkedForLayout doesn't need to be mutable.
R=rune@opera.com

Review-Url: https://codereview.chromium.org/1937023002
Cr-Commit-Position: refs/heads/master@{#390925}
jl
Use v8::Object::CreateDataProperty() for object construction
When creating objects (and arrays) internally, we should typically use
CreateDataProperty() rather than Set(), since the latter may invoke
setters defined by scripts. This could potentially be used by exploits to
do evil things, but more likely is just a potential source of breakage
and/or confusion.

Also, it is typically non-conforming in the cases where exact behavior is
defined in a specification.

BUG=

Review-Url: https://codereview.chromium.org/1938943002
Cr-Commit-Position: refs/heads/master@{#390924}
davve
Revert "Straighten out zoom and border-image"
This patch reverts https://codereview.chromium.org/1819083004 patchset
#3.

Fixing SVG zoom in border-image unfortunatly broke gradients
instead. There is a difference in how scale it applied for
zooming. For SVG a source rect (unzoomed) <-> destination rect
(zoomed) scale factor is computed and used for scaling. For gradients,
the source and destination rect are always the same (both zoomed). The
individual gradients stops are zoomed instead.

BUG=607414, 596075, 561519

Review-Url: https://codereview.chromium.org/1934953002
Cr-Commit-Position: refs/heads/master@{#390920}
mostynb
remove obsolete todo note for CSS property to histogram id mapping
It was decided not to move these (necessarily) hardcoded ids.

BUG=234940
NOTRY=true

Review-Url: https://codereview.chromium.org/1937773002
Cr-Commit-Position: refs/heads/master@{#390917}
sigbjornf
Weak HTMLMediaElement::m_audioSourceNode reference must be cleared.
Weak callbacks must clear the weak references deemed not to be alive.

R=
BUG=

Review-Url: https://codereview.chromium.org/1941693002
Cr-Commit-Position: refs/heads/master@{#390910}
mostynb
remove unused WTF::dataLogFString function
BUG=439559

Review-Url: https://codereview.chromium.org/1936893002
Cr-Commit-Position: refs/heads/master@{#390877}
mostynb
remove unused placeByteAsHex template
BUG=439559

Review-Url: https://codereview.chromium.org/1937723002
Cr-Commit-Position: refs/heads/master@{#390876}
sigbjornf
gc plugin: stop recognizing old and unused options.
The options "enable-oilpan" and "warn-raw-ptr" are following r390631 no
longer being passed in as options, hence we can finally stop recognizing
them.

R=
BUG=585328

Review-Url: https://codereview.chromium.org/1941603002
Cr-Commit-Position: refs/heads/master@{#390875}
sigbjornf
Tidy up releasing of AssociatedURLLoader's client references.
Make the releasing of client references a bit more solid and consistent.

R=
BUG=606998

Review-Url: https://codereview.chromium.org/1937743002
Cr-Commit-Position: refs/heads/master@{#390873}
sigbjornf
Have htmlcollection-reachable.html force the one GC needed.
Calling window.gc() slows down test running times, and is
preferably avoided unless needed to verify behavior across
a GC.

For htmlcollection-reachable.html, we only need the
one GC to determine liveness of custom properties for
various platform objects across a garbage collection.

R=
BUG=593888

Review-Url: https://codereview.chromium.org/1934183002
Cr-Commit-Position: refs/heads/master@{#390872}
mostynb
remove unused placeByteAsHexCompressIfPossible template
This template has been unused since https://codereview.chromium.org/1778743003
landed.

BUG=584999,439559

Review-Url: https://codereview.chromium.org/1936883002
Cr-Commit-Position: refs/heads/master@{#390870}
sigbjornf
Document registration of Oilpan weak callbacks.
R=
BUG=

Review-Url: https://codereview.chromium.org/1935943002
Cr-Commit-Position: refs/heads/master@{#390860}
mstensho
Remove replacedChildren vector from inline layout.
This vector was populated during child walking and consumed right after the
walk. There should be no reason not to just process the objects right away.

Review-Url: https://codereview.chromium.org/1933633002
Cr-Commit-Position: refs/heads/master@{#390765}
fs
Minor tweaks to m_needsReordering in LayoutSVGText::layout
Nit fixes from https://codereview.chromium.org/1933193002/.

BUG=607906

Review-Url: https://codereview.chromium.org/1933413002
Cr-Commit-Position: refs/heads/master@{#390753}
fs
Simplify SVG layout attribute reordering
findFirstAndLastAttributesInVector is an identity transform, since it
only search for first/lastContext in the layout attributes vector and
return that in the out variable. Remove it. This in turn means that the
vector of layout attributes is unused, and hence also removed. Finally
tidy up the reversing loop by moving more code into the swapping helper
function, and merge the two identical sequences of item swapping code.
Drop the ASSERT that disallows having no (nullptr) user-data for the
closure to collectLeafBoxesInLogicalOrder.

BUG=607906

Review-Url: https://codereview.chromium.org/1931303002
Cr-Commit-Position: refs/heads/master@{#390751}
fs
Refactor SVGTextLayoutEngine::currentLogicalCharacterMetrics
The two methods currentLogicalCharacterAttributes and
currentLogicalCharacterMetrics on SVGTextLayoutEngine are very
interdependent, since after calling the former, the latter will be
called.
So fold most of the former into the latter, keeping the bits of the
former that advances to the next layout attribute entry, while
renaming it to nextLogicalAttributes.
The methods are also changed from returning a bool and using out-
variables to return the active SVGTextLayoutAttributes structure
instead.

BUG=607906

Review-Url: https://codereview.chromium.org/1935493002
Cr-Commit-Position: refs/heads/master@{#390736}
mstensho
Move self-collapse checking to LayoutBlockFlow and cache it completely.
Only block containers (that's LayoutBlockFlow in Blinquese) can have adjoining
top and bottom margins, since all other LayoutBlock derivates establish some
kind of formatting context (table, flexbox, etc.).

Also cache self-collapsedness completely. Previously we only used the cached
result if we had previously found that the entire subtree is self-collapsing.
The new approach eliminates the need for "mutable" too.

BUG=302024

Review-Url: https://codereview.chromium.org/1933153002
Cr-Commit-Position: refs/heads/master@{#390729}
mstensho
Move markLinesDirtyInBlockRange() from LayoutBlock to LayoutBlockFlow.
And put the implementation in LayoutBlockFlowLine.cpp.

BUG=302024

Review-Url: https://codereview.chromium.org/1933643002
Cr-Commit-Position: refs/heads/master@{#390724}
fs
Restructure LayoutSVGText::layout
"Uncascade" LayoutSVGText::layout by separating the handling of the two
flags (m_needsTextMetricsUpdate, m_needsPositioningValuesUpdate) into
sequential blocks. Add assert to verify consistency.

BUG=607906

Review-Url: https://codereview.chromium.org/1933193002
Cr-Commit-Position: refs/heads/master@{#390691}
fs
Move isEmptyValue and emptyValue to SVGCharacterData
These two helpers have a stronger tie to SVGCharacterData (on which they
operate) than to SVGTextLayoutAttributes - where they are currently
defined.
Move them as described, and also add simple query helpers to make code
using them simpler and more readable.

BUG=607906

Review-Url: https://codereview.chromium.org/1933183002
Cr-Commit-Position: refs/heads/master@{#390649}
sigbjornf
Remove oilpan build configuration vestiges.
With the updated GC clang plugin that rolled out as part of issue 604993,
we no longer need to supply enable-oilpan to it. Stop doing so along
with removing the enable_oilpan configuration option entirely.

R=haraken,jochen
BUG=585328

Review-Url: https://codereview.chromium.org/1930913002
Cr-Commit-Position: refs/heads/master@{#390640}
sigbjornf
blink_gc_plugin: drop no-op options.
With the updated GC clang plugin that rolled out as part of issue 604993,
we can now assume that the enable-oilpan and warn-raw-ptr options are
by default always on & consequently doesn't need to be passed in by
blink_gc_plugin_flags.py

R=
BUG=604463,604476

Review-Url: https://codereview.chromium.org/1926003003
Cr-Commit-Position: refs/heads/master@{#390631}
jl
Use [[DefineOwnProperty]] when converting IDL array values
This means using v8::Object::CreateDataProperty() rather than Set(), and
is in line with how the conversion is defined in WebIDL. The incorrect use
of Set() is observable by scripts that define setters on Array.prototype
for the properties "0", "1", "2" and so on.

Also apply the same fix to conversion of Vector<std::pair<>> into object.

BUG=607483

Review-Url: https://codereview.chromium.org/1936433002
Cr-Commit-Position: refs/heads/master@{#390610}
mostynb
fix ipc_mojo_unittests.isolate dependencies
BUG=604847

Review-Url: https://codereview.chromium.org/1930773006
Cr-Commit-Position: refs/heads/master@{#390606}
philipj
Drop self from API_OWNERS, OWNERS, etc.
tkent@ takes over web-platform-tests/dom and chcunningham@ joins
wolenetz@ in mediasource/OWNERS.

Review-Url: https://codereview.chromium.org/1919183004
Cr-Commit-Position: refs/heads/master@{#390604}
mstensho
Old lines may be detached / extracted during layout.
Back out over-simplified code from https://codereview.chromium.org/1915803004/

Since lines from an old layout pass that haven't yet been relaid out may not be
in the line box list at all at some given point during layout, lastRootBox()
didn't work as expected. It would either return the wrong last-line, or even
nullptr.

BUG=607451

Review-Url: https://codereview.chromium.org/1927913002
Cr-Commit-Position: refs/heads/master@{#390508}
tsniatowski
Add simple bit_cast unittests, avoid static_assert on gcc+libc++
These should work provided that the is_trivially_copyable logic is not
broken, and will fail to compile of the type traits lie. They do on
Android where we have gcc+libc++, so avoid being too strict there.

BUG=607158

Review-Url: https://codereview.chromium.org/1925683002
Cr-Commit-Position: refs/heads/master@{#390472}
sigbjornf
Refresh LocalDOMWindow post-Oilpan.
The debug flag m_hasBeenReset no longer serves a purpose +
OwnedPtrDeleter<> usage doesn't either.

R=
BUG=585328

Review-Url: https://codereview.chromium.org/1932653003
Cr-Commit-Position: refs/heads/master@{#390436}
sigbjornf
Remove RefCountedGarbageCollected<> GC plugin handling.
The RefCountedGarbageCollected<> transition type is no longer used
and has been removed. Follow up and retire the GC plugin's
checks for it.

R=haraken
BUG=604481

Review-Url: https://codereview.chromium.org/1932713002
Cr-Commit-Position: refs/heads/master@{#390421}
rune
querySelector* fast-path missing namespace check for no namespace.
querySelector* does not allow selectors with namespaces, yet selectors
with no namespace are still allowed. Check for empty namespace before
hitting the fast path for tag names.

R=esprehn@chromium.org
BUG=605502

Review-Url: https://codereview.chromium.org/1932673002
Cr-Commit-Position: refs/heads/master@{#390417}
jl
Use correct creation context when converting sequences to V8
The |creationContext| argument is often a reference to a window proxy
object, that may become incorrect to use if the frame is navigated and/or
detached during the loop that converts values.

BUG=607483

Review-Url: https://codereview.chromium.org/1924073003
Cr-Commit-Position: refs/heads/master@{#390408}
sigbjornf
GC plugin: split out reporting of errors/warnings.
Move code to handle reporting of errors and notes out
into a class of its own.

R=haraken
BUG=531879

Review-Url: https://codereview.chromium.org/1926863002
Cr-Commit-Position: refs/heads/master@{#390350}
sigbjornf
Add sigbjornf as blink_gc_plugin/ owner.
R=
BUG=
NOTRY=true

Review-Url: https://codereview.chromium.org/1928743002
Cr-Commit-Position: refs/heads/master@{#390325}
sigbjornf
Remove unused GCObject class.
This dummy class was accidentally re-introduced in PersistentNode.cpp during the
r389469 revert; remove it.

R=
BUG=

Review-Url: https://codereview.chromium.org/1925973002
Cr-Commit-Position: refs/heads/master@{#390323}
sigbjornf
Make warn-unneeded-finalizer warning usable.
The Blink GC plugin option warn-unneeded-finalizer (enabled by including
"warn-unneeded-finalizer=1" in your  "blink_gc_plugin_flags" gyp defines)
is potentially useful in identifying classes which needlessly derive from
GarbageCollectedFinalized<> where GarbageCollected<> would do.

To avoid far too many false positives to make it practically useful on
the Blink codebase, make it be more forgiving about bases with virtual
destructors + recognize class declarations with
finalizeGarbageCollectedObject() methods defined. Neither of those
two cases should be reported as warnings.

R=
BUG=

Review-Url: https://codereview.chromium.org/1922913004
Cr-Commit-Position: refs/heads/master@{#390184}
sigbjornf
Remove unnecessary uses of GarbageCollectedFinalized<>.
Classes which finalize nothing on their own should derive from
GarbageCollected<> instead.

(As identified by the warn-unneeded-finalizer=1 GC plugin option.)

R=haraken
BUG=585328

Committed: https://crrev.com/e10d108bc9cabf82607b909f35fc541c313e2366
Cr-Commit-Position: refs/heads/master@{#390070}

Review-Url: https://codereview.chromium.org/1929493002
Cr-Commit-Position: refs/heads/master@{#390165}
fs
SVG <marker> painting TLC
* Use range-based loop.
* Hide checking for an empty 'viewBox' in LayoutSVGResourceMarker.
* Simplify handling of marker scale due to 'markerUnits'.
* Add some const qualification, reorder forward decls and add missing
  full stops.

Review-Url: https://codereview.chromium.org/1914293003
Cr-Commit-Position: refs/heads/master@{#390112}
sigbjornf
Have MessagePort use Oilpan-based weak pointers.
Using WeakPtr<>/WeakPtrFactory<> with Oilpan heap objects is problematic
in the face of lazy sweeping, WeakPtr<> references aren't cleared until
the finalizer runs. Should a posted task (like for MessagePort) run
before that happens, it might then access already finalized objects that
MessagePort refers to.

Hence WeakPtr<>s should not be used for Oilpan objects unless extra
finalization care is taken _and_ the object depends on WeakPtrFactory<>'s
support for explicit revocation. Use Oilpan weak references instead.

Also clear out various redundant WeakPtr.h includes throughout Blink.

R=haraken
BUG=522357

Review-Url: https://codereview.chromium.org/1922923003
Cr-Commit-Position: refs/heads/master@{#390105}
sigbjornf
Remove unnecessary uses of GarbageCollectedFinalized<>.
Classes which finalize nothing on their own should derive from
GarbageCollected<> instead.

(As identified by the warn-unneeded-finalizer=1 GC plugin option.)

R=haraken
BUG=585328

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

Cr-Commit-Position: refs/heads/master@{#390070}
fs
Don't use a magic value for 'auto' oriented <marker>s
The value -1 (degrees) is a valid angle, so using it to indicate that
'auto' orientation should be used does not work out.
Just check 'orientType' directly instead and simplify the angle getter.

BUG=606345

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

Cr-Commit-Position: refs/heads/master@{#390029}
sigbjornf
Simplify ownership handling of HTMLImportsController.
The controller is now simply referred to and kept alive from the
associated master Document, detached of and disposed during
Document detach.

R=haraken
BUG=585328

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

Cr-Commit-Position: refs/heads/master@{#389814}
sigbjornf
Deprecate window.postMessage(m, transferables, origin) overload.
This argument-swapped legacy overload has little use, hence it
is time to try to phase it out. Deprecate with view to removing
in M54.

Intent: https://groups.google.com/a/chromium.org/d/msg/blink-dev/h4ooaB_Y9JE/nh7vXshGBwAJ

R=
BUG=425896

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

Cr-Commit-Position: refs/heads/master@{#389800}
jl
Use correct creation context during Iterable.forEach iteration
Use |thisValue| instead of |scriptState->context()->Global()|, since this
is simpler and since Global() actually returns a WindowProxy object that
may change and become incorrect to use as creation context depending on
what the callback function does.

BUG=605910

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

Cr-Commit-Position: refs/heads/master@{#389785}
sigbjornf
Tidy up representation of ScrollState::m_data.
OwnPtr<> is preferable in this context.

R=
BUG=

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

Cr-Commit-Position: refs/heads/master@{#389781}
sigbjornf
Tidy up WebGeolocationController.
Get rid of impedance-matching wrapper now that Oilpan is enabled
always.

R=
BUG=585328

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

Cr-Commit-Position: refs/heads/master@{#389777}
davve
Manually rebaseline hidpi tests
The following pixel tests needed rebaselining after switch from quirks
mode to standards mode in r389730:

fast/hidpi/broken-image-icon-hidpi.html
fast/hidpi/image-srcset-invalid-descriptor.html
fast/hidpi/resize-corner-hidpi.html
fast/hidpi/broken-image-with-size-hidpi.html
fast/hidpi/video-controls-in-hidpi.html
fast/hidpi/focus-rings.html
fast/hidpi/clip-text-in-hidpi.html
fast/hidpi/image-set-as-background-with-zoom.html
fast/hidpi/gradient-with-scaled-ancestor.html

TBR=yoav@yoav.ws
BUG=605065

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

Cr-Commit-Position: refs/heads/master@{#389758}
sigbjornf
Remove unnecessary uses of GarbageCollectedFinalized<>.
R=haraken
BUG=585328

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

Cr-Commit-Position: refs/heads/master@{#389756}
fs
Out-of-line some methods on LayoutSVGResourceMarker
Move the definition of orientType() and markerUnits() to the .cpp file.
Also make use of these helpers where possible and remove some unused
or redundant includes.

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

Cr-Commit-Position: refs/heads/master@{#389747}
fs
Don't force layout of descendants of SVG containers needing self-layout
There isn't much "layout" required for a generic SVG container - it is
sensitive to changes to its descendants and any impact a filter it
itself references has. We would however always relayout the entire
subtree of a container that had been marked as needing layout.
Like he code removed by https://codereview.chromium.org/1907273002, this
remaining part of the condition is primarily a remnant of the old way of
performing paint invalidation.
This CL changes to not force layout unconditionally based on the
self-needs-layout flag, but instead relies on the scale-factor-changed
flag (and of course specific marking of descendants) to handle this job.
To achieve this, rudimentary scale-factor-changed "detection" is added
to LayoutSVGRoot, as well as code to propagate this state to
descendants. LayoutSVGResourceMarker is modified in a similar fashion.
This is needed to counter-act the removal of the forced layout, since
previously this would propagate to descendants (unconditionally) by
forcing layout in both the root and containers. This effect is now
achieved (for the root) by using the scale-factor-changed signal
instead. This signal will be improved in future CLs.

BUG=603956

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

Cr-Commit-Position: refs/heads/master@{#389742}
davve
Modernize fast/hidpi layout tests
 * Add <!DOCTYPE html> to all tests. None of them seem to test
   quirk-mode specific issues.

 * Remove unnecessary <html>, <head> and <body> tags.

 * 4 space indentation.

 * Remove stale FIXME.

 * Drop </img> tags. <img> is a void element.

BUG=605065

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

Cr-Commit-Position: refs/heads/master@{#389730}
mstensho
Remove LayoutFlowThread stuff from line layout code.
We used to force full line layout if we had a flow thread with no column sets.
This may have made sense at some point in the past, where we created column
sets on the fly during layout, but we don't do that anymore (because we don't
mutate the layout tree structure during layout anymore). If we have no column
sets, it means that we cannot have any lines, since there's no column content
(because if there were, we'd have at least one column set). So it was a
pointless (albeit harmless) check.

There was also a flow thread check around some code that checks if previously
created lines will be affected by floats in new ways. If this is the right
thing to do for flowthread based fragmentation, it's also the right thing to do
for non-flowthread based (e.g. printing) fragmentation, so just remove the
check.

Also reordered and cleaned up checkPaginationAndFloatsAtEndLine() somewhat. We
don't have to do anything at all unless we have floats. Let's figure this out
as early as possible and bail if we can.

Also locate the last line in the block flow in a simpler way. Call
lastRootBox() instead of walking some chain of lines all the way to the end.

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

Cr-Commit-Position: refs/heads/master@{#389720}
sigbjornf
Support WeakMember<const T>.
It is entirely valid to have weak references to const objects, but
this failed to compile tracing calls over such members.

R=haraken
BUG=

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

Cr-Commit-Position: refs/heads/master@{#389553}
fs
Return the 'active' value for SVGURIReference.href.animVal
Make animVal return the currently used ('active') value instead of always
returning that of 'href'.
This should re-establish the former "invariant" that baseVal === animVal
when '(xlink:)href' is not being animated.

BUG=606200

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

Cr-Commit-Position: refs/heads/master@{#389490}
sigbjornf
Unify and generalize thread static persistent finalization.
Make ThreadState's registerAsStaticReference() generally available,
and not specific to LSan-only registration of static persistents
that must be cleared prior to performing leak detection.

By doing so, it can be used to handle thread-local static persistents
also.

Upon a thread finalizing its ThreadState, these static persistents
will be cleared & released. In order to make that safe and not leave
dangling PersistentNode references around afterwards, generalize
the release mechanism to also clear the Persistent/PersistentCollectionBase
that registered the persistent node.

R=haraken
BUG=

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

Cr-Commit-Position: refs/heads/master@{#389448}
sigbjornf
Make DOMTokenList.prototype.toString enumerable.
As 'stringifier' implies an enumerable toString(), drop the use
of [NotEnumerable] for DOMTokenList's. This also aligns with other
implementations (FF, Edge.)

R=yoav@yoav.ws, philipj@opera.com
BUG=306606

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

Cr-Commit-Position: refs/heads/master@{#389442}
davve
Manually rebaseline two tests from r389158
TBR=fs
BUG=601011

Review URL: