OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 { | 83 { |
84 return IntSize(0, 0); | 84 return IntSize(0, 0); |
85 } | 85 } |
86 | 86 |
87 void ColorChooserPopupUIController::writeDocument(SharedBuffer* data) | 87 void ColorChooserPopupUIController::writeDocument(SharedBuffer* data) |
88 { | 88 { |
89 Vector<ColorSuggestion> suggestions = m_client->suggestions(); | 89 Vector<ColorSuggestion> suggestions = m_client->suggestions(); |
90 Vector<String> suggestionValues; | 90 Vector<String> suggestionValues; |
91 for (unsigned i = 0; i < suggestions.size(); i++) | 91 for (unsigned i = 0; i < suggestions.size(); i++) |
92 suggestionValues.append(suggestions[i].color.serialized()); | 92 suggestionValues.append(suggestions[i].color.serialized()); |
93 IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elem
entRectRelativeToRootView()); | 93 IntRect anchorRectInScreen = m_chromeClient->viewportToScreen(m_client->elem
entRectRelativeToViewport()); |
94 | 94 |
95 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); | 95 PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><styl
e>\n", data); |
96 data->append(Platform::current()->loadResource("pickerCommon.css")); | 96 data->append(Platform::current()->loadResource("pickerCommon.css")); |
97 data->append(Platform::current()->loadResource("colorSuggestionPicker.css"))
; | 97 data->append(Platform::current()->loadResource("colorSuggestionPicker.css"))
; |
98 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" | 98 PagePopupClient::addString("</style></head><body><div id=main>Loading...</di
v><script>\n" |
99 "window.dialogArguments = {\n", data); | 99 "window.dialogArguments = {\n", data); |
100 PagePopupClient::addProperty("values", suggestionValues, data); | 100 PagePopupClient::addProperty("values", suggestionValues, data); |
101 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca
lizedString::OtherColorLabel), data); | 101 PagePopupClient::addProperty("otherColorLabel", locale().queryString(WebLoca
lizedString::OtherColorLabel), data); |
102 addProperty("anchorRectInScreen", anchorRectInScreen, data); | 102 addProperty("anchorRectInScreen", anchorRectInScreen, data); |
103 PagePopupClient::addString("};\n", data); | 103 PagePopupClient::addString("};\n", data); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 Element& ColorChooserPopupUIController::ownerElement() | 142 Element& ColorChooserPopupUIController::ownerElement() |
143 { | 143 { |
144 return m_client->ownerElement(); | 144 return m_client->ownerElement(); |
145 } | 145 } |
146 | 146 |
147 void ColorChooserPopupUIController::openPopup() | 147 void ColorChooserPopupUIController::openPopup() |
148 { | 148 { |
149 ASSERT(!m_popup); | 149 ASSERT(!m_popup); |
150 m_popup = m_chromeClient->openPagePopup(this, m_client->elementRectRelativeT
oRootView()); | 150 m_popup = m_chromeClient->openPagePopup(this); |
151 } | 151 } |
152 | 152 |
153 void ColorChooserPopupUIController::closePopup() | 153 void ColorChooserPopupUIController::closePopup() |
154 { | 154 { |
155 if (!m_popup) | 155 if (!m_popup) |
156 return; | 156 return; |
157 m_chromeClient->closePagePopup(m_popup); | 157 m_chromeClient->closePagePopup(m_popup); |
158 } | 158 } |
159 | 159 |
160 } // namespace blink | 160 } // namespace blink |
OLD | NEW |