Patch by Thatcher Ulrich <tulrich@google.com>.
Implement "iframe shim" behavior for windowed plugins. In FF and IE on windows, iframes are implemented as native HWNDs. This has the side effect that iframes display on top of windowed plugins. This side effect has long been known as a workaround for allowing HTML elements to appear above plugin content. BUG=1788 Review URL: http://codereview.chromium.org/7032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3137 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
base
base.xcodeproj
build
gfx
bitmap_platform_device_win.ccgdi_util.ccgdi_util.hnative_theme.ccvector_canvas_unittest.ccvector_device.cc
tuple.htuple_unittest.ccchrome
browser
common
plugin
renderer
webkit
build
glue
data
layout_tests
glue
plugins
stacking_order_iterator.ccstacking_order_iterator.hwebcursor.ccwebplugin.hwebplugin_delegate.hwebplugin_impl.ccwebplugin_impl.hport
platform
graphics
tools
test_shell
@ -558,8 +558,6 @@
|
|||||||
8254038E0D92D2CF0006B936 /* word_iterator.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = word_iterator.cc; sourceTree = "<group>"; };
|
8254038E0D92D2CF0006B936 /* word_iterator.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = word_iterator.cc; sourceTree = "<group>"; };
|
||||||
8254038F0D92D2CF0006B936 /* word_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = word_iterator.h; sourceTree = "<group>"; };
|
8254038F0D92D2CF0006B936 /* word_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = word_iterator.h; sourceTree = "<group>"; };
|
||||||
825403B10D92D2E50006B936 /* libbase_gfx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libbase_gfx.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
825403B10D92D2E50006B936 /* libbase_gfx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libbase_gfx.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
825403C00D92D31D0006B936 /* bitmap_header.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bitmap_header.cc; sourceTree = "<group>"; };
|
|
||||||
825403C10D92D31D0006B936 /* bitmap_header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitmap_header.h; sourceTree = "<group>"; };
|
|
||||||
825403C40D92D31D0006B936 /* font_utils.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = font_utils.cc; sourceTree = "<group>"; };
|
825403C40D92D31D0006B936 /* font_utils.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = font_utils.cc; sourceTree = "<group>"; };
|
||||||
825403C50D92D31D0006B936 /* font_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font_utils.h; sourceTree = "<group>"; };
|
825403C50D92D31D0006B936 /* font_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font_utils.h; sourceTree = "<group>"; };
|
||||||
825403C80D92D31D0006B936 /* native_theme.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = native_theme.cc; sourceTree = "<group>"; };
|
825403C80D92D31D0006B936 /* native_theme.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = native_theme.cc; sourceTree = "<group>"; };
|
||||||
@ -1058,8 +1056,6 @@
|
|||||||
825403B40D92D2EC0006B936 /* gfx */ = {
|
825403B40D92D2EC0006B936 /* gfx */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
825403C00D92D31D0006B936 /* bitmap_header.cc */,
|
|
||||||
825403C10D92D31D0006B936 /* bitmap_header.h */,
|
|
||||||
AB6BC1ED0E54E836006436D5 /* bitmap_platform_device.h */,
|
AB6BC1ED0E54E836006436D5 /* bitmap_platform_device.h */,
|
||||||
829E2F940DBFD74B00819EBF /* bitmap_platform_device_mac.cc */,
|
829E2F940DBFD74B00819EBF /* bitmap_platform_device_mac.cc */,
|
||||||
829E2F950DBFD74B00819EBF /* bitmap_platform_device_mac.h */,
|
829E2F950DBFD74B00819EBF /* bitmap_platform_device_mac.h */,
|
||||||
|
@ -121,14 +121,6 @@
|
|||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
|
||||||
RelativePath="..\gfx\bitmap_header.cc"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\gfx\bitmap_header.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\gfx\bitmap_platform_device_win.cc"
|
RelativePath="..\gfx\bitmap_platform_device_win.cc"
|
||||||
>
|
>
|
||||||
@ -153,6 +145,14 @@
|
|||||||
RelativePath="..\gfx\font_utils.h"
|
RelativePath="..\gfx\font_utils.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\gfx\gdi_util.cc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\gfx\gdi_util.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\gfx\image_operations.cc"
|
RelativePath="..\gfx\image_operations.cc"
|
||||||
>
|
>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "base/gfx/bitmap_platform_device_win.h"
|
#include "base/gfx/bitmap_platform_device_win.h"
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/process_util.h"
|
#include "base/process_util.h"
|
||||||
#include "SkMatrix.h"
|
#include "SkMatrix.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
@ -60,5 +60,21 @@ void CreateMonochromeBitmapHeader(int width,
|
|||||||
hdr->biClrImportant = 0;
|
hdr->biClrImportant = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubtractRectanglesFromRegion(HRGN hrgn,
|
||||||
|
const std::vector<gfx::Rect>& cutouts) {
|
||||||
|
if (cutouts.size()) {
|
||||||
|
HRGN cutout = ::CreateRectRgn(0, 0, 0, 0);
|
||||||
|
for (size_t i = 0; i < cutouts.size(); i++) {
|
||||||
|
::SetRectRgn(cutout,
|
||||||
|
cutouts[i].x(),
|
||||||
|
cutouts[i].y(),
|
||||||
|
cutouts[i].right(),
|
||||||
|
cutouts[i].bottom());
|
||||||
|
::CombineRgn(hrgn, hrgn, cutout, RGN_DIFF);
|
||||||
|
}
|
||||||
|
::DeleteObject(cutout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace gfx
|
} // namespace gfx
|
||||||
|
|
@ -2,10 +2,12 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef BASE_GFX_BITMAP_HEADER_H__
|
#ifndef BASE_GFX_GDI_UTIL_H__
|
||||||
#define BASE_GFX_BITMAP_HEADER_H__
|
#define BASE_GFX_GDI_UTIL_H__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include "base/gfx/rect.h"
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
@ -25,8 +27,10 @@ void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr);
|
|||||||
// Creates a monochrome bitmap header.
|
// Creates a monochrome bitmap header.
|
||||||
void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
|
void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr);
|
||||||
|
|
||||||
|
// Modify the given hrgn by subtracting the given rectangles.
|
||||||
|
void SubtractRectanglesFromRegion(HRGN hrgn,
|
||||||
|
const std::vector<gfx::Rect>& cutouts);
|
||||||
|
|
||||||
} // namespace gfx
|
} // namespace gfx
|
||||||
|
|
||||||
#endif // BASE_GFX_BITMAP_HEADER_H__
|
#endif // BASE_GFX_GDI_UTIL_H__
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
#include <vsstyle.h>
|
#include <vsstyle.h>
|
||||||
#include <vssym32.h>
|
#include <vssym32.h>
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/platform_canvas_win.h"
|
#include "base/gfx/platform_canvas_win.h"
|
||||||
#include "base/gfx/skia_utils.h"
|
#include "base/gfx/skia_utils.h"
|
||||||
#include "base/gfx/rect.h"
|
#include "base/gfx/rect.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/png_decoder.h"
|
#include "base/gfx/png_decoder.h"
|
||||||
#include "base/gfx/png_encoder.h"
|
#include "base/gfx/png_encoder.h"
|
||||||
#include "base/gfx/size.h"
|
#include "base/gfx/size.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "base/gfx/vector_device.h"
|
#include "base/gfx/vector_device.h"
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/skia_utils.h"
|
#include "base/gfx/skia_utils.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/scoped_handle.h"
|
||||||
|
123
base/tuple.h
123
base/tuple.h
@ -3,8 +3,8 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// A Tuple is a generic templatized container, similar in concept to std::pair.
|
// A Tuple is a generic templatized container, similar in concept to std::pair.
|
||||||
// There are classes Tuple0 to Tuple5, cooresponding to the number of elements
|
// There are classes Tuple0 to Tuple6, cooresponding to the number of elements
|
||||||
// it contains. The convenient MakeTuple() function takes 0 to 5 arguments,
|
// it contains. The convenient MakeTuple() function takes 0 to 6 arguments,
|
||||||
// and will construct and return the appropriate Tuple object. The functions
|
// and will construct and return the appropriate Tuple object. The functions
|
||||||
// DispatchToMethod and DispatchToFunction take a function pointer or instance
|
// DispatchToMethod and DispatchToFunction take a function pointer or instance
|
||||||
// and method pointer, and unpack a tuple into arguments to the call.
|
// and method pointer, and unpack a tuple into arguments to the call.
|
||||||
@ -193,6 +193,46 @@ public:
|
|||||||
E e;
|
E e;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class A, class B, class C, class D, class E, class F>
|
||||||
|
struct Tuple6 {
|
||||||
|
public:
|
||||||
|
typedef A TypeA;
|
||||||
|
typedef B TypeB;
|
||||||
|
typedef C TypeC;
|
||||||
|
typedef D TypeD;
|
||||||
|
typedef E TypeE;
|
||||||
|
typedef F TypeF;
|
||||||
|
typedef Tuple6<typename TupleTraits<A>::ValueType,
|
||||||
|
typename TupleTraits<B>::ValueType,
|
||||||
|
typename TupleTraits<C>::ValueType,
|
||||||
|
typename TupleTraits<D>::ValueType,
|
||||||
|
typename TupleTraits<E>::ValueType,
|
||||||
|
typename TupleTraits<F>::ValueType> ValueTuple;
|
||||||
|
typedef Tuple6<typename TupleTraits<A>::RefType,
|
||||||
|
typename TupleTraits<B>::RefType,
|
||||||
|
typename TupleTraits<C>::RefType,
|
||||||
|
typename TupleTraits<D>::RefType,
|
||||||
|
typename TupleTraits<E>::RefType,
|
||||||
|
typename TupleTraits<F>::RefType> RefTuple;
|
||||||
|
|
||||||
|
Tuple6() {}
|
||||||
|
Tuple6(typename TupleTraits<A>::ParamType a,
|
||||||
|
typename TupleTraits<B>::ParamType b,
|
||||||
|
typename TupleTraits<C>::ParamType c,
|
||||||
|
typename TupleTraits<D>::ParamType d,
|
||||||
|
typename TupleTraits<E>::ParamType e,
|
||||||
|
typename TupleTraits<F>::ParamType f)
|
||||||
|
: a(a), b(b), c(c), d(d), e(e), f(f) {
|
||||||
|
}
|
||||||
|
|
||||||
|
A a;
|
||||||
|
B b;
|
||||||
|
C c;
|
||||||
|
D d;
|
||||||
|
E e;
|
||||||
|
F f;
|
||||||
|
};
|
||||||
|
|
||||||
// Tuple creators -------------------------------------------------------------
|
// Tuple creators -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Helper functions for constructing tuples while inferring the template
|
// Helper functions for constructing tuples while inferring the template
|
||||||
@ -229,6 +269,12 @@ inline Tuple5<A, B, C, D, E> MakeTuple(const A& a, const B& b, const C& c,
|
|||||||
return Tuple5<A, B, C, D, E>(a, b, c, d, e);
|
return Tuple5<A, B, C, D, E>(a, b, c, d, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class A, class B, class C, class D, class E, class F>
|
||||||
|
inline Tuple6<A, B, C, D, E, F> MakeTuple(const A& a, const B& b, const C& c,
|
||||||
|
const D& d, const E& e, const F& f) {
|
||||||
|
return Tuple6<A, B, C, D, E, F>(a, b, c, d, e, f);
|
||||||
|
}
|
||||||
|
|
||||||
// The following set of helpers make what Boost refers to as "Tiers" - a tuple
|
// The following set of helpers make what Boost refers to as "Tiers" - a tuple
|
||||||
// of references.
|
// of references.
|
||||||
|
|
||||||
@ -257,6 +303,12 @@ inline Tuple5<A&, B&, C&, D&, E&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e) {
|
|||||||
return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e);
|
return Tuple5<A&, B&, C&, D&, E&>(a, b, c, d, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class A, class B, class C, class D, class E, class F>
|
||||||
|
inline Tuple6<A&, B&, C&, D&, E&, F&> MakeRefTuple(A& a, B& b, C& c, D& d, E& e,
|
||||||
|
F& f) {
|
||||||
|
return Tuple6<A&, B&, C&, D&, E&, F&>(a, b, c, d, e, f);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers ----------------------------------------------------------------
|
// Dispatchers ----------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Helper functions that call the given method on an object, with the unpacked
|
// Helper functions that call the given method on an object, with the unpacked
|
||||||
@ -306,6 +358,13 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method, class A, class B, class C, class D, class E,
|
||||||
|
class F>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<A, B, C, D, E, F>& arg) {
|
||||||
|
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f);
|
||||||
|
}
|
||||||
|
|
||||||
// Static Dispatchers with no out params.
|
// Static Dispatchers with no out params.
|
||||||
|
|
||||||
template <class Function>
|
template <class Function>
|
||||||
@ -345,6 +404,12 @@ inline void DispatchToFunction(Function function,
|
|||||||
(*function)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
(*function)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Function, class A, class B, class C, class D, class E, class F>
|
||||||
|
inline void DispatchToFunction(Function function,
|
||||||
|
const Tuple6<A, B, C, D, E, F>& arg) {
|
||||||
|
(*function)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 0 out param (as a Tuple0).
|
// Dispatchers with 0 out param (as a Tuple0).
|
||||||
|
|
||||||
template <class ObjT, class Method>
|
template <class ObjT, class Method>
|
||||||
@ -385,6 +450,13 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method, class A, class B, class C, class D, class E,
|
||||||
|
class F>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<A, B, C, D, E, F>& arg, Tuple0*) {
|
||||||
|
(obj->*method)(arg.a, arg.b, arg.c, arg.d, arg.e, arg.f);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 1 out param.
|
// Dispatchers with 1 out param.
|
||||||
|
|
||||||
template<class ObjT, class Method,
|
template<class ObjT, class Method,
|
||||||
@ -444,6 +516,15 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a);
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method,
|
||||||
|
class InA, class InB, class InC, class InD, class InE, class InF,
|
||||||
|
class OutA>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<InA, InB, InC, InD, InE, InF>& in,
|
||||||
|
Tuple1<OutA>* out) {
|
||||||
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 2 out params.
|
// Dispatchers with 2 out params.
|
||||||
|
|
||||||
template<class ObjT, class Method,
|
template<class ObjT, class Method,
|
||||||
@ -503,6 +584,15 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b);
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method,
|
||||||
|
class InA, class InB, class InC, class InD, class InE, class InF,
|
||||||
|
class OutA, class OutB>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<InA, InB, InC, InD, InE, InF>& in,
|
||||||
|
Tuple2<OutA, OutB>* out) {
|
||||||
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 3 out params.
|
// Dispatchers with 3 out params.
|
||||||
|
|
||||||
template<class ObjT, class Method,
|
template<class ObjT, class Method,
|
||||||
@ -562,6 +652,15 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b, &out->c);
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, &out->a, &out->b, &out->c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method,
|
||||||
|
class InA, class InB, class InC, class InD, class InE, class InF,
|
||||||
|
class OutA, class OutB, class OutC>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<InA, InB, InC, InD, InE, InF>& in,
|
||||||
|
Tuple3<OutA, OutB, OutC>* out) {
|
||||||
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f, &out->a, &out->b, &out->c);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 4 out params.
|
// Dispatchers with 4 out params.
|
||||||
|
|
||||||
template<class ObjT, class Method,
|
template<class ObjT, class Method,
|
||||||
@ -622,6 +721,16 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
&out->a, &out->b, &out->c, &out->d);
|
&out->a, &out->b, &out->c, &out->d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method,
|
||||||
|
class InA, class InB, class InC, class InD, class InE, class InF,
|
||||||
|
class OutA, class OutB, class OutC, class OutD>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<InA, InB, InC, InD, InE, InF>& in,
|
||||||
|
Tuple4<OutA, OutB, OutC, OutD>* out) {
|
||||||
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f,
|
||||||
|
&out->a, &out->b, &out->c, &out->d);
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers with 5 out params.
|
// Dispatchers with 5 out params.
|
||||||
|
|
||||||
template<class ObjT, class Method,
|
template<class ObjT, class Method,
|
||||||
@ -683,5 +792,15 @@ inline void DispatchToMethod(ObjT* obj, Method method,
|
|||||||
&out->a, &out->b, &out->c, &out->d, &out->e);
|
&out->a, &out->b, &out->c, &out->d, &out->e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class ObjT, class Method,
|
||||||
|
class InA, class InB, class InC, class InD, class InE, class InF,
|
||||||
|
class OutA, class OutB, class OutC, class OutD, class OutE>
|
||||||
|
inline void DispatchToMethod(ObjT* obj, Method method,
|
||||||
|
const Tuple6<InA, InB, InC, InD, InE, InF>& in,
|
||||||
|
Tuple5<OutA, OutB, OutC, OutD, OutE>* out) {
|
||||||
|
(obj->*method)(in.a, in.b, in.c, in.d, in.e, in.f,
|
||||||
|
&out->a, &out->b, &out->c, &out->d, &out->e);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // BASE_TUPLE_H__
|
#endif // BASE_TUPLE_H__
|
||||||
|
|
||||||
|
@ -18,6 +18,13 @@ struct Addy {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Addz {
|
||||||
|
Addz() { }
|
||||||
|
void DoAdd(int a, int b, int c, int d, int e, int* res) {
|
||||||
|
*res = a + b + c + d + e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(TupleTest, Basic) {
|
TEST(TupleTest, Basic) {
|
||||||
@ -27,6 +34,7 @@ TEST(TupleTest, Basic) {
|
|||||||
Tuple3<int, int, int> t3(1, 2, 3);
|
Tuple3<int, int, int> t3(1, 2, 3);
|
||||||
Tuple4<int, int, int, int*> t4(1, 2, 3, &t1.a);
|
Tuple4<int, int, int, int*> t4(1, 2, 3, &t1.a);
|
||||||
Tuple5<int, int, int, int, int*> t5(1, 2, 3, 4, &t4.a);
|
Tuple5<int, int, int, int, int*> t5(1, 2, 3, 4, &t4.a);
|
||||||
|
Tuple6<int, int, int, int, int, int*> t6(1, 2, 3, 4, 5, &t4.a);
|
||||||
|
|
||||||
EXPECT_EQ(1, t1.a);
|
EXPECT_EQ(1, t1.a);
|
||||||
EXPECT_EQ(1, t2.a);
|
EXPECT_EQ(1, t2.a);
|
||||||
@ -40,7 +48,11 @@ TEST(TupleTest, Basic) {
|
|||||||
EXPECT_EQ(2, t5.b);
|
EXPECT_EQ(2, t5.b);
|
||||||
EXPECT_EQ(3, t5.c);
|
EXPECT_EQ(3, t5.c);
|
||||||
EXPECT_EQ(4, t5.d);
|
EXPECT_EQ(4, t5.d);
|
||||||
|
EXPECT_EQ(1, t6.a);
|
||||||
|
EXPECT_EQ(2, t6.b);
|
||||||
|
EXPECT_EQ(3, t6.c);
|
||||||
|
EXPECT_EQ(4, t6.d);
|
||||||
|
EXPECT_EQ(5, t6.e);
|
||||||
|
|
||||||
EXPECT_EQ(1, t1.a);
|
EXPECT_EQ(1, t1.a);
|
||||||
DispatchToFunction(&DoAdd, t4);
|
DispatchToFunction(&DoAdd, t4);
|
||||||
@ -54,6 +66,11 @@ TEST(TupleTest, Basic) {
|
|||||||
EXPECT_EQ(1, t4.a);
|
EXPECT_EQ(1, t4.a);
|
||||||
DispatchToMethod(&addy, &Addy::DoAdd, t5);
|
DispatchToMethod(&addy, &Addy::DoAdd, t5);
|
||||||
EXPECT_EQ(10, t4.a);
|
EXPECT_EQ(10, t4.a);
|
||||||
|
|
||||||
|
Addz addz;
|
||||||
|
EXPECT_EQ(10, t4.a);
|
||||||
|
DispatchToMethod(&addz, &Addz::DoAdd, t6);
|
||||||
|
EXPECT_EQ(15, t4.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <shobjidl.h>
|
#include <shobjidl.h>
|
||||||
|
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/point.h"
|
#include "base/gfx/point.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "chrome/app/theme/theme_resources.h"
|
#include "chrome/app/theme/theme_resources.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/platform_device_win.h"
|
#include "base/gfx/platform_device_win.h"
|
||||||
#include "base/gfx/png_decoder.h"
|
#include "base/gfx/png_decoder.h"
|
||||||
#include "base/gfx/png_encoder.h"
|
#include "base/gfx/png_encoder.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "chrome/browser/render_widget_host.h"
|
#include "chrome/browser/render_widget_host.h"
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "chrome/app/chrome_dll_resource.h"
|
#include "chrome/app/chrome_dll_resource.h"
|
||||||
#include "chrome/browser/render_process_host.h"
|
#include "chrome/browser/render_process_host.h"
|
||||||
@ -451,6 +451,7 @@ void RenderWidgetHost::MovePluginWindows(
|
|||||||
move.clip_rect.y(),
|
move.clip_rect.y(),
|
||||||
move.clip_rect.right(),
|
move.clip_rect.right(),
|
||||||
move.clip_rect.bottom());
|
move.clip_rect.bottom());
|
||||||
|
gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects);
|
||||||
|
|
||||||
// Note: System will own the hrgn after we call SetWindowRgn,
|
// Note: System will own the hrgn after we call SetWindowRgn,
|
||||||
// so we don't need to call DeleteObject(hrgn)
|
// so we don't need to call DeleteObject(hrgn)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "chrome/browser/render_widget_host_hwnd.h"
|
#include "chrome/browser/render_widget_host_hwnd.h"
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/rect.h"
|
#include "base/gfx/rect.h"
|
||||||
#include "base/histogram.h"
|
#include "base/histogram.h"
|
||||||
#include "base/win_util.h"
|
#include "base/win_util.h"
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#undef IPC_MESSAGE_ROUTED3
|
#undef IPC_MESSAGE_ROUTED3
|
||||||
#undef IPC_MESSAGE_ROUTED4
|
#undef IPC_MESSAGE_ROUTED4
|
||||||
#undef IPC_MESSAGE_ROUTED5
|
#undef IPC_MESSAGE_ROUTED5
|
||||||
|
#undef IPC_MESSAGE_ROUTED6
|
||||||
#undef IPC_MESSAGE_EMPTY
|
#undef IPC_MESSAGE_EMPTY
|
||||||
#undef IPC_SYNC_MESSAGE_CONTROL0_0
|
#undef IPC_SYNC_MESSAGE_CONTROL0_0
|
||||||
#undef IPC_SYNC_MESSAGE_CONTROL0_1
|
#undef IPC_SYNC_MESSAGE_CONTROL0_1
|
||||||
@ -146,6 +147,9 @@
|
|||||||
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
|
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
|
||||||
msg_class##__ID,
|
msg_class##__ID,
|
||||||
|
|
||||||
|
#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
|
||||||
|
msg_class##__ID,
|
||||||
|
|
||||||
#define IPC_MESSAGE_EMPTY(msg_class) \
|
#define IPC_MESSAGE_EMPTY(msg_class) \
|
||||||
msg_class##__ID,
|
msg_class##__ID,
|
||||||
|
|
||||||
@ -392,6 +396,9 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
|
|||||||
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
|
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
|
||||||
IPC_MESSAGE_LOG(msg_class)
|
IPC_MESSAGE_LOG(msg_class)
|
||||||
|
|
||||||
|
#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
|
||||||
|
IPC_MESSAGE_LOG(msg_class)
|
||||||
|
|
||||||
#define IPC_MESSAGE_EMPTY(msg_class) \
|
#define IPC_MESSAGE_EMPTY(msg_class) \
|
||||||
IPC_MESSAGE_LOG(msg_class)
|
IPC_MESSAGE_LOG(msg_class)
|
||||||
|
|
||||||
@ -633,6 +640,21 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
|
|||||||
routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5)) {} \
|
routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5)) {} \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, \
|
||||||
|
type6) \
|
||||||
|
class msg_class : \
|
||||||
|
public IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \
|
||||||
|
type6> > { \
|
||||||
|
public: \
|
||||||
|
enum { ID = msg_class##__ID }; \
|
||||||
|
msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
|
||||||
|
const type3& arg3, const type4& arg4, const type5& arg5, \
|
||||||
|
const type6& arg6) \
|
||||||
|
: IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \
|
||||||
|
type6> >( \
|
||||||
|
routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5, arg6)) {} \
|
||||||
|
};
|
||||||
|
|
||||||
// Dummy class for now, just to give us the ID field.
|
// Dummy class for now, just to give us the ID field.
|
||||||
#define IPC_MESSAGE_EMPTY(msg_class) \
|
#define IPC_MESSAGE_EMPTY(msg_class) \
|
||||||
class msg_class { \
|
class msg_class { \
|
||||||
|
@ -943,6 +943,40 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class A, class B, class C, class D, class E, class F>
|
||||||
|
struct ParamTraits< Tuple6<A, B, C, D, E, F> > {
|
||||||
|
typedef Tuple6<A, B, C, D, E, F> param_type;
|
||||||
|
static void Write(Message* m, const param_type& p) {
|
||||||
|
WriteParam(m, p.a);
|
||||||
|
WriteParam(m, p.b);
|
||||||
|
WriteParam(m, p.c);
|
||||||
|
WriteParam(m, p.d);
|
||||||
|
WriteParam(m, p.e);
|
||||||
|
WriteParam(m, p.f);
|
||||||
|
}
|
||||||
|
static bool Read(const Message* m, void** iter, param_type* r) {
|
||||||
|
return (ReadParam(m, iter, &r->a) &&
|
||||||
|
ReadParam(m, iter, &r->b) &&
|
||||||
|
ReadParam(m, iter, &r->c) &&
|
||||||
|
ReadParam(m, iter, &r->d) &&
|
||||||
|
ReadParam(m, iter, &r->e) &&
|
||||||
|
ReadParam(m, iter, &r->f));
|
||||||
|
}
|
||||||
|
static void Log(const param_type& p, std::wstring* l) {
|
||||||
|
LogParam(p.a, l);
|
||||||
|
l->append(L", ");
|
||||||
|
LogParam(p.b, l);
|
||||||
|
l->append(L", ");
|
||||||
|
LogParam(p.c, l);
|
||||||
|
l->append(L", ");
|
||||||
|
LogParam(p.d, l);
|
||||||
|
l->append(L", ");
|
||||||
|
LogParam(p.e, l);
|
||||||
|
l->append(L", ");
|
||||||
|
LogParam(p.f, l);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<webkit_glue::WebApplicationInfo> {
|
struct ParamTraits<webkit_glue::WebApplicationInfo> {
|
||||||
typedef webkit_glue::WebApplicationInfo param_type;
|
typedef webkit_glue::WebApplicationInfo param_type;
|
||||||
|
@ -124,9 +124,10 @@ IPC_BEGIN_MESSAGES(Plugin, 5)
|
|||||||
// contains a buffer that the plugin draws into. background_buffer is used
|
// contains a buffer that the plugin draws into. background_buffer is used
|
||||||
// for transparent windowless plugins, and holds the background of the plugin
|
// for transparent windowless plugins, and holds the background of the plugin
|
||||||
// rectangle.
|
// rectangle.
|
||||||
IPC_MESSAGE_ROUTED5(PluginMsg_UpdateGeometry,
|
IPC_MESSAGE_ROUTED6(PluginMsg_UpdateGeometry,
|
||||||
gfx::Rect /* window_rect */,
|
gfx::Rect /* window_rect */,
|
||||||
gfx::Rect /* clip_rect */,
|
gfx::Rect /* clip_rect */,
|
||||||
|
std::vector<gfx::Rect> /* cutout_rects */,
|
||||||
bool /* visible */,
|
bool /* visible */,
|
||||||
SharedMemoryHandle /* windowless_buffer */,
|
SharedMemoryHandle /* windowless_buffer */,
|
||||||
SharedMemoryHandle /* background_buffer */)
|
SharedMemoryHandle /* background_buffer */)
|
||||||
|
@ -1007,6 +1007,7 @@ struct ParamTraits<WebPluginGeometry> {
|
|||||||
WriteParam(m, p.window);
|
WriteParam(m, p.window);
|
||||||
WriteParam(m, p.window_rect);
|
WriteParam(m, p.window_rect);
|
||||||
WriteParam(m, p.clip_rect);
|
WriteParam(m, p.clip_rect);
|
||||||
|
WriteParam(m, p.cutout_rects);
|
||||||
WriteParam(m, p.visible);
|
WriteParam(m, p.visible);
|
||||||
}
|
}
|
||||||
static bool Read(const Message* m, void** iter, param_type* p) {
|
static bool Read(const Message* m, void** iter, param_type* p) {
|
||||||
@ -1014,6 +1015,7 @@ struct ParamTraits<WebPluginGeometry> {
|
|||||||
ReadParam(m, iter, &p->window) &&
|
ReadParam(m, iter, &p->window) &&
|
||||||
ReadParam(m, iter, &p->window_rect) &&
|
ReadParam(m, iter, &p->window_rect) &&
|
||||||
ReadParam(m, iter, &p->clip_rect) &&
|
ReadParam(m, iter, &p->clip_rect) &&
|
||||||
|
ReadParam(m, iter, &p->cutout_rects) &&
|
||||||
ReadParam(m, iter, &p->visible);
|
ReadParam(m, iter, &p->visible);
|
||||||
}
|
}
|
||||||
static void Log(const param_type& p, std::wstring* l) {
|
static void Log(const param_type& p, std::wstring* l) {
|
||||||
@ -1024,6 +1026,8 @@ struct ParamTraits<WebPluginGeometry> {
|
|||||||
l->append(L", ");
|
l->append(L", ");
|
||||||
LogParam(p.clip_rect, l);
|
LogParam(p.clip_rect, l);
|
||||||
l->append(L", ");
|
l->append(L", ");
|
||||||
|
LogParam(p.cutout_rects, l);
|
||||||
|
l->append(L", ");
|
||||||
LogParam(p.visible, l);
|
LogParam(p.visible, l);
|
||||||
l->append(L")");
|
l->append(L")");
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/png_encoder.h"
|
#include "base/gfx/png_encoder.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/registry.h"
|
#include "base/registry.h"
|
||||||
|
@ -237,11 +237,13 @@ void WebPluginDelegateStub::OnPrint(PluginMsg_PrintResponse_Params* params) {
|
|||||||
void WebPluginDelegateStub::OnUpdateGeometry(
|
void WebPluginDelegateStub::OnUpdateGeometry(
|
||||||
const gfx::Rect& window_rect,
|
const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
bool visible,
|
bool visible,
|
||||||
const SharedMemoryHandle& windowless_buffer,
|
const SharedMemoryHandle& windowless_buffer,
|
||||||
const SharedMemoryHandle& background_buffer) {
|
const SharedMemoryHandle& background_buffer) {
|
||||||
webplugin_->UpdateGeometry(
|
webplugin_->UpdateGeometry(
|
||||||
window_rect, clip_rect, visible, windowless_buffer, background_buffer);
|
window_rect, clip_rect, cutout_rects, visible, windowless_buffer,
|
||||||
|
background_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id,
|
void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id,
|
||||||
|
@ -64,7 +64,9 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
|
|||||||
void OnPrint(PluginMsg_PrintResponse_Params* params);
|
void OnPrint(PluginMsg_PrintResponse_Params* params);
|
||||||
|
|
||||||
void OnUpdateGeometry(const gfx::Rect& window_rect,
|
void OnUpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible,
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible,
|
||||||
const SharedMemoryHandle& windowless_buffer,
|
const SharedMemoryHandle& windowless_buffer,
|
||||||
const SharedMemoryHandle& background_buffer);
|
const SharedMemoryHandle& background_buffer);
|
||||||
void OnGetPluginScriptableObject(int* route_id, void** npobject_ptr);
|
void OnGetPluginScriptableObject(int* route_id, void** npobject_ptr);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "chrome/plugin/webplugin_proxy.h"
|
#include "chrome/plugin/webplugin_proxy.h"
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/platform_device_win.h"
|
#include "base/gfx/platform_device_win.h"
|
||||||
#include "base/scoped_handle.h"
|
#include "base/scoped_handle.h"
|
||||||
#include "base/shared_memory.h"
|
#include "base/shared_memory.h"
|
||||||
@ -277,13 +277,14 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
|
|||||||
void WebPluginProxy::UpdateGeometry(
|
void WebPluginProxy::UpdateGeometry(
|
||||||
const gfx::Rect& window_rect,
|
const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
bool visible,
|
bool visible,
|
||||||
const SharedMemoryHandle& windowless_buffer,
|
const SharedMemoryHandle& windowless_buffer,
|
||||||
const SharedMemoryHandle& background_buffer) {
|
const SharedMemoryHandle& background_buffer) {
|
||||||
gfx::Rect old = delegate_->rect();
|
gfx::Rect old = delegate_->rect();
|
||||||
bool moved = delegate_->rect().x() != window_rect.x() ||
|
bool moved = delegate_->rect().x() != window_rect.x() ||
|
||||||
delegate_->rect().y() != window_rect.y();
|
delegate_->rect().y() != window_rect.y();
|
||||||
delegate_->UpdateGeometry(window_rect, clip_rect, visible);
|
delegate_->UpdateGeometry(window_rect, clip_rect, cutout_rects, visible);
|
||||||
if (windowless_buffer) {
|
if (windowless_buffer) {
|
||||||
// The plugin's rect changed, so now we have a new buffer to draw into.
|
// The plugin's rect changed, so now we have a new buffer to draw into.
|
||||||
SetWindowlessBuffer(windowless_buffer, background_buffer);
|
SetWindowlessBuffer(windowless_buffer, background_buffer);
|
||||||
|
@ -81,6 +81,7 @@ class WebPluginProxy : public WebPlugin {
|
|||||||
|
|
||||||
void UpdateGeometry(const gfx::Rect& window_rect,
|
void UpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
bool visible,
|
bool visible,
|
||||||
const SharedMemoryHandle& windowless_buffer,
|
const SharedMemoryHandle& windowless_buffer,
|
||||||
const SharedMemoryHandle& background_buffer);
|
const SharedMemoryHandle& background_buffer);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/bitmap_platform_device_win.h"
|
#include "base/gfx/bitmap_platform_device_win.h"
|
||||||
#include "base/gfx/image_operations.h"
|
#include "base/gfx/image_operations.h"
|
||||||
#include "base/gfx/native_theme.h"
|
#include "base/gfx/native_theme.h"
|
||||||
|
@ -183,6 +183,7 @@ void WebPluginDelegateProxy::FlushGeometryUpdates() {
|
|||||||
Send(new PluginMsg_UpdateGeometry(instance_id_,
|
Send(new PluginMsg_UpdateGeometry(instance_id_,
|
||||||
plugin_rect_,
|
plugin_rect_,
|
||||||
deferred_clip_rect_,
|
deferred_clip_rect_,
|
||||||
|
deferred_cutout_rects_,
|
||||||
visible_,
|
visible_,
|
||||||
NULL,
|
NULL,
|
||||||
NULL));
|
NULL));
|
||||||
@ -333,12 +334,15 @@ void WebPluginDelegateProxy::OnChannelError() {
|
|||||||
render_view_->PluginCrashed(plugin_path_);
|
render_view_->PluginCrashed(plugin_path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
|
void WebPluginDelegateProxy::UpdateGeometry(
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& window_rect,
|
||||||
bool visible) {
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) {
|
||||||
plugin_rect_ = window_rect;
|
plugin_rect_ = window_rect;
|
||||||
if (!windowless_) {
|
if (!windowless_) {
|
||||||
deferred_clip_rect_ = clip_rect;
|
deferred_clip_rect_ = clip_rect;
|
||||||
|
deferred_cutout_rects_ = cutout_rects;
|
||||||
visible_ = visible;
|
visible_ = visible;
|
||||||
send_deferred_update_geometry_ = true;
|
send_deferred_update_geometry_ = true;
|
||||||
return;
|
return;
|
||||||
@ -369,8 +373,8 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
IPC::Message* msg = new PluginMsg_UpdateGeometry(
|
IPC::Message* msg = new PluginMsg_UpdateGeometry(
|
||||||
instance_id_, window_rect, clip_rect, visible, transport_store_handle,
|
instance_id_, window_rect, clip_rect, cutout_rects, visible,
|
||||||
background_store_handle);
|
transport_store_handle, background_store_handle);
|
||||||
msg->set_unblock(true);
|
msg->set_unblock(true);
|
||||||
Send(msg);
|
Send(msg);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,9 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
|
|||||||
virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc,
|
virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc,
|
||||||
WebPlugin* plugin, bool load_manually);
|
WebPlugin* plugin, bool load_manually);
|
||||||
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible);
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible);
|
||||||
virtual void Paint(HDC hdc, const gfx::Rect& rect);
|
virtual void Paint(HDC hdc, const gfx::Rect& rect);
|
||||||
virtual void Print(HDC hdc);
|
virtual void Print(HDC hdc);
|
||||||
virtual NPObject* GetPluginScriptableObject();
|
virtual NPObject* GetPluginScriptableObject();
|
||||||
@ -157,6 +159,7 @@ class WebPluginDelegateProxy : public WebPluginDelegate,
|
|||||||
|
|
||||||
gfx::Rect plugin_rect_;
|
gfx::Rect plugin_rect_;
|
||||||
gfx::Rect deferred_clip_rect_;
|
gfx::Rect deferred_clip_rect_;
|
||||||
|
std::vector<gfx::Rect> deferred_cutout_rects_;
|
||||||
bool send_deferred_update_geometry_;
|
bool send_deferred_update_geometry_;
|
||||||
bool visible_;
|
bool visible_;
|
||||||
|
|
||||||
|
@ -480,6 +480,14 @@
|
|||||||
RelativePath="..\..\glue\simple_clipboard_impl.cc"
|
RelativePath="..\..\glue\simple_clipboard_impl.cc"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\glue\stacking_order_iterator.cc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\glue\stacking_order_iterator.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\glue\webcursor.cc"
|
RelativePath="..\..\glue\webcursor.cc"
|
||||||
>
|
>
|
||||||
|
6
webkit/data/layout_tests/pending/plugins/iframe-shims-expected.txt
Executable file
6
webkit/data/layout_tests/pending/plugins/iframe-shims-expected.txt
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
Test that iframe shims can be used to overlay HTML above a windowed plugin. The red squares should be hidden by the blue flash plugin, and the green squares should appear over it. To test interactively, click over the buttons on the squares. You should not be able to reach the red squares' buttons.
|
||||||
|
|
||||||
|
Prints "SUCCESS" on success, "FAILURE" on failure.
|
||||||
|
|
||||||
|
SUCCESS
|
||||||
|
|
144
webkit/data/layout_tests/pending/plugins/iframe-shims.html
Executable file
144
webkit/data/layout_tests/pending/plugins/iframe-shims.html
Executable file
@ -0,0 +1,144 @@
|
|||||||
|
<html><head>
|
||||||
|
<script>
|
||||||
|
function noop(x) {
|
||||||
|
}
|
||||||
|
|
||||||
|
var red1_clicks = 0;
|
||||||
|
var green1_clicks = 0;
|
||||||
|
var red2_clicks = 0;
|
||||||
|
var green2_clicks = 0;
|
||||||
|
|
||||||
|
function red1Clicked() {
|
||||||
|
red1_clicks++;
|
||||||
|
checkResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
function green1Clicked() {
|
||||||
|
green1_clicks++;
|
||||||
|
checkResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
function red2Clicked() {
|
||||||
|
red2_clicks++;
|
||||||
|
checkResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
function green2Clicked() {
|
||||||
|
green2_clicks++;
|
||||||
|
checkResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkResult() {
|
||||||
|
var output = document.getElementById("output");
|
||||||
|
var success = green1_clicks > 0 && green2_clicks > 0 &&
|
||||||
|
red1_clicks == 0 && red2_clicks == 0;
|
||||||
|
output.innerHTML = success ? "SUCCESS" : "FAILURE";
|
||||||
|
document.title = output.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveMouseOver(elem_name) {
|
||||||
|
var elem = document.getElementById(elem_name);
|
||||||
|
var x = elem.offsetLeft + elem.scrollWidth / 2;
|
||||||
|
var y = elem.offsetTop + elem.scrollHeight / 2;
|
||||||
|
var offsetParent = elem.offsetParent;
|
||||||
|
while (offsetParent) {
|
||||||
|
x += offsetParent.offsetLeft;
|
||||||
|
y += offsetParent.offsetTop;
|
||||||
|
offsetParent = offsetParent.offsetParent;
|
||||||
|
}
|
||||||
|
eventSender.mouseMoveTo(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
if (window.layoutTestController && window.eventSender) {
|
||||||
|
layoutTestController.waitUntilDone();
|
||||||
|
layoutTestController.dumpAsText();
|
||||||
|
setTimeout(doClickRed1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doClickRed1() {
|
||||||
|
moveMouseOver("red_square1");
|
||||||
|
eventSender.mouseDown();
|
||||||
|
setTimeout(doClickGreen1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doClickGreen1() {
|
||||||
|
eventSender.mouseUp();
|
||||||
|
moveMouseOver("green_square1");
|
||||||
|
eventSender.mouseDown();
|
||||||
|
setTimeout(doClickRed2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doClickRed2() {
|
||||||
|
eventSender.mouseUp();
|
||||||
|
moveMouseOver("red_square2");
|
||||||
|
eventSender.mouseDown();
|
||||||
|
setTimeout(doClickGreen2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doClickGreen2() {
|
||||||
|
eventSender.mouseUp();
|
||||||
|
moveMouseOver("green_square2");
|
||||||
|
eventSender.mouseDown();
|
||||||
|
setTimeout(finishTest, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishTest() {
|
||||||
|
eventSender.mouseUp();
|
||||||
|
layoutTestController.notifyDone();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="runTest()">
|
||||||
|
|
||||||
|
<p>Test that iframe shims can be used to overlay HTML above a windowed
|
||||||
|
plugin. The red squares should be hidden by the blue flash plugin, and
|
||||||
|
the green squares should appear over it. To test interactively, click
|
||||||
|
over the buttons on the squares. You should not be able to reach the
|
||||||
|
red squares' buttons.</p>
|
||||||
|
|
||||||
|
<p>Prints "SUCCESS" on success, "FAILURE" on failure.</p>
|
||||||
|
|
||||||
|
<div id=output>NONE</div>
|
||||||
|
|
||||||
|
<div style="position: relative;">
|
||||||
|
|
||||||
|
<!-- div with a lower stacking order than the plugin, appearing earlier in the document -->
|
||||||
|
<div id="red_square1"
|
||||||
|
style="z-index: 50; background-color: #FF0000; position: absolute; top: -10; left: 50; width: 100px; height: 100px; overflow: hidden;">
|
||||||
|
<input type="button" onclick="red1Clicked()" value="red" style="position: absolute; top: 10; left: 10; width: 80px; height: 80px;"/>
|
||||||
|
<iframe src="javascript:void(0);" frameborder=0 style="z-index: -1; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- div with a higher stacking order than the plugin, appearing earlier in the document -->
|
||||||
|
<div id="green_square1"
|
||||||
|
style="z-index: 150; background-color: #00FF00; position: absolute; top: -10; left: 250; width: 100px; height: 100px; overflow: hidden;">
|
||||||
|
<input type="button" onclick="green1Clicked()" value="green" style="position: absolute; top: 10; left: 10; width: 80px; height: 80px;"/>
|
||||||
|
<iframe src="javascript:void(0);" frameborder=0 style="z-index: -1; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="embed_parent" style="position: absolute; z-index: 100"
|
||||||
|
<embed width="400" height="200" wmode="window" loop="false" quality="high" src="simple_blank.swf" type="application/x-shockwave-flash" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- div with a lower stacking order than the plugin, appearing later in the document -->
|
||||||
|
<div id="red_square2"
|
||||||
|
style="z-index: 50; background-color: #FF0000; position: absolute; top: 110; left: 50; width: 100px; height: 100px; overflow: hidden;">
|
||||||
|
<input type="button" onclick="red2Clicked()" value="red" style="position: absolute; top: 10; left: 10; width: 80px; height: 80px;"/>
|
||||||
|
<iframe src="javascript:void(0);" frameborder=0 style="z-index: -1; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- div with a higher stacking order than the plugin, appearing later in the document -->
|
||||||
|
<div id="green_square2"
|
||||||
|
style="z-index: 150; background-color: #00FF00; position: absolute; top: 110; left: 250; width: 100px; height: 100px; overflow: hidden;">
|
||||||
|
<input type="button" onclick="green2Clicked()" value="green" style="position: absolute; top: 10; left: 10; width: 80px; height: 80px;"/>
|
||||||
|
<iframe src="javascript:void(0);" frameborder=0 style="z-index: -1; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
webkit/data/layout_tests/pending/plugins/simple_blank.swf
Normal file
BIN
webkit/data/layout_tests/pending/plugins/simple_blank.swf
Normal file
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/point.h"
|
#include "base/gfx/point.h"
|
||||||
#include "base/stats_counters.h"
|
#include "base/stats_counters.h"
|
||||||
#include "webkit/default_plugin/plugin_impl.h"
|
#include "webkit/default_plugin/plugin_impl.h"
|
||||||
@ -250,13 +251,15 @@ void WebPluginDelegateImpl::DestroyInstance() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginDelegateImpl::UpdateGeometry(const gfx::Rect& window_rect,
|
void WebPluginDelegateImpl::UpdateGeometry(
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& window_rect,
|
||||||
bool visible) {
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) {
|
||||||
if (windowless_) {
|
if (windowless_) {
|
||||||
WindowlessUpdateGeometry(window_rect, clip_rect);
|
WindowlessUpdateGeometry(window_rect, clip_rect);
|
||||||
} else {
|
} else {
|
||||||
WindowedUpdateGeometry(window_rect, clip_rect, visible);
|
WindowedUpdateGeometry(window_rect, clip_rect, cutout_rects, visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate a download on the plugin url. This should be done for the
|
// Initiate a download on the plugin url. This should be done for the
|
||||||
@ -344,10 +347,12 @@ void WebPluginDelegateImpl::InstallMissingPlugin() {
|
|||||||
instance()->NPP_HandleEvent(&evt);
|
instance()->NPP_HandleEvent(&evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginDelegateImpl::WindowedUpdateGeometry(const gfx::Rect& window_rect,
|
void WebPluginDelegateImpl::WindowedUpdateGeometry(
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& window_rect,
|
||||||
bool visible) {
|
const gfx::Rect& clip_rect,
|
||||||
if (WindowedReposition(window_rect, clip_rect, visible) ||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) {
|
||||||
|
if (WindowedReposition(window_rect, clip_rect, cutout_rects, visible) ||
|
||||||
!windowed_did_set_window_) {
|
!windowed_did_set_window_) {
|
||||||
// Let the plugin know that it has been moved
|
// Let the plugin know that it has been moved
|
||||||
WindowedSetWindow();
|
WindowedSetWindow();
|
||||||
@ -584,14 +589,17 @@ bool WebPluginDelegateImpl::CreateDummyWindowForActivation() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginDelegateImpl::MoveWindow(HWND window,
|
void WebPluginDelegateImpl::MoveWindow(
|
||||||
const gfx::Rect& window_rect,
|
HWND window,
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& window_rect,
|
||||||
bool visible) {
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) {
|
||||||
HRGN hrgn = ::CreateRectRgn(clip_rect.x(),
|
HRGN hrgn = ::CreateRectRgn(clip_rect.x(),
|
||||||
clip_rect.y(),
|
clip_rect.y(),
|
||||||
clip_rect.right(),
|
clip_rect.right(),
|
||||||
clip_rect.bottom());
|
clip_rect.bottom());
|
||||||
|
gfx::SubtractRectanglesFromRegion(hrgn, cutout_rects);
|
||||||
|
|
||||||
// Note: System will own the hrgn after we call SetWindowRgn,
|
// Note: System will own the hrgn after we call SetWindowRgn,
|
||||||
// so we don't need to call DeleteObject(hrgn)
|
// so we don't need to call DeleteObject(hrgn)
|
||||||
@ -612,20 +620,24 @@ void WebPluginDelegateImpl::MoveWindow(HWND window,
|
|||||||
flags);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebPluginDelegateImpl::WindowedReposition(const gfx::Rect& window_rect,
|
bool WebPluginDelegateImpl::WindowedReposition(
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& window_rect,
|
||||||
bool visible) {
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) {
|
||||||
if (!windowed_handle_) {
|
if (!windowed_handle_) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_rect_ == window_rect && clip_rect_ == clip_rect &&
|
if (window_rect_ == window_rect && clip_rect_ == clip_rect &&
|
||||||
|
cutout_rects == cutout_rects_ &&
|
||||||
initial_plugin_resize_done_)
|
initial_plugin_resize_done_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
window_rect_ = window_rect;
|
window_rect_ = window_rect;
|
||||||
clip_rect_ = clip_rect;
|
clip_rect_ = clip_rect;
|
||||||
|
cutout_rects_ = cutout_rects;
|
||||||
|
|
||||||
if (!initial_plugin_resize_done_) {
|
if (!initial_plugin_resize_done_) {
|
||||||
// We need to ensure that the plugin process continues to reposition
|
// We need to ensure that the plugin process continues to reposition
|
||||||
@ -636,7 +648,7 @@ bool WebPluginDelegateImpl::WindowedReposition(const gfx::Rect& window_rect,
|
|||||||
// We created the window with 0 width and height since we didn't know it
|
// We created the window with 0 width and height since we didn't know it
|
||||||
// at the time. Now that we know the geometry, we we can update its size
|
// at the time. Now that we know the geometry, we we can update its size
|
||||||
// since the browser only calls SetWindowPos when scrolling occurs.
|
// since the browser only calls SetWindowPos when scrolling occurs.
|
||||||
MoveWindow(windowed_handle_, window_rect, clip_rect, visible);
|
MoveWindow(windowed_handle_, window_rect, clip_rect, cutout_rects, visible);
|
||||||
// Ensure that the entire window gets repainted.
|
// Ensure that the entire window gets repainted.
|
||||||
::InvalidateRect(windowed_handle_, NULL, FALSE);
|
::InvalidateRect(windowed_handle_, NULL, FALSE);
|
||||||
}
|
}
|
||||||
@ -791,6 +803,7 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry(
|
|||||||
|
|
||||||
// We will inform the instance of this change when we call NPP_SetWindow.
|
// We will inform the instance of this change when we call NPP_SetWindow.
|
||||||
clip_rect_ = clip_rect;
|
clip_rect_ = clip_rect;
|
||||||
|
cutout_rects_.clear();
|
||||||
|
|
||||||
if (window_rect_ != window_rect) {
|
if (window_rect_ != window_rect) {
|
||||||
window_rect_ = window_rect;
|
window_rect_ = window_rect;
|
||||||
|
@ -41,7 +41,9 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
|
|||||||
WebPlugin* plugin,
|
WebPlugin* plugin,
|
||||||
bool load_manually);
|
bool load_manually);
|
||||||
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible);
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible);
|
||||||
virtual void Paint(HDC hdc, const gfx::Rect& rect);
|
virtual void Paint(HDC hdc, const gfx::Rect& rect);
|
||||||
virtual void Print(HDC hdc);
|
virtual void Print(HDC hdc);
|
||||||
virtual void SetFocus(); // only called when windowless
|
virtual void SetFocus(); // only called when windowless
|
||||||
@ -93,6 +95,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
|
|||||||
static void MoveWindow(HWND window,
|
static void MoveWindow(HWND window,
|
||||||
const gfx::Rect& window_rect,
|
const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect,
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
bool visible);
|
bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -103,7 +106,9 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
|
|||||||
//--------------------------
|
//--------------------------
|
||||||
// used for windowed plugins
|
// used for windowed plugins
|
||||||
void WindowedUpdateGeometry(const gfx::Rect& window_rect,
|
void WindowedUpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible);
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible);
|
||||||
// Create the native window.
|
// Create the native window.
|
||||||
// Returns true if the window is created (or already exists).
|
// Returns true if the window is created (or already exists).
|
||||||
// Returns false if unable to create the window.
|
// Returns false if unable to create the window.
|
||||||
@ -115,7 +120,9 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
|
|||||||
// Reposition the native window to be in sync with the given geometry.
|
// Reposition the native window to be in sync with the given geometry.
|
||||||
// Returns true if the native window has moved or been clipped differently.
|
// Returns true if the native window has moved or been clipped differently.
|
||||||
bool WindowedReposition(const gfx::Rect& window_rect,
|
bool WindowedReposition(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible);
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible);
|
||||||
|
|
||||||
// Tells the plugin about the current state of the window.
|
// Tells the plugin about the current state of the window.
|
||||||
// See NPAPI NPP_SetWindow for more information.
|
// See NPAPI NPP_SetWindow for more information.
|
||||||
@ -187,6 +194,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
|
|||||||
NPWindow window_;
|
NPWindow window_;
|
||||||
gfx::Rect window_rect_;
|
gfx::Rect window_rect_;
|
||||||
gfx::Rect clip_rect_;
|
gfx::Rect clip_rect_;
|
||||||
|
std::vector<gfx::Rect> cutout_rects_;
|
||||||
int quirks_;
|
int quirks_;
|
||||||
|
|
||||||
// We only move/size the plugin window once after its creation. The
|
// We only move/size the plugin window once after its creation. The
|
||||||
|
137
webkit/glue/stacking_order_iterator.cc
Executable file
137
webkit/glue/stacking_order_iterator.cc
Executable file
@ -0,0 +1,137 @@
|
|||||||
|
// Copyright (c) 2006-2008 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"
|
||||||
|
|
||||||
|
#pragma warning(push, 0)
|
||||||
|
#include "RenderLayer.h"
|
||||||
|
#include "RenderObject.h"
|
||||||
|
#pragma warning(pop)
|
||||||
|
#undef LOG
|
||||||
|
|
||||||
|
#include "webkit/glue/stacking_order_iterator.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// RenderLayerIterator
|
||||||
|
//
|
||||||
|
|
||||||
|
RenderLayerIterator::RenderLayerIterator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderLayerIterator::Reset(WebCore::RenderLayer* rl) {
|
||||||
|
if (rl) {
|
||||||
|
context_stack_.push_back(Context(rl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WebCore::RenderLayer* RenderLayerIterator::Next() {
|
||||||
|
while (context_stack_.size()) {
|
||||||
|
Context* ctx = &(context_stack_.back());
|
||||||
|
if (ctx->HasMoreNeg()) {
|
||||||
|
context_stack_.push_back(ctx->NextNeg());
|
||||||
|
} else if (ctx->HasSelf()) {
|
||||||
|
// Emit self.
|
||||||
|
return ctx->NextSelf();
|
||||||
|
} else if (ctx->HasMoreOverflow()) {
|
||||||
|
context_stack_.push_back(ctx->NextOverflow());
|
||||||
|
} else if (ctx->HasMorePos()) {
|
||||||
|
context_stack_.push_back(ctx->NextPos());
|
||||||
|
} else {
|
||||||
|
// Nothing left in this context. Pop.
|
||||||
|
context_stack_.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderLayerIterator::Context::Context(WebCore::RenderLayer* layer)
|
||||||
|
: layer_(layer),
|
||||||
|
next_neg_(0),
|
||||||
|
next_self_(0),
|
||||||
|
next_overflow_(0),
|
||||||
|
next_pos_(0) {
|
||||||
|
ASSERT(layer_);
|
||||||
|
layer_->updateZOrderLists();
|
||||||
|
layer_->updateOverflowList();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RenderLayerIterator::Context::HasMoreNeg() {
|
||||||
|
return layer_->negZOrderList() &&
|
||||||
|
next_neg_ < layer_->negZOrderList()->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderLayerIterator::Context RenderLayerIterator::Context::NextNeg() {
|
||||||
|
ASSERT(HasMoreNeg());
|
||||||
|
return Context(layer_->negZOrderList()->at(next_neg_++));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RenderLayerIterator::Context::HasSelf() {
|
||||||
|
return next_self_ < 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebCore::RenderLayer* RenderLayerIterator::Context::NextSelf() {
|
||||||
|
ASSERT(HasSelf());
|
||||||
|
next_self_ = 1;
|
||||||
|
return layer_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RenderLayerIterator::Context::HasMoreOverflow() {
|
||||||
|
return layer_->overflowList() &&
|
||||||
|
next_overflow_ >= 0 &&
|
||||||
|
next_overflow_ < layer_->overflowList()->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderLayerIterator::Context RenderLayerIterator::Context::NextOverflow() {
|
||||||
|
ASSERT(HasMoreOverflow());
|
||||||
|
return Context(layer_->overflowList()->at(next_overflow_++));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RenderLayerIterator::Context::HasMorePos() {
|
||||||
|
return layer_->posZOrderList() &&
|
||||||
|
next_pos_ < layer_->posZOrderList()->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderLayerIterator::Context RenderLayerIterator::Context::NextPos() {
|
||||||
|
ASSERT(HasMorePos());
|
||||||
|
return Context(layer_->posZOrderList()->at(next_pos_++));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// StackingOrderIterator
|
||||||
|
//
|
||||||
|
|
||||||
|
StackingOrderIterator::StackingOrderIterator() {
|
||||||
|
Reset(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StackingOrderIterator::Reset(WebCore::RenderLayer* rl) {
|
||||||
|
layer_iterator_.Reset(rl);
|
||||||
|
current_object_ = NULL;
|
||||||
|
current_layer_root_ = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebCore::RenderObject* StackingOrderIterator::Next() {
|
||||||
|
if (current_object_) {
|
||||||
|
// Get the next object inside the current layer.
|
||||||
|
current_object_ = current_object_->nextInPreOrder(current_layer_root_);
|
||||||
|
|
||||||
|
// Skip any sub-layers we encounter along the way; they are
|
||||||
|
// visited (in the correct stacking order) by layer_iterator_.
|
||||||
|
while (current_object_ && current_object_->hasLayer()) {
|
||||||
|
current_object_ = current_object_->
|
||||||
|
nextInPreOrderAfterChildren(current_layer_root_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!current_object_) {
|
||||||
|
// Start the next layer.
|
||||||
|
WebCore::RenderLayer* layer = layer_iterator_.Next();
|
||||||
|
if (layer) {
|
||||||
|
current_object_ = layer->renderer();
|
||||||
|
current_layer_root_ = current_object_;
|
||||||
|
}
|
||||||
|
// No more layers.
|
||||||
|
}
|
||||||
|
return current_object_;
|
||||||
|
}
|
73
webkit/glue/stacking_order_iterator.h
Executable file
73
webkit/glue/stacking_order_iterator.h
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
// Copyright (c) 2006-2008 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.
|
||||||
|
|
||||||
|
// Provides some utilities for iterating over a RenderObject graph in
|
||||||
|
// stacking order.
|
||||||
|
|
||||||
|
#ifndef WEBKIT_GLUE_STACKING_ORDER_ITERATOR_H__
|
||||||
|
#define WEBKIT_GLUE_STACKING_ORDER_ITERATOR_H__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace WebCore {
|
||||||
|
class RenderLayer;
|
||||||
|
class RenderObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterates over a subtree of RenderLayers in stacking order, back to
|
||||||
|
// front. Modifying the RenderObject graph invalidates this iterator.
|
||||||
|
//
|
||||||
|
// TODO(tulrich): this could go in webkit.
|
||||||
|
// TODO(tulrich): needs unittests.
|
||||||
|
class RenderLayerIterator {
|
||||||
|
public:
|
||||||
|
RenderLayerIterator();
|
||||||
|
|
||||||
|
// Sets the RenderLayer subtree to iterate over.
|
||||||
|
void Reset(WebCore::RenderLayer* rl);
|
||||||
|
|
||||||
|
// Returns the next RenderLayer in stacking order, back to front.
|
||||||
|
WebCore::RenderLayer* Next();
|
||||||
|
private:
|
||||||
|
class Context {
|
||||||
|
public:
|
||||||
|
Context(WebCore::RenderLayer* layer);
|
||||||
|
|
||||||
|
bool HasMoreNeg();
|
||||||
|
Context NextNeg();
|
||||||
|
bool HasSelf();
|
||||||
|
WebCore::RenderLayer* NextSelf();
|
||||||
|
bool HasMoreOverflow();
|
||||||
|
Context NextOverflow();
|
||||||
|
bool HasMorePos();
|
||||||
|
Context NextPos();
|
||||||
|
|
||||||
|
private:
|
||||||
|
WebCore::RenderLayer* layer_;
|
||||||
|
size_t next_neg_;
|
||||||
|
size_t next_self_;
|
||||||
|
size_t next_overflow_;
|
||||||
|
size_t next_pos_;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Context> context_stack_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Iterates over a subtree of RenderObjects below a given RenderLayer.
|
||||||
|
//
|
||||||
|
// TODO(tulrich): this could go in webkit.
|
||||||
|
// TODO(tulrich): needs unittests.
|
||||||
|
class StackingOrderIterator {
|
||||||
|
public:
|
||||||
|
StackingOrderIterator();
|
||||||
|
void Reset(WebCore::RenderLayer* rl);
|
||||||
|
WebCore::RenderObject* Next();
|
||||||
|
|
||||||
|
private:
|
||||||
|
RenderLayerIterator layer_iterator_;
|
||||||
|
WebCore::RenderObject* current_object_;
|
||||||
|
WebCore::RenderObject* current_layer_root_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WEBKIT_GLUE_STACKING_ORDER_ITERATOR_H__
|
@ -6,7 +6,7 @@
|
|||||||
#include "webkit/glue/webkit_resources.h"
|
#include "webkit/glue/webkit_resources.h"
|
||||||
|
|
||||||
#if PLATFORM(WIN)
|
#if PLATFORM(WIN)
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WebCursor::WebCursor()
|
WebCursor::WebCursor()
|
||||||
|
@ -56,7 +56,10 @@ struct WebPluginInfo {
|
|||||||
struct WebPluginGeometry {
|
struct WebPluginGeometry {
|
||||||
HWND window;
|
HWND window;
|
||||||
gfx::Rect window_rect;
|
gfx::Rect window_rect;
|
||||||
|
// Clip rect (include) and cutouts (excludes), relative to
|
||||||
|
// window_rect origin.
|
||||||
gfx::Rect clip_rect;
|
gfx::Rect clip_rect;
|
||||||
|
std::vector<gfx::Rect> cutout_rects;
|
||||||
bool visible;
|
bool visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__
|
#define WEBKIT_GLUE_WEBPLUGIN_DELEGATE_H__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/gfx/native_widget_types.h"
|
#include "base/gfx/native_widget_types.h"
|
||||||
@ -42,12 +43,17 @@ class WebPluginDelegate {
|
|||||||
// methods on the WebPlugin again.
|
// methods on the WebPlugin again.
|
||||||
virtual void PluginDestroyed() = 0;
|
virtual void PluginDestroyed() = 0;
|
||||||
|
|
||||||
// Update the geometry of the plugin. This is a request to move the plugin,
|
// Update the geometry of the plugin. This is a request to move the
|
||||||
// relative to its containing window, to the coords given by window_rect.
|
// plugin, relative to its containing window, to the coords given by
|
||||||
// Its contents should be clipped to the coords given by clip_rect, which are
|
// window_rect. Its contents should be clipped to the coords given
|
||||||
// relative to the origin of the plugin window.
|
// by clip_rect, which are relative to the origin of the plugin
|
||||||
|
// window. It's contents should also not overlap the given cutout
|
||||||
|
// rects. The clip_rect and cutout_rects are in plugin-relative
|
||||||
|
// coordinates.
|
||||||
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
virtual void UpdateGeometry(const gfx::Rect& window_rect,
|
||||||
const gfx::Rect& clip_rect, bool visible) = 0;
|
const gfx::Rect& clip_rect,
|
||||||
|
const std::vector<gfx::Rect>& cutout_rects,
|
||||||
|
bool visible) = 0;
|
||||||
|
|
||||||
// Tells the plugin to paint the damaged rect. The HDC is only used for
|
// Tells the plugin to paint the damaged rect. The HDC is only used for
|
||||||
// windowless plugins.
|
// windowless plugins.
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
#include "FrameTree.h"
|
#include "FrameTree.h"
|
||||||
#include "FrameView.h"
|
#include "FrameView.h"
|
||||||
#include "GraphicsContext.h"
|
#include "GraphicsContext.h"
|
||||||
#include "HTMLPlugInElement.h"
|
#include "HTMLNames.h"
|
||||||
|
#include "HTMLPluginElement.h"
|
||||||
#include "IntRect.h"
|
#include "IntRect.h"
|
||||||
#include "KURL.h"
|
#include "KURL.h"
|
||||||
#include "KeyboardEvent.h"
|
#include "KeyboardEvent.h"
|
||||||
@ -46,6 +47,7 @@
|
|||||||
#include "webkit/glue/webplugin_impl.h"
|
#include "webkit/glue/webplugin_impl.h"
|
||||||
#include "webkit/glue/plugins/plugin_host.h"
|
#include "webkit/glue/plugins/plugin_host.h"
|
||||||
#include "webkit/glue/plugins/plugin_instance.h"
|
#include "webkit/glue/plugins/plugin_instance.h"
|
||||||
|
#include "webkit/glue/stacking_order_iterator.h"
|
||||||
#include "webkit/glue/webview_impl.h"
|
#include "webkit/glue/webview_impl.h"
|
||||||
#include "googleurl/src/gurl.h"
|
#include "googleurl/src/gurl.h"
|
||||||
#include "webkit/port/platform/Cursor.h"
|
#include "webkit/port/platform/Cursor.h"
|
||||||
@ -179,6 +181,11 @@ void WebPluginContainer::detachFromWindow() {
|
|||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebPluginContainer::windowCutoutRects(WTF::Vector<WebCore::IntRect>*
|
||||||
|
cutouts) const {
|
||||||
|
impl_->windowCutoutRects(cutouts);
|
||||||
|
}
|
||||||
|
|
||||||
void WebPluginContainer::didReceiveResponse(
|
void WebPluginContainer::didReceiveResponse(
|
||||||
const WebCore::ResourceResponse& response) {
|
const WebCore::ResourceResponse& response) {
|
||||||
|
|
||||||
@ -530,6 +537,36 @@ WebCore::IntRect WebPluginImpl::windowClipRect() const {
|
|||||||
return clip_rect;
|
return clip_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebPluginImpl::windowCutoutRects(
|
||||||
|
WTF::Vector<WebCore::IntRect>* cutouts) const {
|
||||||
|
WebCore::RenderObject* plugin_node = element_->renderer();
|
||||||
|
ASSERT(plugin_node);
|
||||||
|
|
||||||
|
// Find all iframes that stack higher than this plugin.
|
||||||
|
bool higher = false;
|
||||||
|
StackingOrderIterator iterator;
|
||||||
|
WebCore::RenderLayer* root = element_->document()->renderer()->
|
||||||
|
enclosingLayer();
|
||||||
|
iterator.Reset(root);
|
||||||
|
|
||||||
|
while (WebCore::RenderObject* ro = iterator.Next()) {
|
||||||
|
if (ro == plugin_node) {
|
||||||
|
// All nodes after this one are higher than plugin.
|
||||||
|
higher = true;
|
||||||
|
} else if (higher) {
|
||||||
|
// Is this a visible iframe?
|
||||||
|
WebCore::Node* n = ro->node();
|
||||||
|
if (n && n->hasTagName(WebCore::HTMLNames::iframeTag)) {
|
||||||
|
if (!ro->style() || ro->style()->visibility() == WebCore::VISIBLE) {
|
||||||
|
int x, y;
|
||||||
|
ro->absolutePosition(x, y);
|
||||||
|
cutouts->append(WebCore::IntRect(x, y, ro->width(), ro->height()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebPluginImpl::geometryChanged() const {
|
void WebPluginImpl::geometryChanged() const {
|
||||||
if (!widget_)
|
if (!widget_)
|
||||||
return;
|
return;
|
||||||
@ -538,7 +575,7 @@ void WebPluginImpl::geometryChanged() const {
|
|||||||
// our parent view was scrolled.
|
// our parent view was scrolled.
|
||||||
const_cast<WebPluginImpl*>(this)->widget_->setFrameGeometry(
|
const_cast<WebPluginImpl*>(this)->widget_->setFrameGeometry(
|
||||||
widget_->frameGeometry());
|
widget_->frameGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) {
|
void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) {
|
||||||
// Compute a new position and clip rect for ourselves relative to the
|
// Compute a new position and clip rect for ourselves relative to the
|
||||||
@ -564,7 +601,8 @@ void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) {
|
|||||||
|
|
||||||
WebCore::IntRect window_rect;
|
WebCore::IntRect window_rect;
|
||||||
WebCore::IntRect clip_rect;
|
WebCore::IntRect clip_rect;
|
||||||
CalculateBounds(rect, &window_rect, &clip_rect);
|
std::vector<gfx::Rect> cutout_rects;
|
||||||
|
CalculateBounds(rect, &window_rect, &clip_rect, &cutout_rects);
|
||||||
|
|
||||||
if (window_ && received_first_paint_notification_) {
|
if (window_ && received_first_paint_notification_) {
|
||||||
// Let the WebViewDelegate know that the plugin window needs to be moved,
|
// Let the WebViewDelegate know that the plugin window needs to be moved,
|
||||||
@ -573,12 +611,14 @@ void WebPluginImpl::setFrameGeometry(const WebCore::IntRect& rect) {
|
|||||||
move.window = window_;
|
move.window = window_;
|
||||||
move.window_rect = gfx::Rect(window_rect);
|
move.window_rect = gfx::Rect(window_rect);
|
||||||
move.clip_rect = gfx::Rect(clip_rect);
|
move.clip_rect = gfx::Rect(clip_rect);
|
||||||
|
move.cutout_rects = cutout_rects;
|
||||||
move.visible = visible_;
|
move.visible = visible_;
|
||||||
|
|
||||||
webview->delegate()->DidMove(webview, move);
|
webview->delegate()->DidMove(webview, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate_->UpdateGeometry(
|
delegate_->UpdateGeometry(
|
||||||
gfx::Rect(window_rect), gfx::Rect(clip_rect),
|
gfx::Rect(window_rect), gfx::Rect(clip_rect), cutout_rects,
|
||||||
received_first_paint_notification_? visible_ : false);
|
received_first_paint_notification_? visible_ : false);
|
||||||
|
|
||||||
// delegate_ can go away as a result of above call, so check it first.
|
// delegate_ can go away as a result of above call, so check it first.
|
||||||
@ -613,11 +653,13 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
|
|||||||
if (!windowless_) {
|
if (!windowless_) {
|
||||||
WebCore::IntRect window_rect;
|
WebCore::IntRect window_rect;
|
||||||
WebCore::IntRect clip_rect;
|
WebCore::IntRect clip_rect;
|
||||||
|
std::vector<gfx::Rect> cutout_rects;
|
||||||
|
|
||||||
CalculateBounds(widget_->frameGeometry(), &window_rect, &clip_rect);
|
CalculateBounds(widget_->frameGeometry(), &window_rect, &clip_rect,
|
||||||
|
&cutout_rects);
|
||||||
|
|
||||||
delegate_->UpdateGeometry(gfx::Rect(window_rect), gfx::Rect(clip_rect),
|
delegate_->UpdateGeometry(gfx::Rect(window_rect), gfx::Rect(clip_rect),
|
||||||
visible_);
|
cutout_rects, visible_);
|
||||||
delegate_->FlushGeometryUpdates();
|
delegate_->FlushGeometryUpdates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -997,7 +1039,8 @@ WebCore::ScrollView* WebPluginImpl::parent() const {
|
|||||||
|
|
||||||
void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect,
|
void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect,
|
||||||
WebCore::IntRect* window_rect,
|
WebCore::IntRect* window_rect,
|
||||||
WebCore::IntRect* clip_rect) {
|
WebCore::IntRect* clip_rect,
|
||||||
|
std::vector<gfx::Rect>* cutout_rects) {
|
||||||
DCHECK(parent()->isFrameView());
|
DCHECK(parent()->isFrameView());
|
||||||
WebCore::FrameView* view = static_cast<WebCore::FrameView*>(parent());
|
WebCore::FrameView* view = static_cast<WebCore::FrameView*>(parent());
|
||||||
|
|
||||||
@ -1007,6 +1050,16 @@ void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect,
|
|||||||
// Calculate a clip-rect so that we don't overlap the scrollbars, etc.
|
// Calculate a clip-rect so that we don't overlap the scrollbars, etc.
|
||||||
*clip_rect = widget_->windowClipRect();
|
*clip_rect = widget_->windowClipRect();
|
||||||
clip_rect->move(-window_rect->x(), -window_rect->y());
|
clip_rect->move(-window_rect->x(), -window_rect->y());
|
||||||
|
|
||||||
|
cutout_rects->clear();
|
||||||
|
WTF::Vector<WebCore::IntRect> rects;
|
||||||
|
widget_->windowCutoutRects(&rects);
|
||||||
|
// Convert to gfx::Rect and subtract out the plugin position.
|
||||||
|
for (size_t i = 0; i < rects.size(); i++) {
|
||||||
|
gfx::Rect r(rects[i]);
|
||||||
|
r.Offset(-frame_rect.x(), -frame_rect.y());
|
||||||
|
cutout_rects->push_back(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPluginImpl::HandleURLRequest(const char *method,
|
void WebPluginImpl::HandleURLRequest(const char *method,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "ResourceHandleClient.h"
|
#include "ResourceHandleClient.h"
|
||||||
#include "ResourceRequest.h"
|
#include "ResourceRequest.h"
|
||||||
#include "Widget.h"
|
#include "Widget.h"
|
||||||
|
#include "Vector.h"
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
@ -64,6 +65,13 @@ class WebPluginContainer : public WebCore::Widget {
|
|||||||
virtual void attachToWindow();
|
virtual void attachToWindow();
|
||||||
virtual void detachFromWindow();
|
virtual void detachFromWindow();
|
||||||
|
|
||||||
|
// Returns window-relative rectangles that should clip this widget.
|
||||||
|
// Use this to implement iframe shim behavior.
|
||||||
|
//
|
||||||
|
// TODO(tulrich): add this method to WebCore/platform/Widget.h so it
|
||||||
|
// can be used by any platform.
|
||||||
|
void windowCutoutRects(WTF::Vector<WebCore::IntRect>* cutouts) const;
|
||||||
|
|
||||||
// These methods are invoked from webkit when it has data to be sent to the
|
// These methods are invoked from webkit when it has data to be sent to the
|
||||||
// plugin. The plugin in this case does not initiate a download for the data.
|
// plugin. The plugin in this case does not initiate a download for the data.
|
||||||
void didReceiveResponse(const WebCore::ResourceResponse& response);
|
void didReceiveResponse(const WebCore::ResourceResponse& response);
|
||||||
@ -176,6 +184,13 @@ class WebPluginImpl : public WebPlugin,
|
|||||||
virtual WebCore::IntRect windowClipRect() const;
|
virtual WebCore::IntRect windowClipRect() const;
|
||||||
virtual void geometryChanged() const;
|
virtual void geometryChanged() const;
|
||||||
|
|
||||||
|
// Returns window-relative rectangles that should clip this widget.
|
||||||
|
// Use this to implement iframe shim behavior.
|
||||||
|
//
|
||||||
|
// TODO(tulrich): windowCutoutRects() is not in WebCore::Widgets
|
||||||
|
// yet; need to add it.
|
||||||
|
void windowCutoutRects(WTF::Vector<WebCore::IntRect>* rects) const;
|
||||||
|
|
||||||
// Override for when our window changes size or position.
|
// Override for when our window changes size or position.
|
||||||
// Used to notify the plugin when the size or position changes.
|
// Used to notify the plugin when the size or position changes.
|
||||||
virtual void setFrameGeometry(const WebCore::IntRect& rect);
|
virtual void setFrameGeometry(const WebCore::IntRect& rect);
|
||||||
@ -235,7 +250,8 @@ class WebPluginImpl : public WebPlugin,
|
|||||||
// Calculates the bounds of the plugin widget based on the frame rect passed in.
|
// Calculates the bounds of the plugin widget based on the frame rect passed in.
|
||||||
void CalculateBounds(const WebCore::IntRect& frame_rect,
|
void CalculateBounds(const WebCore::IntRect& frame_rect,
|
||||||
WebCore::IntRect* window_rect,
|
WebCore::IntRect* window_rect,
|
||||||
WebCore::IntRect* clip_rect);
|
WebCore::IntRect* clip_rect,
|
||||||
|
std::vector<gfx::Rect>* cutout_rects);
|
||||||
|
|
||||||
void HandleURLRequest(const char *method,
|
void HandleURLRequest(const char *method,
|
||||||
bool is_javascript_url,
|
bool is_javascript_url,
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "SkiaUtils.h"
|
#include "SkiaUtils.h"
|
||||||
#include "SkShader.h"
|
#include "SkShader.h"
|
||||||
|
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#include "base/gfx/image_operations.h"
|
#include "base/gfx/image_operations.h"
|
||||||
#include "base/gfx/native_theme.h"
|
#include "base/gfx/native_theme.h"
|
||||||
#include "base/gfx/platform_canvas_win.h"
|
#include "base/gfx/platform_canvas_win.h"
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "base/gfx/bitmap_header.h"
|
#include "base/gfx/gdi_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void WebCorePointToSkiaPoint(const WebCore::FloatPoint& src, SkPoint* dst)
|
void WebCorePointToSkiaPoint(const WebCore::FloatPoint& src, SkPoint* dst)
|
||||||
|
@ -759,7 +759,8 @@ void TestWebViewDelegate::GetRootWindowRect(WebWidget* webwidget,
|
|||||||
void TestWebViewDelegate::DidMove(WebWidget* webwidget,
|
void TestWebViewDelegate::DidMove(WebWidget* webwidget,
|
||||||
const WebPluginGeometry& move) {
|
const WebPluginGeometry& move) {
|
||||||
WebPluginDelegateImpl::MoveWindow(
|
WebPluginDelegateImpl::MoveWindow(
|
||||||
move.window, move.window_rect, move.clip_rect, move.visible);
|
move.window, move.window_rect, move.clip_rect, move.cutout_rects,
|
||||||
|
move.visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
|
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
|
||||||
|
Reference in New Issue
Block a user