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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 656723005: Use C++11 features in core/html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: mike's comments Created 6 years, 1 month 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 | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/HitRegion.h » ('j') | 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 void CanvasRenderingContext2D::tryRestoreContextEvent(Timer<CanvasRenderingConte xt2D>* timer) 201 void CanvasRenderingContext2D::tryRestoreContextEvent(Timer<CanvasRenderingConte xt2D>* timer)
202 { 202 {
203 if (!m_isContextLost) { 203 if (!m_isContextLost) {
204 // Canvas was already restored (possibly thanks to a resize), so stop tr ying. 204 // Canvas was already restored (possibly thanks to a resize), so stop tr ying.
205 m_tryRestoreContextEventTimer.stop(); 205 m_tryRestoreContextEventTimer.stop();
206 return; 206 return;
207 } 207 }
208 if (canvas()->hasImageBuffer() && canvas()->buffer()->restoreSurface()) { 208 if (canvas()->hasImageBuffer() && canvas()->buffer()->restoreSurface()) {
209 m_tryRestoreContextEventTimer.stop(); 209 m_tryRestoreContextEventTimer.stop();
210 dispatchContextRestoredEvent(0); 210 dispatchContextRestoredEvent(nullptr);
211 } 211 }
212 212
213 if (++m_tryRestoreContextAttemptCount > MaxTryRestoreContextAttempts) 213 if (++m_tryRestoreContextAttemptCount > MaxTryRestoreContextAttempts)
214 canvas()->discardImageBuffer(); 214 canvas()->discardImageBuffer();
215 215
216 if (!canvas()->hasImageBuffer()) { 216 if (!canvas()->hasImageBuffer()) {
217 // final attempt: allocate a brand new image buffer instead of restoring 217 // final attempt: allocate a brand new image buffer instead of restoring
218 timer->stop(); 218 timer->stop();
219 if (canvas()->buffer()) 219 if (canvas()->buffer())
220 dispatchContextRestoredEvent(0); 220 dispatchContextRestoredEvent(nullptr);
221 } 221 }
222 } 222 }
223 223
224 void CanvasRenderingContext2D::dispatchContextRestoredEvent(Timer<CanvasRenderin gContext2D>*) 224 void CanvasRenderingContext2D::dispatchContextRestoredEvent(Timer<CanvasRenderin gContext2D>*)
225 { 225 {
226 if (!m_isContextLost) 226 if (!m_isContextLost)
227 return; 227 return;
228 reset(); 228 reset();
229 m_isContextLost = false; 229 m_isContextLost = false;
230 if (contextLostRestoredEventsEnabled()) { 230 if (contextLostRestoredEventsEnabled()) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 { 560 {
561 return state().m_shadowOffset.width(); 561 return state().m_shadowOffset.width();
562 } 562 }
563 563
564 void CanvasRenderingContext2D::setShadowOffsetX(float x) 564 void CanvasRenderingContext2D::setShadowOffsetX(float x)
565 { 565 {
566 if (!std::isfinite(x)) 566 if (!std::isfinite(x))
567 return; 567 return;
568 if (state().m_shadowOffset.width() == x) 568 if (state().m_shadowOffset.width() == x)
569 return; 569 return;
570 realizeSaves(0); 570 realizeSaves(nullptr);
571 modifiableState().m_shadowOffset.setWidth(x); 571 modifiableState().m_shadowOffset.setWidth(x);
572 applyShadow(); 572 applyShadow();
573 } 573 }
574 574
575 float CanvasRenderingContext2D::shadowOffsetY() const 575 float CanvasRenderingContext2D::shadowOffsetY() const
576 { 576 {
577 return state().m_shadowOffset.height(); 577 return state().m_shadowOffset.height();
578 } 578 }
579 579
580 void CanvasRenderingContext2D::setShadowOffsetY(float y) 580 void CanvasRenderingContext2D::setShadowOffsetY(float y)
581 { 581 {
582 if (!std::isfinite(y)) 582 if (!std::isfinite(y))
583 return; 583 return;
584 if (state().m_shadowOffset.height() == y) 584 if (state().m_shadowOffset.height() == y)
585 return; 585 return;
586 realizeSaves(0); 586 realizeSaves(nullptr);
587 modifiableState().m_shadowOffset.setHeight(y); 587 modifiableState().m_shadowOffset.setHeight(y);
588 applyShadow(); 588 applyShadow();
589 } 589 }
590 590
591 float CanvasRenderingContext2D::shadowBlur() const 591 float CanvasRenderingContext2D::shadowBlur() const
592 { 592 {
593 return state().m_shadowBlur; 593 return state().m_shadowBlur;
594 } 594 }
595 595
596 void CanvasRenderingContext2D::setShadowBlur(float blur) 596 void CanvasRenderingContext2D::setShadowBlur(float blur)
597 { 597 {
598 if (!std::isfinite(blur) || blur < 0) 598 if (!std::isfinite(blur) || blur < 0)
599 return; 599 return;
600 if (state().m_shadowBlur == blur) 600 if (state().m_shadowBlur == blur)
601 return; 601 return;
602 realizeSaves(0); 602 realizeSaves(nullptr);
603 modifiableState().m_shadowBlur = blur; 603 modifiableState().m_shadowBlur = blur;
604 applyShadow(); 604 applyShadow();
605 } 605 }
606 606
607 String CanvasRenderingContext2D::shadowColor() const 607 String CanvasRenderingContext2D::shadowColor() const
608 { 608 {
609 return Color(state().m_shadowColor).serialized(); 609 return Color(state().m_shadowColor).serialized();
610 } 610 }
611 611
612 void CanvasRenderingContext2D::setShadowColor(const String& color) 612 void CanvasRenderingContext2D::setShadowColor(const String& color)
613 { 613 {
614 RGBA32 rgba; 614 RGBA32 rgba;
615 if (!parseColorOrCurrentColor(rgba, color, canvas())) 615 if (!parseColorOrCurrentColor(rgba, color, canvas()))
616 return; 616 return;
617 if (state().m_shadowColor == rgba) 617 if (state().m_shadowColor == rgba)
618 return; 618 return;
619 realizeSaves(0); 619 realizeSaves(nullptr);
620 modifiableState().m_shadowColor = rgba; 620 modifiableState().m_shadowColor = rgba;
621 applyShadow(); 621 applyShadow();
622 } 622 }
623 623
624 const Vector<float>& CanvasRenderingContext2D::getLineDash() const 624 const Vector<float>& CanvasRenderingContext2D::getLineDash() const
625 { 625 {
626 return state().m_lineDash; 626 return state().m_lineDash;
627 } 627 }
628 628
629 static bool lineDashSequenceIsValid(const Vector<float>& dash) 629 static bool lineDashSequenceIsValid(const Vector<float>& dash)
630 { 630 {
631 for (size_t i = 0; i < dash.size(); i++) { 631 for (size_t i = 0; i < dash.size(); i++) {
632 if (!std::isfinite(dash[i]) || dash[i] < 0) 632 if (!std::isfinite(dash[i]) || dash[i] < 0)
633 return false; 633 return false;
634 } 634 }
635 return true; 635 return true;
636 } 636 }
637 637
638 void CanvasRenderingContext2D::setLineDash(const Vector<float>& dash) 638 void CanvasRenderingContext2D::setLineDash(const Vector<float>& dash)
639 { 639 {
640 if (!lineDashSequenceIsValid(dash)) 640 if (!lineDashSequenceIsValid(dash))
641 return; 641 return;
642 642
643 realizeSaves(0); 643 realizeSaves(nullptr);
644 modifiableState().m_lineDash = dash; 644 modifiableState().m_lineDash = dash;
645 // Spec requires the concatenation of two copies the dash list when the 645 // Spec requires the concatenation of two copies the dash list when the
646 // number of elements is odd 646 // number of elements is odd
647 if (dash.size() % 2) 647 if (dash.size() % 2)
648 modifiableState().m_lineDash.appendVector(dash); 648 modifiableState().m_lineDash.appendVector(dash);
649 649
650 applyLineDash(); 650 applyLineDash();
651 } 651 }
652 652
653 float CanvasRenderingContext2D::lineDashOffset() const 653 float CanvasRenderingContext2D::lineDashOffset() const
654 { 654 {
655 return state().m_lineDashOffset; 655 return state().m_lineDashOffset;
656 } 656 }
657 657
658 void CanvasRenderingContext2D::setLineDashOffset(float offset) 658 void CanvasRenderingContext2D::setLineDashOffset(float offset)
659 { 659 {
660 if (!std::isfinite(offset) || state().m_lineDashOffset == offset) 660 if (!std::isfinite(offset) || state().m_lineDashOffset == offset)
661 return; 661 return;
662 662
663 realizeSaves(0); 663 realizeSaves(nullptr);
664 modifiableState().m_lineDashOffset = offset; 664 modifiableState().m_lineDashOffset = offset;
665 applyLineDash(); 665 applyLineDash();
666 } 666 }
667 667
668 void CanvasRenderingContext2D::applyLineDash() const 668 void CanvasRenderingContext2D::applyLineDash() const
669 { 669 {
670 GraphicsContext* c = drawingContext(); 670 GraphicsContext* c = drawingContext();
671 if (!c) 671 if (!c)
672 return; 672 return;
673 DashArray convertedLineDash(state().m_lineDash.size()); 673 DashArray convertedLineDash(state().m_lineDash.size());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 return; 874 return;
875 875
876 resetTransform(); 876 resetTransform();
877 transform(m11, m12, m21, m22, dx, dy); 877 transform(m11, m12, m21, m22, dx, dy);
878 } 878 }
879 879
880 void CanvasRenderingContext2D::setStrokeColor(const String& color) 880 void CanvasRenderingContext2D::setStrokeColor(const String& color)
881 { 881 {
882 if (color == state().m_unparsedStrokeColor) 882 if (color == state().m_unparsedStrokeColor)
883 return; 883 return;
884 realizeSaves(0); 884 realizeSaves(nullptr);
885 setStrokeStyle(CanvasStyle::createFromString(color)); 885 setStrokeStyle(CanvasStyle::createFromString(color));
886 modifiableState().m_unparsedStrokeColor = color; 886 modifiableState().m_unparsedStrokeColor = color;
887 } 887 }
888 888
889 void CanvasRenderingContext2D::setStrokeColor(float grayLevel) 889 void CanvasRenderingContext2D::setStrokeColor(float grayLevel)
890 { 890 {
891 if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLev el, grayLevel, grayLevel, 1.0f)) 891 if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLev el, grayLevel, grayLevel, 1.0f))
892 return; 892 return;
893 setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f)); 893 setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f));
894 } 894 }
(...skipping 21 matching lines...) Expand all
916 { 916 {
917 if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentCMYKA(c, m, y, k, a)) 917 if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentCMYKA(c, m, y, k, a))
918 return; 918 return;
919 setStrokeStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a)); 919 setStrokeStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a));
920 } 920 }
921 921
922 void CanvasRenderingContext2D::setFillColor(const String& color) 922 void CanvasRenderingContext2D::setFillColor(const String& color)
923 { 923 {
924 if (color == state().m_unparsedFillColor) 924 if (color == state().m_unparsedFillColor)
925 return; 925 return;
926 realizeSaves(0); 926 realizeSaves(nullptr);
927 setFillStyle(CanvasStyle::createFromString(color)); 927 setFillStyle(CanvasStyle::createFromString(color));
928 modifiableState().m_unparsedFillColor = color; 928 modifiableState().m_unparsedFillColor = color;
929 } 929 }
930 930
931 void CanvasRenderingContext2D::setFillColor(float grayLevel) 931 void CanvasRenderingContext2D::setFillColor(float grayLevel)
932 { 932 {
933 if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f)) 933 if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f))
934 return; 934 return;
935 setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f)); 935 setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f));
936 } 936 }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 void CanvasRenderingContext2D::clearShadow() 1421 void CanvasRenderingContext2D::clearShadow()
1422 { 1422 {
1423 setShadow(FloatSize(), 0, Color::transparent); 1423 setShadow(FloatSize(), 0, Color::transparent);
1424 } 1424 }
1425 1425
1426 void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, RG BA32 color) 1426 void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, RG BA32 color)
1427 { 1427 {
1428 if (state().m_shadowOffset == offset && state().m_shadowBlur == blur && stat e().m_shadowColor == color) 1428 if (state().m_shadowOffset == offset && state().m_shadowBlur == blur && stat e().m_shadowColor == color)
1429 return; 1429 return;
1430 bool wasDrawingShadows = shouldDrawShadows(); 1430 bool wasDrawingShadows = shouldDrawShadows();
1431 realizeSaves(0); 1431 realizeSaves(nullptr);
1432 modifiableState().m_shadowOffset = offset; 1432 modifiableState().m_shadowOffset = offset;
1433 modifiableState().m_shadowBlur = blur; 1433 modifiableState().m_shadowBlur = blur;
1434 modifiableState().m_shadowColor = color; 1434 modifiableState().m_shadowColor = color;
1435 if (!wasDrawingShadows && !shouldDrawShadows()) 1435 if (!wasDrawingShadows && !shouldDrawShadows())
1436 return; 1436 return;
1437 applyShadow(); 1437 applyShadow();
1438 } 1438 }
1439 1439
1440 void CanvasRenderingContext2D::applyShadow(ShadowMode shadowMode) 1440 void CanvasRenderingContext2D::applyShadow(ShadowMode shadowMode)
1441 { 1441 {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 { 1752 {
1753 if (dirtyRect.isEmpty()) 1753 if (dirtyRect.isEmpty())
1754 return; 1754 return;
1755 1755
1756 canvas()->didDraw(dirtyRect); 1756 canvas()->didDraw(dirtyRect);
1757 } 1757 }
1758 1758
1759 GraphicsContext* CanvasRenderingContext2D::drawingContext() const 1759 GraphicsContext* CanvasRenderingContext2D::drawingContext() const
1760 { 1760 {
1761 if (isContextLost()) 1761 if (isContextLost())
1762 return 0; 1762 return nullptr;
1763 return canvas()->drawingContext(); 1763 return canvas()->drawingContext();
1764 } 1764 }
1765 1765
1766 static PassRefPtrWillBeRawPtr<ImageData> createEmptyImageData(const IntSize& siz e) 1766 static PassRefPtrWillBeRawPtr<ImageData> createEmptyImageData(const IntSize& siz e)
1767 { 1767 {
1768 if (RefPtrWillBeRawPtr<ImageData> data = ImageData::create(size)) { 1768 if (RefPtrWillBeRawPtr<ImageData> data = ImageData::create(size)) {
1769 data->data()->zeroFill(); 1769 data->data()->zeroFill();
1770 return data.release(); 1770 return data.release();
1771 } 1771 }
1772 1772
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 1939
1940 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); 1940 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont);
1941 1941
1942 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/0947 .html, 1942 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/0947 .html,
1943 // the "inherit" and "initial" values must be ignored. 1943 // the "inherit" and "initial" values must be ignored.
1944 if (fontValue == "inherit" || fontValue == "initial") 1944 if (fontValue == "inherit" || fontValue == "initial")
1945 return; 1945 return;
1946 1946
1947 // The parse succeeded. 1947 // The parse succeeded.
1948 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves. 1948 String newFontSafeCopy(newFont); // Create a string copy since newFont can b e deleted inside realizeSaves.
1949 realizeSaves(0); 1949 realizeSaves(nullptr);
1950 modifiableState().m_unparsedFont = newFontSafeCopy; 1950 modifiableState().m_unparsedFont = newFontSafeCopy;
1951 1951
1952 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work 1952 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
1953 // relative to the canvas. 1953 // relative to the canvas.
1954 RefPtr<RenderStyle> newStyle = RenderStyle::create(); 1954 RefPtr<RenderStyle> newStyle = RenderStyle::create();
1955 canvas()->document().updateRenderTreeIfNeeded(); 1955 canvas()->document().updateRenderTreeIfNeeded();
1956 if (RenderStyle* computedStyle = canvas()->computedStyle()) { 1956 if (RenderStyle* computedStyle = canvas()->computedStyle()) {
1957 FontDescription elementFontDescription(computedStyle->fontDescription()) ; 1957 FontDescription elementFontDescription(computedStyle->fontDescription()) ;
1958 // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element. 1958 // Reset the computed size to avoid inheriting the zoom factor from the <canvas> element.
1959 elementFontDescription.setComputedSize(elementFontDescription.specifiedS ize()); 1959 elementFontDescription.setComputedSize(elementFontDescription.specifiedS ize());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 return textAlignName(state().m_textAlign); 2000 return textAlignName(state().m_textAlign);
2001 } 2001 }
2002 2002
2003 void CanvasRenderingContext2D::setTextAlign(const String& s) 2003 void CanvasRenderingContext2D::setTextAlign(const String& s)
2004 { 2004 {
2005 TextAlign align; 2005 TextAlign align;
2006 if (!parseTextAlign(s, align)) 2006 if (!parseTextAlign(s, align))
2007 return; 2007 return;
2008 if (state().m_textAlign == align) 2008 if (state().m_textAlign == align)
2009 return; 2009 return;
2010 realizeSaves(0); 2010 realizeSaves(nullptr);
2011 modifiableState().m_textAlign = align; 2011 modifiableState().m_textAlign = align;
2012 } 2012 }
2013 2013
2014 String CanvasRenderingContext2D::textBaseline() const 2014 String CanvasRenderingContext2D::textBaseline() const
2015 { 2015 {
2016 return textBaselineName(state().m_textBaseline); 2016 return textBaselineName(state().m_textBaseline);
2017 } 2017 }
2018 2018
2019 void CanvasRenderingContext2D::setTextBaseline(const String& s) 2019 void CanvasRenderingContext2D::setTextBaseline(const String& s)
2020 { 2020 {
2021 TextBaseline baseline; 2021 TextBaseline baseline;
2022 if (!parseTextBaseline(s, baseline)) 2022 if (!parseTextBaseline(s, baseline))
2023 return; 2023 return;
2024 if (state().m_textBaseline == baseline) 2024 if (state().m_textBaseline == baseline)
2025 return; 2025 return;
2026 realizeSaves(0); 2026 realizeSaves(nullptr);
2027 modifiableState().m_textBaseline = baseline; 2027 modifiableState().m_textBaseline = baseline;
2028 } 2028 }
2029 2029
2030 inline TextDirection CanvasRenderingContext2D::toTextDirection(Direction directi on, RenderStyle** computedStyle) const 2030 inline TextDirection CanvasRenderingContext2D::toTextDirection(Direction directi on, RenderStyle** computedStyle) const
2031 { 2031 {
2032 RenderStyle* style = (computedStyle || direction == DirectionInherit) ? canv as()->computedStyle() : nullptr; 2032 RenderStyle* style = (computedStyle || direction == DirectionInherit) ? canv as()->computedStyle() : nullptr;
2033 if (computedStyle) 2033 if (computedStyle)
2034 *computedStyle = style; 2034 *computedStyle = style;
2035 switch (direction) { 2035 switch (direction) {
2036 case DirectionInherit: 2036 case DirectionInherit:
(...skipping 22 matching lines...) Expand all
2059 else if (directionString == rtl) 2059 else if (directionString == rtl)
2060 direction = DirectionRTL; 2060 direction = DirectionRTL;
2061 else if (directionString == ltr) 2061 else if (directionString == ltr)
2062 direction = DirectionLTR; 2062 direction = DirectionLTR;
2063 else 2063 else
2064 return; 2064 return;
2065 2065
2066 if (state().m_direction == direction) 2066 if (state().m_direction == direction)
2067 return; 2067 return;
2068 2068
2069 realizeSaves(0); 2069 realizeSaves(nullptr);
2070 modifiableState().m_direction = direction; 2070 modifiableState().m_direction = direction;
2071 } 2071 }
2072 2072
2073 void CanvasRenderingContext2D::fillText(const String& text, float x, float y) 2073 void CanvasRenderingContext2D::fillText(const String& text, float x, float y)
2074 { 2074 {
2075 drawTextInternal(text, x, y, true); 2075 drawTextInternal(text, x, y, true);
2076 } 2076 }
2077 2077
2078 void CanvasRenderingContext2D::fillText(const String& text, float x, float y, fl oat maxWidth) 2078 void CanvasRenderingContext2D::fillText(const String& text, float x, float y, fl oat maxWidth)
2079 { 2079 {
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 { 2436 {
2437 if (m_hitRegionManager) 2437 if (m_hitRegionManager)
2438 m_hitRegionManager->removeAllHitRegions(); 2438 m_hitRegionManager->removeAllHitRegions();
2439 } 2439 }
2440 2440
2441 HitRegion* CanvasRenderingContext2D::hitRegionAtPoint(const LayoutPoint& point) 2441 HitRegion* CanvasRenderingContext2D::hitRegionAtPoint(const LayoutPoint& point)
2442 { 2442 {
2443 if (m_hitRegionManager) 2443 if (m_hitRegionManager)
2444 return m_hitRegionManager->getHitRegionAtPoint(point); 2444 return m_hitRegionManager->getHitRegionAtPoint(point);
2445 2445
2446 return 0; 2446 return nullptr;
2447 } 2447 }
2448 2448
2449 unsigned CanvasRenderingContext2D::hitRegionsCount() const 2449 unsigned CanvasRenderingContext2D::hitRegionsCount() const
2450 { 2450 {
2451 if (m_hitRegionManager) 2451 if (m_hitRegionManager)
2452 return m_hitRegionManager->getHitRegionsCount(); 2452 return m_hitRegionManager->getHitRegionsCount();
2453 2453
2454 return 0; 2454 return 0;
2455 } 2455 }
2456 2456
2457 } // namespace blink 2457 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/HitRegion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698