OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "public/platform/WebDisplayItemList.h" | 46 #include "public/platform/WebDisplayItemList.h" |
47 #include "public/platform/WebFloatAnimationCurve.h" | 47 #include "public/platform/WebFloatAnimationCurve.h" |
48 #include "public/platform/WebFloatPoint.h" | 48 #include "public/platform/WebFloatPoint.h" |
49 #include "public/platform/WebLayer.h" | 49 #include "public/platform/WebLayer.h" |
50 #include "public/platform/WebRect.h" | 50 #include "public/platform/WebRect.h" |
51 #include "public/platform/WebSize.h" | 51 #include "public/platform/WebSize.h" |
52 #include "public/web/WebKit.h" | 52 #include "public/web/WebKit.h" |
53 #include "third_party/skia/include/core/SkCanvas.h" | 53 #include "third_party/skia/include/core/SkCanvas.h" |
54 #include "third_party/skia/include/core/SkPictureRecorder.h" | 54 #include "third_party/skia/include/core/SkPictureRecorder.h" |
55 #include "third_party/skia/include/utils/SkMatrix44.h" | 55 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 56 #include "ui/gfx/geometry/rect.h" |
56 #include "web/WebLocalFrameImpl.h" | 57 #include "web/WebLocalFrameImpl.h" |
57 #include "web/WebSettingsImpl.h" | 58 #include "web/WebSettingsImpl.h" |
58 #include "web/WebViewImpl.h" | 59 #include "web/WebViewImpl.h" |
59 #include "wtf/CurrentTime.h" | 60 #include "wtf/CurrentTime.h" |
60 #include "wtf/Vector.h" | 61 #include "wtf/Vector.h" |
61 | 62 |
62 namespace blink { | 63 namespace blink { |
63 | 64 |
64 PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl*
owningWebViewImpl) | 65 PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl*
owningWebViewImpl) |
65 { | 66 { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (pathHasChanged) { | 254 if (pathHasChanged) { |
254 m_path = newPath; | 255 m_path = newPath; |
255 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size()
); | 256 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size()
); |
256 } | 257 } |
257 | 258 |
258 m_contentLayer->layer()->setPosition(boundingRect.location()); | 259 m_contentLayer->layer()->setPosition(boundingRect.location()); |
259 | 260 |
260 return pathHasChanged; | 261 return pathHasChanged; |
261 } | 262 } |
262 | 263 |
263 void LinkHighlightImpl::paintContents(WebDisplayItemList* webDisplayItemList, co
nst WebRect& webClipRect, WebContentLayerClient::PaintingControlSetting painting
Control) | 264 void LinkHighlightImpl::paintContents(WebDisplayItemList* webDisplayItemList, gf
x::Rect* recordingViewport, WebContentLayerClient::PaintingControlSetting painti
ngControl) |
264 { | 265 { |
265 if (!m_node || !m_node->layoutObject()) | 266 if (!m_node || !m_node->layoutObject()) |
266 return; | 267 return; |
267 | 268 |
268 SkPictureRecorder recorder; | 269 SkPictureRecorder recorder; |
269 SkCanvas* canvas = recorder.beginRecording(webClipRect.width, webClipRect.he
ight); | 270 SkCanvas* canvas = recorder.beginRecording(recordingViewport->width(), recor
dingViewport->height()); |
270 canvas->translate(-webClipRect.x, -webClipRect.y); | 271 canvas->translate(-recordingViewport->x(), -recordingViewport->y()); |
271 | 272 |
272 SkPaint paint; | 273 SkPaint paint; |
273 paint.setStyle(SkPaint::kFill_Style); | 274 paint.setStyle(SkPaint::kFill_Style); |
274 paint.setFlags(SkPaint::kAntiAlias_Flag); | 275 paint.setFlags(SkPaint::kAntiAlias_Flag); |
275 paint.setColor(m_node->layoutObject()->style()->tapHighlightColor().rgb()); | 276 paint.setColor(m_node->layoutObject()->style()->tapHighlightColor().rgb()); |
276 canvas->drawPath(m_path.skPath(), paint); | 277 canvas->drawPath(m_path.skPath(), paint); |
277 | 278 |
278 RefPtr<const SkPicture> picture = adoptRef(recorder.endRecording()); | 279 RefPtr<const SkPicture> picture = adoptRef(recorder.endRecording()); |
279 // TODO(wkorman): Pass actual visual rect with the drawing item. | 280 // TODO(wkorman): Pass actual visual rect with the drawing item. |
280 webDisplayItemList->appendDrawingItem(IntRect(), picture.get()); | 281 webDisplayItemList->appendDrawingItem(IntRect(), picture.get()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 { | 380 { |
380 return clipLayer(); | 381 return clipLayer(); |
381 } | 382 } |
382 | 383 |
383 WebCompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const | 384 WebCompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const |
384 { | 385 { |
385 return m_compositorPlayer.get(); | 386 return m_compositorPlayer.get(); |
386 } | 387 } |
387 | 388 |
388 } // namespace blink | 389 } // namespace blink |
OLD | NEW |