| 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 24 matching lines...) Expand all Loading... |
| 35 void LayoutThemeTest::SetUp() | 35 void LayoutThemeTest::SetUp() |
| 36 { | 36 { |
| 37 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 37 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 38 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 38 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 39 ASSERT(m_document); | 39 ASSERT(m_document); |
| 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()->updateLayoutAndStyleForPainting(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 inline Color outlineColor(Element* element) | 48 inline Color outlineColor(Element* element) |
| 49 { | 49 { |
| 50 return element->computedStyle()->visitedDependentColor(CSSPropertyOutlineCol
or); | 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->computedStyle()->outlineStyle(); | 55 return element->computedStyle()->outlineStyle(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 Color customColor = makeRGB(123, 145, 167); | 66 Color customColor = makeRGB(123, 145, 167); |
| 67 | 67 |
| 68 // Checking unfocused style. | 68 // Checking unfocused style. |
| 69 EXPECT_EQ(BNONE, outlineStyle(span)); | 69 EXPECT_EQ(BNONE, outlineStyle(span)); |
| 70 EXPECT_NE(customColor, outlineColor(span)); | 70 EXPECT_NE(customColor, outlineColor(span)); |
| 71 | 71 |
| 72 // Do focus. | 72 // Do focus. |
| 73 document().page()->focusController().setActive(true); | 73 document().page()->focusController().setActive(true); |
| 74 document().page()->focusController().setFocused(true); | 74 document().page()->focusController().setFocused(true); |
| 75 span->focus(); | 75 span->focus(); |
| 76 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 76 document().view()->updateLayoutAndStyleForPainting(); |
| 77 | 77 |
| 78 // Checking focused style. | 78 // Checking focused style. |
| 79 EXPECT_NE(BNONE, outlineStyle(span)); | 79 EXPECT_NE(BNONE, outlineStyle(span)); |
| 80 EXPECT_NE(customColor, outlineColor(span)); | 80 EXPECT_NE(customColor, outlineColor(span)); |
| 81 | 81 |
| 82 // Change focus ring color. | 82 // Change focus ring color. |
| 83 LayoutTheme::theme().setCustomFocusRingColor(customColor); | 83 LayoutTheme::theme().setCustomFocusRingColor(customColor); |
| 84 Page::platformColorsChanged(); | 84 Page::platformColorsChanged(); |
| 85 document().view()->updateLayoutAndStyleIfNeededRecursive(); | 85 document().view()->updateLayoutAndStyleForPainting(); |
| 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 |