| Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| index 5a627a037a844570a70db6d54df4fbe64439033e..cfa3354378d20c10f581e8ed6d39f253b884a6ca 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
|
| @@ -63,7 +63,8 @@ PaintPropertyTreeBuilder::setupInitialContext() {
|
| context.current.scroll = context.absolutePosition.scroll =
|
| context.fixedPosition.scroll = rootScrollNode();
|
|
|
| - // Ensure scroll tree properties are reset. They will be rebuilt during the tree walk.
|
| + // Ensure scroll tree properties are reset. They will be rebuilt during the
|
| + // tree walk.
|
| rootScrollNode()->clearMainThreadScrollingReasons();
|
|
|
| return context;
|
| @@ -224,11 +225,13 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
|
| // TODO(trchen): Eliminate PaintLayer dependency.
|
| PaintLayer* layer = toLayoutBoxModelObject(object).layer();
|
| if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) {
|
| - // We should use the same subpixel paint offset values for snapping regardless of whether a
|
| - // transform is present. If there is a transform we round the paint offset but keep around
|
| - // the residual fractional component for the transformed content to paint with.
|
| - // In spv1 this was called "subpixel accumulation". For more information, see
|
| - // PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentByApplyingTransform.
|
| + // We should use the same subpixel paint offset values for snapping
|
| + // regardless of whether a transform is present. If there is a transform
|
| + // we round the paint offset but keep around the residual fractional
|
| + // component for the transformed content to paint with. In spv1 this was
|
| + // called "subpixel accumulation". For more information, see
|
| + // PaintLayer::subpixelAccumulation() and
|
| + // PaintLayerPainter::paintFragmentByApplyingTransform.
|
| IntPoint roundedPaintOffset =
|
| roundedIntPoint(context.current.paintOffset);
|
| LayoutPoint fractionalPaintOffset =
|
| @@ -274,10 +277,12 @@ void PaintPropertyTreeBuilder::updateTransform(
|
| DCHECK(object.isSVGForeignObject() ||
|
| context.current.paintOffset == LayoutPoint());
|
|
|
| - // FIXME(pdr): Check for the presence of a transform instead of the value. Checking for an
|
| - // identity matrix will cause the property tree structure to change during animations if
|
| - // the animation passes through the identity matrix.
|
| - // FIXME(pdr): Refactor this so all non-root SVG objects use the same transform function.
|
| + // FIXME(pdr): Check for the presence of a transform instead of the value.
|
| + // Checking for an identity matrix will cause the property tree structure to
|
| + // change during animations if the animation passes through the identity
|
| + // matrix.
|
| + // FIXME(pdr): Refactor this so all non-root SVG objects use the same
|
| + // transform function.
|
| const AffineTransform& transform = object.isSVGForeignObject()
|
| ? object.localSVGTransform()
|
| : object.localToSVGParentTransform();
|
| @@ -310,8 +315,8 @@ void PaintPropertyTreeBuilder::updateTransform(
|
| context.current.shouldFlattenInheritedTransform;
|
| bool childrenFlattenInheritedTransform = true;
|
|
|
| - // TODO(trchen): transform-style should only be respected if a PaintLayer is
|
| - // created.
|
| + // TODO(trchen): transform-style should only be respected if a PaintLayer
|
| + // is created.
|
| if (style.preserves3D()) {
|
| // If a node with transform-style: preserve-3d does not exist in an
|
| // existing rendering context, it establishes a new one.
|
| @@ -361,9 +366,9 @@ void PaintPropertyTreeBuilder::updateCssClip(
|
| PaintPropertyTreeBuilderContext& context) {
|
| if (object.hasClip()) {
|
| // Create clip node for descendants that are not fixed position.
|
| - // We don't have to setup context.absolutePosition.clip here because this object must be
|
| - // a container for absolute position descendants, and will copy from in-flow context later
|
| - // at updateOutOfFlowContext() step.
|
| + // We don't have to setup context.absolutePosition.clip here because this
|
| + // object must be a container for absolute position descendants, and will
|
| + // copy from in-flow context later at updateOutOfFlowContext() step.
|
| DCHECK(object.canContainAbsolutePositionObjects());
|
| LayoutRect clipRect =
|
| toLayoutBox(object).clipRect(context.current.paintOffset);
|
| @@ -384,7 +389,8 @@ void PaintPropertyTreeBuilder::updateCssClip(
|
| void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(
|
| const LayoutObject& object,
|
| PaintPropertyTreeBuilderContext& context) {
|
| - // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since we don't need them at the moment.
|
| + // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since
|
| + // we don't need them at the moment.
|
| if (!object.isBox() && !object.hasLayer())
|
| return;
|
|
|
| @@ -454,10 +460,11 @@ void PaintPropertyTreeBuilder::updateOverflowClip(
|
| return;
|
| const LayoutBox& box = toLayoutBox(object);
|
|
|
| - // The <input> elements can't have contents thus CSS overflow property doesn't apply.
|
| - // However for layout purposes we do generate child layout objects for them, e.g. button label.
|
| - // We should clip the overflow from those children. This is called control clip and we
|
| - // technically treat them like overflow clip.
|
| + // The <input> elements can't have contents thus CSS overflow property doesn't
|
| + // apply. However for layout purposes we do generate child layout objects for
|
| + // them, e.g. button label. We should clip the overflow from those children.
|
| + // This is called control clip and we technically treat them like overflow
|
| + // clip.
|
| LayoutRect clipRect;
|
| if (box.hasControlClip()) {
|
| clipRect = box.controlClipRect(context.current.paintOffset);
|
| @@ -541,8 +548,8 @@ void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(
|
| SVGRootPainter(toLayoutSVGRoot(object))
|
| .transformToPixelSnappedBorderBox(context.current.paintOffset);
|
|
|
| - // The paint offset is included in |transformToBorderBox| so SVG does not need to handle paint
|
| - // offset internally.
|
| + // The paint offset is included in |transformToBorderBox| so SVG does not need
|
| + // to handle paint offset internally.
|
| context.current.paintOffset = LayoutPoint();
|
|
|
| if (transformToBorderBox.isIdentity()) {
|
| @@ -628,16 +635,17 @@ void PaintPropertyTreeBuilder::updateOutOfFlowContext(
|
| context.fixedPosition = context.current;
|
| } else if (object.getMutableForPainting().objectPaintProperties() &&
|
| object.objectPaintProperties()->cssClip()) {
|
| - // CSS clip applies to all descendants, even if this object is not a containing block
|
| - // ancestor of the descendant. It is okay for absolute-position descendants because
|
| - // having CSS clip implies being absolute position container. However for fixed-position
|
| - // descendants we need to insert the clip here if we are not a containing block ancestor
|
| - // of them.
|
| + // CSS clip applies to all descendants, even if this object is not a
|
| + // containing block ancestor of the descendant. It is okay for
|
| + // absolute-position descendants because having CSS clip implies being
|
| + // absolute position container. However for fixed-position descendants we
|
| + // need to insert the clip here if we are not a containing block ancestor of
|
| + // them.
|
| auto* cssClip =
|
| object.getMutableForPainting().objectPaintProperties()->cssClip();
|
|
|
| - // Before we actually create anything, check whether in-flow context and fixed-position
|
| - // context has exactly the same clip. Reuse if possible.
|
| + // Before we actually create anything, check whether in-flow context and
|
| + // fixed-position context has exactly the same clip. Reuse if possible.
|
| if (context.fixedPosition.clip == cssClip->parent()) {
|
| context.fixedPosition.clip = cssClip;
|
| } else {
|
| @@ -675,7 +683,8 @@ static void deriveBorderBoxFromContainerContext(
|
| case AbsolutePosition: {
|
| context.current = context.absolutePosition;
|
|
|
| - // Absolutely positioned content in an inline should be positioned relative to the inline.
|
| + // Absolutely positioned content in an inline should be positioned
|
| + // relative to the inline.
|
| const LayoutObject* container = context.containerForAbsolutePosition;
|
| if (container && container->isInFlowPositioned() &&
|
| container->isLayoutInline()) {
|
| @@ -696,14 +705,16 @@ static void deriveBorderBoxFromContainerContext(
|
| ASSERT_NOT_REACHED();
|
| }
|
|
|
| - // SVGForeignObject needs paint offset because its viewport offset is baked into its location(),
|
| - // while its localSVGTransform() doesn't contain the offset.
|
| + // SVGForeignObject needs paint offset because its viewport offset is baked
|
| + // into its location(), while its localSVGTransform() doesn't contain the
|
| + // offset.
|
| if (boxModelObject.isBox() &&
|
| (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() ||
|
| boxModelObject.isSVGForeignObject())) {
|
| - // TODO(pdr): Several calls in this function walk back up the tree to calculate containers
|
| - // (e.g., topLeftLocation, offsetForInFlowPosition*). The containing block and other
|
| - // containers can be stored on PaintPropertyTreeBuilderContext instead of recomputing them.
|
| + // TODO(pdr): Several calls in this function walk back up the tree to
|
| + // calculate containers (e.g., topLeftLocation, offsetForInFlowPosition*).
|
| + // The containing block and other containers can be stored on
|
| + // PaintPropertyTreeBuilderContext instead of recomputing them.
|
| context.current.paintOffset.moveBy(
|
| toLayoutBox(boxModelObject).topLeftLocation());
|
| // This is a weird quirk that table cells paint as children of table rows,
|
|
|