window.internals.repaintRectsAsText() is hard to use because it doesn't force layout
https://bugs.webkit.org/show_bug.cgi?id=114219

Reviewed by Beth Dakin.

Force layout when setTracksRepaints() is set to true, to flush out any pending
repaints from a layout that hasn't happened yet. Also force layout in
trackedRepaintRectsAsText(), so that any pending layout happpens and thus
repaints.

* page/FrameView.cpp:
(WebCore::FrameView::setTracksRepaints):
(WebCore::FrameView::trackedRepaintRectsAsText):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Repaint rect too small on elements with shadows
https://bugs.webkit.org/show_bug.cgi?id=114225

Source/WebCore:

Reviewed by Dain Adler.

We assumed that shadows (box-shadow, text-shadow, svg shadows)
only required inflating the repaint rect by the blur radius of
the shadow. However, this is incorrect; the shadow can extend
further, which resulted in clipped or incorrectly invalidated
shadows.

Fix by disambiguating the blur radius (which is 2x the standard
deviation of the Gaussian distribution used to generate the blur),
from the painting extent, which is how far the shadow visually
projects. Using a 1.4 multiplier of the blur radius is a good
approximation for the painting extent.

Renamed ShadowData::blur() to ShadowData::radius(), and added
ShadowData::paintingExtent(). Use the latter in all places
which relate to invalidation.

Test: fast/box-shadow/shadow-repaint.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::valueForShadow):
* editing/mac/EditorMac.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::applyShadowToGraphicsContext):
(WebCore::InlineTextBox::paintDecoration):
* rendering/RenderBoxModelObject.cpp:
(WebCore::applyBoxShadowForBackground):
(WebCore::areaCastingShadowInHole):
(WebCore::RenderBoxModelObject::paintBoxShadow):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getShadowExtent):
(WebCore::RenderStyle::getShadowInsetExtent):
(WebCore::RenderStyle::getShadowHorizontalExtent):
(WebCore::RenderStyle::getShadowVerticalExtent):
* rendering/style/ShadowData.cpp:
(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::operator==):
(WebCore::calculateShadowExtent):
* rendering/style/ShadowData.h:
(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::radius):
(WebCore::ShadowData::paintingExtent):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::prepareToRenderSVGContent):

LayoutTests:

Reviewed by Darin Alder.

New test for invalidation with box-shadow. Update test results affected
by shadow extent.

* compositing/geometry/foreground-layer-expected.txt:
* compositing/iframes/composited-parent-iframe-expected.txt:
* compositing/iframes/connect-compositing-iframe-delayed-expected.txt:
* compositing/iframes/connect-compositing-iframe-expected.txt:
* compositing/iframes/connect-compositing-iframe2-expected.txt:
* compositing/iframes/connect-compositing-iframe3-expected.txt:
* compositing/iframes/enter-compositing-iframe-expected.txt:
* compositing/iframes/iframe-resize-expected.txt:
* compositing/iframes/invisible-nested-iframe-show-expected.txt:
* compositing/iframes/overlapped-iframe-expected.txt:
* compositing/iframes/page-cache-layer-tree-expected.txt:
* compositing/iframes/scrolling-iframe-expected.txt:
* compositing/visible-rect/iframe-and-layers-expected.txt:
* fast/box-shadow/shadow-repaint-expected.txt: Added.
* fast/box-shadow/shadow-repaint.html: Added.
* platform/mac/fast/multicol/shadow-breaking-expected.png:
* platform/mac/fast/multicol/shadow-breaking-expected.txt:
* platform/mac/fast/repaint/moving-shadow-on-container-expected.txt:
* platform/mac/fast/repaint/moving-shadow-on-path-expected.png:
* platform/mac/fast/repaint/moving-shadow-on-path-expected.txt:
* platform/mac/svg/css/arrow-with-shadow-expected.png:
* platform/mac/svg/css/circle-in-mask-with-shadow-expected.png:
* platform/mac/svg/css/clippath-with-shadow-expected.png:
* platform/mac/svg/css/composite-shadow-example-expected.png:
* platform/mac/svg/css/composite-shadow-example-expected.txt:
* platform/mac/svg/css/composite-shadow-text-expected.txt:
* platform/mac/svg/css/composite-shadow-with-opacity-expected.png:
* platform/mac/svg/css/composite-shadow-with-opacity-expected.txt:
* platform/mac/svg/css/group-with-shadow-expected.png:
* platform/mac/svg/css/group-with-shadow-expected.txt:
* platform/mac/svg/css/mask-with-shadow-expected.png:
* platform/mac/svg/css/path-with-shadow-expected.png:
* platform/mac/svg/css/path-with-shadow-expected.txt:
* platform/mac/svg/css/shadow-and-opacity-expected.png:
* platform/mac/svg/css/shadow-and-opacity-expected.txt:
* platform/mac/svg/css/shadow-changes-expected.png:
* platform/mac/svg/css/shadow-changes-expected.txt:
* platform/mac/svg/css/shadow-with-large-radius-expected.png:
* platform/mac/svg/css/shadow-with-negative-offset-expected.png:
* platform/mac/svg/css/stars-with-shadow-expected.png:
* platform/mac/svg/css/stars-with-shadow-expected.txt:
* platform/mac/svg/css/text-gradient-shadow-expected.png:
* platform/mac/svg/css/text-gradient-shadow-expected.txt:
* platform/mac/svg/css/text-shadow-multiple-expected.png:
* platform/mac/svg/custom/repaint-shadow-expected.png:
* platform/mac/svg/custom/transform-with-shadow-and-gradient-expected.txt:
* svg/css/arrow-with-shadow-expected.txt:
* svg/css/circle-in-mask-with-shadow-expected.txt:
* svg/css/clippath-with-shadow-expected.txt:
* svg/css/mask-with-shadow-expected.txt:
* svg/css/shadow-with-large-radius-expected.txt:
* svg/css/shadow-with-negative-offset-expected.txt:
* svg/css/text-shadow-multiple-expected.txt:
* svg/custom/repaint-shadow-expected.txt:
* svg/filters/shadow-on-rect-with-filter-expected.txt:
* svg/repaint/repaint-webkit-svg-shadow-container-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] user caption styles not applied to correct element
https://bugs.webkit.org/show_bug.cgi?id=114230

