Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Side by Side Diff: webkit/glue/webkit_glue.cc

Issue 338056: Add layoutTestController.counterValueForElementById (Closed)
Patch Set: style fix Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/glue/webkit_glue.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "webkit/glue/webkit_glue.h" 6 #include "webkit/glue/webkit_glue.h"
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <objidl.h> 9 #include <objidl.h>
10 #include <mlang.h> 10 #include <mlang.h>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 std::wstring DumpRenderer(WebFrame* web_frame) { 132 std::wstring DumpRenderer(WebFrame* web_frame) {
133 WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame); 133 WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame);
134 WebCore::Frame* frame = webFrameImpl->frame(); 134 WebCore::Frame* frame = webFrameImpl->frame();
135 135
136 WebCore::String frameText = 136 WebCore::String frameText =
137 WebCore::externalRepresentation(frame->contentRenderer()); 137 WebCore::externalRepresentation(frame->contentRenderer());
138 return StringToStdWString(frameText); 138 return StringToStdWString(frameText);
139 } 139 }
140 140
141 bool CounterValueForElementById(WebFrame* web_frame, const std::string& id,
142 std::wstring* counter_value) {
143 WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame);
144 WebCore::Frame* frame = webFrameImpl->frame();
145
146 WebCore::Element* element =
147 frame->document()->getElementById(WebCore::AtomicString(id.c_str()));
148 if (!element)
149 return false;
150 WebCore::String counterValue = WebCore::counterValueForElement(element);
151 *counter_value = StringToStdWString(counterValue);
152 return true;
153 }
154
141 std::wstring DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { 155 std::wstring DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) {
142 WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame); 156 WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(web_frame);
143 WebCore::IntSize offset = webFrameImpl->frameview()->scrollOffset(); 157 WebCore::IntSize offset = webFrameImpl->frameview()->scrollOffset();
144 std::wstring result; 158 std::wstring result;
145 159
146 if (offset.width() > 0 || offset.height() > 0) { 160 if (offset.width() > 0 || offset.height() > 0) {
147 if (webFrameImpl->parent()) { 161 if (webFrameImpl->parent()) {
148 StringAppendF(&result, L"frame '%ls' ", StringToStdWString( 162 StringAppendF(&result, L"frame '%ls' ", StringToStdWString(
149 webFrameImpl->frame()->tree()->name()).c_str()); 163 webFrameImpl->frame()->tree()->name()).c_str());
150 } 164 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 498
485 bool IsMediaCacheEnabled() { 499 bool IsMediaCacheEnabled() {
486 return g_enable_media_cache; 500 return g_enable_media_cache;
487 } 501 }
488 502
489 void SetMediaCacheEnabled(bool enabled) { 503 void SetMediaCacheEnabled(bool enabled) {
490 g_enable_media_cache = enabled; 504 g_enable_media_cache = enabled;
491 } 505 }
492 506
493 } // namespace webkit_glue 507 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkit_glue.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698