- Revision
- 186956
- Author
- [email protected]
- Date
- 2015-07-17 11:24:49 -0700 (Fri, 17 Jul 2015)
Log Message
iOS TextIndicators include text that is not supposed to be indicated
https://bugs.webkit.org/show_bug.cgi?id=147028
<rdar://problem/21643094>
Reviewed by Sam Weinig.
Paint the selection and background, but not other foregrounds, for iOS TextIndicators.
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
* page/FrameSnapshotting.h:
Add a new snapshot option where we'll paint backgrounds and the selected
foreground and nothing else.
Pass the new snapshot option through as a paint behavior.
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
Implement the incantations necessary to make a temporary selection
change not get sent to the UI process and actually have WebCore know about it
and accurately respond to questions about it.
(WebCore::TextIndicator::createWithSelectionInFrame):
Paint selection and backgrounds on iOS.
* rendering/PaintPhase.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor):
Add a new paint behavior, SelectionAndBackgroundsOnly, which behaves
the same as selection only except it allows backgrounds to paint.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::shouldCreateTransientPaintingSnapshot):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (186955 => 186956)
--- trunk/Source/WebCore/ChangeLog 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/ChangeLog 2015-07-17 18:24:49 UTC (rev 186956)
@@ -1,3 +1,37 @@
+2015-07-17 Tim Horton <[email protected]>
+
+ iOS TextIndicators include text that is not supposed to be indicated
+ https://bugs.webkit.org/show_bug.cgi?id=147028
+ <rdar://problem/21643094>
+
+ Reviewed by Sam Weinig.
+
+ Paint the selection and background, but not other foregrounds, for iOS TextIndicators.
+
+ * page/FrameSnapshotting.cpp:
+ (WebCore::snapshotFrameRect):
+ * page/FrameSnapshotting.h:
+ Add a new snapshot option where we'll paint backgrounds and the selected
+ foreground and nothing else.
+ Pass the new snapshot option through as a paint behavior.
+
+ * page/TextIndicator.cpp:
+ (WebCore::TextIndicator::createWithRange):
+ Implement the incantations necessary to make a temporary selection
+ change not get sent to the UI process and actually have WebCore know about it
+ and accurately respond to questions about it.
+
+ (WebCore::TextIndicator::createWithSelectionInFrame):
+ Paint selection and backgrounds on iOS.
+
+ * rendering/PaintPhase.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::paintLayerContents):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::selectionColor):
+ Add a new paint behavior, SelectionAndBackgroundsOnly, which behaves
+ the same as selection only except it allows backgrounds to paint.
+
2015-07-17 Mark Lam <[email protected]>
Remove leak of objects between isolated worlds on custom events, message events, and pop state events.
Modified: trunk/Source/WebCore/page/FrameSnapshotting.cpp (186955 => 186956)
--- trunk/Source/WebCore/page/FrameSnapshotting.cpp 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp 2015-07-17 18:24:49 UTC (rev 186956)
@@ -87,6 +87,8 @@
paintBehavior |= PaintBehaviorForceBlackText;
if (options & SnapshotOptionsPaintSelectionOnly)
paintBehavior |= PaintBehaviorSelectionOnly;
+ if (options & SnapshotOptionsPaintSelectionAndBackgroundsOnly)
+ paintBehavior |= PaintBehaviorSelectionAndBackgroundsOnly;
// Other paint behaviors are set by paintContentsForSnapshot.
frame.view()->setPaintBehavior(paintBehavior);
Modified: trunk/Source/WebCore/page/FrameSnapshotting.h (186955 => 186956)
--- trunk/Source/WebCore/page/FrameSnapshotting.h 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h 2015-07-17 18:24:49 UTC (rev 186956)
@@ -45,6 +45,7 @@
SnapshotOptionsPaintSelectionOnly = 1 << 1,
SnapshotOptionsInViewCoordinates = 1 << 2,
SnapshotOptionsForceBlackText = 1 << 3,
+ SnapshotOptionsPaintSelectionAndBackgroundsOnly = 1 << 4,
};
typedef unsigned SnapshotOptions;
Modified: trunk/Source/WebCore/page/TextIndicator.cpp (186955 => 186956)
--- trunk/Source/WebCore/page/TextIndicator.cpp 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/TextIndicator.cpp 2015-07-17 18:24:49 UTC (rev 186956)
@@ -27,6 +27,7 @@
#include "TextIndicator.h"
#include "Document.h"
+#include "Editor.h"
#include "Frame.h"
#include "FrameSelection.h"
#include "FrameSnapshotting.h"
@@ -54,6 +55,11 @@
if (!frame)
return nullptr;
+#if PLATFORM(IOS)
+ frame->editor().setIgnoreCompositionSelectionChange(true);
+ frame->selection().setUpdateAppearanceEnabled(true);
+#endif
+
VisibleSelection oldSelection = frame->selection().selection();
frame->selection().setSelection(range);
@@ -63,7 +69,12 @@
if (indicator)
indicator->setWantsMargin(!areRangesEqual(&range, oldSelection.toNormalizedRange().get()));
-
+
+#if PLATFORM(IOS)
+ frame->editor().setIgnoreCompositionSelectionChange(false);
+ frame->selection().setUpdateAppearanceEnabled(false);
+#endif
+
return indicator.release();
}
@@ -120,7 +131,7 @@
// FIXME: We should have TextIndicator options instead of this being platform-specific.
#if PLATFORM(IOS)
- SnapshotOptions snapshotOptions = SnapshotOptionsNone;
+ SnapshotOptions snapshotOptions = SnapshotOptionsPaintSelectionAndBackgroundsOnly;
#else
SnapshotOptions snapshotOptions = SnapshotOptionsForceBlackText | SnapshotOptionsPaintSelectionOnly;
#endif
Modified: trunk/Source/WebCore/rendering/PaintPhase.h (186955 => 186956)
--- trunk/Source/WebCore/rendering/PaintPhase.h 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/PaintPhase.h 2015-07-17 18:24:49 UTC (rev 186956)
@@ -62,6 +62,7 @@
PaintBehaviorRenderingSVGMask = 1 << 4,
PaintBehaviorSkipRootBackground = 1 << 5,
PaintBehaviorRootBackgroundOnly = 1 << 6,
+ PaintBehaviorSelectionAndBackgroundsOnly = 1 << 7,
};
typedef unsigned PaintBehavior;
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (186955 => 186956)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2015-07-17 18:24:49 UTC (rev 186956)
@@ -1575,7 +1575,7 @@
// If the element is unselectable, or we are only painting the selection,
// don't override the foreground color with the selection foreground color.
if (style().userSelect() == SELECT_NONE
- || (view().frameView().paintBehavior() & PaintBehaviorSelectionOnly))
+ || (view().frameView().paintBehavior() & (PaintBehaviorSelectionOnly | PaintBehaviorSelectionAndBackgroundsOnly)))
return Color();
if (RefPtr<RenderStyle> pseudoStyle = selectionPseudoStyle()) {
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (186955 => 186956)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-07-17 18:24:49 UTC (rev 186956)
@@ -4275,7 +4275,8 @@
if (localPaintingInfo.overlapTestRequests && isSelfPaintingLayer)
performOverlapTests(*localPaintingInfo.overlapTestRequests, localPaintingInfo.rootLayer, this);
- bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionOnly;
+ bool selectionAndBackgroundsOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionAndBackgroundsOnly;
+ bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionOnly;
PaintBehavior paintBehavior = PaintBehaviorNormal;
if (localPaintFlags & PaintLayerPaintingSkipRootBackground)
@@ -4314,7 +4315,7 @@
if (isPaintingCompositedForeground) {
if (shouldPaintContent)
paintForegroundForFragments(layerFragments, context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency,
- localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly);
+ localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly || selectionAndBackgroundsOnly);
}
if (shouldPaintOutline)
@@ -4346,7 +4347,7 @@
// Make sure that we now use the original transparency context.
ASSERT(transparencyLayerContext == context);
- if (shouldPaintContent && !selectionOnly) {
+ if (shouldPaintContent && !(selectionOnly || selectionAndBackgroundsOnly)) {
if (shouldPaintMask(paintingInfo.paintBehavior, localPaintFlags)) {
// Paint the mask for the fragments.
paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
Modified: trunk/Source/WebKit2/ChangeLog (186955 => 186956)
--- trunk/Source/WebKit2/ChangeLog 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-17 18:24:49 UTC (rev 186956)
@@ -1,3 +1,14 @@
+2015-07-17 Tim Horton <[email protected]>
+
+ iOS TextIndicators include text that is not supposed to be indicated
+ https://bugs.webkit.org/show_bug.cgi?id=147028
+ <rdar://problem/21643094>
+
+ Reviewed by Sam Weinig.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::shouldCreateTransientPaintingSnapshot):
+
2015-07-17 Carlos Garcia Campos <[email protected]>
[GTK] Cleanup PasteboardHelper
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (186955 => 186956)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2015-07-17 18:24:49 UTC (rev 186956)
@@ -1826,7 +1826,7 @@
return false;
if (FrameView* frameView = frame()->view()) {
- if (frameView->paintBehavior() & (PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText)) {
+ if (frameView->paintBehavior() & (PaintBehaviorSelectionOnly | PaintBehaviorSelectionAndBackgroundsOnly | PaintBehaviorForceBlackText)) {
// This paint behavior is used when drawing the find indicator and there's no need to
// snapshot plug-ins, because they can never be painted as part of the find indicator.
return false;