https://bugs.webkit.org/show_bug.cgi?id=169309
<rdar://problem/
30883525>
Reviewed by Tim Horton.
Source/WebCore:
Work towards <rdar://problem/
30882974>. Adds support in TextIndicator to include a snapshot of all visible
content, excluding nodes captured in the current selection. This comes in the form of the new
TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.
No new tests, since there is no change in behavior yet.
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/FrameSnapshotting.h:
Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.
(WebCore::snapshotFrameRectWithClip):
* page/TextIndicator.cpp:
If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
snapshot of the visible bounds of the frame.
(WebCore::takeSnapshot):
(WebCore::takeSnapshots):
(WebCore::initializeIndicator):
* page/TextIndicator.h:
Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthOfTextRange):
* platform/graphics/FontCascade.h:
Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
text decorations for the selected region of the TextRun.
* rendering/InlineTextBox.cpp:
Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
Similarly, when painting text decorations, we exclude the rect surrounding the selected content.
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):
* rendering/InlineTextBox.h:
* rendering/PaintPhase.h:
Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
lie within the current selection range.
* rendering/RenderLayer.cpp:
Propagate the PaintBehaviorExcludeSelection flag to children when painting.
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintForegroundForFragments):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
paint behavior is enabled.
* rendering/TextDecorationPainter.h:
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextSelectionPaintStyle):
* rendering/TextPaintStyle.h:
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintText):
* rendering/TextPainter.h:
Source/WebKit2:
Serialize the snapshot excluding the selection and the snapshot's bounds when sending TextIndicatorData over
IPC to the UI process.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextIndicatorData>::encode):
(IPC::ArgumentCoder<TextIndicatorData>::decode):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213614
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-03-08 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Add TextIndicator support for providing a snapshot excluding selected content
+ https://bugs.webkit.org/show_bug.cgi?id=169309
+ <rdar://problem/30883525>
+
+ Reviewed by Tim Horton.
+
+ Work towards <rdar://problem/30882974>. Adds support in TextIndicator to include a snapshot of all visible
+ content, excluding nodes captured in the current selection. This comes in the form of the new
+ TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.
+
+ No new tests, since there is no change in behavior yet.
+
+ * page/FrameSnapshotting.cpp:
+ (WebCore::snapshotFrameRectWithClip):
+ * page/FrameSnapshotting.h:
+
+ Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.
+
+ (WebCore::snapshotFrameRectWithClip):
+ * page/TextIndicator.cpp:
+
+ If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
+ snapshot of the visible bounds of the frame.
+
+ (WebCore::takeSnapshot):
+ (WebCore::takeSnapshots):
+ (WebCore::initializeIndicator):
+ * page/TextIndicator.h:
+
+ Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.
+
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::FontCascade::widthOfTextRange):
+ * platform/graphics/FontCascade.h:
+
+ Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
+ before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
+ text decorations for the selected region of the TextRun.
+
+ * rendering/InlineTextBox.cpp:
+
+ Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
+ used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
+ Similarly, when painting text decorations, we exclude the rect surrounding the selected content.
+
+ (WebCore::InlineTextBox::paint):
+ (WebCore::InlineTextBox::paintDecoration):
+ * rendering/InlineTextBox.h:
+ * rendering/PaintPhase.h:
+
+ Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
+ lie within the current selection range.
+
+ * rendering/RenderLayer.cpp:
+
+ Propagate the PaintBehaviorExcludeSelection flag to children when painting.
+
+ (WebCore::RenderLayer::paintLayerContents):
+ (WebCore::RenderLayer::paintForegroundForFragments):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::shouldPaint):
+
+ Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
+ paint behavior is enabled.
+
+ * rendering/TextDecorationPainter.h:
+ * rendering/TextPaintStyle.cpp:
+ (WebCore::computeTextSelectionPaintStyle):
+ * rendering/TextPaintStyle.h:
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::paintText):
+ * rendering/TextPainter.h:
+
2017-03-08 Youenn Fablet <youenn@apple.com>
Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
return snapshotFrameRectWithClip(frame, imageRect, clipRects, options);
}
-std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRect& imageRect, Vector<FloatRect>& clipRects, SnapshotOptions options)
+std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRect& imageRect, const Vector<FloatRect>& clipRects, SnapshotOptions options)
{
if (!frame.page())
return nullptr;
paintBehavior |= PaintBehaviorSelectionOnly;
if (options & SnapshotOptionsPaintSelectionAndBackgroundsOnly)
paintBehavior |= PaintBehaviorSelectionAndBackgroundsOnly;
+ if (options & SnapshotOptionsPaintEverythingExcludingSelection)
+ paintBehavior |= PaintBehaviorExcludeSelection;
// Other paint behaviors are set by paintContentsForSnapshot.
frame.view()->setPaintBehavior(paintBehavior);
SnapshotOptionsInViewCoordinates = 1 << 2,
SnapshotOptionsForceBlackText = 1 << 3,
SnapshotOptionsPaintSelectionAndBackgroundsOnly = 1 << 4,
+ SnapshotOptionsPaintEverythingExcludingSelection = 1 << 5
};
typedef unsigned SnapshotOptions;
WEBCORE_EXPORT std::unique_ptr<ImageBuffer> snapshotFrameRect(Frame&, const IntRect&, SnapshotOptions = SnapshotOptionsNone);
-std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame&, const IntRect&, Vector<FloatRect>& clipRects, SnapshotOptions = SnapshotOptionsNone);
+std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame&, const IntRect&, const Vector<FloatRect>& clipRects = { }, SnapshotOptions = SnapshotOptionsNone);
std::unique_ptr<ImageBuffer> snapshotNode(Frame&, Node&);
WEBCORE_EXPORT std::unique_ptr<ImageBuffer> snapshotSelection(Frame&, SnapshotOptions = SnapshotOptionsNone);
return snapshotOptions;
}
-static RefPtr<Image> takeSnapshot(Frame& frame, IntRect rect, SnapshotOptions options, float& scaleFactor, Vector<FloatRect>& clipRectsInDocumentCoordinates)
+static RefPtr<Image> takeSnapshot(Frame& frame, IntRect rect, SnapshotOptions options, float& scaleFactor, const Vector<FloatRect>& clipRectsInDocumentCoordinates)
{
std::unique_ptr<ImageBuffer> buffer = snapshotFrameRectWithClip(frame, rect, clipRectsInDocumentCoordinates, options);
if (!buffer)
return ImageBuffer::sinkIntoImage(WTFMove(buffer), Unscaled);
}
-static bool takeSnapshots(TextIndicatorData& data, Frame& frame, IntRect snapshotRect, Vector<FloatRect>& clipRectsInDocumentCoordinates)
+static bool takeSnapshots(TextIndicatorData& data, Frame& frame, IntRect snapshotRect, const Vector<FloatRect>& clipRectsInDocumentCoordinates)
{
SnapshotOptions snapshotOptions = snapshotOptionsForTextIndicatorOptions(data.options);
data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, SnapshotOptionsNone, snapshotScaleFactor, clipRectsInDocumentCoordinates);
ASSERT(!data.contentImageWithHighlight || data.contentImageScaleFactor == snapshotScaleFactor);
}
+
+ if (data.options & TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection) {
+ float snapshotScaleFactor;
+ auto snapshotRect = enclosingIntRect(frame.view()->visualViewportRect());
+ data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, SnapshotOptionsPaintEverythingExcludingSelection, snapshotScaleFactor, { });
+ data.contentImageWithoutSelectionRectInRootViewCoordinates = frame.view()->contentsToRootView(snapshotRect);
+ }
return true;
}
};
// Make sure to keep these in sync with the ones in Internals.idl.
-enum TextIndicatorOption : uint8_t {
+enum TextIndicatorOption : uint16_t {
TextIndicatorOptionDefault = 0,
// Use the styled text color instead of forcing black text (the default)
// By default, TextIndicator clips the indicated rects to the visible content rect.
// If this option is set, do not clip the indicated rects.
TextIndicatorOptionDoNotClipToVisibleRect = 1 << 7,
+
+ // Include an additional snapshot of everything in view, with the exception of nodes within the currently selected range.
+ TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection = 1 << 8,
};
-typedef uint8_t TextIndicatorOptions;
+typedef uint16_t TextIndicatorOptions;
struct TextIndicatorData {
FloatRect selectionRectInRootViewCoordinates;
FloatRect textBoundingRectInRootViewCoordinates;
+ FloatRect contentImageWithoutSelectionRectInRootViewCoordinates;
Vector<FloatRect> textRectsInBoundingRectCoordinates;
float contentImageScaleFactor;
RefPtr<Image> contentImageWithHighlight;
+ RefPtr<Image> contentImageWithoutSelection;
RefPtr<Image> contentImage;
TextIndicatorPresentationTransition presentationTransition;
TextIndicatorOptions options;
#include "FontCascade.h"
#include "CharacterProperties.h"
+#include "ComplexTextController.h"
#include "FloatRect.h"
#include "FontCache.h"
#include "GlyphBuffer.h"
drawEmphasisMarksForComplexText(context, run, mark, point, from, destination);
}
+float FontCascade::widthOfTextRange(const TextRun& run, unsigned from, unsigned to, HashSet<const Font*>* fallbackFonts, float* outWidthBeforeRange, float* outWidthAfterRange) const
+{
+ ASSERT(from <= to);
+ ASSERT(to <= run.length());
+
+ float offsetBeforeRange = 0;
+ float offsetAfterRange = 0;
+ float totalWidth = 0;
+
+ auto codePathToUse = codePath(run);
+ if (codePathToUse == Complex) {
+ ComplexTextController complexIterator(*this, run, false, fallbackFonts);
+ complexIterator.advance(from, nullptr, IncludePartialGlyphs, fallbackFonts);
+ offsetBeforeRange = complexIterator.runWidthSoFar();
+ complexIterator.advance(to, nullptr, IncludePartialGlyphs, fallbackFonts);
+ offsetAfterRange = complexIterator.runWidthSoFar();
+ complexIterator.advance(run.length(), nullptr, IncludePartialGlyphs, fallbackFonts);
+ totalWidth = complexIterator.runWidthSoFar();
+ } else {
+ WidthIterator simpleIterator(this, run, fallbackFonts);
+ simpleIterator.advance(from, nullptr);
+ offsetBeforeRange = simpleIterator.runWidthSoFar();
+ simpleIterator.advance(to, nullptr);
+ offsetAfterRange = simpleIterator.runWidthSoFar();
+ simpleIterator.advance(run.length(), nullptr);
+ totalWidth = simpleIterator.runWidthSoFar();
+ }
+
+ if (outWidthBeforeRange)
+ *outWidthBeforeRange = offsetBeforeRange;
+
+ if (outWidthAfterRange)
+ *outWidthAfterRange = totalWidth - offsetAfterRange;
+
+ return offsetAfterRange - offsetBeforeRange;
+}
+
float FontCascade::width(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
CodePath codePathToUse = codePath(run);
DashArray dashesForIntersectionsWithRect(const TextRun&, const FloatPoint& textOrigin, const FloatRect& lineExtents) const;
+ float widthOfTextRange(const TextRun&, unsigned from, unsigned to, HashSet<const Font*>* fallbackFonts = 0, float* outWidthBeforeRange = nullptr, float* outWidthAfterRange = nullptr) const;
WEBCORE_EXPORT float width(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
float widthForSimpleText(StringView text) const;
bool paintSelectedTextOnly = false;
bool paintSelectedTextSeparately = false;
+ bool paintNonSelectedTextOnly = false;
const ShadowData* selectionShadow = nullptr;
// Text with custom underlines does not have selection background painted, so selection paint style is not appropriate for it.
- TextPaintStyle selectionPaintStyle = haveSelection && !useCustomUnderlines ? computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow) : textPaintStyle;
+ TextPaintStyle selectionPaintStyle = haveSelection && !useCustomUnderlines ? computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly, selectionShadow) : textPaintStyle;
// Set our font.
const FontCascade& font = fontToUse(lineStyle, renderer());
textPainter.addTextShadow(textShadow, selectionShadow);
textPainter.addEmphasis(emphasisMark, emphasisMarkOffset, combinedText);
- textPainter.paintText(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately);
+ textPainter.paintText(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly);
// Paint decorations
TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
- if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection)
- paintDecoration(context, font, combinedText, textRun, textOrigin, boxRect, textDecorations, textPaintStyle, textShadow);
+ if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection) {
+ FloatRect textDecorationSelectionClipOutRect;
+ if ((paintInfo.paintBehavior & PaintBehaviorExcludeSelection) && selectionStart < selectionEnd && selectionEnd <= length) {
+ textDecorationSelectionClipOutRect = logicalOverflowRect();
+ textDecorationSelectionClipOutRect.moveBy(localPaintOffset);
+ float logicalWidthBeforeRange;
+ float logicalWidthAfterRange;
+ float logicalSelectionWidth = font.widthOfTextRange(textRun, selectionStart, selectionEnd, nullptr, &logicalWidthBeforeRange, &logicalWidthAfterRange);
+ // FIXME: Do we need to handle vertical bottom to top text?
+ if (!isHorizontal()) {
+ textDecorationSelectionClipOutRect.move(0, logicalWidthBeforeRange);
+ textDecorationSelectionClipOutRect.setHeight(logicalSelectionWidth);
+ } else if (direction() == RTL) {
+ textDecorationSelectionClipOutRect.move(logicalWidthAfterRange, 0);
+ textDecorationSelectionClipOutRect.setWidth(logicalSelectionWidth);
+ } else {
+ textDecorationSelectionClipOutRect.move(logicalWidthBeforeRange, 0);
+ textDecorationSelectionClipOutRect.setWidth(logicalSelectionWidth);
+ }
+ }
+ paintDecoration(context, font, combinedText, textRun, textOrigin, boxRect, textDecorations, textPaintStyle, textShadow, textDecorationSelectionClipOutRect);
+ }
if (paintInfo.phase == PaintPhaseForeground) {
paintDocumentMarkers(context, boxOrigin, lineStyle, font, false);
}
void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade& font, RenderCombineText* combinedText, const TextRun& textRun, const FloatPoint& textOrigin,
- const FloatRect& boxRect, TextDecoration decoration, TextPaintStyle textPaintStyle, const ShadowData* shadow)
+ const FloatRect& boxRect, TextDecoration decoration, TextPaintStyle textPaintStyle, const ShadowData* shadow, const FloatRect& clipOutRect)
{
if (m_truncation == cFullTruncation)
return;
FloatPoint localOrigin = boxRect.location();
localOrigin.move(start, 0);
+
+ if (!clipOutRect.isEmpty()) {
+ context.save();
+ context.clipOut(clipOutRect);
+ }
+
decorationPainter.paintTextDecoration(textRun, textOrigin, localOrigin);
+ if (!clipOutRect.isEmpty())
+ context.restore();
+
if (combinedText)
context.concatCTM(rotation(boxRect, Counterclockwise));
}
private:
void paintDecoration(GraphicsContext&, const FontCascade&, RenderCombineText*, const TextRun&, const FloatPoint& textOrigin, const FloatRect& boxRect,
- TextDecoration, TextPaintStyle, const ShadowData*);
+ TextDecoration, TextPaintStyle, const ShadowData*, const FloatRect& clipOutRect);
void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, const Color& textColor);
void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
PaintBehaviorSkipRootBackground = 1 << 6,
PaintBehaviorRootBackgroundOnly = 1 << 7,
PaintBehaviorSelectionAndBackgroundsOnly = 1 << 8,
+ PaintBehaviorExcludeSelection = 1 << 9,
};
typedef unsigned PaintBehavior;
else if (localPaintFlags & PaintLayerPaintingRootBackgroundOnly)
paintBehavior |= PaintBehaviorRootBackgroundOnly;
+ if (paintingInfo.paintBehavior & PaintBehaviorExcludeSelection)
+ paintBehavior |= PaintBehaviorExcludeSelection;
+
LayoutRect paintDirtyRect = localPaintingInfo.paintDirtyRect;
if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
// Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment, as well as whether or not the content of each
else
localPaintBehavior = paintBehavior;
+ if (localPaintingInfo.paintBehavior & PaintBehaviorExcludeSelection)
+ localPaintBehavior |= PaintBehaviorExcludeSelection;
+
// Optimize clipping for the single fragment case.
bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRect.isEmpty();
ClipRect clippedRect;
bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
+ if ((paintInfo.paintBehavior & PaintBehaviorExcludeSelection) && isSelected())
+ return false;
+
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline
&& paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseMask)
return false;
namespace WebCore {
class FontCascade;
+class FloatRect;
class GraphicsContext;
class InlineTextBox;
class RenderObject;
return paintStyle;
}
-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle& textPaintStyle, const RenderText& renderer, const RenderStyle& lineStyle, const PaintInfo& paintInfo, bool& paintSelectedTextOnly, bool& paintSelectedTextSeparately, const ShadowData*& selectionShadow)
+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle& textPaintStyle, const RenderText& renderer, const RenderStyle& lineStyle, const PaintInfo& paintInfo, bool& paintSelectedTextOnly, bool& paintSelectedTextSeparately, bool& paintNonSelectedTextOnly, const ShadowData*& selectionShadow)
{
paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
- paintSelectedTextSeparately = false;
+ paintSelectedTextSeparately = paintInfo.paintBehavior & PaintBehaviorExcludeSelection;
+ paintNonSelectedTextOnly = paintInfo.paintBehavior & PaintBehaviorExcludeSelection;
selectionShadow = (paintInfo.forceTextColor()) ? nullptr : lineStyle.textShadow();
TextPaintStyle selectionPaintStyle = textPaintStyle;
};
TextPaintStyle computeTextPaintStyle(const Frame&, const RenderStyle&, const PaintInfo&);
-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&, const RenderText&, const RenderStyle&, const PaintInfo&, bool& paintSelectedTextOnly, bool& paintSelectedTextSeparately, const ShadowData*& selectionShadow);
+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&, const RenderText&, const RenderStyle&, const PaintInfo&, bool& paintSelectedTextOnly, bool& paintSelectedTextSeparately, bool& paintNonSelectedTextOnly, const ShadowData*& selectionShadow);
enum FillColorType { UseNormalFillColor, UseEmphasisMarkColor };
void updateGraphicsContext(GraphicsContext&, const TextPaintStyle&, FillColorType = UseNormalFillColor);
}
void TextPainter::paintText(const TextRun& textRun, unsigned length, const FloatRect& boxRect, const FloatPoint& textOrigin, unsigned selectionStart, unsigned selectionEnd,
- bool paintSelectedTextOnly, bool paintSelectedTextSeparately)
+ bool paintSelectedTextOnly, bool paintSelectedTextSeparately, bool paintNonSelectedTextOnly)
{
ASSERT(m_font);
if (!paintSelectedTextOnly) {
paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, selectionEnd, length, m_textPaintStyle, m_textShadow);
}
}
+
+ if (paintNonSelectedTextOnly)
+ return;
+
// Paint only the text that is selected.
if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) {
GraphicsContextStateSaver stateSaver(m_context, m_selectionPaintStyle.strokeWidth > 0);
void addTextShadow(const ShadowData* textShadow, const ShadowData* selectionShadow);
void paintText(const TextRun&, unsigned length, const FloatRect& boxRect, const FloatPoint& textOrigin,
- unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false);
+ unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false, bool paintNonSelectedTextOnly = false);
private:
void drawTextOrEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& emphasisMark, float emphasisMarkOffset,
+2017-03-08 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ Add TextIndicator support for providing a snapshot excluding selected content
+ https://bugs.webkit.org/show_bug.cgi?id=169309
+ <rdar://problem/30883525>
+
+ Reviewed by Tim Horton.
+
+ Serialize the snapshot excluding the selection and the snapshot's bounds when sending TextIndicatorData over
+ IPC to the UI process.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<TextIndicatorData>::encode):
+ (IPC::ArgumentCoder<TextIndicatorData>::decode):
+
2017-03-08 Brent Fulgham <bfulgham@apple.com>
REGRESSION(r213564): Netflix does not play content
encoder << textIndicatorData.selectionRectInRootViewCoordinates;
encoder << textIndicatorData.textBoundingRectInRootViewCoordinates;
encoder << textIndicatorData.textRectsInBoundingRectCoordinates;
+ encoder << textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates;
encoder << textIndicatorData.contentImageScaleFactor;
encoder.encodeEnum(textIndicatorData.presentationTransition);
encoder << static_cast<uint64_t>(textIndicatorData.options);
encodeOptionalImage(encoder, textIndicatorData.contentImage.get());
encodeOptionalImage(encoder, textIndicatorData.contentImageWithHighlight.get());
+ encodeOptionalImage(encoder, textIndicatorData.contentImageWithoutSelection.get());
}
bool ArgumentCoder<TextIndicatorData>::decode(Decoder& decoder, TextIndicatorData& textIndicatorData)
if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))
return false;
+ if (!decoder.decode(textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates))
+ return false;
+
if (!decoder.decode(textIndicatorData.contentImageScaleFactor))
return false;
if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithHighlight))
return false;
+ if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithoutSelection))
+ return false;
+
return true;
}