Commit f06540c5 authored by Xianzhu Wang's avatar Xianzhu Wang

[CI] Refactor FragmentPaintPropertyTreeBuilder::UpdateForPaintOffsetTranslation

- Combine ApplyPaintOffsetTranslation into the method. This avoids
  the ambiguous function name.

- Remove unrelated context_.absolute_position.paint_offset and
  context_.fixed_position.paint_offset updates for LayoutView from
  the function. They will be done by existing code in
  UpdateOutOfFlowContext().

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I3cd103cf5d7614f144ebfcf30c3aaa7a75db76f6
Reviewed-on: https://chromium-review.googlesource.com/1080014Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563139}
parent 4ed270af
...@@ -252,8 +252,11 @@ static bool NeedsPaintOffsetTranslation(const LayoutObject& object) { ...@@ -252,8 +252,11 @@ static bool NeedsPaintOffsetTranslation(const LayoutObject& object) {
return false; return false;
} }
IntPoint ApplyPaintOffsetTranslation(const LayoutObject& object, void FragmentPaintPropertyTreeBuilder::UpdateForPaintOffsetTranslation(
LayoutPoint& paint_offset) { base::Optional<IntPoint>& paint_offset_translation) {
if (!NeedsPaintOffsetTranslation(object_))
return;
// We should use the same subpixel paint offset values for snapping // We should use the same subpixel paint offset values for snapping
// regardless of whether a transform is present. If there is a transform // regardless of whether a transform is present. If there is a transform
// we round the paint offset but keep around the residual fractional // we round the paint offset but keep around the residual fractional
...@@ -261,35 +264,21 @@ IntPoint ApplyPaintOffsetTranslation(const LayoutObject& object, ...@@ -261,35 +264,21 @@ IntPoint ApplyPaintOffsetTranslation(const LayoutObject& object,
// called "subpixel accumulation". For more information, see // called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and // PaintLayer::subpixelAccumulation() and
// PaintLayerPainter::paintFragmentByApplyingTransform. // PaintLayerPainter::paintFragmentByApplyingTransform.
IntPoint paint_offset_translation = RoundedIntPoint(paint_offset); paint_offset_translation = RoundedIntPoint(context_.current.paint_offset);
LayoutPoint fractional_paint_offset = LayoutPoint fractional_paint_offset =
LayoutPoint(paint_offset - paint_offset_translation); LayoutPoint(context_.current.paint_offset - *paint_offset_translation);
if (fractional_paint_offset != LayoutPoint()) { if (fractional_paint_offset != LayoutPoint()) {
// If the object has a non-translation transform, discard the fractional // If the object has a non-translation transform, discard the fractional
// paint offset which can't be transformed by the transform. // paint offset which can't be transformed by the transform.
TransformationMatrix matrix; TransformationMatrix matrix;
object.StyleRef().ApplyTransform( object_.StyleRef().ApplyTransform(
matrix, LayoutSize(), ComputedStyle::kExcludeTransformOrigin, matrix, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
ComputedStyle::kIncludeMotionPath, ComputedStyle::kIncludeMotionPath,
ComputedStyle::kIncludeIndependentTransformProperties); ComputedStyle::kIncludeIndependentTransformProperties);
if (!matrix.IsIdentityOrTranslation()) if (!matrix.IsIdentityOrTranslation())
fractional_paint_offset = LayoutPoint(); fractional_paint_offset = LayoutPoint();
} }
paint_offset = fractional_paint_offset; context_.current.paint_offset = fractional_paint_offset;
return paint_offset_translation;
}
void FragmentPaintPropertyTreeBuilder::UpdateForPaintOffsetTranslation(
base::Optional<IntPoint>& paint_offset_translation) {
if (!NeedsPaintOffsetTranslation(object_))
return;
paint_offset_translation =
ApplyPaintOffsetTranslation(object_, context_.current.paint_offset);
if (object_.IsLayoutView()) {
context_.absolute_position.paint_offset = context_.current.paint_offset;
context_.fixed_position.paint_offset = context_.current.paint_offset;
}
} }
void FragmentPaintPropertyTreeBuilder::UpdatePaintOffsetTranslation( void FragmentPaintPropertyTreeBuilder::UpdatePaintOffsetTranslation(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment