OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "SkBitmap.h" | 35 #include "SkBitmap.h" |
36 #include "SkCanvas.h" | 36 #include "SkCanvas.h" |
37 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 37 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
38 #include "bindings/core/v8/V8Node.h" | 38 #include "bindings/core/v8/V8Node.h" |
39 #include "core/clipboard/DataTransfer.h" | 39 #include "core/clipboard/DataTransfer.h" |
40 #include "core/css/StyleSheetContents.h" | 40 #include "core/css/StyleSheetContents.h" |
41 #include "core/css/resolver/StyleResolver.h" | 41 #include "core/css/resolver/StyleResolver.h" |
42 #include "core/css/resolver/ViewportStyleResolver.h" | 42 #include "core/css/resolver/ViewportStyleResolver.h" |
43 #include "core/dom/DocumentMarkerController.h" | 43 #include "core/dom/DocumentMarkerController.h" |
44 #include "core/dom/Fullscreen.h" | 44 #include "core/dom/Fullscreen.h" |
45 #include "core/dom/NodeLayoutStyle.h" | 45 #include "core/dom/NodeComputedStyle.h" |
46 #include "core/dom/Range.h" | 46 #include "core/dom/Range.h" |
47 #include "core/editing/Editor.h" | 47 #include "core/editing/Editor.h" |
48 #include "core/editing/FrameSelection.h" | 48 #include "core/editing/FrameSelection.h" |
49 #include "core/editing/SpellChecker.h" | 49 #include "core/editing/SpellChecker.h" |
50 #include "core/editing/VisiblePosition.h" | 50 #include "core/editing/VisiblePosition.h" |
51 #include "core/events/MouseEvent.h" | 51 #include "core/events/MouseEvent.h" |
52 #include "core/fetch/FetchRequest.h" | 52 #include "core/fetch/FetchRequest.h" |
53 #include "core/fetch/MemoryCache.h" | 53 #include "core/fetch/MemoryCache.h" |
54 #include "core/fetch/ResourceFetcher.h" | 54 #include "core/fetch/ResourceFetcher.h" |
55 #include "core/frame/FrameHost.h" | 55 #include "core/frame/FrameHost.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 EXPECT_THAT(matchedSelectors(), ElementsAre("div.initial_off", "div.initial_
on")); | 467 EXPECT_THAT(matchedSelectors(), ElementsAre("div.initial_off", "div.initial_
on")); |
468 | 468 |
469 // Check that we can turn off callbacks for certain selectors. | 469 // Check that we can turn off callbacks for certain selectors. |
470 doc().watchCSSSelectors(WebVector<WebString>()); | 470 doc().watchCSSSelectors(WebVector<WebString>()); |
471 m_frame->view()->layout(); | 471 m_frame->view()->layout(); |
472 runPendingTasks(); | 472 runPendingTasks(); |
473 EXPECT_EQ(3, updateCount()); | 473 EXPECT_EQ(3, updateCount()); |
474 EXPECT_THAT(matchedSelectors(), ElementsAre()); | 474 EXPECT_THAT(matchedSelectors(), ElementsAre()); |
475 } | 475 } |
476 | 476 |
477 TEST_F(WebFrameCSSCallbackTest, SharedLayoutStyle) | 477 TEST_F(WebFrameCSSCallbackTest, SharedComputedStyle) |
478 { | 478 { |
479 // Check that adding an element calls back when it matches an existing rule. | 479 // Check that adding an element calls back when it matches an existing rule. |
480 std::vector<WebString> selectors; | 480 std::vector<WebString> selectors; |
481 selectors.push_back(WebString::fromUTF8("span")); | 481 selectors.push_back(WebString::fromUTF8("span")); |
482 doc().watchCSSSelectors(WebVector<WebString>(selectors)); | 482 doc().watchCSSSelectors(WebVector<WebString>(selectors)); |
483 | 483 |
484 executeScript( | 484 executeScript( |
485 "i1 = document.createElement('span');" | 485 "i1 = document.createElement('span');" |
486 "i1.id = 'first_span';" | 486 "i1.id = 'first_span';" |
487 "document.body.appendChild(i1)"); | 487 "document.body.appendChild(i1)"); |
488 EXPECT_EQ(1, updateCount()); | 488 EXPECT_EQ(1, updateCount()); |
489 EXPECT_THAT(matchedSelectors(), ElementsAre("span")); | 489 EXPECT_THAT(matchedSelectors(), ElementsAre("span")); |
490 | 490 |
491 // Adding a second element that shares a LayoutStyle shouldn't call back. | 491 // Adding a second element that shares a ComputedStyle shouldn't call back. |
492 // We use <span>s to avoid default style rules that can set | 492 // We use <span>s to avoid default style rules that can set |
493 // LayoutStyle::unique(). | 493 // ComputedStyle::unique(). |
494 executeScript( | 494 executeScript( |
495 "i2 = document.createElement('span');" | 495 "i2 = document.createElement('span');" |
496 "i2.id = 'second_span';" | 496 "i2.id = 'second_span';" |
497 "i1 = document.getElementById('first_span');" | 497 "i1 = document.getElementById('first_span');" |
498 "i1.parentNode.insertBefore(i2, i1.nextSibling);"); | 498 "i1.parentNode.insertBefore(i2, i1.nextSibling);"); |
499 EXPECT_EQ(1, updateCount()); | 499 EXPECT_EQ(1, updateCount()); |
500 EXPECT_THAT(matchedSelectors(), ElementsAre("span")); | 500 EXPECT_THAT(matchedSelectors(), ElementsAre("span")); |
501 | 501 |
502 // Removing the first element shouldn't call back. | 502 // Removing the first element shouldn't call back. |
503 executeScript( | 503 executeScript( |
(...skipping 6567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7071 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7071 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
7072 WebView* view = WebView::create(&viewClient); | 7072 WebView* view = WebView::create(&viewClient); |
7073 view->setMainFrame(WebRemoteFrame::create(&remoteClient)); | 7073 view->setMainFrame(WebRemoteFrame::create(&remoteClient)); |
7074 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; | 7074 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; |
7075 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe
moteChild("", WebSandboxFlags::None, &childFrameClient); | 7075 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe
moteChild("", WebSandboxFlags::None, &childFrameClient); |
7076 childFrame->detach(); | 7076 childFrame->detach(); |
7077 view->close(); | 7077 view->close(); |
7078 } | 7078 } |
7079 | 7079 |
7080 } // namespace blink | 7080 } // namespace blink |
OLD | NEW |