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

Side by Side Diff: ui/gfx/ipc/gfx_param_traits.cc

Issue 1713723002: Implement accessibility support for CSS-transformed iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return gfx::Rect from AccessibilityTransformToRootCoordSpace, get rid of ifdefed-out code accidenta… Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 "ui/gfx/ipc/gfx_param_traits.h" 5 #include "ui/gfx/ipc/gfx_param_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/gfx/geometry/point3_f.h" 13 #include "ui/gfx/geometry/point3_f.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/rect_f.h" 15 #include "ui/gfx/geometry/rect_f.h"
16 #include "ui/gfx/geometry/scroll_offset.h" 16 #include "ui/gfx/geometry/scroll_offset.h"
17 #include "ui/gfx/range/range.h" 17 #include "ui/gfx/range/range.h"
18 #include "ui/gfx/transform.h"
18 19
19 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
20 #include "ipc/mach_port_mac.h" 21 #include "ipc/mach_port_mac.h"
21 #endif 22 #endif
22 23
23 namespace { 24 namespace {
24 25
25 struct SkBitmap_Data { 26 struct SkBitmap_Data {
26 // The color type for the bitmap (bits per pixel, etc). 27 // The color type for the bitmap (bits per pixel, etc).
27 SkColorType fColorType; 28 SkColorType fColorType;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 357 }
357 358
358 void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) { 359 void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) {
359 l->append("("); 360 l->append("(");
360 LogParam(p.x(), l); 361 LogParam(p.x(), l);
361 l->append(", "); 362 l->append(", ");
362 LogParam(p.y(), l); 363 LogParam(p.y(), l);
363 l->append(")"); 364 l->append(")");
364 } 365 }
365 366
367 void ParamTraits<gfx::Transform>::Write(base::Pickle* m, const param_type& p) {
368 #ifdef SK_MSCALAR_IS_FLOAT
369 float column_major_data[16];
370 p.matrix().asColMajorf(column_major_data);
371 #else
372 double column_major_data[16];
373 p.matrix().asColMajord(column_major_data);
374 #endif
375 // We do this in a single write for performance reasons.
376 m->WriteBytes(&column_major_data, sizeof(SkMScalar) * 16);
377 }
378
379 bool ParamTraits<gfx::Transform>::Read(const base::Pickle* m,
380 base::PickleIterator* iter,
381 param_type* r) {
382 const char* column_major_data;
383 if (!iter->ReadBytes(&column_major_data, sizeof(SkMScalar) * 16))
384 return false;
385 r->matrix().setColMajor(
386 reinterpret_cast<const SkMScalar*>(column_major_data));
387 return true;
388 }
389
390 void ParamTraits<gfx::Transform>::Log(
391 const param_type& p, std::string* l) {
392 #ifdef SK_MSCALAR_IS_FLOAT
393 float row_major_data[16];
394 p.matrix().asRowMajorf(row_major_data);
395 #else
396 double row_major_data[16];
397 p.matrix().asRowMajord(row_major_data);
398 #endif
399 l->append("(");
400 for (int i = 0; i < 16; ++i) {
401 if (i > 0)
402 l->append(", ");
403 LogParam(row_major_data[i], l);
404 }
405 l->append(") ");
406 }
407
366 #if defined(OS_MACOSX) && !defined(OS_IOS) 408 #if defined(OS_MACOSX) && !defined(OS_IOS)
367 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write( 409 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write(
368 base::Pickle* m, 410 base::Pickle* m,
369 const param_type p) { 411 const param_type p) {
370 MachPortMac mach_port_mac(p.get()); 412 MachPortMac mach_port_mac(p.get());
371 ParamTraits<MachPortMac>::Write(m, mach_port_mac); 413 ParamTraits<MachPortMac>::Write(m, mach_port_mac);
372 } 414 }
373 415
374 bool ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Read( 416 bool ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Read(
375 const base::Pickle* m, 417 const base::Pickle* m,
(...skipping 29 matching lines...) Expand all
405 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ 447 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_
406 #include "ui/gfx/ipc/gfx_param_traits_macros.h" 448 #include "ui/gfx/ipc/gfx_param_traits_macros.h"
407 } // namespace IPC 449 } // namespace IPC
408 450
409 // Generate param traits log methods. 451 // Generate param traits log methods.
410 #include "ipc/param_traits_log_macros.h" 452 #include "ipc/param_traits_log_macros.h"
411 namespace IPC { 453 namespace IPC {
412 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ 454 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_
413 #include "ui/gfx/ipc/gfx_param_traits_macros.h" 455 #include "ui/gfx/ipc/gfx_param_traits_macros.h"
414 } // namespace IPC 456 } // namespace IPC
OLDNEW
« ui/accessibility/ax_node_data.cc ('K') | « ui/gfx/ipc/gfx_param_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698