| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/layout/LayoutTheme.h" | 6 #include "core/layout/LayoutTheme.h" |
| 7 | 7 |
| 8 #include "core/dom/NodeLayoutStyle.h" | 8 #include "core/dom/NodeComputedStyle.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/html/HTMLDocument.h" | 10 #include "core/html/HTMLDocument.h" |
| 11 #include "core/html/HTMLElement.h" | 11 #include "core/html/HTMLElement.h" |
| 12 #include "core/layout/style/LayoutStyle.h" | 12 #include "core/layout/style/ComputedStyle.h" |
| 13 #include "core/page/FocusController.h" | 13 #include "core/page/FocusController.h" |
| 14 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
| 15 #include "core/testing/DummyPageHolder.h" | 15 #include "core/testing/DummyPageHolder.h" |
| 16 #include "platform/graphics/Color.h" | 16 #include "platform/graphics/Color.h" |
| 17 #include <gtest/gtest.h> | 17 #include <gtest/gtest.h> |
| 18 | 18 |
| 19 using namespace blink; | 19 using namespace blink; |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent) | 42 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent) |
| 43 { | 43 { |
| 44 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); | 44 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); |
| 45 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 45 document().view()->updateLayoutAndStyleIfNeededRecursive(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 inline Color outlineColor(Element* element) | 48 inline Color outlineColor(Element* element) |
| 49 { | 49 { |
| 50 return element->layoutStyle()->visitedDependentColor(CSSPropertyOutlineColor
); | 50 return element->computedStyle()->visitedDependentColor(CSSPropertyOutlineCol
or); |
| 51 } | 51 } |
| 52 | 52 |
| 53 inline EBorderStyle outlineStyle(Element* element) | 53 inline EBorderStyle outlineStyle(Element* element) |
| 54 { | 54 { |
| 55 return element->layoutStyle()->outlineStyle(); | 55 return element->computedStyle()->outlineStyle(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TEST_F(LayoutThemeTest, ChangeFocusRingColor) | 58 TEST_F(LayoutThemeTest, ChangeFocusRingColor) |
| 59 { | 59 { |
| 60 setHtmlInnerHTML("<span id=span tabIndex=0>Span</span>"); | 60 setHtmlInnerHTML("<span id=span tabIndex=0>Span</span>"); |
| 61 | 61 |
| 62 Element* span = document().getElementById(AtomicString("span")); | 62 Element* span = document().getElementById(AtomicString("span")); |
| 63 EXPECT_NE(nullptr, span); | 63 EXPECT_NE(nullptr, span); |
| 64 EXPECT_NE(nullptr, span->layoutObject()); | 64 EXPECT_NE(nullptr, span->layoutObject()); |
| 65 | 65 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 83 LayoutTheme::theme().setCustomFocusRingColor(customColor); | 83 LayoutTheme::theme().setCustomFocusRingColor(customColor); |
| 84 Page::platformColorsChanged(); | 84 Page::platformColorsChanged(); |
| 85 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 85 document().view()->updateLayoutAndStyleIfNeededRecursive(); |
| 86 | 86 |
| 87 // Check that the focus ring color is updated. | 87 // Check that the focus ring color is updated. |
| 88 EXPECT_NE(BNONE, outlineStyle(span)); | 88 EXPECT_NE(BNONE, outlineStyle(span)); |
| 89 EXPECT_EQ(customColor, outlineColor(span)); | 89 EXPECT_EQ(customColor, outlineColor(span)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } | 92 } |
| OLD | NEW |