| 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/NodeComputedStyle.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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 void LayoutThemeTest::SetUp() | 32 void LayoutThemeTest::SetUp() |
| 33 { | 33 { |
| 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 35 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 35 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 36 ASSERT(m_document); | 36 ASSERT(m_document); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent) | 39 void LayoutThemeTest::setHtmlInnerHTML(const char* htmlContent) |
| 40 { | 40 { |
| 41 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); | 41 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); |
| 42 document().view()->updateLayoutAndStyleForPainting(); | 42 document().view()->updateAllLifecyclePhases(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 inline Color outlineColor(Element* element) | 45 inline Color outlineColor(Element* element) |
| 46 { | 46 { |
| 47 return element->computedStyle()->visitedDependentColor(CSSPropertyOutlineCol
or); | 47 return element->computedStyle()->visitedDependentColor(CSSPropertyOutlineCol
or); |
| 48 } | 48 } |
| 49 | 49 |
| 50 inline EBorderStyle outlineStyle(Element* element) | 50 inline EBorderStyle outlineStyle(Element* element) |
| 51 { | 51 { |
| 52 return element->computedStyle()->outlineStyle(); | 52 return element->computedStyle()->outlineStyle(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 Color customColor = makeRGB(123, 145, 167); | 63 Color customColor = makeRGB(123, 145, 167); |
| 64 | 64 |
| 65 // Checking unfocused style. | 65 // Checking unfocused style. |
| 66 EXPECT_EQ(BNONE, outlineStyle(span)); | 66 EXPECT_EQ(BNONE, outlineStyle(span)); |
| 67 EXPECT_NE(customColor, outlineColor(span)); | 67 EXPECT_NE(customColor, outlineColor(span)); |
| 68 | 68 |
| 69 // Do focus. | 69 // Do focus. |
| 70 document().page()->focusController().setActive(true); | 70 document().page()->focusController().setActive(true); |
| 71 document().page()->focusController().setFocused(true); | 71 document().page()->focusController().setFocused(true); |
| 72 span->focus(); | 72 span->focus(); |
| 73 document().view()->updateLayoutAndStyleForPainting(); | 73 document().view()->updateAllLifecyclePhases(); |
| 74 | 74 |
| 75 // Checking focused style. | 75 // Checking focused style. |
| 76 EXPECT_NE(BNONE, outlineStyle(span)); | 76 EXPECT_NE(BNONE, outlineStyle(span)); |
| 77 EXPECT_NE(customColor, outlineColor(span)); | 77 EXPECT_NE(customColor, outlineColor(span)); |
| 78 | 78 |
| 79 // Change focus ring color. | 79 // Change focus ring color. |
| 80 LayoutTheme::theme().setCustomFocusRingColor(customColor); | 80 LayoutTheme::theme().setCustomFocusRingColor(customColor); |
| 81 Page::platformColorsChanged(); | 81 Page::platformColorsChanged(); |
| 82 document().view()->updateLayoutAndStyleForPainting(); | 82 document().view()->updateAllLifecyclePhases(); |
| 83 | 83 |
| 84 // Check that the focus ring color is updated. | 84 // Check that the focus ring color is updated. |
| 85 EXPECT_NE(BNONE, outlineStyle(span)); | 85 EXPECT_NE(BNONE, outlineStyle(span)); |
| 86 EXPECT_EQ(customColor, outlineColor(span)); | 86 EXPECT_EQ(customColor, outlineColor(span)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |