| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 imageStyle.append(AtomicString::number(m_checkerSize)); | 411 imageStyle.append(AtomicString::number(m_checkerSize)); |
| 412 imageStyle.append("px;"); | 412 imageStyle.append("px;"); |
| 413 | 413 |
| 414 int tileSize = m_checkerSize * 2; | 414 int tileSize = m_checkerSize * 2; |
| 415 imageStyle.append("background-size: "); | 415 imageStyle.append("background-size: "); |
| 416 imageStyle.append(AtomicString::number(tileSize)); | 416 imageStyle.append(AtomicString::number(tileSize)); |
| 417 imageStyle.append("px "); | 417 imageStyle.append("px "); |
| 418 imageStyle.append(AtomicString::number(tileSize)); | 418 imageStyle.append(AtomicString::number(tileSize)); |
| 419 imageStyle.append("px;"); | 419 imageStyle.append("px;"); |
| 420 | 420 |
| 421 // Generating the checkerboard pattern this way is not exactly cheap. |
| 422 // If rasterization performance becomes an issue, we could look at using |
| 423 // a cheaper shader (e.g. pre-generate a scaled tile + base64-encode + |
| 424 // inline dataURI => single bitmap shader). |
| 421 imageStyle.append( | 425 imageStyle.append( |
| 422 "background-color: white;" | |
| 423 "background-image:" | 426 "background-image:" |
| 424 "linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, " | 427 "linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, " |
| 425 "#eee 75%, #eee 100%)," | 428 "#eee 75%, #eee 100%)," |
| 426 "linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, " | 429 "linear-gradient(45deg, #eee 25%, white 25%, white 75%, " |
| 427 "#eee 75%, #eee 100%);"); | 430 "#eee 75%, #eee 100%);"); |
| 428 } | 431 } |
| 429 } | 432 } |
| 430 | 433 |
| 431 m_imageElement->setAttribute(styleAttr, imageStyle.toAtomicString()); | 434 m_imageElement->setAttribute(styleAttr, imageStyle.toAtomicString()); |
| 432 } | 435 } |
| 433 | 436 |
| 434 void ImageDocument::imageUpdated() { | 437 void ImageDocument::imageUpdated() { |
| 435 DCHECK(m_imageElement); | 438 DCHECK(m_imageElement); |
| 436 | 439 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 590 } |
| 588 | 591 |
| 589 bool ImageEventListener::operator==(const EventListener& listener) const { | 592 bool ImageEventListener::operator==(const EventListener& listener) const { |
| 590 if (const ImageEventListener* imageEventListener = | 593 if (const ImageEventListener* imageEventListener = |
| 591 ImageEventListener::cast(&listener)) | 594 ImageEventListener::cast(&listener)) |
| 592 return m_doc == imageEventListener->m_doc; | 595 return m_doc == imageEventListener->m_doc; |
| 593 return false; | 596 return false; |
| 594 } | 597 } |
| 595 | 598 |
| 596 } // namespace blink | 599 } // namespace blink |
| OLD | NEW |