Changeset 201701 in webkit
- Timestamp:
- Jun 5, 2016, 12:48:26 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201685 r201701 1 2016-06-05 Antti Koivisto <antti@apple.com> 2 3 TextIterator should ignore non-visible frames in findPlainText 4 https://bugs.webkit.org/show_bug.cgi?id=158395 5 6 Reviewed by Dan Bernstein and Darin Adler. 7 8 * editing/text-iterator/count-matches-in-frames-expected.txt: Added. 9 * editing/text-iterator/count-matches-in-frames.html: Added. 10 * imported/blink/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-width.html: Non-rendered whitespace change. 11 1 12 2016-06-04 Brady Eidson <beidson@apple.com> 2 13 -
trunk/LayoutTests/imported/blink/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-width-expected.txt
r190629 r201701 1 1 Test passes if it does not crash. 2 2 3 -
trunk/Source/WebCore/ChangeLog
r201700 r201701 1 2016-06-05 Antti Koivisto <antti@apple.com> 2 3 Find on page finds too many matches 4 https://bugs.webkit.org/show_bug.cgi?id=158395 5 rdar://problem/7440637 6 7 Reviewed by Dan Bernstein and Darin Adler. 8 9 There is a long standing bug where in some cases WebKit may find non-visible text matches when doing find on page. 10 For example searching patch review view in bugs.webkit.org returns twice as many matches as there actually are 11 on the page. This happens because the text content is replicated in an invisible subframe. 12 13 Fix by making TextIterator ignore content in non-visible subframes in findPlainText. 14 15 Test: editing/text-iterator/count-matches-in-frames.html 16 17 * editing/TextIterator.cpp: 18 (WebCore::nextInPreOrderCrossingShadowBoundaries): 19 20 Remove support for an uninteresting assertion. 21 22 (WebCore::fullyClipsContents): 23 24 Elements without renderer clip their content (except for display:contents). 25 Test the content rect instead of the size rect for emptiness. 26 27 (WebCore::ignoresContainerClip): 28 (WebCore::pushFullyClippedState): 29 (WebCore::setUpFullyClippedStack): 30 (WebCore::isClippedByFrameAncestor): 31 32 Test if the frame owner element is clipped in any of the parent frames. 33 34 (WebCore::TextIterator::TextIterator): 35 36 If the frame is clipped by its ancestors the iterator is initialized to end state. 37 Clipped frame never renders anything so there is no need to maintain clip stack and traverse. 38 39 (WebCore::findPlainText): 40 41 Use TextIteratorClipsToFrameAncestors behavior. There might be other places where 42 this behavior should be used (or perhaps it should be used always?) but limit this to 43 text search for now. 44 45 (WebCore::depthCrossingShadowBoundaries): Deleted. 46 * editing/TextIterator.h: 47 * editing/TextIteratorBehavior.h: 48 49 Add TextIteratorClipsToFrameAncestors behavior. 50 51 * testing/Internals.cpp: 52 (WebCore::Internals::countMatchesForText): 53 (WebCore::Internals::countFindMatches): 54 (WebCore::Internals::numberOfLiveNodes): 55 * testing/Internals.h: 56 * testing/Internals.idl: 57 58 Testing support 59 1 60 2016-06-05 Konstantin Tokarev <annulen@yandex.ru> 2 61 -
trunk/Source/WebCore/editing/TextIterator.cpp
r201441 r201701 34 34 #include "HTMLBodyElement.h" 35 35 #include "HTMLElement.h" 36 #include "HTMLFrameOwnerElement.h" 36 37 #include "HTMLInputElement.h" 37 38 #include "HTMLLegendElement.h" … … 186 187 // -------- 187 188 188 #if !ASSERT_DISABLED189 190 static unsigned depthCrossingShadowBoundaries(Node& node)191 {192 unsigned depth = 0;193 for (Node* parent = node.parentOrShadowHostNode(); parent; parent = parent->parentOrShadowHostNode())194 ++depth;195 return depth;196 }197 198 #endif199 200 189 // This function is like Range::pastLastNode, except for the fact that it can climb up out of shadow trees. 201 190 static Node* nextInPreOrderCrossingShadowBoundaries(Node& rangeEndContainer, int rangeEndOffset) … … 215 204 { 216 205 auto* renderer = node.renderer(); 217 if (!is<RenderBox>(renderer) || !renderer->hasOverflowClip()) 206 if (!renderer) { 207 if (!is<Element>(node)) 208 return false; 209 return !downcast<Element>(node).hasDisplayContents(); 210 } 211 if (!is<RenderBox>(*renderer)) 218 212 return false; 219 return downcast<RenderBox>(*renderer).size().isEmpty(); 213 auto& box = downcast<RenderBox>(*renderer); 214 if (!box.hasOverflowClip()) 215 return false; 216 return box.contentSize().isEmpty(); 220 217 } 221 218 … … 230 227 static void pushFullyClippedState(BitStack& stack, Node& node) 231 228 { 232 ASSERT(stack.size() == depthCrossingShadowBoundaries(node));233 234 229 // Push true if this node full clips its contents, or if a parent already has fully 235 230 // clipped and this is not a node that ignores its container's clip. … … 240 235 { 241 236 // Put the nodes in a vector so we can iterate in reverse order. 237 // FIXME: This (and TextIterator in general) should use ComposedTreeIterator. 242 238 Vector<Node*, 100> ancestry; 243 239 for (Node* parent = node.parentOrShadowHostNode(); parent; parent = parent->parentOrShadowHostNode()) … … 249 245 pushFullyClippedState(stack, *ancestry[size - i - 1]); 250 246 pushFullyClippedState(stack, node); 251 252 ASSERT(stack.size() == 1 + depthCrossingShadowBoundaries(node)); 247 } 248 249 static bool isClippedByFrameAncestor(const Document& document, TextIteratorBehavior behavior) 250 { 251 if (!(behavior & TextIteratorClipsToFrameAncestors)) 252 return false; 253 254 for (auto* owner = document.ownerElement(); owner; owner = owner->document().ownerElement()) { 255 BitStack ownerClipStack; 256 setUpFullyClippedStack(ownerClipStack, *owner); 257 if (ownerClipStack.top()) 258 return true; 259 } 260 return false; 253 261 } 254 262 … … 366 374 if (!m_node) 367 375 return; 376 377 if (isClippedByFrameAncestor(m_node->document(), m_behavior)) 378 return; 379 368 380 setUpFullyClippedStack(m_fullyClippedStack, *m_node); 381 369 382 m_offset = m_node == m_startContainer ? m_startOffset : 0; 370 383 371 384 m_pastEndNode = nextInPreOrderCrossingShadowBoundaries(*m_endContainer, m_endOffset); 372 385 373 #ifndef NDEBUG374 // Need this just because of the assert in advance().375 386 m_positionNode = m_node; 376 #endif377 387 378 388 advance(); … … 1224 1234 m_endOffset = endOffset; 1225 1235 1226 #ifndef NDEBUG1227 // Need this just because of the assert.1228 1236 m_positionNode = endNode; 1229 #endif1230 1237 1231 1238 m_lastTextNode = nullptr; … … 2614 2621 } 2615 2622 2616 CharacterIterator findIterator(range, TextIteratorEntersTextControls );2623 CharacterIterator findIterator(range, TextIteratorEntersTextControls | TextIteratorClipsToFrameAncestors); 2617 2624 2618 2625 while (!findIterator.atEnd()) { … … 2653 2660 2654 2661 // Then, find the document position of the start and the end of the text. 2655 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls );2662 CharacterIterator computeRangeIterator(range, TextIteratorEntersTextControls | TextIteratorClipsToFrameAncestors); 2656 2663 return characterSubrange(range.ownerDocument(), computeRangeIterator, matchStart, matchLength); 2657 2664 } -
trunk/Source/WebCore/editing/TextIteratorBehavior.h
r200744 r201701 55 55 56 56 TextIteratorBehavesAsIfNodesFollowing = 1 << 7, 57 58 // Makes visiblity test take into account the visibility of the frame. 59 // FIXME: This should probably be always on unless TextIteratorIgnoresStyleVisibility is set. 60 TextIteratorClipsToFrameAncestors = 1 << 8, 57 61 }; 58 62 -
trunk/Source/WebCore/rendering/RenderBox.h
r201635 r201701 210 210 void updateLayerTransform(); 211 211 212 LayoutSize contentSize() const { return { contentWidth(), contentHeight() }; } 212 213 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } 213 214 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); } -
trunk/Source/WebCore/testing/Internals.cpp
r201422 r201701 1734 1734 } 1735 1735 1736 unsigned Internals::countFindMatches(const String& text, unsigned findOptions, ExceptionCode&) 1737 { 1738 Document* document = contextDocument(); 1739 if (!document || !document->page()) 1740 return 0; 1741 1742 return document->page()->countFindMatches(text, findOptions, 1000); 1743 } 1744 1736 1745 unsigned Internals::numberOfLiveNodes() const 1737 1746 { -
trunk/Source/WebCore/testing/Internals.h
r201422 r201701 225 225 226 226 unsigned countMatchesForText(const String&, unsigned findOptions, const String& markMatches, ExceptionCode&); 227 unsigned countFindMatches(const String&, unsigned findOptions, ExceptionCode&); 227 228 228 229 unsigned numberOfScrollableAreas(ExceptionCode&); -
trunk/Source/WebCore/testing/Internals.idl
r201422 r201701 162 162 void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType); 163 163 [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches); 164 [RaisesException] unsigned long countFindMatches(DOMString text, unsigned long findOptions); 164 165 165 166 [RaisesException] DOMString autofillFieldName(Element formControlElement);
Note:
See TracChangeset
for help on using the changeset viewer.