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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 2523513002: Simplify ImageDocument checkerboard background styling (Closed)
Patch Set: typos Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698