WebKit Bugzilla
Attachment 372642 Details for
Bug 199049
: Preview of <picture> element doesn't match element bounds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199049-20190621130740.patch (text/plain), 23.04 KB, created by
Tim Horton
on 2019-06-21 13:07:41 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2019-06-21 13:07:41 PDT
Size:
23.04 KB
patch
obsolete
>Subversion Revision: 246652 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d6b03f8bededfd1b0cd106f4f344159cfcbe465a..acae6688ca368c4c5381b9561a7cd1013d361ac5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2019-06-20 Tim Horton <timothy_horton@apple.com> >+ >+ Preview of <picture> element doesn't match element bounds >+ https://bugs.webkit.org/show_bug.cgi?id=199049 >+ <rdar://problem/51474402> >+ >+ Reviewed by Simon Fraser. >+ >+ Test: fast/text-indicator/text-indicator-uses-img-size-inside-picture.html >+ >+ * dom/DOMRectReadOnly.idl: >+ * dom/Range.cpp: >+ (WebCore::Range::absoluteRectsForRangeInText const): >+ (WebCore::Range::absoluteTextRects const): >+ (WebCore::Range::borderAndTextRects const): >+ (WebCore::Range::boundingRect const): >+ (WebCore::Range::absoluteBoundingRect const): >+ * dom/Range.h: >+ (WebCore::Range::absoluteTextRects): >+ (WebCore::Range::absoluteBoundingRect): >+ (WebCore::Range::borderAndTextRects): >+ (WebCore::Range::boundingRect): >+ * page/TextIndicator.cpp: >+ (WebCore::absoluteBoundingRectForRange): >+ (WebCore::estimatedBackgroundColorForRange): >+ (WebCore::initializeIndicator): >+ * rendering/RenderBlock.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::TextIndicatorData::TextIndicatorData): >+ (WebCore::Internals::TextIndicatorData::~TextIndicatorData): >+ (WebCore::Internals::textIndicatorForRange): >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2019-06-20 Brent Fulgham <bfulgham@apple.com> > > Resolve frequent crashes in topPrivatelyControlledDomain >diff --git a/Source/WebCore/dom/DOMRectReadOnly.idl b/Source/WebCore/dom/DOMRectReadOnly.idl >index 9975a6342663a8421c135d0ef543a1cc5d1ac877..58721fd61c6a67624c8c67afa4aebc5f7fc040cc 100644 >--- a/Source/WebCore/dom/DOMRectReadOnly.idl >+++ b/Source/WebCore/dom/DOMRectReadOnly.idl >@@ -28,6 +28,7 @@ > [ > Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, > optional unrestricted double width = 0, optional unrestricted double height = 0), >+ ExportMacro=WEBCORE_EXPORT, > Exposed=(Window,Worker), > GenerateIsReachable=Impl, > ImplementationLacksVTable >diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp >index 73db66949d1680c0f7fe6809f5174ec360fb15a1..bf8fdbdff96029af2d1a7a8102b4a37814c04c3d 100644 >--- a/Source/WebCore/dom/Range.cpp >+++ b/Source/WebCore/dom/Range.cpp >@@ -40,8 +40,10 @@ > #include "NodeTraversal.h" > #include "NodeWithIndex.h" > #include "ProcessingInstruction.h" >+#include "RenderBlock.h" > #include "RenderBoxModelObject.h" > #include "RenderText.h" >+#include "RenderView.h" > #include "ScopedEventQueue.h" > #include "TextIterator.h" > #include "VisiblePosition.h" >@@ -1159,14 +1161,14 @@ IntRect Range::absoluteBoundingBox() const > return result; > } > >-Vector<FloatRect> Range::absoluteRectsForRangeInText(Node* node, RenderText& renderText, bool useSelectionHeight, bool& isFixed, RespectClippingForTextRects respectClippingForTextRects) const >+Vector<FloatRect> Range::absoluteRectsForRangeInText(Node* node, RenderText& renderText, bool useSelectionHeight, bool& isFixed, OptionSet<BoundingRectBehavior> rectOptions) const > { > unsigned startOffset = node == &startContainer() ? m_start.offset() : 0; > unsigned endOffset = node == &endContainer() ? m_end.offset() : std::numeric_limits<unsigned>::max(); > > auto textQuads = renderText.absoluteQuadsForRange(startOffset, endOffset, useSelectionHeight, &isFixed); > >- if (respectClippingForTextRects == RespectClippingForTextRects::Yes) { >+ if (rectOptions.contains(BoundingRectBehavior::RespectClipping)) { > Vector<FloatRect> clippedRects; > clippedRects.reserveInitialCapacity(textQuads.size()); > >@@ -1188,7 +1190,7 @@ Vector<FloatRect> Range::absoluteRectsForRangeInText(Node* node, RenderText& ren > return floatRects; > } > >-void Range::absoluteTextRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed, RespectClippingForTextRects respectClippingForTextRects) const >+void Range::absoluteTextRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed, OptionSet<BoundingRectBehavior> rectOptions) const > { > // FIXME: This function should probably return FloatRects. > >@@ -1204,7 +1206,7 @@ void Range::absoluteTextRects(Vector<IntRect>& rects, bool useSelectionHeight, R > if (renderer->isBR()) > renderer->absoluteRects(rects, flooredLayoutPoint(renderer->localToAbsolute())); > else if (is<RenderText>(*renderer)) { >- auto rectsForRenderer = absoluteRectsForRangeInText(node, downcast<RenderText>(*renderer), useSelectionHeight, isFixed, respectClippingForTextRects); >+ auto rectsForRenderer = absoluteRectsForRangeInText(node, downcast<RenderText>(*renderer), useSelectionHeight, isFixed, rectOptions); > for (auto& rect : rectsForRenderer) > rects.append(enclosingIntRect(rect)); > } else >@@ -1793,13 +1795,14 @@ Ref<DOMRect> Range::getBoundingClientRect() const > return DOMRect::create(boundingRect(CoordinateSpace::Client)); > } > >-Vector<FloatRect> Range::borderAndTextRects(CoordinateSpace space, RespectClippingForTextRects respectClippingForTextRects) const >+Vector<FloatRect> Range::borderAndTextRects(CoordinateSpace space, OptionSet<BoundingRectBehavior> rectOptions) const > { > Vector<FloatRect> rects; > > ownerDocument().updateLayoutIgnorePendingStylesheets(); > > Node* stopNode = pastLastNode(); >+ bool useVisibleBounds = rectOptions.contains(BoundingRectBehavior::UseVisibleBounds); > > HashSet<Node*> selectedElementsSet; > for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) { >@@ -1811,22 +1814,37 @@ Vector<FloatRect> Range::borderAndTextRects(CoordinateSpace space, RespectClippi > Node* lastNode = m_end.childBefore() ? m_end.childBefore() : &endContainer(); > for (Node* parent = lastNode->parentNode(); parent; parent = parent->parentNode()) > selectedElementsSet.remove(parent); >+ >+ OptionSet<RenderObject::VisibleRectContextOption> visibleRectOptions = { RenderObject::VisibleRectContextOption::UseEdgeInclusiveIntersection, RenderObject::VisibleRectContextOption::ApplyCompositedClips, RenderObject::VisibleRectContextOption::ApplyCompositedContainerScrolls }; > > for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) { >- if (is<Element>(*node) && selectedElementsSet.contains(node) && (!node->parentNode() || !selectedElementsSet.contains(node->parentNode()))) { >+ if (is<Element>(*node) && selectedElementsSet.contains(node) && (useVisibleBounds || !node->parentNode() || !selectedElementsSet.contains(node->parentNode()))) { > if (auto* renderer = downcast<Element>(*node).renderBoxModelObject()) { >+ if (useVisibleBounds) { >+ auto localBounds = renderer->borderBoundingBox(); >+ auto rootClippedBounds = renderer->computeVisibleRectInContainer(localBounds, &renderer->view(), { false, false, visibleRectOptions }); >+ if (!rootClippedBounds) >+ continue; >+ auto snappedBounds = snapRectToDevicePixels(*rootClippedBounds, node->document().deviceScaleFactor()); >+ if (space == CoordinateSpace::Client) >+ node->document().convertAbsoluteToClientRect(snappedBounds, renderer->style()); >+ rects.append(snappedBounds); >+ >+ continue; >+ } >+ > Vector<FloatQuad> elementQuads; > renderer->absoluteQuads(elementQuads); > if (space == CoordinateSpace::Client) > node->document().convertAbsoluteToClientQuads(elementQuads, renderer->style()); >- >+ > for (auto& quad : elementQuads) > rects.append(quad.boundingBox()); > } > } else if (is<Text>(*node)) { > if (auto* renderer = downcast<Text>(*node).renderer()) { > bool isFixed; >- auto clippedRects = absoluteRectsForRangeInText(node, *renderer, false, isFixed, respectClippingForTextRects); >+ auto clippedRects = absoluteRectsForRangeInText(node, *renderer, false, isFixed, rectOptions); > if (space == CoordinateSpace::Client) > node->document().convertAbsoluteToClientRects(clippedRects, renderer->style()); > >@@ -1838,17 +1856,17 @@ Vector<FloatRect> Range::borderAndTextRects(CoordinateSpace space, RespectClippi > return rects; > } > >-FloatRect Range::boundingRect(CoordinateSpace space, RespectClippingForTextRects respectClippingForTextRects) const >+FloatRect Range::boundingRect(CoordinateSpace space, OptionSet<BoundingRectBehavior> rectOptions) const > { > FloatRect result; >- for (auto& rect : borderAndTextRects(space, respectClippingForTextRects)) >+ for (auto& rect : borderAndTextRects(space, rectOptions)) > result.uniteIfNonZero(rect); > return result; > } > >-FloatRect Range::absoluteBoundingRect(RespectClippingForTextRects respectClippingForTextRects) const >+FloatRect Range::absoluteBoundingRect(OptionSet<BoundingRectBehavior> rectOptions) const > { >- return boundingRect(CoordinateSpace::Absolute, respectClippingForTextRects); >+ return boundingRect(CoordinateSpace::Absolute, rectOptions); > } > > WTF::TextStream& operator<<(WTF::TextStream& ts, const RangeBoundaryPoint& r) >diff --git a/Source/WebCore/dom/Range.h b/Source/WebCore/dom/Range.h >index b99b31410d67c5c52079323d65fcc0589df0a854..003533d598aa867f3d1cd5c8cd376da60d0f9e23 100644 >--- a/Source/WebCore/dom/Range.h >+++ b/Source/WebCore/dom/Range.h >@@ -28,6 +28,7 @@ > #include "IntRect.h" > #include "RangeBoundaryPoint.h" > #include <wtf/Forward.h> >+#include <wtf/OptionSet.h> > #include <wtf/RefCounted.h> > #include <wtf/Vector.h> > >@@ -114,15 +115,19 @@ public: > PartiallyFixedPosition, > EntirelyFixedPosition > }; >+ >+ enum class BoundingRectBehavior : uint8_t { >+ RespectClipping = 1 << 0, >+ UseVisibleBounds = 1 << 1, >+ }; > > // Not transform-friendly >- enum class RespectClippingForTextRects { No, Yes }; >- WEBCORE_EXPORT void absoluteTextRects(Vector<IntRect>&, bool useSelectionHeight = false, RangeInFixedPosition* = nullptr, RespectClippingForTextRects = RespectClippingForTextRects::No) const; >+ WEBCORE_EXPORT void absoluteTextRects(Vector<IntRect>&, bool useSelectionHeight = false, RangeInFixedPosition* = nullptr, OptionSet<BoundingRectBehavior> = { }) const; > WEBCORE_EXPORT IntRect absoluteBoundingBox() const; > > // Transform-friendly > WEBCORE_EXPORT void absoluteTextQuads(Vector<FloatQuad>&, bool useSelectionHeight = false, RangeInFixedPosition* = nullptr) const; >- WEBCORE_EXPORT FloatRect absoluteBoundingRect(RespectClippingForTextRects = RespectClippingForTextRects::No) const; >+ WEBCORE_EXPORT FloatRect absoluteBoundingRect(OptionSet<BoundingRectBehavior> = { }) const; > #if PLATFORM(IOS_FAMILY) > WEBCORE_EXPORT void collectSelectionRects(Vector<SelectionRect>&) const; > WEBCORE_EXPORT int collectSelectionRectsWithoutUnionInteriorLines(Vector<SelectionRect>&) const; >@@ -163,10 +168,10 @@ private: > ExceptionOr<RefPtr<DocumentFragment>> processContents(ActionType); > > enum class CoordinateSpace { Absolute, Client }; >- Vector<FloatRect> borderAndTextRects(CoordinateSpace, RespectClippingForTextRects = RespectClippingForTextRects::No) const; >- FloatRect boundingRect(CoordinateSpace, RespectClippingForTextRects = RespectClippingForTextRects::No) const; >+ Vector<FloatRect> borderAndTextRects(CoordinateSpace, OptionSet<BoundingRectBehavior> = { }) const; >+ FloatRect boundingRect(CoordinateSpace, OptionSet<BoundingRectBehavior> = { }) const; > >- Vector<FloatRect> absoluteRectsForRangeInText(Node*, RenderText&, bool useSelectionHeight, bool& isFixed, RespectClippingForTextRects) const; >+ Vector<FloatRect> absoluteRectsForRangeInText(Node*, RenderText&, bool useSelectionHeight, bool& isFixed, OptionSet<BoundingRectBehavior>) const; > > Ref<Document> m_ownerDocument; > RangeBoundaryPoint m_start; >diff --git a/Source/WebCore/page/TextIndicator.cpp b/Source/WebCore/page/TextIndicator.cpp >index 7900812f0f3e2771f3ad523557b319b0202aee12..a05d2eb8d75e30707ecb524be80cab618e45baa3 100644 >--- a/Source/WebCore/page/TextIndicator.cpp >+++ b/Source/WebCore/page/TextIndicator.cpp >@@ -221,6 +221,14 @@ static HashSet<Color> estimatedTextColorsForRange(const Range& range) > } > return colors; > } >+ >+static FloatRect absoluteBoundingRectForRange(const Range& range) >+{ >+ return range.absoluteBoundingRect({ >+ Range::BoundingRectBehavior::RespectClipping, >+ Range::BoundingRectBehavior::UseVisibleBounds >+ }); >+} > > static Color estimatedBackgroundColorForRange(const Range& range, const Frame& frame) > { >@@ -236,7 +244,7 @@ static Color estimatedBackgroundColorForRange(const Range& range, const Frame& f > commonAncestor = commonAncestor->parentOrShadowHostElement(); > } > >- auto boundingRectForRange = enclosingIntRect(range.absoluteBoundingRect(Range::RespectClippingForTextRects::Yes)); >+ auto boundingRectForRange = enclosingIntRect(absoluteBoundingRectForRange(range)); > Vector<Color> parentRendererBackgroundColors; > for (; !!renderer; renderer = renderer->parent()) { > auto absoluteBoundingBox = renderer->absoluteBoundingBoxRect(); >@@ -311,7 +319,7 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Ran > #endif > else { > Vector<IntRect> absoluteTextRects; >- range.absoluteTextRects(absoluteTextRects, textRectHeight == FrameSelection::TextRectangleHeight::SelectionHeight, nullptr, Range::RespectClippingForTextRects::Yes); >+ range.absoluteTextRects(absoluteTextRects, textRectHeight == FrameSelection::TextRectangleHeight::SelectionHeight, nullptr, Range::BoundingRectBehavior::RespectClipping); > > textRects.reserveInitialCapacity(absoluteTextRects.size()); > for (auto& rect : absoluteTextRects) >@@ -319,7 +327,7 @@ static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Ran > } > > if (textRects.isEmpty()) >- textRects.append(range.absoluteBoundingRect(Range::RespectClippingForTextRects::Yes)); >+ textRects.append(absoluteBoundingRectForRange(range)); > > auto frameView = frame.view(); > >diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h >index 01ffc8d0deb0f2eb3ff29d5f05057e7f48d8a34b..128b5f18715a5fbf94d4be7c7ea48e8750b9acb6 100644 >--- a/Source/WebCore/rendering/RenderBlock.h >+++ b/Source/WebCore/rendering/RenderBlock.h >@@ -393,6 +393,9 @@ public: > void adjustBorderBoxRectForPainting(LayoutRect&) override; > LayoutRect paintRectToClipOutFromBorder(const LayoutRect&) override; > bool isInlineBlockOrInlineTable() const final { return isInline() && isReplaced(); } >+ >+ void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override; >+ void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; > > protected: > virtual void addOverflowFromChildren(); >@@ -477,9 +480,6 @@ private: > virtual void clipOutFloatingObjects(RenderBlock&, const PaintInfo*, const LayoutPoint&, const LayoutSize&) { }; > friend class LogicalSelectionOffsetCaches; > >- void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override; >- void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; >- > void paintContinuationOutlines(PaintInfo&, const LayoutPoint&); > > LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) final; >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 7efc7c4469712f06c734fee2fadc534532047c4a..5d07868212c74f59f7479858d4a967a569027037 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -5095,5 +5095,22 @@ void Internals::setIsPlayingToAutomotiveHeadUnit(bool isPlaying) > { > PlatformMediaSessionManager::sharedManager().setIsPlayingToAutomotiveHeadUnit(isPlaying); > } >+ >+Internals::TextIndicatorInfo::TextIndicatorInfo() >+{ >+} >+ >+Internals::TextIndicatorInfo::TextIndicatorInfo(const WebCore::TextIndicatorData& data) >+ : textBoundingRectInRootViewCoordinates(DOMRect::create(data.textBoundingRectInRootViewCoordinates)) >+{ >+} >+ >+Internals::TextIndicatorInfo::~TextIndicatorInfo() = default; >+ >+Internals::TextIndicatorInfo Internals::textIndicatorForRange(const Range& range, TextIndicatorOptions options) >+{ >+ auto indicator = TextIndicator::createWithRange(range, options.core(), TextIndicatorPresentationTransition::None); >+ return indicator->data(); >+} > > } // namespace WebCore >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 0c03d68646ae6b4cc42cbe139f0a7c0c645308fc..21c9cd7bc495abd920564e4f78c80bd08dcadd54 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -35,6 +35,7 @@ > #include "OrientationNotifier.h" > #include "PageConsoleClient.h" > #include "RealtimeMediaSource.h" >+#include "TextIndicator.h" > #include <JavaScriptCore/Float32Array.h> > #include <wtf/Optional.h> > >@@ -53,6 +54,7 @@ class AudioContext; > class CacheStorageConnection; > class DOMRect; > class DOMRectList; >+class DOMRectReadOnly; > class DOMURL; > class DOMWindow; > class Document; >@@ -827,6 +829,28 @@ public: > void setXHRMaximumIntervalForUserGestureForwarding(XMLHttpRequest&, double); > > void setIsPlayingToAutomotiveHeadUnit(bool); >+ >+ struct TextIndicatorInfo { >+ RefPtr<DOMRectReadOnly> textBoundingRectInRootViewCoordinates; >+ >+ TextIndicatorInfo(); >+ TextIndicatorInfo(const WebCore::TextIndicatorData&); >+ ~TextIndicatorInfo(); >+ }; >+ >+ struct TextIndicatorOptions { >+ bool useBoundingRectAndPaintAllContentForComplexRanges { false }; >+ >+ WebCore::TextIndicatorOptions core() >+ { >+ WebCore::TextIndicatorOptions options = 0; >+ if (useBoundingRectAndPaintAllContentForComplexRanges) >+ options = options | TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges; >+ return options; >+ } >+ }; >+ >+ TextIndicatorInfo textIndicatorForRange(const Range&, TextIndicatorOptions); > > private: > explicit Internals(Document&); >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 2692535d4614227aa161f4bdc86a08f258062f01..19e1b30492ba7a6f1f22247f6836de3a44cc7a6e 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -159,6 +159,20 @@ enum CompositingPolicy { > boolean isSameSiteStrict; > }; > >+[ >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ JSGenerateToJSObject, >+] dictionary TextIndicatorInfo { >+ DOMRectReadOnly textBoundingRectInRootViewCoordinates; >+}; >+ >+[ >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ JSGenerateToJSObject, >+] dictionary TextIndicatorOptions { >+ boolean useBoundingRectAndPaintAllContentForComplexRanges = false; >+}; >+ > [ > ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, > NoInterfaceObject, >@@ -757,4 +771,6 @@ enum CompositingPolicy { > void setXHRMaximumIntervalForUserGestureForwarding(XMLHttpRequest xhr, double interval); > > void setIsPlayingToAutomotiveHeadUnit(boolean value); >+ >+ TextIndicatorInfo textIndicatorForRange(Range range, TextIndicatorOptions options); > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 47c6893d660da8b79769270df2b7c7f436c25bb5..f08b4bd02fe5572760d16592d2a0291ea1b269f9 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-06-20 Tim Horton <timothy_horton@apple.com> >+ >+ Preview of <picture> element doesn't match element bounds >+ https://bugs.webkit.org/show_bug.cgi?id=199049 >+ <rdar://problem/51474402> >+ >+ Reviewed by Simon Fraser. >+ >+ * fast/text-indicator/text-indicator-uses-img-size-inside-picture-expected.txt: Added. >+ * fast/text-indicator/text-indicator-uses-img-size-inside-picture.html: Added. >+ > 2019-06-20 Saam Barati <sbarati@apple.com> > > [WHLSL] Property resolver needs to recurse on newValueExpression for RMW operations >diff --git a/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture-expected.txt b/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..825763439f97a58deadafe903cc636742d9d8ede >--- /dev/null >+++ b/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture-expected.txt >@@ -0,0 +1,6 @@ >+ >+imageOnly: -2 -1 260 258 >+picture: -2 -1 260 258 >+clippedPicture: -2 -1 260 22 >+deeperClippedPicture: -2 -1 260 22 >+ >diff --git a/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture.html b/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0fdfdfd867e1e3d32a0353194177634ce0cb51e9 >--- /dev/null >+++ b/LayoutTests/fast/text-indicator/text-indicator-uses-img-size-inside-picture.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+* { box-sizing: border-box; } >+body { margin: 0; } >+span { position: absolute; top: 0; left: 0; } >+</style> >+<script> >+if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+function output(s) >+{ >+ window.log.innerText += s + "\n"; >+} >+ >+function runTest() >+{ >+ if (!window.internals) { >+ output("This test cannot be run outside of WebKitTestRunner."); >+ return; >+ } >+ >+ function dumpIndicatorBoundsForElement(el) >+ { >+ var indicatorOptions = {"useBoundingRectAndPaintAllContentForComplexRanges": true}; >+ var range = internals.rangeFromLocationAndLength(el, 0, 1); >+ var indicator = window.internals.textIndicatorForRange(range, indicatorOptions); >+ var rect = indicator.textBoundingRectInRootViewCoordinates; >+ output(`${el.id}: ${rect.x} ${rect.y} ${rect.width} ${rect.height}`); >+ } >+ >+ dumpIndicatorBoundsForElement(document.getElementById("imageOnly")); >+ dumpIndicatorBoundsForElement(document.getElementById("picture")); >+ dumpIndicatorBoundsForElement(document.getElementById("clippedPicture")); >+ dumpIndicatorBoundsForElement(document.getElementById("deeperClippedPicture")); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<span id="imageOnly"><img src="../images/resources/green-256x256.jpg"></span> >+<span id="picture"><picture><img src="../images/resources/green-256x256.jpg"></picture></span> >+<span id="clippedPicture"><picture style="display: inline-block; height: 20px; overflow: hidden;"><img src="../images/resources/green-256x256.jpg"></picture></span> >+<span id="deeperClippedPicture"><div style="display: inline-block; height: 20px; overflow: hidden;"><picture style="position: relative; height: 50px; overflow: hidden;"><img src="../images/resources/green-256x256.jpg"></picture></div></span> >+<pre id="log"></pre> >+</body> >+</html> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199049
:
372509
|
372515
|
372517
|
372520
|
372521
|
372522
|
372545
|
372597
| 372642