Reviewed by Jer Noble.

Source/WebCore: 

Test: media/track/track-css-user-override.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): Drive by clean-up so we don't log excessively.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement): Initialize
    new member variables.
(WebCore::MediaControlTextTrackContainerElement::updateDisplay): Set cue font size when it is
    inserted into the tree.
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired): Update the font size of 
    all active cues.
(WebCore::MediaControlTextTrackContainerElement::updateSizes): Set size-relative CSS properties
    after a time because this can be called during layout.
* html/shadow/MediaControlElements.h:

* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::textTrackPreferencesChanged): Call closedCaptionTracksChanged before updateSizes.

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::setFontSize): New, set the cue's font size.
* html/track/TextTrackCue.h:

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGenericBoxElement::applyCSSProperties): Set cue properties on the cue element
    instead of on the cue box to match what we do for the "cue" pseudo element.
(WebCore::TextTrackCueGeneric::setFontSize): New, set the cue's font size.
* html/track/TextTrackCueGeneric.h:

* html/track/TextTrackList.cpp:
(TextTrackList::remove): Drive-by cleanup, don't ASSERT when the media element is NULL.

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride): New, allow user CSS overrides
    to be tested in DRT.
(WebCore::CaptionUserPreferences::updateCaptionStyleSheetOveride): New, generate a user style
    sheet override. Moved here from CaptionUserPreferencesMac.
* page/CaptionUserPreferences.h:

* page/CaptionUserPreferencesMac.h:
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS): Don't ignore background color importance.
(WebCore::CaptionUserPreferencesMac::captionsStyleSheetOverride): Implement even when we don't 
    have the media accessibility framework so this can be tested in DRT. Apply all cue properties
    to the element used for the "cue" pseudo element.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::didLoadingProgress): Drive-by cleanup, remove logging
    because this method is called so frequently and the logging is not especially useful.
(WebCore::MediaPlayerPrivateAVFoundation::updateStates): Only log when the ready/network
    state changes because this method is called so frequently.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer): Drive-by cleanup, remove logging
    because this method is called so frequently and the logging is not especially useful.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Make the logging more useful.

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState): Reset captions style sheet override.
(WebCore::Internals::captionsStyleSheetOverride): New, return the captions style sheet override.
(WebCore::Internals::setCaptionsStyleSheetOverride): New, override the captions style sheet override.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests: 

* media/track/track-css-user-override-expected.txt: Added.
* media/track/track-css-user-override.html: Added.
* media/track/track-cue-container-rendering-position-expected.txt:
* media/track/track-cue-container-rendering-position.html:
* media/track/track-cue-rendering-expected.txt:
* media/track/track-cue-rendering.html: Font size is not applied instantly when a video element is
    resized, so check after a very short delay.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148050 268f45cc-cd09-0410-ab3c-d52691b4dbfc