Commit 6819be07 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Revert "[PE] Support float, block, table descendants for background-clip:text"

This reverts commit 91779560.

Reason for revert: The layout object to paint text clip might not be
LayoutBlock.

Bug: 881644

Original change's description:
> [PE] Support float, block, table descendants for background-clip:text
> 
> In https://chromium-review.googlesource.com/c/chromium/src/+/1197462
> we changed box_model_.Paint() to LineBoxListPainter so we no longer
> supported text clip for descendants other than inline contents.
> 
> This CL calls ToLayoutBlock(box_model_).PaintObject() to support text
> clip of other descendants, and still avoid the original double paint
> offset issue of box_model_.Paint().
> 
> Bug: 880825
> Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
> Change-Id: I2c4b0e23df11bf300c01f9c804fb7e7d129f3aa0
> Reviewed-on: https://chromium-review.googlesource.com/1211244
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#589314}

TBR=wangxianzhu@chromium.org,pdr@chromium.org

Change-Id: Id26f9f690884300fceb4bdaf3e4f3fb2aad4fc04
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 880825
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Reviewed-on: https://chromium-review.googlesource.com/1212483Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589443}
parent e7492cbb
<!DOCTYPE html>
<style>
body {
font-size: 40px;
}
.transformed {
transform: translateX(0);
}
.clip-text {
background: blue;
-webkit-background-clip: text;
color: rgba(255,0,0,0.5);
clear: both;
}
</style>
Passes if all texts are purple.
<div class="clip-text">Block</div>
<div class="clip-text">Block transformed</div>
<div><div class="clip-text" style="float:left">Float</div><br></div>
<div><div class="clip-text" style="float:left">Float transformed</div><br></div>
<table><tr><td class="clip-text">Table</td></tr></table>
<table><tr><td class="clip-text">Table transformed</td></tr></table>
Except these (inline-block is not supported for text background clip yet):
<div style="color: rgba(255,0,0,0.5"><div style="display: inline-block">Inline block</div></div>
<div style="color: rgba(255,0,0,0.5"><div style="display: inline-block">Inline block transformed</div></div>
<!DOCTYPE html>
<style>
body {
font-size: 40px;
}
.transformed {
transform: translateX(0);
}
.clip-text {
background: blue;
-webkit-background-clip: text;
color: rgba(255,0,0,0.5);
}
</style>
Passes if all texts are purple.
<div class="clip-text"><div>Block</div></div>
<div class="clip-text transformed"><div>Block transformed</div></div>
<div class="clip-text"><div style="float:left">Float</div><br></div>
<div class="clip-text transformed"><div style="float:left">Float transformed</div><br></div>
<table class="clip-text"><tr><td>Table</td></tr></table>
<table class="clip-text transformed"><tr><td>Table transformed</td></tr></table>
Except these (inline-block is not supported for text background clip yet):
<div class="clip-text"><div style="display: inline-block">Inline block</div></div>
<div class="clip-text transformed"><div style="display: inline-block">Inline block transformed</div></div>
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
#include "third_party/blink/renderer/core/paint/box_model_object_painter.h" #include "third_party/blink/renderer/core/paint/box_model_object_painter.h"
#include "third_party/blink/renderer/core/layout/layout_block.h" #include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_box_model_object.h" #include "third_party/blink/renderer/core/layout/layout_box_model_object.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/line/root_inline_box.h" #include "third_party/blink/renderer/core/layout/line/root_inline_box.h"
#include "third_party/blink/renderer/core/paint/background_image_geometry.h" #include "third_party/blink/renderer/core/paint/background_image_geometry.h"
#include "third_party/blink/renderer/core/paint/line_box_list_painter.h"
#include "third_party/blink/renderer/core/paint/object_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h"
#include "third_party/blink/renderer/core/paint/paint_info.h" #include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
...@@ -83,9 +85,14 @@ void BoxModelObjectPainter::PaintTextClipMask(GraphicsContext& context, ...@@ -83,9 +85,14 @@ void BoxModelObjectPainter::PaintTextClipMask(GraphicsContext& context,
flow_box_->Paint(paint_info, paint_offset - local_offset, root.LineTop(), flow_box_->Paint(paint_info, paint_offset - local_offset, root.LineTop(),
root.LineBottom()); root.LineBottom());
} else { } else {
// We should go through the above path for LayoutInlines. const LineBoxList* line_boxes = nullptr;
DCHECK(box_model_.IsLayoutBlock()); if (box_model_.IsLayoutBlockFlow())
ToLayoutBlock(box_model_).PaintObject(paint_info, paint_offset); line_boxes = &ToLayoutBlockFlow(box_model_).LineBoxes();
else if (box_model_.IsLayoutInline())
line_boxes = ToLayoutInline(box_model_).LineBoxes();
if (!line_boxes)
return;
LineBoxListPainter(*line_boxes).Paint(box_model_, paint_info, paint_offset);
} }
} }
......
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