Changeset 185804 in webkit
- Timestamp:
- Jun 20, 2015, 11:43:14 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/TextIndicator.cpp (modified) (8 diffs)
-
WebCore/page/TextIndicator.h (modified) (3 diffs)
-
WebCore/page/mac/TextIndicatorWindow.mm (modified) (2 diffs)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebImmediateActionController.mm (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Shared/WebCoreArgumentCoders.cpp (modified) (2 diffs)
-
WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185790 r185804 1 2015-06-20 Tim Horton <timothy_horton@apple.com> 2 3 Deselection of text causes a noticeable jump on force touch machines 4 https://bugs.webkit.org/show_bug.cgi?id=146173 5 <rdar://problem/20992842> 6 7 Reviewed by Sam Weinig. 8 9 When we have a TextIndicator of type Crossfade, we end up putting 10 a layer with the blue highlight + text painted into it on top of the 11 content, and cross-fading that layer to the yellow-highlighted text. 12 13 This is necessary for BounceAndCrossfade TextIndicators, because the 14 blue highlight has to bounce, but is not necessary for Crossfade-only 15 ones; we can just fade in the yellow highlight on top of the 16 existing blue page highlight, and all is well. 17 18 So, get rid of the Crossfade TextIndicator type and use FadeIn, separately 19 keeping track of whether or not we can add a margin (we still can't 20 add a margin to TextIndicators that indicate the page's current selection, 21 because the blue highlight cannot have the margin applied to it, and we 22 want the bounds to match exactly). 23 24 * page/TextIndicator.cpp: 25 (WebCore::TextIndicator::createWithRange): 26 If the range is the same as the selection, turn off the margin. 27 We were previously doing this based on the presentation transition, but now 28 there's no difference in presentation transition in this case. 29 30 (WebCore::TextIndicator::createWithSelectionInFrame): 31 (WebCore::TextIndicator::wantsBounce): 32 (WebCore::TextIndicator::wantsContentCrossfade): 33 (WebCore::TextIndicator::wantsFadeIn): 34 (WebCore::TextIndicator::wantsManualAnimation): 35 * page/TextIndicator.h: 36 Get rid of TextIndicatorPresentationTransition::Crossfade. 37 38 (WebCore::TextIndicator::setWantsMargin): 39 (WebCore::TextIndicator::wantsMargin): 40 Keep track of whether we want a margin. 41 42 * page/mac/TextIndicatorWindow.mm: 43 (-[WebTextIndicatorView initWithFrame:textIndicator:margin:]): 44 Determine if we should use a margin based on wantsMargin instead of the 45 presentation transition. 46 1 47 2015-06-20 Ryuan Choi <ryuan.choi@navercorp.com> 2 48 -
trunk/Source/WebCore/page/TextIndicator.cpp
r184066 r185804 37 37 #include "IntRect.h" 38 38 #include "Page.h" 39 #include "Range.h" 39 40 40 41 using namespace WebCore; … … 104 105 105 106 frame->selection().setSelection(oldSelection); 107 108 indicator->setWantsMargin(!areRangesEqual(&range, oldSelection.toNormalizedRange().get())); 106 109 107 110 return indicator.release(); … … 142 145 143 146 RefPtr<Image> indicatorBitmapWithHighlight; 144 if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade || presentationTransition == TextIndicatorPresentationTransition::Crossfade)147 if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade) 145 148 indicatorBitmapWithHighlight = snapshotSelectionWithHighlight(frame); 146 149 … … 177 180 data.contentImageWithHighlight = indicatorBitmapWithHighlight; 178 181 data.presentationTransition = presentationTransition; 182 data.wantsMargin = true; 179 183 180 184 return TextIndicator::create(data); … … 204 208 205 209 case TextIndicatorPresentationTransition::FadeIn: 206 case TextIndicatorPresentationTransition::Crossfade:207 210 case TextIndicatorPresentationTransition::None: 208 211 return false; … … 220 223 switch (m_data.presentationTransition) { 221 224 case TextIndicatorPresentationTransition::BounceAndCrossfade: 222 case TextIndicatorPresentationTransition::Crossfade:223 225 return true; 224 226 … … 241 243 case TextIndicatorPresentationTransition::Bounce: 242 244 case TextIndicatorPresentationTransition::BounceAndCrossfade: 243 case TextIndicatorPresentationTransition::Crossfade:244 245 case TextIndicatorPresentationTransition::None: 245 246 return false; … … 254 255 switch (m_data.presentationTransition) { 255 256 case TextIndicatorPresentationTransition::FadeIn: 256 case TextIndicatorPresentationTransition::Crossfade:257 257 return true; 258 258 -
trunk/Source/WebCore/page/TextIndicator.h
r184066 r185804 52 52 BounceAndCrossfade, 53 53 54 // Th ese animations needto be driven manually via TextIndicatorWindow::setAnimationProgress.54 // This animation needs to be driven manually via TextIndicatorWindow::setAnimationProgress. 55 55 FadeIn, 56 Crossfade57 56 }; 58 57 … … 78 77 RefPtr<Image> contentImage; 79 78 TextIndicatorPresentationTransition presentationTransition; 79 bool wantsMargin; 80 80 }; 81 81 … … 105 105 bool wantsManualAnimation() const; 106 106 107 void setWantsMargin(bool wantsMargin) { m_data.wantsMargin = wantsMargin; } 108 bool wantsMargin() const { return m_data.wantsMargin; } 109 107 110 private: 108 111 TextIndicator(const TextIndicatorData&); -
trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm
r183870 r185804 103 103 self.layer.anchorPoint = CGPointZero; 104 104 105 bool wantsCrossfade = _textIndicator->wantsContentCrossfade();106 107 105 FloatSize contentsImageLogicalSize = _textIndicator->contentImage()->size(); 108 106 contentsImageLogicalSize.scale(1 / _textIndicator->contentImageScaleFactor()); 109 107 RetainPtr<CGImageRef> contentsImage; 110 if ( wantsCrossfade)108 if (_textIndicator->wantsContentCrossfade()) 111 109 contentsImage = _textIndicator->contentImageWithHighlight()->getCGImageRef(); 112 110 else … … 138 136 // FIXME (138888): Ideally we wouldn't remove the margin in this case, but we need to 139 137 // ensure that the yellow highlight and contentImageWithHighlight overlap precisely. 140 if ( wantsCrossfade) {138 if (!_textIndicator->wantsMargin()) { 141 139 yellowHighlightRect.inflateX(-horizontalBorder); 142 140 yellowHighlightRect.inflateY(-verticalBorder); -
trunk/Source/WebKit/mac/ChangeLog
r185766 r185804 1 2015-06-20 Tim Horton <timothy_horton@apple.com> 2 3 Deselection of text causes a noticeable jump on force touch machines 4 https://bugs.webkit.org/show_bug.cgi?id=146173 5 <rdar://problem/20992842> 6 7 Reviewed by Sam Weinig. 8 9 * WebView/WebImmediateActionController.mm: 10 (-[WebImmediateActionController _animationControllerForText]): 11 Get rid of TextIndicatorPresentationTransition::Crossfade. 12 1 13 2015-06-19 Brent Fulgham <bfulgham@apple.com> 2 14 -
trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm
r183957 r185804 529 529 530 530 RefPtr<Range> selectionRange = frame->page()->focusController().focusedOrMainFrame().selection().selection().firstRange(); 531 bool rangeMatchesSelection = areRangesEqual(dictionaryRange.get(), selectionRange.get()); 532 DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, *dictionaryRange, options, rangeMatchesSelection ? TextIndicatorPresentationTransition::Crossfade : TextIndicatorPresentationTransition::FadeIn); 531 DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, *dictionaryRange, options, TextIndicatorPresentationTransition::FadeIn); 533 532 if (!dictionaryPopupInfo.attributedString) 534 533 return nil; -
trunk/Source/WebKit2/ChangeLog
r185803 r185804 1 2015-06-20 Tim Horton <timothy_horton@apple.com> 2 3 Deselection of text causes a noticeable jump on force touch machines 4 https://bugs.webkit.org/show_bug.cgi?id=146173 5 <rdar://problem/20992842> 6 7 Reviewed by Sam Weinig. 8 9 * Shared/WebCoreArgumentCoders.cpp: 10 (IPC::ArgumentCoder<TextIndicatorData>::encode): 11 (IPC::ArgumentCoder<TextIndicatorData>::decode): 12 Encode/decode wantsMargin. 13 14 * WebProcess/WebPage/mac/WebPageMac.mm: 15 (WebKit::WebPage::performImmediateActionHitTestAtLocation): 16 (WebKit::textIndicatorTransitionForImmediateAction): Deleted. 17 Get rid of TextIndicatorPresentationTransition::Crossfade. 18 1 19 2015-06-20 Dan Bernstein <mitz@apple.com> 2 20 -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r182869 r185804 2103 2103 encoder << textIndicatorData.textRectsInBoundingRectCoordinates; 2104 2104 encoder << textIndicatorData.contentImageScaleFactor; 2105 encoder << textIndicatorData.wantsMargin; 2105 2106 encoder.encodeEnum(textIndicatorData.presentationTransition); 2106 2107 … … 2130 2131 return false; 2131 2132 2133 if (!decoder.decode(textIndicatorData.wantsMargin)) 2134 return false; 2135 2132 2136 if (!decoder.decodeEnum(textIndicatorData.presentationTransition)) 2133 2137 return false; -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r184780 r185804 1063 1063 } 1064 1064 1065 static TextIndicatorPresentationTransition textIndicatorTransitionForImmediateAction(Range* selectionRange, Range& indicatorRange, bool forDataDetectors)1066 {1067 if (areRangesEqual(&indicatorRange, selectionRange))1068 return TextIndicatorPresentationTransition::Crossfade;1069 return TextIndicatorPresentationTransition::FadeIn;1070 }1071 1072 #if ENABLE(PDFKIT_PLUGIN)1073 static TextIndicatorPresentationTransition textIndicatorTransitionForImmediateAction()1074 {1075 return TextIndicatorPresentationTransition::FadeIn;1076 }1077 #endif1078 1079 1065 void WebPage::performImmediateActionHitTestAtLocation(WebCore::FloatPoint locationInViewCoordinates) 1080 1066 { … … 1105 1091 if (!absoluteLinkURL.isEmpty() && URLElement) { 1106 1092 RefPtr<Range> linkRange = rangeOfContents(*URLElement); 1107 immediateActionResult.linkTextIndicator = TextIndicator::createWithRange(*linkRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *linkRange, false));1093 immediateActionResult.linkTextIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::FadeIn); 1108 1094 } 1109 1095 … … 1115 1101 if (Node* node = hitTestResult.innerNode()) { 1116 1102 if (Frame* hitTestResultFrame = node->document().frame()) 1117 immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &options, textIndicatorTransitionForImmediateAction(selectionRange.get(), *lookupRange, false));1103 immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &options, TextIndicatorPresentationTransition::FadeIn); 1118 1104 } 1119 1105 } … … 1141 1127 1142 1128 immediateActionResult.detectedDataBoundingBox = detectedDataBoundingBox; 1143 immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *mainResultRange, true));1129 immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, TextIndicatorPresentationTransition::FadeIn); 1144 1130 immediateActionResult.detectedDataOriginatingPageOverlay = overlay->pageOverlayID(); 1145 1131 … … 1154 1140 if (immediateActionResult.detectedDataActionContext && detectedDataRange) { 1155 1141 immediateActionResult.detectedDataBoundingBox = detectedDataBoundingBox; 1156 immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *detectedDataRange, true));1142 immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::FadeIn); 1157 1143 } 1158 1144 } … … 1182 1168 immediateActionResult.allowsCopy = true; 1183 1169 1184 immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForSelectionInPDFPlugin(selection, *pdfPugin, &options, textIndicatorTransitionForImmediateAction());1170 immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForSelectionInPDFPlugin(selection, *pdfPugin, &options, TextIndicatorPresentationTransition::FadeIn); 1185 1171 } 1186 1172 }
Note:
See TracChangeset
for help on using the changeset viewer.