Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1657)

Unified Diff: third_party/WebKit/Source/web/tests/TextFinderTest.cpp

Issue 2144673003: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in SearchBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback addressed. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/TextFinderTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
index c40f851c4da0341aa9bce5c94be520b56437afe7..9bce1b51271511dfcea2eab430b93737fa4e83f9 100644
--- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -10,6 +10,7 @@
#include "core/dom/Range.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
#include "core/frame/VisualViewport.h"
#include "core/html/HTMLElement.h"
#include "core/layout/TextAutosizer.h"
@@ -69,6 +70,7 @@ WebFloatRect TextFinderTest::findInPageRect(Node* startContainer, int startOffse
TEST_F(TextFinderTest, FindTextSimple)
{
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
Node* textNode = document().body()->firstChild();
int identifier = 0;
@@ -138,6 +140,7 @@ TEST_F(TextFinderTest, FindTextSimple)
TEST_F(TextFinderTest, FindTextAutosizing)
{
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("FindMe"));
@@ -153,6 +156,7 @@ TEST_F(TextFinderTest, FindTextAutosizing)
document().settings()->setTextAutosizingEnabled(true);
document().settings()->setTextAutosizingWindowSizeOverride(IntSize(20, 20));
document().textAutosizer()->updatePageInfo();
+ document().updateStyleAndLayout();
// In case of autosizing, scale _should_ change
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect));
@@ -163,6 +167,7 @@ TEST_F(TextFinderTest, FindTextAutosizing)
visualViewport.setScale(20);
document().settings()->setTextAutosizingEnabled(false);
document().textAutosizer()->updatePageInfo();
+ document().updateStyleAndLayout();
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect));
ASSERT_TRUE(textFinder().activeMatch());
@@ -172,6 +177,7 @@ TEST_F(TextFinderTest, FindTextAutosizing)
TEST_F(TextFinderTest, FindTextNotFound)
{
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("Boo"));
@@ -191,6 +197,7 @@ TEST_F(TextFinderTest, FindTextInShadowDOM)
Node* textInBElement = document().body()->firstChild()->firstChild();
Node* textInIElement = document().body()->lastChild()->firstChild();
Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild();
+ document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("foo"));
@@ -278,6 +285,8 @@ TEST_F(TextFinderTest, FindTextInShadowDOM)
TEST_F(TextFinderTest, ScopeTextMatchesSimple)
{
document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
+
Node* textNode = document().body()->firstChild();
int identifier = 0;
@@ -305,6 +314,7 @@ TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM)
Node* textInBElement = document().body()->firstChild()->firstChild();
Node* textInIElement = document().body()->lastChild()->firstChild();
Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild();
+ document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("fOO"));
@@ -330,6 +340,8 @@ TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM)
TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches)
{
document().body()->setInnerHTML("ab ab ab ab ab", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
+
Node* textNode = document().body()->firstChild();
int identifier = 0;
@@ -352,6 +364,8 @@ TEST_F(TextFinderTest, ScopeRepeatPatternTextMatches)
TEST_F(TextFinderTest, OverlappingMatches)
{
document().body()->setInnerHTML("aababaa", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
+
Node* textNode = document().body()->firstChild();
int identifier = 0;
@@ -374,6 +388,8 @@ TEST_F(TextFinderTest, OverlappingMatches)
TEST_F(TextFinderTest, SequentialMatches)
{
document().body()->setInnerHTML("ababab", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
+
Node* textNode = document().body()->firstChild();
int identifier = 0;
@@ -397,6 +413,7 @@ TEST_F(TextFinderTest, SequentialMatches)
TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOM)
{
document().body()->setInnerHTML("<b>XXXXFindMeYYYY</b><i></i>", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("FindMe"));
@@ -420,6 +437,7 @@ TEST_F(TextFinderTest, FindTextJavaScriptUpdatesDOM)
Element* iElement = toElement(document().body()->lastChild());
ASSERT_TRUE(iElement);
iElement->setInnerHTML("ZZFindMe", ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithinFrame, selectionRect, &activeNow));
Range* activeMatch = textFinder().activeMatch();
@@ -485,6 +503,7 @@ TEST_F(TextFinderFakeTimerTest, ScopeWithTimeouts)
text.insert(searchPattern, 90);
document().body()->setInnerHTML(text, ASSERT_NO_EXCEPTION);
+ document().updateStyleAndLayout();
int identifier = 0;
WebFindOptions findOptions; // Default.
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698