- Revision
- 186978
- Author
- [email protected]
- Date
- 2015-07-17 17:20:35 -0700 (Fri, 17 Jul 2015)
Log Message
[iOS] TextIndicator has a large forehead when line-height > 1
https://bugs.webkit.org/show_bug.cgi?id=147058
<rdar://problem/21643094>
Reviewed by Dean Jackson.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::getClippedVisibleTextRectangles):
* editing/FrameSelection.h:
Add a parameter controlling whether getClippedVisibleTextRectangles
returns selection-height rects (including extra line-height) or text-height
rects (including only the text height). Plumb it down.
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
(WebCore::TextIndicator::createWithSelectionInFrame):
Use the tighter text-height rects on iOS, where there's no selection highlight to cover up.
Remove an assertion that is no longer always true, and which is mostly obsoleted by the
fact that we don't let FrameSnapshotting code arbitrarily decide the rect to snapshot anymore.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
Apply a review comment that I left myself and then forgot about.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (186977 => 186978)
--- trunk/Source/WebCore/ChangeLog 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebCore/ChangeLog 2015-07-18 00:20:35 UTC (rev 186978)
@@ -1,5 +1,27 @@
2015-07-17 Tim Horton <[email protected]>
+ [iOS] TextIndicator has a large forehead when line-height > 1
+ https://bugs.webkit.org/show_bug.cgi?id=147058
+ <rdar://problem/21643094>
+
+ Reviewed by Dean Jackson.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::getClippedVisibleTextRectangles):
+ * editing/FrameSelection.h:
+ Add a parameter controlling whether getClippedVisibleTextRectangles
+ returns selection-height rects (including extra line-height) or text-height
+ rects (including only the text height). Plumb it down.
+
+ * page/TextIndicator.cpp:
+ (WebCore::TextIndicator::createWithRange):
+ (WebCore::TextIndicator::createWithSelectionInFrame):
+ Use the tighter text-height rects on iOS, where there's no selection highlight to cover up.
+ Remove an assertion that is no longer always true, and which is mostly obsoleted by the
+ fact that we don't let FrameSnapshotting code arbitrarily decide the rect to snapshot anymore.
+
+2015-07-17 Tim Horton <[email protected]>
+
Improve rect shrink-wrapping algorithm
https://bugs.webkit.org/show_bug.cgi?id=147037
<rdar://problem/21643094>
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (186977 => 186978)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2015-07-18 00:20:35 UTC (rev 186978)
@@ -2075,7 +2075,7 @@
return clipToVisibleContent ? intersection(selectionRect, view->visibleContentRect(ScrollableArea::LegacyIOSDocumentVisibleRect)) : selectionRect;
}
-void FrameSelection::getClippedVisibleTextRectangles(Vector<FloatRect>& rectangles) const
+void FrameSelection::getClippedVisibleTextRectangles(Vector<FloatRect>& rectangles, TextRectangleHeight textRectHeight) const
{
RenderView* root = m_frame->contentRenderer();
if (!root)
@@ -2084,7 +2084,7 @@
FloatRect visibleContentRect = m_frame->view()->visibleContentRect(ScrollableArea::LegacyIOSDocumentVisibleRect);
Vector<FloatQuad> quads;
- toNormalizedRange()->textQuads(quads, true);
+ toNormalizedRange()->textQuads(quads, textRectHeight == TextRectangleHeight::SelectionHeight);
size_t size = quads.size();
for (size_t i = 0; i < size; ++i) {
Modified: trunk/Source/WebCore/editing/FrameSelection.h (186977 => 186978)
--- trunk/Source/WebCore/editing/FrameSelection.h 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebCore/editing/FrameSelection.h 2015-07-18 00:20:35 UTC (rev 186978)
@@ -260,7 +260,8 @@
WEBCORE_EXPORT FloatRect selectionBounds(bool clipToVisibleContent = true) const;
- WEBCORE_EXPORT void getClippedVisibleTextRectangles(Vector<FloatRect>&) const;
+ enum class TextRectangleHeight { TextHeight, SelectionHeight };
+ WEBCORE_EXPORT void getClippedVisibleTextRectangles(Vector<FloatRect>&, TextRectangleHeight = TextRectangleHeight::SelectionHeight) const;
WEBCORE_EXPORT HTMLFormElement* currentForm() const;
Modified: trunk/Source/WebCore/page/TextIndicator.cpp (186977 => 186978)
--- trunk/Source/WebCore/page/TextIndicator.cpp 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebCore/page/TextIndicator.cpp 2015-07-18 00:20:35 UTC (rev 186978)
@@ -104,8 +104,17 @@
RefPtr<TextIndicator> TextIndicator::createWithSelectionInFrame(Frame& frame, TextIndicatorPresentationTransition presentationTransition, unsigned margin)
{
Vector<FloatRect> textRects;
- frame.selection().getClippedVisibleTextRectangles(textRects);
+ // On iOS, we don't need to expand the TextIndicator to cover the whole selection height.
+ // FIXME: Ideally, on Mac, there are times when we don't need to (if we don't have a selection),
+ // and using TextHeight would provide a more sensible appearance.
+#if PLATFORM(IOS)
+ FrameSelection::TextRectangleHeight textRectHeight = FrameSelection::TextRectangleHeight::TextHeight;
+#else
+ FrameSelection::TextRectangleHeight textRectHeight = FrameSelection::TextRectangleHeight::SelectionHeight;
+#endif
+ frame.selection().getClippedVisibleTextRectangles(textRects, textRectHeight);
+
// The bounding rect of all the text rects can be different than the selection
// rect when the selection spans multiple lines; the indicator doesn't actually
// care where the selection highlight goes, just where the text actually is.
@@ -166,7 +175,6 @@
TextIndicator::TextIndicator(const TextIndicatorData& data)
: m_data(data)
{
- ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage->size() == enclosingIntRect(m_data.selectionRectInRootViewCoordinates).size());
}
TextIndicator::~TextIndicator()
Modified: trunk/Source/WebKit2/ChangeLog (186977 => 186978)
--- trunk/Source/WebKit2/ChangeLog 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-18 00:20:35 UTC (rev 186978)
@@ -1,3 +1,15 @@
+2015-07-17 Tim Horton <[email protected]>
+
+ [iOS] TextIndicator has a large forehead when line-height > 1
+ https://bugs.webkit.org/show_bug.cgi?id=147058
+ <rdar://problem/21643094>
+
+ Reviewed by Dean Jackson.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::getPositionInformation):
+ Apply a review comment that I left myself and then forgot about.
+
2015-07-17 Enrica Casucci <[email protected]>
[iOS] Implement selectionInteractionAssistant accessor.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (186977 => 186978)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-17 23:59:12 UTC (rev 186977)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-18 00:20:35 UTC (rev 186978)
@@ -2198,7 +2198,7 @@
if (linkRange) {
float deviceScaleFactor = corePage()->deviceScaleFactor();
const float marginInPoints = 4;
- RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::FadeIn, marginInPoints * deviceScaleFactor);
+ RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::None, marginInPoints * deviceScaleFactor);
if (textIndicator)
info.linkIndicator = textIndicator->data();
}