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

Unified Diff: Source/web/tests/sim/SimDisplayItemList.cpp

Issue 1329553004: Add a FOUC painting test. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build. Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/tests/sim/SimDisplayItemList.h ('k') | Source/web/tests/sim/SimLayerTreeView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/sim/SimDisplayItemList.cpp
diff --git a/Source/web/tests/sim/SimDisplayItemList.cpp b/Source/web/tests/sim/SimDisplayItemList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1fa83b9d8129ae1a49473c784c96a9d096aae55a
--- /dev/null
+++ b/Source/web/tests/sim/SimDisplayItemList.cpp
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "web/tests/sim/SimDisplayItemList.h"
+
+#include "core/css/parser/CSSParser.h"
+#include "platform/graphics/LoggingCanvas.h"
+#include "third_party/skia/include/core/SkPicture.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+namespace blink {
+
+SimDisplayItemList::SimDisplayItemList()
+ : m_containsText(false)
+{
+}
+
+void SimDisplayItemList::appendDrawingItem(const SkPicture* picture)
+{
+ m_containsText |= picture->hasText();
+
+ SkIRect bounds = picture->cullRect().roundOut();
+ SimCanvas canvas(bounds.width(), bounds.height());
+ picture->playback(&canvas);
+ m_commands.append(canvas.commands().data(), canvas.commands().size());
+}
+
+bool SimDisplayItemList::contains(SimCanvas::CommandType type, const String& colorString) const
+{
+ RGBA32 color = 0;
+ if (!colorString.isNull())
+ RELEASE_ASSERT(CSSParser::parseColor(color, colorString, true));
+ for (auto& command : m_commands) {
+ if (command.type == type && (colorString.isNull() || command.color == color))
+ return true;
+ }
+ return false;
+}
+
+} // namespace blink
« no previous file with comments | « Source/web/tests/sim/SimDisplayItemList.h ('k') | Source/web/tests/sim/SimLayerTreeView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698