Modified: trunk/Source/WebCore/ChangeLog (253832 => 253833)
--- trunk/Source/WebCore/ChangeLog 2019-12-20 19:18:46 UTC (rev 253832)
+++ trunk/Source/WebCore/ChangeLog 2019-12-20 19:40:37 UTC (rev 253833)
@@ -1,3 +1,24 @@
+2019-12-20 Daniel Bates <daba...@apple.com>
+
+ Share code for computing the absolute positioned line boxes for a range
+ https://bugs.webkit.org/show_bug.cgi?id=205510
+
+ Reviewed by Wenson Hsieh.
+
+ Implement RenderTextLineBoxes::absoluteRectsForRange() in terms of absoluteQuadsForRange()
+ to remove almost identical code. This makes absoluteRectsForRange() a tiny bit slower. If
+ it turns out this slowness isn't so tiny then we should use revert this change and implement
+ again using templates to avoid duplication.
+
+ Also moved absoluteQuadsForRange() to be above absoluteRectsForRange() to group these
+ related functions closer together.
+
+ * rendering/RenderTextLineBoxes.cpp:
+ (WebCore::RenderTextLineBoxes::absoluteQuadsForRange const): No change, though I moved it
+ to be above absoluteRectsForRange().
+ (WebCore::RenderTextLineBoxes::absoluteRectsForRange const): Implement in terms of absoluteQuadsForRange().
+ * rendering/RenderTextLineBoxes.h: Group absolute*ForRange() declarations.
+
2019-12-20 youenn fablet <you...@apple.com>
Remove the certificate info checks related to getUserMedia
Modified: trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp (253832 => 253833)
--- trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp 2019-12-20 19:18:46 UTC (rev 253832)
+++ trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp 2019-12-20 19:40:37 UTC (rev 253833)
@@ -429,9 +429,9 @@
return boxSelectionRect;
}
-Vector<IntRect> RenderTextLineBoxes::absoluteRectsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const
+Vector<FloatQuad> RenderTextLineBoxes::absoluteQuadsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const
{
- Vector<IntRect> rects;
+ Vector<FloatQuad> quads;
for (auto* box = m_first; box; box = box->nextTextBox()) {
if (start <= box->start() && box->end() <= end) {
FloatRect boundaries = box->calculateBoundaries();
@@ -445,16 +445,21 @@
boundaries.setX(selectionRect.x());
}
}
- rects.append(renderer.localToAbsoluteQuad(boundaries, UseTransforms, wasFixed).enclosingBoundingBox());
+ quads.append(renderer.localToAbsoluteQuad(boundaries, UseTransforms, wasFixed));
continue;
}
FloatRect rect = localQuadForTextBox(*box, start, end, useSelectionHeight);
if (!rect.isZero())
- rects.append(renderer.localToAbsoluteQuad(rect, UseTransforms, wasFixed).enclosingBoundingBox());
+ quads.append(renderer.localToAbsoluteQuad(rect, UseTransforms, wasFixed));
}
- return rects;
+ return quads;
}
+Vector<IntRect> RenderTextLineBoxes::absoluteRectsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const
+{
+ return absoluteQuadsForRange(renderer, start, end, useSelectionHeight, wasFixed).map([](auto& quad) { return quad.enclosingBoundingBox(); });
+}
+
Vector<FloatQuad> RenderTextLineBoxes::absoluteQuads(const RenderText& renderer, bool* wasFixed, ClippingOption option) const
{
Vector<FloatQuad> quads;
@@ -475,32 +480,6 @@
return quads;
}
-Vector<FloatQuad> RenderTextLineBoxes::absoluteQuadsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const
-{
- Vector<FloatQuad> quads;
- for (auto* box = m_first; box; box = box->nextTextBox()) {
- if (start <= box->start() && box->end() <= end) {
- FloatRect boundaries = box->calculateBoundaries();
- if (useSelectionHeight) {
- LayoutRect selectionRect = box->localSelectionRect(start, end);
- if (box->isHorizontal()) {
- boundaries.setHeight(selectionRect.height());
- boundaries.setY(selectionRect.y());
- } else {
- boundaries.setWidth(selectionRect.width());
- boundaries.setX(selectionRect.x());
- }
- }
- quads.append(renderer.localToAbsoluteQuad(boundaries, UseTransforms, wasFixed));
- continue;
- }
- FloatRect rect = localQuadForTextBox(*box, start, end, useSelectionHeight);
- if (!rect.isZero())
- quads.append(renderer.localToAbsoluteQuad(rect, UseTransforms, wasFixed));
- }
- return quads;
-}
-
void RenderTextLineBoxes::dirtyAll()
{
for (auto* box = m_first; box; box = box->nextTextBox())
Modified: trunk/Source/WebCore/rendering/RenderTextLineBoxes.h (253832 => 253833)
--- trunk/Source/WebCore/rendering/RenderTextLineBoxes.h 2019-12-20 19:18:46 UTC (rev 253832)
+++ trunk/Source/WebCore/rendering/RenderTextLineBoxes.h 2019-12-20 19:40:37 UTC (rev 253833)
@@ -64,10 +64,10 @@
LayoutRect visualOverflowBoundingBox(const RenderText&) const;
- Vector<IntRect> absoluteRectsForRange(const RenderText&, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const;
enum ClippingOption { NoClipping, ClipToEllipsis };
Vector<FloatQuad> absoluteQuads(const RenderText&, bool* wasFixed, ClippingOption) const;
Vector<FloatQuad> absoluteQuadsForRange(const RenderText&, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const;
+ Vector<IntRect> absoluteRectsForRange(const RenderText&, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const;
#if !ASSERT_DISABLED
~RenderTextLineBoxes();