diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-24 08:29:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-24 08:29:43 +0200 |
commit | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (patch) | |
tree | 3b94a9a9fa83efa384b8dac611cf8c6495532a62 /Source/WebCore | |
parent | f53e6f8e798362ed712d4a51633b0d0b03dbc213 (diff) | |
download | qtwebkit-2e2ba8ff45915f40ed3e014101269c175f2a89a0.tar.gz |
Imported WebKit commit bf0b0213bbf3886c96610020602012ca7d11b084 (http://svn.webkit.org/repository/webkit/trunk@126545)
New snapshot with clang and python build fixes
Diffstat (limited to 'Source/WebCore')
243 files changed, 4231 insertions, 2030 deletions
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 07823029d..138082037 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1793 @@ +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8DOMWindowShell should use ScopedPersistent + https://bugs.webkit.org/show_bug.cgi?id=94882 + + Reviewed by Kentaro Hara. + + This patch updates V8DOMWindowShell to use ScopedPersistent rather than + manually managing v8::Persistent handles. I've also fixed some style + issues in code I needed to edit for this patch. This class could use + more touchup, but I'm going to hold off until the next patch. + + * bindings/v8/ScopedPersistent.h: + (WebCore::ScopedPersistent::adopt): + (ScopedPersistent): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::initializeV8IfNeeded): + (WebCore): + (WebCore::V8DOMWindowShell::isContextInitialized): + (WebCore::V8DOMWindowShell::disposeContextHandles): + (WebCore::V8DOMWindowShell::destroyGlobal): + (WebCore::V8DOMWindowShell::clearForClose): + (WebCore::V8DOMWindowShell::clearForNavigation): + (WebCore::V8DOMWindowShell::initContextIfNeeded): + (WebCore::V8DOMWindowShell::setContext): + (WebCore::V8DOMWindowShell::updateDocumentWrapper): + (WebCore::V8DOMWindowShell::clearDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::V8DOMWindowShell::clearDocumentWrapperCache): + (WebCore::V8DOMWindowShell::setSecurityToken): + (WebCore::V8DOMWindowShell::updateDocument): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + (WebCore::V8DOMWindowShell::updateSecurityOrigin): + * bindings/v8/V8DOMWindowShell.h: + (WebCore::V8DOMWindowShell::context): + (V8DOMWindowShell): + +2012-08-23 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r126496. + http://trac.webkit.org/changeset/126496 + https://bugs.webkit.org/show_bug.cgi?id=94895 + + Broke TestNotificationActiveDescendantChanged (Requested by + dominicc on #webkit). + + * accessibility/AccessibilityNodeObject.cpp: + * accessibility/AccessibilityNodeObject.h: + (AccessibilityNodeObject): + * accessibility/AccessibilityObject.cpp: + * accessibility/AccessibilityObject.h: + (AccessibilityObject): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::title): + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + (WebCore::AccessibilityRenderObject::isDescendantOfElementType): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + +2012-08-23 Frederik Gladhorn <gladhorn@kde.org> + + Make it possible to build WebKit with Python 3 (and 2) + https://bugs.webkit.org/show_bug.cgi?id=94814 + + Exceptions need a hack to work with both. + string.join was already deprecated in Python 2. + Relative imports are no longer supported, use package name instead. + + Reviewed by Ryosuke Niwa. + + * inspector/CodeGeneratorInspector.py: + (EnumConstants.get_enum_constant_code): + (TypeBindings.create_type_declaration_.EnumBinding.get_code_generator.CodeGenerator.generate_type_builder): + (Generator.go): + (Generator.process_event): + (Generator.process_command): + +2012-08-23 Antoine Labour <piman@chromium.org> + + [chromium] Fix lost context when textures are evicted + https://bugs.webkit.org/show_bug.cgi?id=94892 + + Reviewed by James Robinson. + + After eviction, the CCPrioritizedTextureManager is in a limbo state + where all its resources are invalid. If we try to release them we will + double-destroy them. + + New test: CCLayerTreeHostTestLostContextAfterEvictTextures. + + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::recreateContextOnImplThread): + +2012-08-23 Keishi Hattori <keishi@webkit.org> + + REGRESSION(r126132): thumb doesn't match click position for rtl input type=range + https://bugs.webkit.org/show_bug.cgi?id=94890 + + Reviewed by Kent Tamura. + + r126132 broke rtl input type=range so the thumb doesn't match click position. + + Added new tests to range-hit-test-with-padding.html. + + * html/shadow/SliderThumbElement.cpp: + (WebCore::SliderThumbElement::setPositionFromPoint): + +2012-08-23 James Robinson <jamesr@chromium.org> + + Add OVERRIDE and deinline virtual getters on *PlatformGestureCurve + https://bugs.webkit.org/show_bug.cgi?id=94887 + + Reviewed by Dirk Pranke. + + This makes clang happy. Clang makes me happy. By induction, this makes me happy. + + * platform/TouchpadFlingPlatformGestureCurve.cpp: + (WebCore::TouchpadFlingPlatformGestureCurve::debugName): + (WebCore): + * platform/TouchpadFlingPlatformGestureCurve.h: + (TouchpadFlingPlatformGestureCurve): + * platform/WheelFlingPlatformGestureCurve.cpp: + (WebCore::WheelFlingPlatformGestureCurve::debugName): + (WebCore): + * platform/WheelFlingPlatformGestureCurve.h: + (WheelFlingPlatformGestureCurve): + +2012-08-23 Yoshifumi Inoue <yosin@chromium.org> + + [Forms] Step mismatched value should be editable in multiple field time UI. + https://bugs.webkit.org/show_bug.cgi?id=94664 + + Reviewed by Kent Tamura. + + This patch changes layout method of multiple field time input UI to + check value of the "input" element in addition to step and range to + allow users to change step mismatched value from UI. + + Tests: fast/forms/time-multiple-fields/time-multiple-fields-change-layout-by-value.html: for changing layout by value change. + This patch also adds new test case into fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic.html. + + * html/TimeInputType.cpp: + (WebCore::TimeInputType::createShadowSubtree): Changed for DateTimeEditElement::create signature change. + (WebCore::TimeInputType::minOrMaxAttributeChanged): Changed to call updateInnerTextValue instead of removed updateEditElementLayout() + (WebCore::TimeInputType::stepAttributeChanged): ditto. + (WebCore::TimeInputType::updateInnerTextValue): Changed for DateTimeEditElement::setValueAsDate() and setEmptyValue() signature change. + * html/TimeInputType.h: + (TimeInputType): Removed updateEditElementLayout() declaration. + * html/shadow/DateTimeEditElement.cpp: + (DateTimeEditBuilder): + (WebCore::DateTimeEditBuilder::DateTimeEditBuilder): Added a new parameter date value to constructor to use it for layout decision. + (WebCore::DateTimeEditBuilder::needMillisecondField): Changed to check date value too. + (WebCore::DateTimeEditBuilder::needMinuteField): ditto + (WebCore::DateTimeEditBuilder::needSecondField): ditto + (WebCore::DateTimeEditBuilder::shouldMillisecondFieldReadOnly): ditto + (WebCore::DateTimeEditBuilder::shouldMinuteFieldReadOnly): ditto + (WebCore::DateTimeEditBuilder::shouldSecondFieldReadOnly): ditto + (WebCore::DateTimeEditElement::create): Changed for removing stepRange parameter. + (WebCore::DateTimeEditElement::layout): Changed to keep focus field for new layout. + (WebCore::DateTimeEditElement::setValueAsDate): Changed to call layout() with StepRange and date value. + (WebCore::DateTimeEditElement::setEmptyValue): ditto + * html/shadow/DateTimeEditElement.h: + (DateTimeEditElement): + +2012-08-23 Andreas Kling <kling@webkit.org> + + Use immutable StylePropertySets for element inline style declarations. + <http://webkit.org/b/94714> + + Reviewed by Antti Koivisto. + + Construct the inline styles as immutable StylePropertySets initially (until they are + modified through CSSOM APIs), reducing their memory footprint and enabling us to do + sharing optimizations in the future. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseInlineStyleDeclaration): + (WebCore::CSSParser::parseDeclaration): + * css/CSSParser.h: + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::updateInlineStyleAvoidingMutation): + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8AbstractEventListener re-implements ScopedPersistent by hand + https://bugs.webkit.org/show_bug.cgi?id=94873 + + Reviewed by Eric Seidel. + + Rather than calling New/Dispose manually, this patch changes + V8AbstractEventListener to use ScopedPersistent. + + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::weakEventListenerCallback): + (WebCore::V8AbstractEventListener::~V8AbstractEventListener): + (WebCore::V8AbstractEventListener::setListenerObject): + (WebCore::V8AbstractEventListener::getReceiverObject): + * bindings/v8/V8AbstractEventListener.h: + (WebCore::V8AbstractEventListener::getListenerObject): + (WebCore::V8AbstractEventListener::getExistingListenerObject): + (WebCore::V8AbstractEventListener::existingListenerObjectPersistentHandle): + (WebCore::V8AbstractEventListener::hasExistingListenerObject): + (V8AbstractEventListener): + +2012-08-23 Simon Fraser <simon.fraser@apple.com> + + Prep work for: Implement sticky positioning + https://bugs.webkit.org/show_bug.cgi?id=90046 + + Reviewed by Dave Hyatt. + + Do some method renaming in preparation for adding a new kind + of in-flow positioning: sticky positioning. + + Rename RenderStyle::isOutOfFlowPositioned() to hasOutOfFlowPosition(). + Add RenderStyle::hasInFlowPosition(). + + Use RenderObject::isInFlowPositioned() in places where it will apply + for both relative and sticky positioning. + + Add RenderBoxModelObject::offsetForInFlowPosition(), which currently + applies just to relative positioning, but will also apply to sticky. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::getPositionOffsetValue): + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * editing/TextIterator.cpp: + (WebCore::ignoresContainerClip): + * rendering/LayoutState.cpp: + (WebCore::LayoutState::LayoutState): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::styleWillChange): + (WebCore::RenderBlock::isSelectionRoot): + (WebCore::RenderBlock::blockSelectionGaps): + (WebCore::positionForPointRespectingEditingBoundaries): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::styleWillChange): + (WebCore::RenderBox::updateBoxModelInfoFromStyle): + (WebCore::RenderBox::mapLocalToContainer): + (WebCore::RenderBox::offsetFromContainer): + (WebCore::RenderBox::computeRectForRepaint): + (WebCore::RenderBox::containingBlockLogicalWidthForPositioned): + (WebCore::RenderBox::containingBlockLogicalHeightForPositioned): + (WebCore::RenderBox::layoutOverflowRectForPropagation): + * rendering/RenderBox.h: + * rendering/RenderBoxModelObject.cpp: + (WebCore::accumulateInFlowPositionOffsets): + (WebCore::RenderBoxModelObject::relativePositionOffset): + (WebCore::RenderBoxModelObject::offsetForInFlowPosition): + (WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint): + * rendering/RenderBoxModelObject.h: + (RenderBoxModelObject): + (WebCore::RenderBoxModelObject::stickyPositionLogicalOffset): + (WebCore::RenderBoxModelObject::requiresLayer): + * rendering/RenderInline.cpp: + (WebCore::inFlowPositionedInlineAncestor): We need to actually return + the ancestor, since we will need to copy its position type once there + is more than one kind of in-flow position. + (WebCore::updateStyleOfAnonymousBlockContinuations): + (WebCore::RenderInline::styleDidChange): + (WebCore::RenderInline::addChildIgnoringContinuation): + (WebCore::RenderInline::clippedOverflowRectForRepaint): + (WebCore::RenderInline::computeRectForRepaint): + (WebCore::RenderInline::offsetFromContainer): + (WebCore::RenderInline::mapLocalToContainer): + (WebCore::RenderInline::offsetForInFlowPositionedInline): + * rendering/RenderInline.h: + (WebCore::RenderInline::requiresLayer): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateLayerPosition): + (WebCore::isPositionedContainer): + (WebCore::RenderLayer::calculateClipRects): + (WebCore::RenderLayer::shouldBeNormalFlowOnly): + * rendering/RenderLayer.h: + (WebCore::RenderLayer::offsetForInFlowPosition): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::markContainingBlocksForLayout): + (WebCore::RenderObject::setPreferredLogicalWidthsDirty): + (WebCore::RenderObject::invalidateContainerPreferredLogicalWidths): + (WebCore::RenderObject::containingBlock): + * rendering/RenderObject.h: + (WebCore::RenderObject::isRelPositioned): + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::updateBeforeAfterContent): + * rendering/style/RenderStyle.h: + +2012-08-23 Ryosuke Niwa <rniwa@webkit.org> + + EFL build fix attempt after r126494. Try touching the IDL file. + + * Modules/battery/BatteryManager.idl: + +2012-08-23 Adam Barth <abarth@webkit.org> + + Unreviewed attempt to fix build failure in Debug. + + * bindings/v8/ScriptValue.h: + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Expose mechanism for database to force a connection to close + https://bugs.webkit.org/show_bug.cgi?id=91010 + + Reviewed by Tony Chang. + + In response to user action (e.g. "delete my browsing data") a connection may + need to be forcibly terminated. This allows an event to be sent to a connection + from the back end via IDBDatabaseCallbacks to initiate closing the connection. + + Test: [chromium] webkit_unit_test --gtest_filter='IDBDatabaseBackendTest.ForcedClose' + + * Modules/indexeddb/IDBDatabase.cpp: + (WebCore::IDBDatabase::forceClose): Abort all transactions and close. + (WebCore): + * Modules/indexeddb/IDBDatabase.h: + (IDBDatabase): Entry point. + * Modules/indexeddb/IDBDatabaseCallbacks.h: + (IDBDatabaseCallbacks): Event plumbing from back end. + * Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp: + (WebCore::IDBDatabaseCallbacksImpl::onForcedClose): Ditto. + (WebCore): + * Modules/indexeddb/IDBDatabaseCallbacksImpl.h: + (IDBDatabaseCallbacksImpl): Ditto. + * inspector/InspectorIndexedDBAgent.cpp: + (WebCore): Method stub. + +2012-08-23 James Robinson <jamesr@chromium.org> + + [chromium] Convert WebAnimationCurve subtypes into pure virtual + https://bugs.webkit.org/show_bug.cgi?id=94068 + + Reviewed by Adrienne Walker. + + Updates users of the Web*AnimationCurve interface for its new pointery goodness. + + * platform/graphics/chromium/AnimationTranslationUtil.cpp: + (WebCore::appendKeyframeWithStandardTimingFunction): + (WebCore::appendKeyframeWithCustomBezierTimingFunction): + (WebCore::WebTransformAnimationCurve): + (WebCore::createWebAnimation): + +2012-08-23 Emil A Eklund <eae@chromium.org> + + Add saturation arithmetic support to FractionalLayoutUnit + https://bugs.webkit.org/show_bug.cgi?id=94364 + + Reviewed by Benjamin Poulain. + + Add experimental saturation arithmetic support to FractionalLayoutUnit, + guarded by a flag. + The idea here is to saturate (or clamp) rather than overflow when + computing positions and sizes. + + No new tests for WebCore, not enabled by default. + + * platform/FractionalLayoutUnit.h: + (WebCore::FractionalLayoutUnit::intMinForLayoutUnit): + Use INT_MIN instead of -INT_MAX to compute minimum value as the two are + not the same. + + (WebCore::FractionalLayoutUnit::FractionalLayoutUnit): + (WebCore::FractionalLayoutUnit::fromFloatCeil): + (WebCore::FractionalLayoutUnit::fromFloatFloor): + (WebCore::FractionalLayoutUnit::fromFloatRound): + (WebCore::FractionalLayoutUnit::setValue): + Add range checks. + + (WebCore::operator*): + (WebCore::operator+): + (WebCore::operator-): + (WebCore::operator+=): + (WebCore::operator-=): + Use the saturatedAddition and saturatedSubtraction functions, which have + been optimized to reduce branching, instead of range checks for the most + common operators. + +2012-08-23 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r126483. + http://trac.webkit.org/changeset/126483 + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Caused two Chromium browser_tests to time out 100% reliably. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameLoader): + +2012-08-23 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Just added comments I forgot to add in r126506. + + * bindings/v8/ScriptController.h: + (WebCore): + (ScriptController): + +2012-08-23 Kenneth Russell <kbr@google.com> + + Unreviewed, rolling out r126483. + http://trac.webkit.org/changeset/126483 + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Caused two Chromium browser_tests to time out 100% reliably. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameLoader): + +2012-08-23 Kentaro Hara <haraken@chromium.org> + + [V8] Remove V8Proxy.{h,cpp} + https://bugs.webkit.org/show_bug.cgi?id=94794 + + Reviewed by Dimitri Glazkov. + + Now V8Proxy is no longer used. We can completely remove V8Proxy from the codebase. + + No tests. No change in behavior. + + * UseV8.cmake: + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateImplementation): + (GenerateCallbackImplementation): + * bindings/scripts/test/V8/V8Float64Array.cpp: + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: + * bindings/scripts/test/V8/V8TestCallback.cpp: + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: + * bindings/scripts/test/V8/V8TestEventConstructor.cpp: + * bindings/scripts/test/V8/V8TestEventTarget.cpp: + * bindings/scripts/test/V8/V8TestException.cpp: + * bindings/scripts/test/V8/V8TestInterface.cpp: + * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: + * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: + * bindings/scripts/test/V8/V8TestNode.cpp: + * bindings/scripts/test/V8/V8TestObj.cpp: + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::ScriptController): + (WebCore::ScriptController::~ScriptController): + (WebCore::ScriptController::callFunction): + (WebCore::ScriptController::clearWindowShell): + * bindings/v8/ScriptController.h: + (WebCore): + (ScriptController): + * bindings/v8/V8AbstractEventListener.h: + (WebCore): + * bindings/v8/V8Binding.cpp: + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::reportFatalErrorInV8): + * bindings/v8/V8DOMWrapper.h: + (WebCore): + * bindings/v8/V8ObjectConstructor.cpp: + (WebCore::V8ObjectConstructor::newInstanceInDocument): + * bindings/v8/V8Proxy.cpp: Removed. + * bindings/v8/V8Proxy.h: Removed. + * bindings/v8/V8RecursionScope.h: + (WebCore): + * bindings/v8/V8Utilities.cpp: + * bindings/v8/custom/V8CustomXPathNSResolver.h: + +2012-08-23 Otto Derek Cheung <otcheung@rim.com> + + + [BlackBerry] Add a check to filter out cookies that tries to set the domain to a top level domain + https://bugs.webkit.org/show_bug.cgi?id=94722 + + Reviewed by Rob Buis. + + Changing the topleveldomain method name for better readability. + + Also renaming the TopLevelDomain.h in platform to DomainTools + because there exists other tests that should belong in the same file. + + Only changing method names and include file names. + + * platform/blackberry/CookieParser.cpp: + (WebCore::CookieParser::parseOneCookie): + +2012-08-23 Shezan Baig <shezbaig.wk@gmail.com> + + Fix cross-direction stretch for replaced elements in column flexbox + https://bugs.webkit.org/show_bug.cgi?id=94604 + + Reviewed by Ojan Vafai. + + Moved the logic that constrains logical width by MinSize and MaxSize to + a new helper function called constrainLogicalWidthInRegionByMinMax. + This helper function is used from both computeLogicalWidthInRegion and + RenderFlexibleBox::applyStretchAlignmentToChild. + + RenderFlexibleBox no longer checks for isMultiline when stretching + elements in a column flexbox. Instead, we now constrain the available + width by the child's min-width and max-width, and set the override + width only if that constrained width is different from the child's + current logicalWidth. + + No new tests. The existing css3/flexbox/flexitem.html test was extended + to exercise the new code. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::constrainLogicalWidthInRegionByMinMax): New helper + method to constrain logical width by min-width and max-width. + (WebCore): + (WebCore::RenderBox::computeLogicalWidthInRegion): Changed to use the + new constrainLogicalWidthInRegionByMinMax helper method. + * rendering/RenderBox.h: + (RenderBox): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Changed to + use constrainLogicalWidthInRegionByMinMax to determine the override + width for the child. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScriptState is using stone knifes and bear skins + https://bugs.webkit.org/show_bug.cgi?id=94846 + + Reviewed by Eric Seidel. + + This patch just modernizes ScriptState to use some of the newer tools + available in the V8 bindings. There shouldn't be any behavior changes. + + * bindings/v8/ScriptState.cpp: + (WebCore::ScriptState::ScriptState): + (WebCore::ScriptState::~ScriptState): + (WebCore::ScriptState::domWindow): + (WebCore::ScriptState::scriptExecutionContext): + (WebCore::ScriptState::forContext): + (WebCore::ScriptState::current): + * bindings/v8/ScriptState.h: + (WebCore): + (WebCore::ScriptState::context): + (ScriptState): + (WebCore::ScriptStateProtectedPtr::ScriptStateProtectedPtr): + (ScriptStateProtectedPtr): + * bindings/v8/V8Binding.cpp: + (WebCore::toScriptExecutionContext): + (WebCore): + * bindings/v8/V8Binding.h: + (WebCore): + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Don't require a RenderSurface* in order to create a RenderPass + https://bugs.webkit.org/show_bug.cgi?id=94862 + + Reviewed by Adrienne Walker. + + If a test wants to create a RenderPass, they are required to create a + Layer, and a RenderSurface. This is not ideal, we should let tests + create RenderPasses more simply by giving the information that it needs. + + This also helps us recreate the RenderPasses after receiving a copy + via IPC. + + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::create): + (WebCore::CCRenderPass::CCRenderPass): + * platform/graphics/chromium/cc/CCRenderPass.h: + (CCRenderPass): + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScriptValue should use ScopedPresistent rather than calling New/Dispose directly + https://bugs.webkit.org/show_bug.cgi?id=94864 + + Reviewed by Eric Seidel. + + ScriptValue was created before ScopedPersistent existed and therefore + calls New/Dispose manually. Instead, it should use the less error-prone + approach of having ScopedPersistent balance those calls. + + * bindings/v8/ScriptValue.cpp: + (WebCore::ScriptValue::serialize): + (WebCore::ScriptValue::getString): + (WebCore::ScriptValue::toString): + (WebCore::ScriptValue::toInspectorValue): + * bindings/v8/ScriptValue.h: + (WebCore::ScriptValue::ScriptValue): + (WebCore::ScriptValue::operator=): + (WebCore::ScriptValue::operator==): + (WebCore::ScriptValue::isEqual): + (WebCore::ScriptValue::isFunction): + (WebCore::ScriptValue::isNull): + (WebCore::ScriptValue::isUndefined): + (WebCore::ScriptValue::isObject): + (WebCore::ScriptValue::hasNoValue): + (WebCore::ScriptValue::clear): + (WebCore::ScriptValue::v8Value): + (ScriptValue): + +2012-08-22 James Robinson <jamesr@chromium.org> + + [chromium] Remove WebLayer::setChildren API + https://bugs.webkit.org/show_bug.cgi?id=94749 + + Reviewed by Adrienne Walker. + + Sets up the child list directly instead of building an intermediate buffer. Covered by compositing/* + + * platform/graphics/chromium/GraphicsLayerChromium.cpp: + (WebCore::GraphicsLayerChromium::updateChildList): + +2012-08-23 Dominic Mazzoni <dmazzoni@google.com> + + AX: Focusable elements without a role should not be ignored + https://bugs.webkit.org/show_bug.cgi?id=94302 + + Reviewed by Chris Fleizach. + + Changes the accessibility logic so that a generic element that's focusable is + not ignored for accessibility, and returns its inner text as its title. That way + if you Tab to the element, a reasonable accessibility notification is generated. + + One exception is the body element, because focusing the body is equivalent to + blurring the current focused element and does not result in a "focus" accessibility + notification. + + Also fixes logic that determined if an element was contentEditable by making + sure it catches the case with no attribute value (e.g. <div contentEditable>), + which also implies contentEditable=true according to the spec. + + Test: accessibility/focusable-div.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore): + (WebCore::nodeHasContentEditableAttributeSet): + (WebCore::AccessibilityRenderObject::title): + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + +2012-08-23 Julien Chaffraix <jchaffraix@webkit.org> + + Remove RenderTable::removeChild + https://bugs.webkit.org/show_bug.cgi?id=94842 + + Reviewed by Abhishek Arya. + + This change removed removeChild, replaced by willBeRemovedFromTree calls. The upside is that + the invalidations are now guaranteed to run if we split a table (which is not guaranteed when + using removeChild). This change also shows that our code may be doing too much work in some + of the child's removal, in which case the code was marked as needed. + + Covered by existing tests. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::removeCaption): + Helper function used to remove the caption from our Vector. The invalidation are very likely + unneeded so added a comment about that. + + * rendering/RenderTable.h: + * rendering/RenderTableCaption.cpp: + (WebCore::RenderTableCaption::willBeRemovedFromTree): + (WebCore::RenderTableCaption::table): + * rendering/RenderTableCaption.h: + * rendering/RenderTableCol.cpp: + (WebCore::RenderTableCol::willBeRemovedFromTree): + * rendering/RenderTableCol.h: + Added the following functions to do the invalidation. + +2012-08-23 Mark Hahnenberg <mhahnenberg@apple.com> + + Change behavior of MasqueradesAsUndefined to better accommodate DFG changes + https://bugs.webkit.org/show_bug.cgi?id=93884 + + Reviewed by Filip Pizlo. + + With some upcoming changes to the DFG to remove uses of ClassInfo, we will be changing the behavior of + MasqueradesAsUndefined. In order to make this change consistent across all of our execution engines, + we will make this change to MasqueradesAsUndefined as a separate patch. After this patch, MasqueradesAsUndefined + objects will only masquerade as undefined in their original context (i.e. their original JSGlobalObject). + For example, if an object that masquerades as undefined in frame A is passed to frame B, it will not + masquerade as undefined within frame B, but it will continue to masquerade in frame A. + + Test: fast/js/document-all-between-frames.html + + All of the changes in WebCore are simply passing the additional ExecState argument to JSValue::toBoolean. + + * bindings/js/JSCustomSQLStatementErrorCallback.cpp: + (WebCore::JSSQLStatementErrorCallback::handleEvent): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::addEventListener): + (WebCore::JSDOMWindow::removeEventListener): + * bindings/js/JSDataViewCustom.cpp: + (WebCore::getDataViewMember): + * bindings/js/JSDeviceMotionEventCustom.cpp: + (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent): + * bindings/js/JSDeviceOrientationEventCustom.cpp: + (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): + * bindings/js/JSDictionary.cpp: + (WebCore::JSDictionary::convertValue): + * bindings/js/JSHTMLCanvasElementCustom.cpp: + (WebCore::JSHTMLCanvasElement::getContext): + * bindings/js/JSInspectorFrontendHostCustom.cpp: + (WebCore::populateContextMenuItems): + * bindings/js/JSMessageEventCustom.cpp: + (WebCore::handleInitMessageEvent): + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::dataFunctionMatrix): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::open): + * bindings/js/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::exec): + (WebCore): + * bindings/js/JavaScriptCallFrame.h: + (JavaScriptCallFrame): + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::hasBreakpoint): + * bindings/js/SerializedScriptValue.cpp: + (WebCore::CloneSerializer::dumpIfTerminal): + * bindings/scripts/CodeGeneratorJS.pm: Also add the custom create function for MasqueradesAsUndefined JS DOM wrappers. + (GenerateEventListenerCall): + (GenerateHeader): + (JSValueToNative): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: + (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): + (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): + * bindings/scripts/test/JS/JSTestEventTarget.h: + (WebCore::JSTestEventTarget::create): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::setJSTestObjCreate): + (WebCore::setJSTestObjReflectedBooleanAttr): + (WebCore::setJSTestObjReflectedCustomBooleanAttr): + (WebCore::jsTestObjPrototypeFunctionAddEventListener): + (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): + * bridge/c/c_utility.cpp: + (JSC::Bindings::convertValueToNPVariant): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::convertValueToJObject): + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2012-08-23 Adenilson Cavalcanti <cavalcantii@gmail.com> + + CSSParser: Move enumeration to a common place (StylePropertyShorthand) + https://bugs.webkit.org/show_bug.cgi?id=93210 + + Reviewed by Dean Jackson. + + CSSParser::parseAnimationShorthand() uses an enumeration with the same + elements as another enumeration present in StylePropertyShorthand, but + with different ordering of values. This patch puts both enums in the same place. + + No new tests. No change in behavior. + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseAnimationShorthand): + * css/StylePropertyShorthand.cpp: + (WebCore::webkitAnimationShorthandForParsing): + (WebCore): + * css/StylePropertyShorthand.h: + (WebCore): + +2012-08-23 Mike West <mkwst@chromium.org> + + Trailing spaces in CSP source lists should not generate console warnings. + https://bugs.webkit.org/show_bug.cgi?id=94847 + + Reviewed by Adam Barth. + + Trailing space after a valid source in a Content Security Policy source + list was accidentally generating console warnings about an invalid + (empty) source. This patch silently ignores trailing whitespace instead. + + A test-case has been added to 'source-list-parsing-02.html' to cover + this case. + + * page/ContentSecurityPolicy.cpp: + (WebCore::CSPSourceList::parse): + Return early if we reach the end of the source list after skipping + leading whitespace. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] OwnHandle is a bit of a misnomer + https://bugs.webkit.org/show_bug.cgi?id=94841 + + Reviewed by Eric Seidel. + + You don't really own the handle in the same way that you own a pointer + with OwnPtr. This class is more correctly called ScopedPersistent + because it just forces you to balance New() and Dispose() calls. + + * WebCore.gypi: + * bindings/v8/JavaScriptCallFrame.h: + (JavaScriptCallFrame): + * bindings/v8/OwnHandle.h: Removed. + * bindings/v8/ScheduledAction.h: + (ScheduledAction): + * bindings/v8/ScopedPersistent.h: Copied from Source/WebCore/bindings/v8/OwnHandle.h. + (ScopedPersistent): + (WebCore::ScopedPersistent::ScopedPersistent): + (WebCore::ScopedPersistent::~ScopedPersistent): + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::compileScript): + (WebCore::ScriptDebugServer::runScript): + * bindings/v8/ScriptDebugServer.h: + (ScriptDebugServer): + * bindings/v8/ScriptInstance.h: + (V8ScriptInstance): + * bindings/v8/V8PerContextData.h: + (V8PerContextData): + +2012-08-23 Nate Chapin <japhet@chromium.org> + + ProgressTracker never completes if iframe detached during parsing + https://bugs.webkit.org/show_bug.cgi?id=92272 + + Reviewed by Adam Barth. + + Add a simple helper class to FrameLoader to ensure progressStarted/progressCompleted calls are matched, + and balance the calls when the Frame is detached. + + No new tests, as this behavior has only been producing reliably by setting a breakpoint in a specific place. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::init): + (WebCore::FrameLoader::FrameProgressTracker::progressStarted): + (WebCore::FrameLoader::FrameProgressTracker::progressCompleted): + (WebCore::FrameLoader::FrameProgressTracker::~FrameProgressTracker): + (WebCore::FrameLoader::prepareForLoadStart): + (WebCore::FrameLoader::clearProvisionalLoad): + (WebCore::FrameLoader::checkLoadCompleteForThisFrame): + (WebCore::FrameLoader::detachFromParent): + * loader/FrameLoader.h: + (FrameProgressTracker): + (WebCore::FrameLoader::FrameProgressTracker::create): + (WebCore::FrameLoader::FrameProgressTracker::FrameProgressTracker): + +2012-08-23 Dana Jansens <danakj@chromium.org> + + [chromium] Create sharedQuadState at same time as creating quads and give them to the quadSink + https://bugs.webkit.org/show_bug.cgi?id=94752 + + Reviewed by Adrienne Walker. + + Previously, CCRenderPass would create a sharedQuadState for a layer, + and pass it in to the layer. Then the layer would point all its quads + at the sharedQuadState. + + After this change, the layer creates its own sharedQuadState, gives it + to the RenderPass (via CCQuadSink), and points its quads at it. + + This approach allows a layer to generate more than one sharedQuadState + with different quads pointing to different shared states. Also, this + will allow the layer representing a delegating renderer (via ubercomp) + to copy sharedQuadStates from the delegating renderer in order to + merge its quads into the RenderPass for the current renderer. + + Covered by existing tests, no change in behaviour. + + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: + (WebCore::CCHeadsUpDisplayLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h: + (CCHeadsUpDisplayLayerImpl): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + (WebCore::CCIOSurfaceLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h: + (CCIOSurfaceLayerImpl): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (CCLayerImpl): + (WebCore::CCLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + (WebCore::CCQuadCuller::CCQuadCuller): + (WebCore::CCQuadCuller::append): + (WebCore::CCQuadCuller::useSharedQuadState): + (WebCore): + * platform/graphics/chromium/cc/CCQuadCuller.h: + (WebCore): + (CCQuadCuller): + * platform/graphics/chromium/cc/CCQuadSink.h: + (WebCore): + (CCQuadSink): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForLayer): + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + (WebCore::CCRenderPass::appendQuadsToFillScreen): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + (CCRenderPass): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: + (WebCore::CCScrollbarLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: + (CCScrollbarLayerImpl): + * platform/graphics/chromium/cc/CCSharedQuadState.cpp: + (WebCore::CCSharedQuadState::create): + (WebCore::CCSharedQuadState::CCSharedQuadState): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (CCSharedQuadState): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: + (WebCore::CCSolidColorLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + (CCSolidColorLayerImpl): + * platform/graphics/chromium/cc/CCTextureLayerImpl.cpp: + (WebCore::CCTextureLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTextureLayerImpl.h: + (CCTextureLayerImpl): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCTiledLayerImpl.h: + (CCTiledLayerImpl): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + (CCVideoLayerImpl): + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Remove some unneeded cruft from WebCore.xcodeproj. + + * WebCore.xcodeproj/project.pbxproj: + +2012-08-23 Mark Rowe <mrowe@apple.com> + + Make WebCore build with the latest version of clang. + + Reviewed by Dan Bernstein. + + * html/shadow/MediaControlRootElement.h: Remove m_textTrackDisplay as it is unused. + * platform/audio/mac/AudioFileReaderMac.cpp: + (WebCore::AudioFileReader::AudioFileReader): Remove m_filePath as it is unused. + * platform/audio/mac/AudioFileReaderMac.h: + (AudioFileReader): Ditto. + * platform/graphics/ImageSource.h: + (ImageSource): Guard m_alphaOption and m_gammaAndColorProfileOption with !USE(CG) + as they're unused on platforms using CG. + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: + (MediaPlayerPrivateAVFoundationObjC): Remove m_player as it is unused. + * platform/graphics/cg/ImageSourceCG.cpp: + (WebCore::ImageSource::ImageSource): Don't initialize the m_alphaOption and + m_gammaAndColorProfileOption members since we never use them. + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate): Remove m_graphicsContext3D + as it is unused. + +2012-08-23 Alexandre Elias <aelias@chromium.org> + + [chromium] Rename LayerRendererChromium to GL-specific name + https://bugs.webkit.org/show_bug.cgi?id=94835 + + Reviewed by James Robinson. + + Over time, LayerRendererChromium has evolved to be a GL-specific + subclass of CCRenderer that has no awareness of layers (as it operates + only with drawQuads). + + This patch renames LayerRendererChromium to CCRendererGL, replaces all + instances of "layerRenderer" with just "renderer", and removes a + few unnecessary includes of LayerRendererChromium.h. + + No new tests (no-op refactoring). + + * WebCore.gypi: + * platform/graphics/chromium/Canvas2DLayerBridge.cpp: + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/GeometryBinding.cpp: + * platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp: + (WebCore::HeadsUpDisplayLayerChromium::update): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/LayerTextureSubImage.cpp: + * platform/graphics/chromium/ProgramBinding.cpp: + * platform/graphics/chromium/RenderSurfaceChromium.h: + (WebCore): + * platform/graphics/chromium/ScrollbarLayerChromium.cpp: + (WebCore::ScrollbarLayerChromium::createTextureUpdaterIfNeeded): + * platform/graphics/chromium/TextureCopier.cpp: + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateTileSizeAndTilingOption): + * platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp: + * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp: + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::sortLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initializeRenderer): + (WebCore::CCLayerTreeHost::deleteContentsTexturesOnImplThread): + (WebCore::CCLayerTreeHost::finishAllRendering): + (WebCore::CCLayerTreeHost::rendererCapabilities): + (WebCore::CCLayerTreeHost::initializeRendererIfNeeded): + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::RendererCapabilities::RendererCapabilities): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::canDraw): + (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::CCLayerTreeHostImpl::drawLayers): + (WebCore::CCLayerTreeHostImpl::finishAllRendering): + (WebCore::CCLayerTreeHostImpl::isContextLost): + (WebCore::CCLayerTreeHostImpl::rendererCapabilities): + (WebCore::CCLayerTreeHostImpl::swapBuffers): + (WebCore::CCLayerTreeHostImpl::readback): + (WebCore::CCLayerTreeHostImpl::setVisible): + (WebCore::CCLayerTreeHostImpl::initializeRenderer): + (WebCore::CCLayerTreeHostImpl::setViewportSize): + (WebCore::CCLayerTreeHostImpl::ensureRenderSurfaceLayerList): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (WebCore): + (WebCore::CCLayerTreeHostImpl::renderer): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + * platform/graphics/chromium/cc/CCPriorityCalculator.cpp: + * platform/graphics/chromium/cc/CCProxy.h: + (WebCore): + (CCProxy): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderer.h: + (CCRenderer): + * platform/graphics/chromium/cc/CCRendererGL.cpp: Renamed from Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp. + (WebCore::CCRendererGL::create): + (WebCore): + (WebCore::CCRendererGL::CCRendererGL): + (WebCore::CCRendererGL::initialize): + (WebCore::CCRendererGL::~CCRendererGL): + (WebCore::CCRendererGL::context): + (WebCore::CCRendererGL::debugGLCall): + (WebCore::CCRendererGL::setVisible): + (WebCore::CCRendererGL::releaseRenderPassTextures): + (WebCore::CCRendererGL::viewportChanged): + (WebCore::CCRendererGL::clearFramebuffer): + (WebCore::CCRendererGL::beginDrawingFrame): + (WebCore::CCRendererGL::doNoOp): + (WebCore::CCRendererGL::drawQuad): + (WebCore::CCRendererGL::drawCheckerboardQuad): + (WebCore::CCRendererGL::drawDebugBorderQuad): + (WebCore::applyFilters): + (WebCore::CCRendererGL::drawBackgroundFilters): + (WebCore::CCRendererGL::drawRenderPassQuad): + (WebCore::CCRendererGL::drawSolidColorQuad): + (TileProgramUniforms): + (WebCore::tileUniformLocation): + (WebCore::CCRendererGL::drawTileQuad): + (WebCore::CCRendererGL::drawYUVVideoQuad): + (WebCore::CCRendererGL::drawStreamVideoQuad): + (WebCore::TextureProgramBinding::set): + (TextureProgramBinding): + (WebCore::TexTransformTextureProgramBinding::set): + (TexTransformTextureProgramBinding): + (WebCore::CCRendererGL::drawTextureQuad): + (WebCore::CCRendererGL::drawIOSurfaceQuad): + (WebCore::CCRendererGL::finishDrawingFrame): + (WebCore::CCRendererGL::toGLMatrix): + (WebCore::CCRendererGL::setShaderFloatQuad): + (WebCore::CCRendererGL::setShaderOpacity): + (WebCore::CCRendererGL::drawQuadGeometry): + (WebCore::CCRendererGL::copyTextureToFramebuffer): + (WebCore::CCRendererGL::finish): + (WebCore::CCRendererGL::swapBuffers): + (WebCore::CCRendererGL::onSwapBuffersComplete): + (WebCore::CCRendererGL::onMemoryAllocationChanged): + (WebCore::CCRendererGL::onMemoryAllocationChangedOnImplThread): + (WebCore::CCRendererGL::discardFramebuffer): + (WebCore::CCRendererGL::ensureFramebuffer): + (WebCore::CCRendererGL::onContextLost): + (WebCore::CCRendererGL::getFramebufferPixels): + (WebCore::CCRendererGL::getFramebufferTexture): + (WebCore::CCRendererGL::useScopedTexture): + (WebCore::CCRendererGL::bindFramebufferToOutputSurface): + (WebCore::CCRendererGL::bindFramebufferToTexture): + (WebCore::CCRendererGL::enableScissorTestRect): + (WebCore::CCRendererGL::disableScissorTest): + (WebCore::CCRendererGL::setDrawViewportSize): + (WebCore::CCRendererGL::makeContextCurrent): + (WebCore::CCRendererGL::initializeSharedObjects): + (WebCore::CCRendererGL::tileCheckerboardProgram): + (WebCore::CCRendererGL::solidColorProgram): + (WebCore::CCRendererGL::renderPassProgram): + (WebCore::CCRendererGL::renderPassProgramAA): + (WebCore::CCRendererGL::renderPassMaskProgram): + (WebCore::CCRendererGL::renderPassMaskProgramAA): + (WebCore::CCRendererGL::tileProgram): + (WebCore::CCRendererGL::tileProgramOpaque): + (WebCore::CCRendererGL::tileProgramAA): + (WebCore::CCRendererGL::tileProgramSwizzle): + (WebCore::CCRendererGL::tileProgramSwizzleOpaque): + (WebCore::CCRendererGL::tileProgramSwizzleAA): + (WebCore::CCRendererGL::textureProgram): + (WebCore::CCRendererGL::textureProgramFlip): + (WebCore::CCRendererGL::textureIOSurfaceProgram): + (WebCore::CCRendererGL::videoYUVProgram): + (WebCore::CCRendererGL::videoStreamTextureProgram): + (WebCore::CCRendererGL::cleanupSharedObjects): + (WebCore::CCRendererGL::isContextLost): + * platform/graphics/chromium/cc/CCRendererGL.h: Renamed from Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h. + (WebKit): + (WebCore): + (CCRendererGL): + (WebCore::CCRendererGL::sharedGeometryQuad): + (WebCore::CCRendererGL::sharedGeometry): + (WebCore::CCRendererGL::isFramebufferDiscarded): + * platform/graphics/chromium/cc/CCResourceProvider.cpp: + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::CCSingleThreadProxy): + (WebCore::CCSingleThreadProxy::initializeRenderer): + (WebCore::CCSingleThreadProxy::recreateContext): + (WebCore::CCSingleThreadProxy::rendererCapabilities): + (WebCore::CCSingleThreadProxy::doCommit): + (WebCore::CCSingleThreadProxy::forceSerializeOnSwapBuffers): + (WebCore::CCSingleThreadProxy::commitAndComposite): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + (CCSingleThreadProxy): + * platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::CCThreadProxy): + (WebCore::CCThreadProxy::compositeAndReadback): + (WebCore::CCThreadProxy::initializeRenderer): + (WebCore::CCThreadProxy::recreateContext): + (WebCore::CCThreadProxy::rendererCapabilities): + (WebCore::CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread): + (WebCore::CCThreadProxy::beginFrame): + (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread): + (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal): + (WebCore::CCThreadProxy::initializeRendererOnImplThread): + (WebCore::CCThreadProxy::recreateContextOnImplThread): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-08-23 Shezan Baig <shezbaig.wk@gmail.com> + + Flexbox doesn't need to compute logical height for stretched items in row flow + https://bugs.webkit.org/show_bug.cgi?id=94807 + + Reviewed by Tony Chang. + + Change logicalHeightConstrainedByMinMax to + constrainLogicalHeightByMinMax. The new method doesn't compute the + MainOrPreferred logical height (that computation has been moved back to + computeLogicalHeight). RenderFlexibleBox now just constrains the + stretchedLogicalHeight by min/max. + + No new tests. This is a cleanup of bug 94237. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::constrainLogicalHeightByMinMax): Instead of + computing the MainOrPreferred logical height, just constrain the given + logical height by MinSize and MaxSize. + (WebCore::RenderBox::computeLogicalHeight): Compute the MainOrPreferred + logical height before constraining by min/max. + * rendering/RenderBox.h: + (RenderBox): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Use + constrainLogicalHeightByMinMax to constrain the stretchedLogicalHeight. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] V8ScriptInstance is much more complicated than necessary + https://bugs.webkit.org/show_bug.cgi?id=94785 + + Reviewed by Kentaro Hara. + + V8ScriptInstance just needs to be a one-line wrapper around OwnHandle. + + * bindings/v8/OwnHandle.h: + (WebCore::OwnHandle::get): + * bindings/v8/ScriptInstance.cpp: + (WebCore::V8ScriptInstance::V8ScriptInstance): + (WebCore::V8ScriptInstance::~V8ScriptInstance): + (WebCore::V8ScriptInstance::instance): + * bindings/v8/ScriptInstance.h: + (WebCore::V8ScriptInstance::create): + (V8ScriptInstance): + +2012-08-23 Christophe Dumez <christophe.dumez@intel.com> + + Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics + https://bugs.webkit.org/show_bug.cgi?id=65292 + + Reviewed by Oliver Hunt. + + JSC now correctly serialize Boolean, Number and String objects as per + the structured clone algorithm specification. This patch reduces the + delta with the V8 implementation of SerializedScriptValue. + + No new tests, already tested by fast/dom/Window/window-postmessage-clone.html + + * bindings/js/SerializedScriptValue.cpp: + (WebCore): + (WebCore::CloneSerializer::dumpStringObject): + (CloneSerializer): + (WebCore::CloneSerializer::dumpIfTerminal): + (WebCore::CloneDeserializer::readTerminal): + +2012-08-23 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Move onSuccess(IDBDatabaseBackendInterface) to IDBOpenDBRequest + https://bugs.webkit.org/show_bug.cgi?id=94757 + + Reviewed by Tony Chang. + + Move the implementation of IDBCallbacks::onSuccess(IDBDatabaseBackendInterface) + from IDBRequest to the new IDBOpenDBRequest, which is the only request type that + should be receiving that callback. + + No new tests - no functional changes. + + * Modules/indexeddb/IDBCallbacks.h: + (IDBCallbacks): + (WebCore::IDBCallbacks::onSuccess): + * Modules/indexeddb/IDBOpenDBRequest.cpp: + (WebCore::IDBOpenDBRequest::onUpgradeNeeded): + (WebCore::IDBOpenDBRequest::onSuccess): + (WebCore): + * Modules/indexeddb/IDBOpenDBRequest.h: + (IDBOpenDBRequest): + * Modules/indexeddb/IDBRequest.cpp: + * Modules/indexeddb/IDBRequest.h: + +2012-08-23 Andrei Onea <onea@adobe.com> + + [CSSRegions]Crash when moving anonymous block children inside a named flow + https://bugs.webkit.org/show_bug.cgi?id=90865 + + Reviewed by Abhishek Arya. + + When an anonymous block's children are detached in RenderBlock::collapseAnonymousBoxChild, the reference + to their enclosingRenderFlowThread is lost and causes a crash in RenderObject::willBeRemovedFromTree. + Because of this, we now maintain the enclosingRenderFlowThread during the whole lifetime of the + RenderBlock::collapseAnonymousBoxChild function, using a CurrentRenderFlowThreadMaintainer local. + + + Test: fast/regions/move-anonymous-block-inside-named-flow-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::collapseAnonymousBoxChild): + * rendering/RenderFlowThread.cpp: + (WebCore::CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer): + (WebCore): + (WebCore::CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer): + Moved CurrentRenderFlowThreadMaintaner declaration from .cpp to .h, so that we can access it from + RenderBlock::collapseAnonymousBoxChild. + * rendering/RenderFlowThread.h: + (CurrentRenderFlowThreadMaintainer): + (WebCore): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::willBeRemovedFromTree): + +2012-08-23 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Add wx to the list of platforms that use CoreText + APIs on Mac. + + * platform/graphics/SimpleFontData.h: + (SimpleFontData): + +2012-08-23 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Don't rely on implicit casts, explicitly use the + Cursor constructor that takes a platform cursor for creating native cursors. + + * platform/wx/CursorWx.cpp: + (WebCore::pointerCursor): + (WebCore::crossCursor): + (WebCore::handCursor): + (WebCore::iBeamCursor): + (WebCore::waitCursor): + (WebCore::helpCursor): + (WebCore::eastResizeCursor): + (WebCore::northResizeCursor): + (WebCore::northEastResizeCursor): + (WebCore::northWestResizeCursor): + (WebCore::columnResizeCursor): + (WebCore::rowResizeCursor): + (WebCore::notAllowedCursor): + (WebCore::zoomInCursor): + (WebCore::moveCursor): + +2012-08-23 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> + + Remove redundant check for negative values when using WebCore::Color::alpha() + https://bugs.webkit.org/show_bug.cgi?id=94811 + + Reviewed by Eric Seidel. + + Though alpha() returns a signed value (int), its value is stored on an unsigned + typedef (RGBA32) and is safeguarded by alphaChannel() that its value never goes + beyond 255, so no integer overflow, thus we can safely remove redundant check + for negative values while using it. + + This change does not affect behavior, so no new tests needed. + + * platform/graphics/Image.cpp: + (WebCore::Image::fillWithSolidColor): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Using hasAlpha() for readibility. + * rendering/RenderView.cpp: + (WebCore::RenderView::paintBoxDecorations): + * rendering/style/RenderStyle.h: + +2012-08-23 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] Move feature defines processing into a GNUmakefile that's simple to autogenerate + https://bugs.webkit.org/show_bug.cgi?id=87127 + + Reviewed by Martin Robinson. + + List all the feature defines with their default value in + GNUmakefile.features.am and append them to the 'feature_defines_defaults'. + variable. + + In GNUmakefile.am, include the GNUmakefile.features.am. When checking the + AM conditionals for feature-enabling, append the appropriate define to + 'feature_defines_overrides'. + + After all such overrides are performed, append the proper define (of which + value was possibly overridden) for each feature to the 'feature_defines' + variable. Finally, append all these defines to webcore_cppflags in the form + of macros for preprocessing. + + No new tests - no new functionality. + + * GNUmakefile.am: + * GNUmakefile.features.am: Added. + +2012-08-23 Adam Barth <abarth@webkit.org> + + [V8] ScheduledAction is ugly and needs a cleanup + https://bugs.webkit.org/show_bug.cgi?id=94784 + + Reviewed by Eric Seidel. + + This patch updates ScheduledAction to use modern WebKit machinery, like + OwnHandle and Vector. + + * bindings/v8/OwnHandle.h: + (OwnHandle): + * bindings/v8/ScheduledAction.cpp: + (WebCore::ScheduledAction::ScheduledAction): + (WebCore::ScheduledAction::~ScheduledAction): + (WebCore::ScheduledAction::execute): + * bindings/v8/ScheduledAction.h: + (WebCore): + (ScheduledAction): + (WebCore::ScheduledAction::ScheduledAction): + +2012-08-23 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: dblclick on Timeline overview no longer selects entire timeline range + https://bugs.webkit.org/show_bug.cgi?id=94826 + + Reviewed by Vsevolod Vlasov. + + Only install a glass pane for drag-n-drop upon first mouseout event -- otherwise, glass pane + will interfere with double clicks. + + * inspector/front-end/UIUtils.js: + (WebInspector._elementDragStart.onMouseOut): + (WebInspector._elementDragStart): + (WebInspector._elementDragEnd): + +2012-08-23 Adrienne Walker <enne@google.com> + + Convert ScrollableArea ASSERT_NOT_REACHED virtuals + https://bugs.webkit.org/show_bug.cgi?id=93306 + + Reviewed by Darin Adler. + + ASSERT_NOT_REACHED is a bad way to make sure that a virtual function + gets an override, because it only fails at run-time in debug builds. + + To fix this, convert the virtuals in ScrollableArea that have + ASSERT_NOT_REACHED to be either pure virtual or implemented directly + in ScrollableArea. Add implementations where necessary to make derived + classes concrete. + + Additionally, consistently add OVERRIDE for virtual functions in + derived classes that override ScrollableArea methods. + + * WebCore.exp.in: + * page/FrameView.h: + (FrameView): + * platform/ScrollView.h: + (ScrollView): + * platform/ScrollableArea.cpp: + (WebCore::ScrollableArea::scrollPosition): + (WebCore): + (WebCore::ScrollableArea::minimumScrollPosition): + (WebCore::ScrollableArea::maximumScrollPosition): + (WebCore::ScrollableArea::visibleContentRect): + * platform/ScrollableArea.h: + (ScrollableArea): + (WebCore::ScrollableArea::overhangAmount): + * platform/chromium/FramelessScrollView.cpp: + (WebCore::FramelessScrollView::isOnActivePage): + (WebCore): + (WebCore::FramelessScrollView::scrollableAreaBoundingBox): + * platform/chromium/FramelessScrollView.h: + (FramelessScrollView): + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::visibleHeight): + (WebCore): + (WebCore::PopupMenuWin::visibleWidth): + (WebCore::PopupMenuWin::contentsSize): + (WebCore::PopupMenuWin::isOnActivePage): + (WebCore::PopupMenuWin::scrollableAreaBoundingBox): + * platform/win/PopupMenuWin.h: + (PopupMenuWin): + * rendering/RenderListBox.cpp: + * rendering/RenderListBox.h: + (RenderListBox): + +2012-08-23 Alexander Shalamov <alexander.shalamov@intel.com> + + getComputedStyle returns wrong value for CSS3 2D transformations + https://bugs.webkit.org/show_bug.cgi?id=94211 + + Reviewed by Simon Fraser. + + When computed style is calculated for CSS3 2D transformation, content + box size is used. According to W3C specification, object's bounding + box should be used. This patch fixes transformation matrix calculation. + + Layout tests getComputedStyle-transform.html and computed-style-origin.html + were modified to test changes. + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::computedTransform): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + (WebCore::pixelSnappedSizingBox): Removed unused method + +2012-08-23 Takashi Sakamoto <tasak@google.com> + + Distributed nodes should not share styles. + https://bugs.webkit.org/show_bug.cgi?id=90661 + + Reviewed by Hajime Morita. + + styleForElement tries to use previous sibling's style for distributed + nodes. However distributed nodes are children of a shadow host, but + the nodes are not siblings as the result of distribution. + The spec is: + http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-dom-subtrees + So sharing previous sibling's style should be disabled for distrbuted + nodes. + + Test: fast/dom/shadow/style-of-distributed-node.html + + * css/StyleResolver.cpp: + (WebCore::StyleResolver::StyleResolver): + Initialized m_distributedToInsertionPoint. Its initial value is false. + (WebCore::StyleResolver::initForStyleResolve): + After invoking NodeRenderingContext, if the context returns any + insertion point, set m_distributedToInsertionPoint to be true. + Otherwise, false. The value is used in styleForElement. + (WebCore::StyleResolver::styleForElement): + If m_distributedToInsertionPoint is true, disable local sibling style + cache. + * css/StyleResolver.h: + (StyleResolver): + Added a new member variable, m_distributedToInsertionPoint. + The variable keeps whether the m_element is distributed to an + insertion point. + +2012-08-23 John Griggs <jgriggs@rim.com> + + Replace access ot HTMLMediaElement from MediaPlayerPrivateBlackBerry with methods in MediaPlayerClient - updated with notes from initial reviews. https://bugs.webkit.org/show_bug.cgi?id=84291 + + Reviewed by Eric Carlson. + + Code standard compliance - no functional change, so no new tests required. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::mediaPlayerExitFullscreen): + (WebCore): + (WebCore::HTMLMediaElement::mediaPlayerIsVideo): + (WebCore::HTMLMediaElement::mediaPlayerContentBoxRect): + (WebCore::HTMLMediaElement::mediaPlayerSetSize): + (WebCore::HTMLMediaElement::mediaPlayerPause): + (WebCore::HTMLMediaElement::mediaPlayerPlay): + (WebCore::HTMLMediaElement::mediaPlayerIsPaused): + (WebCore::HTMLMediaElement::mediaPlayerHostWindow): + (WebCore::HTMLMediaElement::mediaPlayerWindowClipRect): + * html/HTMLMediaElement.h: + (HTMLMediaElement): + * platform/graphics/MediaPlayer.h: + (WebCore): + (WebCore::MediaPlayerClient::mediaPlayerExitFullscreen): + (WebCore::MediaPlayerClient::mediaPlayerIsVideo): + (WebCore::MediaPlayerClient::mediaPlayerContentBoxRect): + (WebCore::MediaPlayerClient::mediaPlayerSetSize): + (WebCore::MediaPlayerClient::mediaPlayerPause): + (WebCore::MediaPlayerClient::mediaPlayerPlay): + (WebCore::MediaPlayerClient::mediaPlayerIsPaused): + (WebCore::MediaPlayerClient::mediaPlayerHostWindow): + (WebCore::MediaPlayerClient::mediaPlayerWindowClipRect): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp: + (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::load): + (WebCore::MediaPlayerPrivate::paint): + (WebCore::MediaPlayerPrivate::resizeSourceDimensions): + (WebCore::MediaPlayerPrivate::updateStates): + (WebCore::MediaPlayerPrivate::onPauseStateChanged): + (WebCore::MediaPlayerPrivate::onPlayNotified): + (WebCore::MediaPlayerPrivate::onPauseNotified): + (WebCore::MediaPlayerPrivate::onAuthenticationNeeded): + (WebCore::MediaPlayerPrivate::showErrorDialog): + (WebCore::MediaPlayerPrivate::platformWindow): + (WebCore::MediaPlayerPrivate::isElementPaused): + (WebCore::MediaPlayerPrivate::isTabVisible): + * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h: + (MediaPlayerPrivate): + +2012-08-23 John Mellor <johnme@chromium.org> + + Text Autosizing: Multiply large fonts less, as they are already more legible. + https://bugs.webkit.org/show_bug.cgi?id=94227 + + Reviewed by Kenneth Rohde Christiansen. + + Rather than uniformly multiplying font sizes by the multiplier (derived + from the width of the block), we should multiply fonts that are already + large less, since they are already more legible hence there is less need + for them to grow. + + However it is still important to maintain differentiation between text + that the author specified to be of different sizes. + + This algorithm multiplies text by the multiplier up until a predefined + "pleasant" font size; beyond that the computedSize goes up with + specifiedSize but at a gradient of less than 1 in order to gradually + fade out the size increase; finally for very large specifiedSizes the + computedSize will be the same as the specifiedSize. + + For further details, including a graph, please see the bug report. + + Test: fast/text-autosizing/various-font-sizes.html + + * rendering/TextAutosizer.cpp: + (WebCore::TextAutosizer::computeAutosizedFontSize): + + Implements the custom multiplication. See comment for details. + + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::lineHeight): + + Use computeAutosizedFontSize instead of directly multiplying. + + (WebCore::RenderStyle::setFontSize): + + Use computeAutosizedFontSize instead of directly multiplying. + +2012-08-23 Emil A Eklund <eae@chromium.org> + + Remove dependency on RenderStyle from FractionalLayoutBoxExtent and LayoutBox + https://bugs.webkit.org/show_bug.cgi?id=94146 + + Reviewed by Eric Seidel. + + FractionalLayoutBoxExtent and LayoutBox currently have a dependency on + RenderStyle to resolve writing mode and text direction. + This is undesirable and breaks encapsulation. + + Change FractionalLayoutBoxExtent and LengthBox to take a writing mode + parameter, and text direction as needed, instead of a pointer to a + RenderStyle object. + + No new tests, no change in functionality. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + Add new WritingMode.h file. + + * css/CSSPrimitiveValueMappings.h: + * css/CSSProperty.h: + * css/CSSToStyleMap.h: + Change includes as needed. + + * platform/LengthBox.h: + * platform/LengthBox.cpp: + (WebCore::LengthBox::logicalLeft): + (WebCore::LengthBox::logicalRight): + (WebCore::LengthBox::before): + (WebCore::LengthBox::after): + Change methods to take a WirtingMode parameter instead of a RenderStyle pointer. + + (WebCore::LengthBox::start): + (WebCore::LengthBox::end): + Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer. + + * platform/graphics/FractionalLayoutBoxExtent.h: + * platform/graphics/FractionalLayoutBoxExtent.cpp: + (WebCore::FractionalLayoutBoxExtent::logicalTop): + (WebCore::FractionalLayoutBoxExtent::logicalBottom): + (WebCore::FractionalLayoutBoxExtent::logicalLeft): + (WebCore::FractionalLayoutBoxExtent::logicalRight): + (WebCore::FractionalLayoutBoxExtent::before): + (WebCore::FractionalLayoutBoxExtent::after): + (WebCore::FractionalLayoutBoxExtent::setBefore): + (WebCore::FractionalLayoutBoxExtent::setAfter): + (WebCore::FractionalLayoutBoxExtent::mutableLogicalLeft): + (WebCore::FractionalLayoutBoxExtent::mutableLogicalRight): + (WebCore::FractionalLayoutBoxExtent::mutableBefore): + (WebCore::FractionalLayoutBoxExtent::mutableAfter): + Change methods to take a WritingMode parameter instead of a RenderStyle pointer. + + (WebCore::FractionalLayoutBoxExtent::start): + (WebCore::FractionalLayoutBoxExtent::end): + (WebCore::FractionalLayoutBoxExtent::setStart): + (WebCore::FractionalLayoutBoxExtent::setEnd): + Change methods to take WritingMode and TextDirection parameters instead of a RenderStyle pointer. + + * platform/text/TextDirection.h: + (WebCore::isLeftToRightDirection): + Add convenience method. + + * platform/text/WritingMode.h: Added. + Move WritingMode enum from RenderStyleConstants to new file. + + (WebCore::isHorizontalWritingMode): + (WebCore::isFlippedLinesWritingMode): + (WebCore::isFlippedBlocksWritingMode): + Add convenience methods for working with writing modes. + + * rendering/InlineFlowBox.cpp: + * rendering/RenderBox.cpp: + * rendering/RenderBox.h: + * rendering/style/RenderStyle.h: + Update calls to FractionalLayoutBoxExtent/LengthBox to pass WritingMode/ + TextDirection as needed. + + * rendering/style/RenderStyleConstants.h: + Remove WritingMode enum as it is now in a dedicated file. + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce canFilter on panel (otherwise we check for function existence). + https://bugs.webkit.org/show_bug.cgi?id=94820 + + Reviewed by Alexander Pavlov. + + Drive-by: fix for network panel sorting null pointer access. + + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkPanel.prototype.performSearch): + (WebInspector.NetworkPanel.prototype.canFilter): + * inspector/front-end/Panel.js: + (WebInspector.Panel.prototype.replaceAllWith): + (WebInspector.Panel.prototype.canFilter): + (WebInspector.Panel.prototype.performFilter): + * inspector/front-end/SearchController.js: + (WebInspector.SearchController.prototype._updateFilterVisibility): + (WebInspector.SearchController.prototype._performFilter): + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: introduce TimelineGrid.Calculator interface. + https://bugs.webkit.org/show_bug.cgi?id=94819 + + Reviewed by Alexander Pavlov. + + This way we can compile TimelineGrid properly. + + * inspector/front-end/MemoryStatistics.js: + (WebInspector.MemoryStatistics.prototype._calculateVisibleIndexes): + * inspector/front-end/TimelineGrid.js: + (WebInspector.TimelineGrid.prototype.updateDividers): + (WebInspector.TimelineGrid.Calculator): + (WebInspector.TimelineGrid.Calculator.prototype.computePosition): + (WebInspector.TimelineGrid.Calculator.prototype.formatTime): + (WebInspector.TimelineGrid.Calculator.prototype.minimumBoundary): + (WebInspector.TimelineGrid.Calculator.prototype.maximumBoundary): + (WebInspector.TimelineGrid.Calculator.prototype.boundarySpan): + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.TimelineOverviewCalculator.prototype.computePosition): + (WebInspector.TimelineOverviewCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineOverviewCalculator.prototype.setWindow): + (WebInspector.TimelineOverviewCalculator.prototype.formatTime): + (WebInspector.TimelineOverviewCalculator.prototype.maximumBoundary): + (WebInspector.TimelineOverviewCalculator.prototype.minimumBoundary): + (WebInspector.TimelineOverviewCalculator.prototype.boundarySpan): + * inspector/front-end/TimelinePanel.js: + (WebInspector.TimelinePanel.prototype._shouldShowFrames): + (WebInspector.TimelineCalculator.prototype.computePosition): + (WebInspector.TimelineCalculator.prototype.computeBarGraphPercentages): + (WebInspector.TimelineCalculator.prototype.setWindow): + (WebInspector.TimelineCalculator.prototype.formatTime): + (WebInspector.TimelineCalculator.prototype.maximumBoundary): + (WebInspector.TimelineCalculator.prototype.minimumBoundary): + (WebInspector.TimelineCalculator.prototype.boundarySpan): + +2012-08-23 David Reveman <reveman@chromium.org> + + [Chromium] Unnecessary delay when starting to update resources with an inactive vsync timer. + https://bugs.webkit.org/show_bug.cgi?id=94719 + + Reviewed by James Robinson. + + Replace nextTickTime() with nextTickTimeIfActivated() and return + appropriate value when timer is inactive. + + No new tests. + + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp: + (WebCore::CCDelayBasedTimeSource::nextTickTimeIfActivated): + (WebCore::CCDelayBasedTimeSource::nextTickTarget): + (WebCore): + (WebCore::CCDelayBasedTimeSource::postNextTickTask): + * platform/graphics/chromium/cc/CCDelayBasedTimeSource.h: + * platform/graphics/chromium/cc/CCFrameRateController.cpp: + (WebCore::CCFrameRateController::nextTickTimeIfActivated): + * platform/graphics/chromium/cc/CCFrameRateController.h: + (CCFrameRateController): + * platform/graphics/chromium/cc/CCScheduler.cpp: + (WebCore::CCScheduler::processScheduledActions): + * platform/graphics/chromium/cc/CCTimeSource.h: + (CCTimeSource): + +2012-08-23 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: make treeoutline.js compiler-friendly + https://bugs.webkit.org/show_bug.cgi?id=94818 + + Reviewed by Alexander Pavlov. + + This change declares base methods on TreeElement so that we did not need to check for their existence. + + * inspector/front-end/AdvancedSearchController.js: + (WebInspector.FileBasedSearchResultsPane.prototype._appendShowMoreMatchesElement): + (WebInspector.FileBasedSearchResultsPane.prototype._addFileTreeElement): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype.onselect): + * inspector/front-end/SidebarPane.js: + (WebInspector.SidebarPane.prototype.expand): + (WebInspector.SidebarPane.prototype.onexpand): + (WebInspector.SidebarPane.prototype.collapse): + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype._treeKeyDown): + (TreeOutline.prototype._searchInputKeyDown): + (TreeElement.prototype._fireDidChange): + (TreeElement.prototype._attach): + (TreeElement.treeElementDoubleClicked): + (TreeElement.prototype.collapse): + (TreeElement.prototype.expand): + (TreeElement.prototype.reveal): + (TreeElement.prototype.select): + (TreeElement.prototype.deselect): + (TreeElement.prototype.onpopulate): + (TreeElement.prototype.onenter): + (TreeElement.prototype.ondelete): + (TreeElement.prototype.onspace): + (TreeElement.prototype.onattach): + (TreeElement.prototype.onexpand): + (TreeElement.prototype.oncollapse): + (TreeElement.prototype.ondblclick): + (TreeElement.prototype.onreveal): + (TreeElement.prototype.onselect): + +2012-08-23 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: use temporary directory for modules generated by compile-front-end.py + https://bugs.webkit.org/show_bug.cgi?id=94804 + + Reviewed by Pavel Feldman. + + Create temporary directory for generated js modules and remove the directory + after the compilation. + + * inspector/compile-front-end.py: + 2012-08-23 Simon Hausmann <simon.hausmann@nokia.com> [Qt] Fix make install on Windows diff --git a/Source/WebCore/Configurations/Version.xcconfig b/Source/WebCore/Configurations/Version.xcconfig index c5c8365a3..428a583bc 100644 --- a/Source/WebCore/Configurations/Version.xcconfig +++ b/Source/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 537; -MINOR_VERSION = 6; +MINOR_VERSION = 8; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index 5974082f3..2f06ae3c6 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -1,3 +1,4 @@ +include $(srcdir)/Source/WebCore/GNUmakefile.features.am include $(srcdir)/Source/WebCore/GNUmakefile.list.am WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in @@ -43,6 +44,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/WebCore/loader \ -I$(srcdir)/Source/WebCore/loader/appcache \ -I$(srcdir)/Source/WebCore/loader/archive \ + -I$(srcdir)/Source/WebCore/loader/archive/mhtml \ -I$(srcdir)/Source/WebCore/loader/cache \ -I$(srcdir)/Source/WebCore/loader/icon \ -I$(srcdir)/Source/WebCore/mathml \ @@ -118,25 +120,21 @@ webcoregtk_cppflags += \ -I$(srcdir)/Source/WebCore/platform/text/gtk # --- -# Features enabled by default at compilation time -# --- -FEATURE_DEFINES += ENABLE_SMOOTH_SCROLLING=1 -webcore_cppflags += -DENABLE_SMOOTH_SCROLLING=1 - -# --- # Channel mesaging support # --- if ENABLE_CHANNEL_MESSAGING -FEATURE_DEFINES += ENABLE_CHANNEL_MESSAGING=1 -webcore_cppflags += -DENABLE_CHANNEL_MESSAGING=1 +feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=1 +else +feature_defines_overrides += ENABLE_CHANNEL_MESSAGING=0 endif # END ENABLE_CHANNEL_MESSAGING # --- # Fast Mobile Scrolling # --- if ENABLE_FAST_MOBILE_SCROLLING -FEATURE_DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 -webcore_cppflags += -DENABLE_FAST_MOBILE_SCROLLING=1 +feature_defines_overrides += ENABLE_FAST_MOBILE_SCROLLING=1 +else +feature_defines_overrides += ENABLE_FAST_MOBILE_SCROLLING=0 endif # END ENABLE_FAST_MOBILE_SCROLLING # --- @@ -169,86 +167,90 @@ endif # END TARGET_WIN32 # HTML Details Element # ---- if ENABLE_DETAILS_ELEMENT -FEATURE_DEFINES += ENABLE_DETAILS_ELEMENT=1 -webcore_cppflags += -DENABLE_DETAILS_ELEMENT=1 +feature_defines_overrides += ENABLE_DETAILS_ELEMENT=1 +else +feature_defines_overrides += ENABLE_DETAILS_ELEMENT=0 endif # END ENABLE_DETAILS_ELEMENT # ---- # HTML Meter Element # ---- if ENABLE_METER_ELEMENT -FEATURE_DEFINES += ENABLE_METER_ELEMENT=1 -webcore_cppflags += -DENABLE_METER_ELEMENT=1 +feature_defines_overrides += ENABLE_METER_ELEMENT=1 +else +feature_defines_overrides += ENABLE_METER_ELEMENT=0 endif # END ENABLE_METER_ELEMENT # ---- # HTML Progress Element # ---- if ENABLE_PROGRESS_ELEMENT -FEATURE_DEFINES += ENABLE_PROGRESS_ELEMENT=1 -webcore_cppflags += -DENABLE_PROGRESS_ELEMENT=1 +feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=1 +else +feature_defines_overrides += ENABLE_PROGRESS_ELEMENT=0 endif # END ENABLE_PROGRESS_ELEMENT # ---- # JavaScript Debugger/Profiler # ---- if ENABLE_JAVASCRIPT_DEBUGGER -FEATURE_DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=1 -webcore_cppflags += -DENABLE_JAVASCRIPT_DEBUGGER=1 +feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=1 else -webcore_cppflags += -DENABLE_JAVASCRIPT_DEBUGGER=0 +feature_defines_overrides += ENABLE_JAVASCRIPT_DEBUGGER=0 endif # END ENABLE_JAVASCRIPT_DEBUGGER # ---- # Gamepad support # --- if ENABLE_GAMEPAD -FEATURE_DEFINES += ENABLE_GAMEPAD=1 -webcore_cppflags += -DENABLE_GAMEPAD=1 +feature_defines_overrides += ENABLE_GAMEPAD=1 else -webcore_cppflags += -DENABLE_GAMEPAD=0 +feature_defines_overrides += ENABLE_GAMEPAD=0 endif # END ENABLE_GAMEPAD # ---- # Database Support # ---- if ENABLE_SQL_DATABASE -FEATURE_DEFINES += ENABLE_SQL_DATABASE=1 -webcore_cppflags += -DENABLE_SQL_DATABASE=1 +feature_defines_overrides += ENABLE_SQL_DATABASE=1 else -webcore_cppflags += -DENABLE_SQL_DATABASE=0 +feature_defines_overrides += ENABLE_SQL_DATABASE=0 endif # END ENABLE_SQL_DATABASE # ---- # HTML5 datalist Support # ---- if ENABLE_DATALIST_ELEMENT -FEATURE_DEFINES += ENABLE_DATALIST_ELEMENT=1 -webcore_cppflags += -DENABLE_DATALIST_ELEMENT=1 +feature_defines_overrides += ENABLE_DATALIST_ELEMENT=1 +else +feature_defines_overrides += ENABLE_DATALIST_ELEMENT=0 endif # END ENABLE_DATALIST_ELEMENT # ---- # HTML5 data transfer items support # ---- if ENABLE_DATA_TRANSFER_ITEMS -FEATURE_DEFINES += ENABLE_DATA_TRANSFER_ITEMS=1 -webcore_cppflags += -DENABLE_DATA_TRANSFER_ITEMS=1 +feature_defines_overrides += ENABLE_DATA_TRANSFER_ITEMS=1 +else +feature_defines_overrides += ENABLE_DATA_TRANSFER_ITEMS=0 endif # END ENABLE_DATA_TRANSFER_ITEMS # ---- # HTML5 <style scoped> support # ---- if ENABLE_STYLE_SCOPED -FEATURE_DEFINES += ENABLE_STYLE_SCOPED=1 -webcore_cppflags += -DENABLE_STYLE_SCOPED=1 +feature_defines_overrides += ENABLE_STYLE_SCOPED=1 +else +feature_defines_overrides += ENABLE_STYLE_SCOPED=0 endif # END ENABLE_STYLE_SCOPED # ---- # Indexed Database API support # ---- if ENABLE_INDEXED_DATABASE -FEATURE_DEFINES += ENABLE_INDEXED_DATABASE=1 -webcore_cppflags += -DENABLE_INDEXED_DATABASE=1 +feature_defines_overrides += ENABLE_INDEXED_DATABASE=1 +else +feature_defines_overrides += ENABLE_INDEXED_DATABASE=0 endif # END ENABLE_INDEXED_DATABASE if USE_LEVELDB @@ -259,153 +261,149 @@ endif # END USE_LEVELDB # Support for <input type="file" directory> # ---- if ENABLE_DIRECTORY_UPLOAD -FEATURE_DEFINES += ENABLE_DIRECTORY_UPLOAD=1 -webcore_cppflags += -DENABLE_DIRECTORY_UPLOAD=1 +feature_defines_overrides += ENABLE_DIRECTORY_UPLOAD=1 else -webcore_cppflags += -DENABLE_DIRECTORY_UPLOAD=0 +feature_defines_overrides += ENABLE_DIRECTORY_UPLOAD=0 endif # END ENABLE_DIRECTORY_UPLOAD # ---- # DOM mutation observer support # ---- if ENABLE_MUTATION_OBSERVERS -FEATURE_DEFINES += ENABLE_MUTATION_OBSERVERS=1 -webcore_cppflags += -DENABLE_MUTATION_OBSERVERS=1 +feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=1 +else +feature_defines_overrides += ENABLE_MUTATION_OBSERVERS=0 endif # END ENABLE_MUTATION_OBSERVERS # ---- # FileSystem API support # ---- if ENABLE_FILE_SYSTEM -FEATURE_DEFINES += ENABLE_FILE_SYSTEM=1 -webcore_cppflags += -DENABLE_FILE_SYSTEM=1 +feature_defines_overrides += ENABLE_FILE_SYSTEM=1 +else +feature_defines_overrides += ENABLE_FILE_SYSTEM=0 endif # END ENABLE_FILE_SYSTEM # ---- # Quota support # ---- if ENABLE_QUOTA -FEATURE_DEFINES += ENABLE_QUOTA=1 -webcore_cppflags += -DENABLE_QUOTA=1 +feature_defines_overrides += ENABLE_QUOTA=1 +else +feature_defines_overrides += ENABLE_QUOTA=0 endif # END ENABLE_QUOTA # ---- # Touch Icon Loading # ---- if ENABLE_TOUCH_ICON_LOADING -FEATURE_DEFINES += ENABLE_TOUCH_ICON_LOADING=1 -webcore_cppflags += -DENABLE_TOUCH_ICON_LOADING=1 +feature_defines_overrides += ENABLE_TOUCH_ICON_LOADING=1 else -webcore_cppflags += -DENABLE_TOUCH_ICON_LOADING=0 +feature_defines_overrides += ENABLE_TOUCH_ICON_LOADING=0 endif # END ENABLE_TOUCH_ICON_LOADING # ---- # Color Input API support # ---- if ENABLE_INPUT_TYPE_COLOR -FEATURE_DEFINES += ENABLE_INPUT_TYPE_COLOR=1 -webcore_cppflags += -DENABLE_INPUT_TYPE_COLOR=1 +feature_defines_overrides += ENABLE_INPUT_TYPE_COLOR=1 else -webcore_cppflags += -DENABLE_INPUT_TYPE_COLOR=0 +feature_defines_overrides += ENABLE_INPUT_TYPE_COLOR=0 endif # END ENABLE_INPUT_TYPE_COLOR # ---- # Speech Input API support # ---- if ENABLE_INPUT_SPEECH -FEATURE_DEFINES += ENABLE_INPUT_SPEECH=1 -webcore_cppflags += -DENABLE_INPUT_SPEECH=1 +feature_defines_overrides += ENABLE_INPUT_SPEECH=1 else -webcore_cppflags += -DENABLE_INPUT_SPEECH=0 +feature_defines_overrides += ENABLE_INPUT_SPEECH=0 endif # END ENABLE_INPUT_SPEECH # ---- # Scripted Speech API support # ---- if ENABLE_SCRIPTED_SPEECH -FEATURE_DEFINES += ENABLE_SCRIPTED_SPEECH=1 -webcore_cppflags += -DENABLE_SCRIPTED_SPEECH=1 +feature_defines_overrides += ENABLE_SCRIPTED_SPEECH=1 else -webcore_cppflags += -DENABLE_SCRIPTED_SPEECH=0 +feature_defines_overrides += ENABLE_SCRIPTED_SPEECH=0 endif # END ENABLE_SCRIPTED_SPEECH # ---- # Icon Database Support # ---- if ENABLE_ICONDATABASE -webcore_cppflags += -DENABLE_ICONDATABASE=1 +feature_defines_overrides += -DENABLE_ICONDATABASE=1 else -webcore_cppflags += -DENABLE_ICONDATABASE=0 +feature_defines_overrides += -DENABLE_ICONDATABASE=0 endif # END ENABLE_ICONDATABASE # ---- # Orientation Events # ---- if ENABLE_ORIENTATION_EVENTS -FEATURE_DEFINES += ENABLE_ORIENTATION_EVENTS=1 -webcore_cppflags += -DENABLE_ORIENTATION_EVENTS=1 +feature_defines_overrides += ENABLE_ORIENTATION_EVENTS=1 +else +feature_defines_overrides += ENABLE_ORIENTATION_EVENTS=0 endif # END ENABLE_ORIENTATION_EVENTS # ---- # Video Support # ---- if ENABLE_VIDEO -FEATURE_DEFINES += ENABLE_VIDEO=1 -webcore_cppflags += -DENABLE_VIDEO=1 - +feature_defines_overrides += ENABLE_VIDEO=1 if USE_GSTREAMER if ENABLE_DEBUG webcore_cppflags += -DGST_DISABLE_DEPRECATED endif # END ENABLE_DEBUG endif # END USE_GSTREAMER +else +feature_defines_overrides += ENABLE_VIDEO=0 endif # END ENABLE_VIDEO # ---- # Media Source Support # ---- if ENABLE_MEDIA_SOURCE -FEATURE_DEFINES += ENABLE_MEDIA_SOURCE=1 -webcore_cppflags += -DENABLE_MEDIA_SOURCE=1 +feature_defines_overrides += ENABLE_MEDIA_SOURCE=1 else -webcore_cppflags += -DENABLE_MEDIA_SOURCE=0 +feature_defines_overrides += ENABLE_MEDIA_SOURCE=0 endif # END ENABLE_MEDIA_SOURCE # ---- # Media Statistics Support # ---- if ENABLE_MEDIA_STATISTICS -FEATURE_DEFINES += ENABLE_MEDIA_STATISTICS=1 -webcore_cppflags += -DENABLE_MEDIA_STATISTICS=1 +feature_defines_overrides += ENABLE_MEDIA_STATISTICS=1 else -webcore_cppflags += -DENABLE_MEDIA_STATISTICS=0 +feature_defines_overrides += ENABLE_MEDIA_STATISTICS=0 endif # END ENABLE_MEDIA_STATISTICS # ---- # Javascript Fullscreen Support # ---- if ENABLE_FULLSCREEN_API -FEATURE_DEFINES += ENABLE_FULLSCREEN_API=1 -webcore_cppflags += -DENABLE_FULLSCREEN_API=1 +feature_defines_overrides += ENABLE_FULLSCREEN_API=1 +else +feature_defines_overrides += ENABLE_FULLSCREEN_API=0 endif # END ENABLE_FULLSCREEN_API # ---- # Track Support # ---- if ENABLE_VIDEO_TRACK -FEATURE_DEFINES += ENABLE_VIDEO_TRACK=1 -webcore_cppflags += -DENABLE_VIDEO_TRACK=1 +feature_defines_overrides += ENABLE_VIDEO_TRACK=1 else -webcore_cppflags += -DENABLE_VIDEO_TRACK=0 +feature_defines_overrides += ENABLE_VIDEO_TRACK=0 endif # END ENABLE_VIDEO_TRACK # ---- # Media Stream Support # ---- if ENABLE_MEDIA_STREAM -FEATURE_DEFINES += ENABLE_MEDIA_STREAM=1 -webcore_cppflags += -DENABLE_MEDIA_STREAM=1 +feature_defines_overrides += ENABLE_MEDIA_STREAM=1 else -webcore_cppflags += -DENABLE_MEDIA_STREAM=0 +feature_defines_overrides += ENABLE_MEDIA_STREAM=0 endif # END ENABLE_MEDIA_STREAM # XPath grammar @@ -426,101 +424,108 @@ $(GENSOURCES_WEBCORE)/XPathGrammar.cpp: $(WebCore)/xml/XPathGrammar.y # XSLT Support # ---- if ENABLE_XSLT -FEATURE_DEFINES += ENABLE_XSLT=1 -webcore_cppflags += -DENABLE_XSLT=1 +feature_defines_overrides += ENABLE_XSLT=1 +else +feature_defines_overrides += ENABLE_XSLT=0 endif # END ENABLE_XSLT # ---- # Web Workers support # ---- if ENABLE_WORKERS -FEATURE_DEFINES += ENABLE_WORKERS=1 -webcore_cppflags += -DENABLE_WORKERS=1 +feature_defines_overrides += ENABLE_WORKERS=1 +else +feature_defines_overrides += ENABLE_WORKERS=0 endif # --- # Shadow DOM support # --- if ENABLE_SHADOW_DOM -FEATURE_DEFINES += ENABLE_SHADOW_DOM=1 -webcore_cppflags += -DENABLE_SHADOW_DOM=1 +feature_defines_overrides += ENABLE_SHADOW_DOM=1 +else +feature_defines_overrides += ENABLE_SHADOW_DOM=0 endif # --- # SharedWorker support # --- if ENABLE_SHARED_WORKERS -FEATURE_DEFINES += ENABLE_SHARED_WORKERS=1 -webcore_cppflags += -DENABLE_SHARED_WORKERS=1 +feature_defines_overrides += ENABLE_SHARED_WORKERS=1 +else +feature_defines_overrides += ENABLE_SHARED_WORKERS=0 endif # ---- # Filters # ---- if ENABLE_FILTERS -FEATURE_DEFINES += ENABLE_FILTERS=1 -webcore_cppflags += -DENABLE_FILTERS=1 +feature_defines_overrides += ENABLE_FILTERS=1 +else +feature_defines_overrides += ENABLE_FILTERS=0 endif # END ENABLE_FILTERS # ---- # CSS box decoration break # ---- if ENABLE_CSS_BOX_DECORATION_BREAK -FEATURE_DEFINES += ENABLE_CSS_BOX_DECORATION_BREAK=1 -webcore_cppflags += -DENABLE_CSS_BOX_DECORATION_BREAK=1 - +feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=1 +else +feature_defines_overrides += ENABLE_CSS_BOX_DECORATION_BREAK=0 endif # END ENABLE_CSS_BOX_DECORATION_BREAK # ---- # Regions # ---- if ENABLE_CSS_REGIONS -FEATURE_DEFINES += ENABLE_CSS_REGIONS=1 -webcore_cppflags += -DENABLE_CSS_REGIONS=1 - +feature_defines_overrides += ENABLE_CSS_REGIONS=1 +else +feature_defines_overrides += ENABLE_CSS_REGIONS=0 endif # END ENABLE_CSS_REGIONS # ---- # Filters # ---- if ENABLE_CSS_FILTERS -FEATURE_DEFINES += ENABLE_CSS_FILTERS=1 -webcore_cppflags += -DENABLE_CSS_FILTERS=1 - +feature_defines_overrides += ENABLE_CSS_FILTERS=1 +else +feature_defines_overrides += ENABLE_CSS_FILTERS=0 endif # END ENABLE_CSS_FILTERS # ---- # Compositing # ---- if ENABLE_CSS_COMPOSITING -FEATURE_DEFINES += ENABLE_CSS_COMPOSITING=1 -webcore_cppflags += -DENABLE_CSS_COMPOSITING=1 +feature_defines_overrides += ENABLE_CSS_COMPOSITING=1 +else +feature_defines_overrides += ENABLE_CSS_COMPOSITING=0 endif # END ENABLE_CSS_COMPOSITING # ---- # Exclusions # ---- if ENABLE_CSS_EXCLUSIONS -FEATURE_DEFINES += ENABLE_CSS_EXCLUSIONS=1 -webcore_cppflags += -DENABLE_CSS_EXCLUSIONS=1 - +feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=1 +else +feature_defines_overrides += ENABLE_CSS_EXCLUSIONS=0 endif # END ENABLE_CSS_EXCLUSIONS # ---- # Geolocation # ---- if ENABLE_GEOLOCATION - -FEATURE_DEFINES += ENABLE_GEOLOCATION=1 -webcore_cppflags += -DENABLE_GEOLOCATION=1 +feature_defines_overrides += ENABLE_GEOLOCATION=1 +else +feature_defines_overrides += ENABLE_GEOLOCATION=0 endif # END ENABLE_GEOLOCATION # ---- # MathML support # ---- if ENABLE_MATHML -FEATURE_DEFINES += ENABLE_MATHML=1 -webcore_cppflags += -DENABLE_MATHML=1 +feature_defines_overrides += ENABLE_MATHML=1 +else +feature_defines_overrides += ENABLE_MATHML=0 endif # END ENABLE_MATHML # MathML tag and attribute names, and element factory @@ -533,8 +538,9 @@ DerivedSources/WebCore/MathMLElementFactory.cpp DerivedSources/WebCore/MathMLNam # Notifications support # ---- if ENABLE_NOTIFICATIONS -FEATURE_DEFINES += ENABLE_NOTIFICATIONS=1 ENABLE_LEGACY_NOTIFICATIONS=1 -webcore_cppflags += -DENABLE_NOTIFICATIONS=1 -DENABLE_LEGACY_NOTIFICATIONS=1 +feature_defines_overrides += ENABLE_NOTIFICATIONS=1 ENABLE_LEGACY_NOTIFICATIONS=1 +else +feature_defines_overrides += ENABLE_NOTIFICATIONS=0 ENABLE_LEGACY_NOTIFICATIONS=0 endif # END ENABLE_NOTIFICATIONS # ---- @@ -543,24 +549,24 @@ endif # END ENABLE_NOTIFICATIONS # FIXME: allow a more fine-grained inclusion/generation of sources per SVG feature # ---- if ENABLE_SVG -FEATURE_DEFINES += ENABLE_SVG=1 -webcore_cppflags += -DENABLE_SVG=1 +feature_defines_overrides += ENABLE_SVG=1 WEBCORE_CSS_PROPERTY_NAMES += $(WebCore)/css/SVGCSSPropertyNames.in WEBCORE_CSS_VALUE_KEYWORDS += $(WebCore)/css/SVGCSSValueKeywords.in - # SVG Features if ENABLE_SVG_FONTS -FEATURE_DEFINES += ENABLE_SVG_FONTS=1 -webcore_cppflags += -DENABLE_SVG_FONTS=1 +feature_defines_overrides += ENABLE_SVG_FONTS=1 +else +feature_defines_overrides += ENABLE_SVG_FONTS=0 endif - +else +feature_defines_overrides += ENABLE_SVG=0 ENABLE_SVG_FONTS=0 endif # END ENABLE_SVG # SVG tag and attribute names (need to pass an extra flag if svg experimental features are enabled) DerivedSources/WebCore/SVGNames.cpp: DerivedSources/WebCore/SVGElementFactory.cpp DerivedSources/WebCore/JSSVGElementWrapperFactory.cpp: DerivedSources/WebCore/SVGElementFactory.cpp DerivedSources/WebCore/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(feature_defines)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" # end SVG Features @@ -572,8 +578,9 @@ DerivedSources/WebCore/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/ # Web Audio Support # ---- if ENABLE_WEB_AUDIO -FEATURE_DEFINES += ENABLE_WEB_AUDIO=1 -webcore_cppflags += -DENABLE_WEB_AUDIO=1 +feature_defines_overrides += ENABLE_WEB_AUDIO=1 +else +feature_defines_overrides += ENABLE_WEB_AUDIO=0 endif if USE_WEBAUDIO_GSTREAMER @@ -584,59 +591,63 @@ endif # Web Sockets Support # ---- if ENABLE_WEB_SOCKETS -FEATURE_DEFINES += ENABLE_WEB_SOCKETS=1 -webcore_cppflags += -DENABLE_WEB_SOCKETS=1 +feature_defines_overrides += ENABLE_WEB_SOCKETS=1 else -webcore_cppflags += -DENABLE_WEB_SOCKETS=0 +feature_defines_overrides += ENABLE_WEB_SOCKETS=0 endif # END ENABLE_WEB_SOCKETS # --- # Blob support # --- if ENABLE_BLOB -FEATURE_DEFINES += ENABLE_BLOB=1 -webcore_cppflags += -DENABLE_BLOB=1 +feature_defines_overrides += ENABLE_BLOB=1 +else +feature_defines_overrides += ENABLE_BLOB=0 endif # END ENABLE_BLOB # --- # Legacy WebKitBlobBuilder support # --- if ENABLE_LEGACY_WEBKIT_BLOB_BUILDER -FEATURE_DEFINES += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 -webcore_cppflags += -DENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 +feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 +else +feature_defines_overrides += ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=0 endif # END ENABLE_LEGACY_WEBKIT_BLOB_BUILDER # --- # Animation API support # --- if ENABLE_ANIMATION_API -FEATURE_DEFINES += ENABLE_ANIMATION_API=1 -webcore_cppflags += -DENABLE_ANIMATION_API=1 +feature_defines_overrides += ENABLE_ANIMATION_API=1 +else +feature_defines_overrides += ENABLE_ANIMATION_API=0 endif # END ENABLE_ANIMATION_API # --- # RequestAnimationFrame support # --- if ENABLE_REQUEST_ANIMATION_FRAME -FEATURE_DEFINES += ENABLE_REQUEST_ANIMATION_FRAME=1 -webcore_cppflags += -DENABLE_REQUEST_ANIMATION_FRAME=1 +feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=1 +else +feature_defines_overrides += ENABLE_REQUEST_ANIMATION_FRAME=0 endif # END ENABLE_REQUEST_ANIMATION_FRAME # --- # 3D canvas (WebGL) support # --- if ENABLE_WEBGL -FEATURE_DEFINES += ENABLE_WEBGL=1 -webcore_cppflags += -DENABLE_WEBGL=1 +feature_defines_overrides += ENABLE_WEBGL=1 +else +feature_defines_overrides += ENABLE_WEBGL=0 endif # END ENABLE_WEBGL # --- # Accelerated compositing support # --- if USE_ACCELERATED_COMPOSITING -FEATURE_DEFINES += \ - ENABLE_3D_RENDERING=1 \ - ACCELERATED_COMPOSITING=1 +feature_defines_overrides += ENABLE_3D_RENDERING=1 +else +feature_defines_overrides += ENABLE_3D_RENDERING=0 endif # END USE_ACCELERATED_COMPOSITING if USE_TEXTURE_MAPPER_CAIRO @@ -659,104 +670,143 @@ endif # END USE_CLUTTER # MHTML support # --- if ENABLE_MHTML -FEATURE_DEFINES += ENABLE_MHTML=1 -webcore_cppflags += \ - -DENABLE_MHTML=1 \ - -I$(srcdir)/Source/WebCore/loader/archive/mhtml +feature_defines_overrides += ENABLE_MHTML=1 +else +feature_defines_overrides += ENABLE_MHTML=0 endif # END ENABLE_MHTML # --- # HTML5 Microdata support # --- if ENABLE_MICRODATA -FEATURE_DEFINES += ENABLE_MICRODATA=1 -webcore_cppflags += -DENABLE_MICRODATA=1 +feature_defines_overrides += ENABLE_MICRODATA=1 +else +feature_defines_overrides += ENABLE_MICRODATA=0 endif # END ENABLE_MICRODATA # --- # Register Protocol Handler support # --- if ENABLE_REGISTER_PROTOCOL_HANDLER -FEATURE_DEFINES += ENABLE_REGISTER_PROTOCOL_HANDLER=1 -webcore_cppflags += -DENABLE_REGISTER_PROTOCOL_HANDLER=1 +feature_defines_overrides += ENABLE_REGISTER_PROTOCOL_HANDLER=1 +else +feature_defines_overrides += ENABLE_REGISTER_PROTOCOL_HANDLER=0 endif # END ENABLE_REGISTER_PROTOCOL_HANDLER # --- # DeviceOrientation support # --- if ENABLE_DEVICE_ORIENTATION -FEATURE_DEFINES += ENABLE_DEVICE_ORIENTATION=1 -webcore_cppflags += -DENABLE_DEVICE_ORIENTATION=1 +feature_defines_overrides += ENABLE_DEVICE_ORIENTATION=1 +else +feature_defines_overrides += ENABLE_DEVICE_ORIENTATION=0 endif # END ENABLE_DEVICE_ORIENTATION # --- # Text Autosizing support # --- if ENABLE_TEXT_AUTOSIZING -FEATURE_DEFINES += ENABLE_TEXT_AUTOSIZING=1 -webcore_cppflags += -DENABLE_TEXT_AUTOSIZING=1 +feature_defines_overrides += ENABLE_TEXT_AUTOSIZING=1 +else +feature_defines_overrides += ENABLE_TEXT_AUTOSIZING=0 endif # END ENABLE_TEXT_AUTOSIZING # --- # Web Timing support # --- if ENABLE_WEB_TIMING -FEATURE_DEFINES += ENABLE_WEB_TIMING=1 -webcore_cppflags += -DENABLE_WEB_TIMING=1 +feature_defines_overrides += ENABLE_WEB_TIMING=1 +else +feature_defines_overrides += ENABLE_WEB_TIMING=0 endif # END ENABLE_WEB_TIMING # --- # HTML iframe seamless attribute support # --- if ENABLE_IFRAME_SEAMLESS -FEATURE_DEFINES += ENABLE_IFRAME_SEAMLESS=1 -webcore_cppflags += -DENABLE_IFRAME_SEAMLESS=1 +feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=1 +else +feature_defines_overrides += ENABLE_IFRAME_SEAMLESS=0 endif # END ENABLE_IFRAME_SEAMLESS # --- # CSS3 Flexbox support # --- if ENABLE_CSS3_FLEXBOX -FEATURE_DEFINES += ENABLE_CSS3_FLEXBOX=1 -webcore_cppflags += -DENABLE_CSS3_FLEXBOX=1 +feature_defines_overrides += ENABLE_CSS3_FLEXBOX=1 +else +feature_defines_overrides += ENABLE_CSS3_FLEXBOX=0 endif # END ENABLE_CSS3_FLEXBOX # --- # CSS3 Text Decoration support if ENABLE_CSS3_TEXT_DECORATION -FEATURE_DEFINES += ENABLE_CSS3_TEXT_DECORATION=1 -webcore_cppflags += -DENABLE_CSS3_TEXT_DECORATION=1 +feature_defines_overrides += ENABLE_CSS3_TEXT_DECORATION=1 +else +feature_defines_overrides += ENABLE_CSS3_TEXT_DECORATION=0 endif # END ENABLE_CSS3_TEXT_DECORATION # --- # Link prefetch support # --- if ENABLE_LINK_PREFETCH -FEATURE_DEFINES += ENABLE_LINK_PREFETCH=1 -webcore_cppflags += -DENABLE_LINK_PREFETCH=1 +feature_defines_overrides += ENABLE_LINK_PREFETCH=1 +else +feature_defines_overrides += ENABLE_LINK_PREFETCH=0 endif # END ENABLE_LINK_PREFETCH # --- # Widget region support # --- if ENABLE_WIDGET_REGION -FEATURE_DEFINES += ENABLE_WIDGET_REGION=1 -webcore_cppflags += -DENABLE_WIDGET_REGION=1 +feature_defines_overrides += ENABLE_WIDGET_REGION=1 +else +feature_defines_overrides += ENABLE_WIDGET_REGION=0 endif # END ENABLE_WIDGET_REGION # --- # Spell check support # --- if ENABLE_SPELLCHECK -FEATURE_DEFINES += ENABLE_SPELLCHECK=1 -webcore_cppflags += -DENABLE_SPELLCHECK=1 +feature_defines_overrides += ENABLE_SPELLCHECK=1 +else +feature_defines_overrides += ENABLE_SPELLCHECK=0 endif # END ENABLE_SPELLCHECK +# --- +# Unstable features +# If unstable features should not be enabled, their defines should be overriden with a 0 value. +# --- +if !ENABLE_UNSTABLE_FEATURES +# FIXME: List unstable features here once their configuration options are removed. +feature_defines_overrides += +endif + + +# Fill the feature_defines variable with all the defines, making it possible +# to override the default define value (as set in feature_defines_defaults) +# through adding the feature define with the desired value to feature_defines_overrides. +feature_defines += $(strip $(foreach bare_define, \ + $(foreach define,$(feature_defines_defaults), \ + $(foreach fvalue,0 1, \ + $(if $(findstring =$(fvalue),$(define)),$(patsubst %=$(fvalue),%,$(define))) \ + ) \ + ), \ + $(if $(findstring $(bare_define), $(feature_defines_overrides)), \ + $(filter $(bare_define)=%,$(feature_defines_overrides)), \ + $(filter $(bare_define)=%,$(feature_defines_defaults)) \ + ) \ +)) + +# Add the feature defines to webcore_cppflags in macro form. +webcore_cppflags += $(foreach define,$(feature_defines),-D$(define)) + + DerivedSources/WebCore/CSSPropertyNames.cpp: DerivedSources/WebCore/CSSPropertyNames.h DerivedSources/WebCore/CSSPropertyNames.h: $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/makeprop.pl $(AM_V_GEN) $(AM_V_at)cat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makeprop.pl" --defines "$(FEATURE_DEFINES)" + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makeprop.pl" --defines "$(feature_defines)" $(AM_V_at)mv CSSPropertyNames* $(GENSOURCES_WEBCORE) # Lower case all the values, as CSS values are case-insensitive @@ -764,7 +814,7 @@ DerivedSources/WebCore/CSSValueKeywords.cpp: DerivedSources/WebCore/CSSValueKeyw DerivedSources/WebCore/CSSValueKeywords.h: $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/makevalues.pl $(AM_V_GEN) $(AM_V_at)cat $(WEBCORE_CSS_VALUE_KEYWORDS) > CSSValueKeywords.in - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makevalues.pl" --defines "$(FEATURE_DEFINES)" + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts "$(WebCore)/css/makevalues.pl" --defines "$(feature_defines)" $(AM_V_at)mv CSSValueKeywords* $(GENSOURCES_WEBCORE) # XML Viewer CSS @@ -825,7 +875,7 @@ SCRIPTS_FOR_PREPROCESS_IDLS = \ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp: DerivedSources/WebCore/UserAgentStyleSheets.h DerivedSources/WebCore/UserAgentStyleSheets.h: $(WebCore)/css/make-css-file-arrays.pl $(WebCore)/bindings/scripts/preprocessor.pm $(USER_AGENT_STYLE_SHEETS) - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --defines "$(FEATURE_DEFINES)" $@ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --defines "$(feature_defines)" $@ DerivedSources/WebCore/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) DerivedSources/WebCore/WebKitFontFamilyNames.cpp: DerivedSources/WebCore/WebKitFontFamilyNames.h DerivedSources/WebCore/WebKitFontFamilyNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/css/WebKitFontFamilyNames.in @@ -838,7 +888,7 @@ DerivedSources/WebCore/HTMLElementFactory.cpp: DerivedSources/WebCore/HTMLElemen DerivedSources/WebCore/HTMLElementFactory.h: DerivedSources/WebCore/HTMLNames.cpp DerivedSources/WebCore/HTMLNames.cpp: DerivedSources/WebCore/HTMLNames.h DerivedSources/WebCore/HTMLNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(feature_defines)" --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" DerivedSources/WebCore/XMLNSNames.cpp DerivedSources/WebCore/XMLNSNames.h: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlnsattrs.in @@ -930,7 +980,7 @@ $(supplemental_dependency_file): $(SCRIPTS_FOR_PREPROCESS_IDLS) $(dom_binding_id $(AM_V_GEN) $(AM_V_at)echo -n > $(idl_files_list) $(AM_V_at)($(foreach idl, $(dom_binding_idls), echo $(idl) &&) echo -n) >> $(idl_files_list) - $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@ --idlAttributesFile $(idl_attributes_file) + $(AM_V_at)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/preprocess-idls.pl --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --idlFilesList $(idl_files_list) --supplementalDependencyFile $@ --idlAttributesFile $(idl_attributes_file) # This does not appear to work correctly with gnumake unless # it includes an empty command list (the semicolon). @@ -938,7 +988,7 @@ DerivedSources/WebCore/JS%.cpp: DerivedSources/WebCore/JS%.h; .SECONDARY: DerivedSources/WebCore/JS%.h: %.idl $(SCRIPTS_FOR_GENERATE_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm $(supplemental_dependency_file) - $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $< + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(feature_defines)" --generator JS --supplementalDependencyFile $(supplemental_dependency_file) $< # See https://bugs.webkit.org/show_bug.cgi?id=76388 # We need to introduce a manual dependency to prevent non-generated sources from diff --git a/Source/WebCore/GNUmakefile.features.am b/Source/WebCore/GNUmakefile.features.am new file mode 100644 index 000000000..0a8c3ce65 --- /dev/null +++ b/Source/WebCore/GNUmakefile.features.am @@ -0,0 +1,96 @@ +feature_defines_defaults += \ + ENABLE_3D_RENDERING=0 \ + ENABLE_ACCELERATED_2D_CANVAS=0 \ + ENABLE_ANIMATION_API=0 \ + ENABLE_BATTERY_STATUS=0 \ + ENABLE_BLOB=1 \ + ENABLE_CHANNEL_MESSAGING=1 \ + ENABLE_CSP_NEXT=0 \ + ENABLE_CSS_BOX_DECORATION_BREAK=1 \ + ENABLE_CSS_COMPOSITING=1 \ + ENABLE_CSS_EXCLUSIONS=1 \ + ENABLE_CSS_FILTERS=0 \ + ENABLE_CSS_HIERARCHIES=0 \ + ENABLE_CSS_IMAGE_ORIENTATION=0 \ + ENABLE_CSS_IMAGE_RESOLUTION=0 \ + ENABLE_CSS_REGIONS=1 \ + ENABLE_CSS_SHADERS=0 \ + ENABLE_CSS_VARIABLES=0 \ + ENABLE_CSS3_FLEXBOX=1 \ + ENABLE_CUSTOM_SCHEME_HANDLER=0 \ + ENABLE_DASHBOARD_SUPPORT=0 \ + ENABLE_DATALIST_ELEMENT=1 \ + ENABLE_DATA_TRANSFER_ITEMS=0 \ + ENABLE_DETAILS_ELEMENT=1 \ + ENABLE_DEVICE_ORIENTATION=0 \ + ENABLE_DIALOG_ELEMENT=0 \ + ENABLE_DIRECTORY_UPLOAD=0 \ + ENABLE_DOWNLOAD_ATTRIBUTE=0 \ + ENABLE_FILE_SYSTEM=0 \ + ENABLE_FILTERS=1 \ + ENABLE_FTPDIR=0 \ + ENABLE_FULLSCREEN_API=1 \ + ENABLE_GAMEPAD=1 \ + ENABLE_GEOLOCATION=1 \ + ENABLE_HIGH_DPI_CANVAS=0 \ + ENABLE_ICONDATABASE=1 \ + ENABLE_IFRAME_SEAMLESS=1 \ + ENABLE_INDEXED_DATABASE=0 \ + ENABLE_INPUT_SPEECH=0 \ + ENABLE_INPUT_TYPE_COLOR=0 \ + ENABLE_INPUT_TYPE_DATE=0 \ + ENABLE_INPUT_TYPE_DATETIME=0 \ + ENABLE_INPUT_TYPE_DATETIMELOCAL=0 \ + ENABLE_INPUT_TYPE_MONTH=0 \ + ENABLE_INPUT_TYPE_TIME=0 \ + ENABLE_INPUT_TYPE_WEEK=0 \ + ENABLE_INSPECTOR=1 \ + ENABLE_JAVASCRIPT_DEBUGGER=1 \ + ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0 \ + ENABLE_LEGACY_NOTIFICATIONS=0 \ + ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1 \ + ENABLE_LINK_PREFETCH=1 \ + ENABLE_LINK_PRERENDER=0 \ + ENABLE_MATHML=1 \ + ENABLE_MEDIA_CAPTURE=0 \ + ENABLE_MEDIA_SOURCE=0 \ + ENABLE_MEDIA_STATISTICS=0 \ + ENABLE_MEDIA_STREAM=1 \ + ENABLE_METER_ELEMENT=1 \ + ENABLE_MHTML=0 \ + ENABLE_MICRODATA=0 \ + ENABLE_MUTATION_OBSERVERS=1 \ + ENABLE_NETSCAPE_PLUGIN_API=1 \ + ENABLE_NETWORK_INFO=0 \ + ENABLE_NOTIFICATIONS=0 \ + ENABLE_ORIENTATION_EVENTS=0 \ + ENABLE_PAGE_VISIBILITY_API=0 \ + ENABLE_PROGRESS_ELEMENT=1 \ + ENABLE_QUOTA=0 \ + ENABLE_REGISTER_PROTOCOL_HANDLER=0 \ + ENABLE_REQUEST_ANIMATION_FRAME=1 \ + ENABLE_SCRIPTED_SPEECH=0 \ + ENABLE_SHADOW_DOM=1 \ + ENABLE_SHARED_WORKERS=1 \ + ENABLE_SMOOTH_SCROLLING=1 \ + ENABLE_SPELLCHECK=1 \ + ENABLE_SQL_DATABASE=1 \ + ENABLE_STYLE_SCOPED=0 \ + ENABLE_SVG=1 \ + ENABLE_SVG_DOM_OBJC_BINDINGS=0 \ + ENABLE_SVG_FONTS=1 \ + ENABLE_TEXT_AUTOSIZING=0 \ + ENABLE_TOUCH_EVENTS=0 \ + ENABLE_TOUCH_ICON_LOADING=0 \ + ENABLE_UNDO_MANAGER=0 \ + ENABLE_VIBRATION=0 \ + ENABLE_VIDEO=1 \ + ENABLE_VIDEO_TRACK=1 \ + ENABLE_WEBGL=1 \ + ENABLE_WEB_AUDIO=0 \ + ENABLE_WEB_INTENTS=0 \ + ENABLE_WEB_INTENTS_TAG=0 \ + ENABLE_WEB_SOCKETS=1 \ + ENABLE_WEB_TIMING=1 \ + ENABLE_WORKERS=1 \ + ENABLE_XSLT=1 diff --git a/Source/WebCore/Modules/battery/BatteryManager.idl b/Source/WebCore/Modules/battery/BatteryManager.idl index e552df36e..49a2056ab 100644 --- a/Source/WebCore/Modules/battery/BatteryManager.idl +++ b/Source/WebCore/Modules/battery/BatteryManager.idl @@ -42,7 +42,7 @@ module window { void removeEventListener(in DOMString type, in EventListener listener, in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) + boolean dispatchEvent(in Event event) raises(EventException); }; diff --git a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h index a79483e9b..1feb0d701 100644 --- a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h @@ -54,8 +54,6 @@ public: virtual void onSuccess(PassRefPtr<DOMStringList>) = 0; // From IDBObjectStore/IDBIndex.openCursor(), IDBIndex.openKeyCursor() virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>) = 0; - // From IDBFactory.open() - virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) = 0; // From IDBObjectStore.add()/put(), IDBIndex.getKey() virtual void onSuccess(PassRefPtr<IDBKey>) = 0; // From IDBDatabase.setVersion() @@ -68,9 +66,12 @@ public: virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>) = 0; // From IDBCursor.advance()/continue() virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >& keys, const Vector<RefPtr<IDBKey> >& primaryKeys, const Vector<RefPtr<SerializedScriptValue> >& values) = 0; + // From IDBFactory.open()/deleteDatabase(), IDBDatabase.setVersion() virtual void onBlocked() { ASSERT_NOT_REACHED(); } virtual void onBlocked(int64_t existingVersion) { ASSERT_NOT_REACHED(); } + // From IDBFactory.open() virtual void onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface>, PassRefPtr<IDBDatabaseBackendInterface>) { ASSERT_NOT_REACHED(); } + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) { ASSERT_NOT_REACHED(); } }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp index dab74ed0e..aa93e6a82 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp @@ -272,6 +272,14 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont return transaction(context, prpStoreNames, modeString, ec); } +void IDBDatabase::forceClose() +{ + ExceptionCode ec = 0; + for (HashSet<IDBTransaction*>::iterator it = m_transactions.begin(); it != m_transactions.end(); ++it) + (*it)->abort(ec); + this->close(); +} + void IDBDatabase::close() { if (m_closePending) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h index a7d72ce19..27f03b6e3 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h @@ -88,6 +88,7 @@ public: virtual const AtomicString& interfaceName() const; virtual ScriptExecutionContext* scriptExecutionContext() const; + void forceClose(); void registerFrontendCallbacks(); const IDBDatabaseMetadata metadata() const { return m_metadata; } void enqueueEvent(PassRefPtr<Event>); diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h index faa166f7f..e83de5128 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h @@ -37,6 +37,7 @@ class IDBDatabaseCallbacks : public RefCounted<IDBDatabaseCallbacks> { public: virtual ~IDBDatabaseCallbacks() { } + virtual void onForcedClose() = 0; virtual void onVersionChange(const String& version) = 0; virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) = 0; }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp index ceb7af31f..f6565dca1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp @@ -46,6 +46,12 @@ IDBDatabaseCallbacksImpl::~IDBDatabaseCallbacksImpl() { } +void IDBDatabaseCallbacksImpl::onForcedClose() +{ + if (m_database) + m_database->forceClose(); +} + void IDBDatabaseCallbacksImpl::onVersionChange(const String& version) { if (m_database) diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h index 02c8de0df..792be3ad7 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h @@ -41,6 +41,7 @@ public: static PassRefPtr<IDBDatabaseCallbacksImpl> create(IDBDatabase*); virtual ~IDBDatabaseCallbacksImpl(); + virtual void onForcedClose(); virtual void onVersionChange(const String& version); virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); void unregisterDatabase(IDBDatabase*); diff --git a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp index 1d849488f..e89a74cfd 100644 --- a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp @@ -30,6 +30,7 @@ #include "IDBDatabase.h" #include "IDBPendingTransactionMonitor.h" +#include "IDBTracing.h" #include "IDBUpgradeNeededEvent.h" #include "ScriptExecutionContext.h" @@ -67,6 +68,7 @@ void IDBOpenDBRequest::onBlocked(int64_t oldVersion) void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface> prpTransactionBackend, PassRefPtr<IDBDatabaseBackendInterface> prpDatabaseBackend) { + IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()"); if (!shouldEnqueueEvent()) return; @@ -86,6 +88,24 @@ void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransac enqueueEvent(IDBUpgradeNeededEvent::create(oldVersion, m_version, eventNames().upgradeneededEvent)); } +void IDBOpenDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) +{ + IDB_TRACE("IDBOpenDBRequest::onSuccess()"); + if (!shouldEnqueueEvent()) + return; + + RefPtr<IDBDatabase> idbDatabase; + if (m_result) { + idbDatabase = m_result->idbDatabase(); + ASSERT(idbDatabase); + } else { + idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend); + m_result = IDBAny::create(idbDatabase.get()); + } + idbDatabase->registerFrontendCallbacks(); + enqueueEvent(Event::create(eventNames().successEvent, false, false)); +} + bool IDBOpenDBRequest::shouldEnqueueEvent() const { if (m_contextStopped || !scriptExecutionContext()) diff --git a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h index 638f63157..c87db7ed1 100644 --- a/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.h @@ -37,8 +37,11 @@ public: static PassRefPtr<IDBOpenDBRequest> create(ScriptExecutionContext*, PassRefPtr<IDBAny> source, int64_t version); virtual ~IDBOpenDBRequest(); + using IDBRequest::onSuccess; + virtual void onBlocked(int64_t existingVersion) OVERRIDE; virtual void onUpgradeNeeded(int64_t oldVersion, PassRefPtr<IDBTransactionBackendInterface>, PassRefPtr<IDBDatabaseBackendInterface>) OVERRIDE; + virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>) OVERRIDE; // EventTarget virtual const AtomicString& interfaceName() const; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp index c96b32565..a94af33ca 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp @@ -291,24 +291,6 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRe enqueueEvent(createSuccessEvent()); } -void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend) -{ - IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)"); - if (!shouldEnqueueEvent()) - return; - - RefPtr<IDBDatabase> idbDatabase; - if (m_result) { - idbDatabase = m_result->idbDatabase(); - ASSERT(idbDatabase); - } else { - idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend); - m_result = IDBAny::create(idbDatabase.get()); - } - idbDatabase->registerFrontendCallbacks(); - enqueueEvent(createSuccessEvent()); -} - void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) { IDB_TRACE("IDBRequest::onSuccess(IDBKey)"); @@ -428,11 +410,6 @@ void IDBRequest::stop() markEarlyDeath(); } -void IDBRequest::onBlocked() -{ - ASSERT_NOT_REACHED(); -} - const AtomicString& IDBRequest::interfaceName() const { return eventNames().interfaceForIDBRequest; diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h index 92d58b748..7f9992485 100644 --- a/Source/WebCore/Modules/indexeddb/IDBRequest.h +++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h @@ -83,7 +83,6 @@ public: // IDBCallbacks virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(PassRefPtr<DOMStringList>); - virtual void onSuccess(PassRefPtr<IDBDatabaseBackendInterface>); virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>); @@ -91,8 +90,6 @@ public: virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&); virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>); virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { ASSERT_NOT_REACHED(); } // Not implemented. Callback should not reach the renderer side. - virtual void onBlocked(); - virtual void onBlocked(int64_t existingVersion) { ASSERT_NOT_REACHED(); } // ActiveDOMObject virtual bool hasPendingActivity() const OVERRIDE; diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake index 91ce8352e..45eee600e 100755 --- a/Source/WebCore/UseV8.cmake +++ b/Source/WebCore/UseV8.cmake @@ -64,7 +64,6 @@ LIST(APPEND WebCore_SOURCES bindings/v8/V8ObjectConstructor.cpp bindings/v8/V8PerContextData.cpp bindings/v8/V8PerIsolateData.cpp - bindings/v8/V8Proxy.cpp bindings/v8/V8RecursionScope.cpp bindings/v8/V8ThrowException.cpp bindings/v8/V8Utilities.cpp diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 770dd858c..dd677fd81 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -1619,6 +1619,7 @@ __ZN7WebCore7nsColorERKNS_5ColorE __ZN7WebCore8IntPointC1ERK8_NSPoint __ZN7WebCore9FloatRectC1ERK7_NSRect __ZNK7WebCore10FloatPointcv8_NSPointEv +__ZNK7WebCore14ScrollableArea18visibleContentRectEb __ZNK7WebCore6Cursor14platformCursorEv __ZNK7WebCore7IntRectcv7_NSRectEv __ZNK7WebCore7IntSizecv6CGSizeEv diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index a6e62cada..0ba33776f 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -531,6 +531,7 @@ 'platform/text/TextStream.h', 'platform/text/UnicodeBidi.h', 'platform/text/UnicodeRange.h', + 'platform/text/WritingMode.h', 'platform/text/mac/CharsetData.h', 'plugins/PluginData.h', 'plugins/PluginMainThreadScheduler.h', @@ -2204,7 +2205,6 @@ 'bindings/v8/NPV8Object.h', 'bindings/v8/Dictionary.cpp', 'bindings/v8/Dictionary.h', - 'bindings/v8/OwnHandle.h', 'bindings/v8/PageScriptDebugServer.cpp', 'bindings/v8/PageScriptDebugServer.h', 'bindings/v8/RetainedDOMInfo.cpp', @@ -2214,6 +2214,7 @@ 'bindings/v8/ScheduledAction.h', 'bindings/v8/ScopedDOMDataStore.cpp', 'bindings/v8/ScopedDOMDataStore.h', + 'bindings/v8/ScopedPersistent.h', 'bindings/v8/ScriptCachedFrameData.cpp', 'bindings/v8/ScriptCachedFrameData.h', 'bindings/v8/ScriptCallStackFactory.cpp', @@ -2299,8 +2300,6 @@ 'bindings/v8/V8PerContextData.h', 'bindings/v8/V8PerIsolateData.cpp', 'bindings/v8/V8PerIsolateData.h', - 'bindings/v8/V8Proxy.cpp', - 'bindings/v8/V8Proxy.h', 'bindings/v8/V8RecursionScope.cpp', 'bindings/v8/V8RecursionScope.h', 'bindings/v8/V8StringResource.cpp', @@ -8352,8 +8351,6 @@ 'platform/graphics/chromium/LayerChromium.cpp', 'platform/graphics/chromium/LayerChromium.h', 'platform/graphics/chromium/LayerPainterChromium.h', - 'platform/graphics/chromium/LayerRendererChromium.cpp', - 'platform/graphics/chromium/LayerRendererChromium.h', 'platform/graphics/chromium/LayerTextureSubImage.cpp', 'platform/graphics/chromium/LayerTextureSubImage.h', 'platform/graphics/chromium/LayerTextureUpdater.h', @@ -8463,6 +8460,8 @@ 'platform/graphics/chromium/cc/CCQuadCuller.cpp', 'platform/graphics/chromium/cc/CCQuadCuller.h', 'platform/graphics/chromium/cc/CCRenderer.h', + 'platform/graphics/chromium/cc/CCRendererGL.cpp', + 'platform/graphics/chromium/cc/CCRendererGL.h', 'platform/graphics/chromium/cc/CCRenderPass.cpp', 'platform/graphics/chromium/cc/CCRenderPass.h', 'platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 88752e296..8758fce19 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -34026,6 +34026,10 @@ > </File> <File + RelativePath="..\platform\text\WritingMode.h" + > + </File> + <File RelativePath="..\platform\graphics\WidthIterator.cpp" > </File> diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index d95f65847..a974ffaf6 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -307,6 +307,7 @@ 142B97CA13138943008BEF4B /* TextControlInnerElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 142B97C813138943008BEF4B /* TextControlInnerElements.h */; }; 1432E8470C51493800B1500F /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1432E8460C51493800B1500F /* GCController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1432E8490C51493F00B1500F /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1432E8480C51493F00B1500F /* GCController.cpp */; }; + 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14476AA715DC4BB100305DB2 /* WritingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1449E24C107D4A8400B5793F /* JSCallbackData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1449E24A107D4A8400B5793F /* JSCallbackData.h */; }; 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1449E286107D4DB400B5793F /* JSCallbackData.cpp */; }; 144FCE5214EC79BC000D17A3 /* FractionalLayoutUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 144FCE5114EC79BC000D17A3 /* FractionalLayoutUnit.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -7321,6 +7322,7 @@ 142B97C813138943008BEF4B /* TextControlInnerElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextControlInnerElements.h; sourceTree = "<group>"; }; 1432E8460C51493800B1500F /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; }; 1432E8480C51493F00B1500F /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; }; + 14476AA715DC4BB100305DB2 /* WritingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritingMode.h; sourceTree = "<group>"; }; 1449E24A107D4A8400B5793F /* JSCallbackData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackData.h; sourceTree = "<group>"; }; 1449E286107D4DB400B5793F /* JSCallbackData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackData.cpp; sourceTree = "<group>"; }; 144FCE5114EC79BC000D17A3 /* FractionalLayoutUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FractionalLayoutUnit.h; sourceTree = "<group>"; }; @@ -19986,6 +19988,7 @@ A863E2001343412000274926 /* UnicodeBidi.h */, B2C3DA1C0D006C1D00EF6F26 /* UnicodeRange.cpp */, B2C3DA1D0D006C1D00EF6F26 /* UnicodeRange.h */, + 14476AA715DC4BB100305DB2 /* WritingMode.h */, ); path = text; sourceTree = "<group>"; @@ -25445,6 +25448,7 @@ 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */, + 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -28592,11 +28596,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; }; name = Debug; @@ -28605,11 +28604,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; }; name = Release; @@ -28619,11 +28613,6 @@ baseConfigurationReference = 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */; buildSettings = { BUILD_VARIANTS = normal; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - ); - FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; }; name = Production; }; diff --git a/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp index 34c28e9ce..0f53d4420 100644 --- a/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp +++ b/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp @@ -64,7 +64,7 @@ bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLEr // Therefore an exception and returning true are the same thing - so, return true on an exception return true; } - return result.toBoolean(); + return result.toBoolean(exec); } } diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp index 39beae5da..a1f0c1b22 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -641,7 +641,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec) if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return jsUndefined(); } @@ -655,7 +655,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec) if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/JSDataViewCustom.cpp b/Source/WebCore/bindings/js/JSDataViewCustom.cpp index a88989bad..3eb7a3e1a 100644 --- a/Source/WebCore/bindings/js/JSDataViewCustom.cpp +++ b/Source/WebCore/bindings/js/JSDataViewCustom.cpp @@ -73,7 +73,7 @@ static JSValue getDataViewMember(ExecState* exec, DataView* imp, DataViewAccessT bool littleEndian = false; if (exec->argumentCount() > 1 && (type == AccessDataViewMemberAsFloat32 || type == AccessDataViewMemberAsFloat64)) { - littleEndian = exec->argument(1).toBoolean(); + littleEndian = exec->argument(1).toBoolean(exec); if (exec->hadException()) return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp index f4d2bf6d8..8e9948f1a 100644 --- a/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp @@ -165,8 +165,8 @@ JSValue JSDeviceMotionEvent::interval(ExecState*) const JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec) { const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec)); - bool bubbles = exec->argument(1).toBoolean(); - bool cancelable = exec->argument(2).toBoolean(); + bool bubbles = exec->argument(1).toBoolean(exec); + bool cancelable = exec->argument(2).toBoolean(exec); // If any of the parameters are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. diff --git a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp index 25976e411..d03b740aa 100644 --- a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp @@ -71,8 +71,8 @@ JSValue JSDeviceOrientationEvent::absolute(ExecState*) const JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) { const String& type = ustringToString(exec->argument(0).toString(exec)->value(exec)); - bool bubbles = exec->argument(1).toBoolean(); - bool cancelable = exec->argument(2).toBoolean(); + bool bubbles = exec->argument(1).toBoolean(exec); + bool cancelable = exec->argument(2).toBoolean(exec); // If alpha, beta or gamma are null or undefined, mark them as not provided. // Otherwise, use the standard JavaScript conversion. bool alphaProvided = !exec->argument(3).isUndefinedOrNull(); @@ -82,7 +82,7 @@ JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) bool gammaProvided = !exec->argument(5).isUndefinedOrNull(); double gamma = exec->argument(5).toNumber(exec); bool absoluteProvided = !exec->argument(6).isUndefinedOrNull(); - bool absolute = exec->argument(6).toBoolean(); + bool absolute = exec->argument(6).toBoolean(exec); RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute); DeviceOrientationEvent* imp = static_cast<DeviceOrientationEvent*>(impl()); imp->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get()); diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index ec8948ccf..85b759198 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -63,9 +63,9 @@ JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propert return PropertyFound; } -void JSDictionary::convertValue(ExecState*, JSValue value, bool& result) +void JSDictionary::convertValue(ExecState* exec, JSValue value, bool& result) { - result = value.toBoolean(); + result = value.toBoolean(exec); } void JSDictionary::convertValue(ExecState* exec, JSValue value, int& result) diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp index a72af1062..3f9a39fd2 100644 --- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -55,22 +55,22 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec) JSObject* jsAttrs = exec->argument(1).getObject(); Identifier alpha(exec, "alpha"); if (jsAttrs->hasProperty(exec, alpha)) - webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean()); + webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec)); Identifier depth(exec, "depth"); if (jsAttrs->hasProperty(exec, depth)) - webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean()); + webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean(exec)); Identifier stencil(exec, "stencil"); if (jsAttrs->hasProperty(exec, stencil)) - webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean()); + webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean(exec)); Identifier antialias(exec, "antialias"); if (jsAttrs->hasProperty(exec, antialias)) - webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean()); + webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean(exec)); Identifier premultipliedAlpha(exec, "premultipliedAlpha"); if (jsAttrs->hasProperty(exec, premultipliedAlpha)) - webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean()); + webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec)); Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer"); if (jsAttrs->hasProperty(exec, preserveDrawingBuffer)) - webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean()); + webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec)); } } #endif diff --git a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp index 7c4945053..338f4c479 100644 --- a/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp +++ b/Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp @@ -118,9 +118,9 @@ static void populateContextMenuItems(ExecState* exec, JSArray* array, ContextMen ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec)); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)->value(exec))); if (!enabled.isUndefined()) - menuItem.setEnabled(enabled.toBoolean()); + menuItem.setEnabled(enabled.toBoolean(exec)); if (!checked.isUndefined()) - menuItem.setChecked(checked.toBoolean()); + menuItem.setChecked(checked.toBoolean(exec)); menu.appendItem(menuItem); } } diff --git a/Source/WebCore/bindings/js/JSMessageEventCustom.cpp b/Source/WebCore/bindings/js/JSMessageEventCustom.cpp index 3511e679e..64fcef88a 100644 --- a/Source/WebCore/bindings/js/JSMessageEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSMessageEventCustom.cpp @@ -103,8 +103,8 @@ JSValue JSMessageEvent::ports(ExecState* exec) const static JSC::JSValue handleInitMessageEvent(JSMessageEvent* jsEvent, JSC::ExecState* exec) { const UString& typeArg = exec->argument(0).toString(exec)->value(exec); - bool canBubbleArg = exec->argument(1).toBoolean(); - bool cancelableArg = exec->argument(2).toBoolean(); + bool canBubbleArg = exec->argument(1).toBoolean(exec); + bool cancelableArg = exec->argument(2).toBoolean(exec); const UString& originArg = exec->argument(4).toString(exec)->value(exec); const UString& lastEventIdArg = exec->argument(5).toString(exec)->value(exec); DOMWindow* sourceArg = toDOMWindow(exec->argument(6)); diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index d6a171fb9..af008074f 100644 --- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -613,7 +613,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat if (exec->hadException()) return jsUndefined(); - bool transpose = exec->argument(1).toBoolean(); + bool transpose = exec->argument(1).toBoolean(exec); if (exec->hadException()) return jsUndefined(); diff --git a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 40c329b73..c08c29560 100644 --- a/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -89,7 +89,7 @@ JSValue JSXMLHttpRequest::open(ExecState* exec) ExceptionCode ec = 0; if (exec->argumentCount() >= 3) { - bool async = exec->argument(2).toBoolean(); + bool async = exec->argument(2).toBoolean(exec); if (exec->argumentCount() >= 4 && !exec->argument(3).isUndefined()) { String user = valueToStringWithNullCheck(exec, exec->argument(3)); diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp index 3aefad167..9ea9ec8f0 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp @@ -100,6 +100,14 @@ JSObject* JavaScriptCallFrame::thisObject() const return m_debuggerCallFrame.thisObject(); } +ExecState* JavaScriptCallFrame::exec() const +{ + ASSERT(m_isValid); + if (!m_isValid) + return 0; + return m_debuggerCallFrame.callFrame(); +} + // Evaluate some JavaScript code in the scope of this frame. JSValue JavaScriptCallFrame::evaluate(const UString& script, JSValue& exception) const { diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.h b/Source/WebCore/bindings/js/JavaScriptCallFrame.h index a581c4fc7..e987ecf88 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.h @@ -71,6 +71,7 @@ public: JSC::DebuggerCallFrame::Type type() const; JSC::ScopeChainNode* scopeChain() const; JSC::JSGlobalObject* dynamicGlobalObject() const; + JSC::ExecState* exec() const; JSC::JSObject* thisObject() const; JSC::JSValue evaluate(const JSC::UString& script, JSC::JSValue& exception) const; diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp index 967b3d21f..bbcd54299 100644 --- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp @@ -206,7 +206,7 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, const TextPosition& pos // An erroneous condition counts as "false". return false; } - return result.toBoolean(); + return result.toBoolean(m_currentCallFrame->exec()); } void ScriptDebugServer::clearBreakpoints() diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp index 9d5ca654d..ea702295b 100644 --- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp @@ -56,6 +56,7 @@ #include <limits> #include <JavaScriptCore/APICast.h> #include <JavaScriptCore/APIShims.h> +#include <runtime/BooleanObject.h> #include <runtime/DateInstance.h> #include <runtime/Error.h> #include <runtime/ExceptionHelpers.h> @@ -108,6 +109,11 @@ enum SerializationTag { ArrayBufferTag = 21, ArrayBufferViewTag = 22, ArrayBufferTransferTag = 23, + TrueObjectTag = 24, + FalseObjectTag = 25, + StringObjectTag = 26, + EmptyStringObjectTag = 27, + NumberObjectTag = 28, ErrorTag = 255 }; @@ -152,8 +158,10 @@ static unsigned typedArrayElementSize(ArrayBufferViewSubtag tag) * * Initial version was 1. * Version 2. added the ObjectReferenceTag and support for serialization of cyclic graphs. + * Version 3. added the FalseObjectTag, TrueObjectTag, NumberObjectTag, StringObjectTag + * and EmptyStringObjectTag for serialization of Boolean, Number and String objects. */ -static const unsigned int CurrentVersion = 2; +static const unsigned int CurrentVersion = 3; static const unsigned int TerminatorTag = 0xFFFFFFFF; static const unsigned int StringPoolTag = 0xFFFFFFFE; @@ -182,10 +190,14 @@ static const unsigned int StringPoolTag = 0xFFFFFFFE; * | OneTag * | FalseTag * | TrueTag + * | FalseObjectTag + * | TrueObjectTag * | DoubleTag <value:double> + * | NumberObjectTag <value:double> * | DateTag <value:double> * | String * | EmptyStringTag + * | EmptyStringObjectTag * | File * | FileList * | ImageData @@ -200,6 +212,10 @@ static const unsigned int StringPoolTag = 0xFFFFFFFE; * EmptyStringTag * StringTag StringData * + * StringObject: + * EmptyStringObjectTag + * StringObjectTag StringData + * * StringData :- * StringPoolTag <cpIndex:IndexType> * (not (TerminatorTag | StringPoolTag))<length:uint32_t><characters:UChar{length}> // Added to constant pool when seen, string length 0xFFFFFFFF is disallowed @@ -517,6 +533,16 @@ private: } } + void dumpStringObject(UString str) + { + if (str.isEmpty()) + write(EmptyStringObjectTag); + else { + write(StringObjectTag); + write(str); + } + } + bool dumpArrayBufferView(JSObject* obj, SerializationReturnCode& code) { write(ArrayBufferViewTag); @@ -585,6 +611,27 @@ private: if (value.isObject()) { JSObject* obj = asObject(value); + if (obj->inherits(&BooleanObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + write(asBooleanObject(value)->internalValue().toBoolean(m_exec) ? TrueObjectTag : FalseObjectTag); + return true; + } + if (obj->inherits(&StringObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + UString str = asString(asStringObject(value)->internalValue())->value(m_exec); + dumpStringObject(str); + return true; + } + if (obj->inherits(&NumberObject::s_info)) { + if (!startObjectInternal(obj)) // handle duplicates + return true; + write(NumberObjectTag); + NumberObject* obj = static_cast<NumberObject*>(asObject(value)); + write(obj->internalValue().asNumber()); + return true; + } if (obj->inherits(&JSFile::s_info)) { write(FileTag); write(toFile(obj)); @@ -1398,12 +1445,32 @@ private: return jsBoolean(false); case TrueTag: return jsBoolean(true); + case FalseObjectTag: { + BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); + obj->setInternalValue(m_exec->globalData(), jsBoolean(false)); + m_gcBuffer.append(obj); + return obj; + } + case TrueObjectTag: { + BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); + obj->setInternalValue(m_exec->globalData(), jsBoolean(true)); + m_gcBuffer.append(obj); + return obj; + } case DoubleTag: { double d; if (!read(d)) return JSValue(); return jsNumber(d); } + case NumberObjectTag: { + double d; + if (!read(d)) + return JSValue(); + NumberObject* obj = constructNumber(m_exec, m_globalObject, jsNumber(d)); + m_gcBuffer.append(obj); + return obj; + } case DateTag: { double d; if (!read(d)) @@ -1479,6 +1546,19 @@ private: } case EmptyStringTag: return jsEmptyString(&m_exec->globalData()); + case StringObjectTag: { + CachedStringRef cachedString; + if (!readStringData(cachedString)) + return JSValue(); + StringObject* obj = constructString(m_exec, m_globalObject, cachedString->jsString(m_exec)); + m_gcBuffer.append(obj); + return obj; + } + case EmptyStringObjectTag: { + StringObject* obj = constructString(m_exec, m_globalObject, jsEmptyString(&m_exec->globalData())); + m_gcBuffer.append(obj); + return obj; + } case RegExpTag: { CachedStringRef pattern; if (!readStringData(pattern)) diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 997be4137..e680dbf44 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -165,7 +165,7 @@ END JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean()); + impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); END return @GenerateEventListenerImpl; @@ -751,6 +751,15 @@ sub GenerateHeader push(@headerContent, " ptr->finishCreation(globalData);\n"); push(@headerContent, " return ptr;\n"); push(@headerContent, " }\n\n"); + } elsif ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { + AddIncludesForTypeInHeader($implType) unless $svgPropertyOrListPropertyType; + push(@headerContent, " static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); + push(@headerContent, " {\n"); + push(@headerContent, " globalObject->masqueradesAsUndefinedWatchpoint()->notifyWrite();\n"); + push(@headerContent, " $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalObject->globalData().heap)) $className(structure, globalObject, impl);\n"); + push(@headerContent, " ptr->finishCreation(globalObject->globalData());\n"); + push(@headerContent, " return ptr;\n"); + push(@headerContent, " }\n\n"); } else { AddIncludesForTypeInHeader($implType) unless $svgPropertyOrListPropertyType; push(@headerContent, " static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); @@ -3015,7 +3024,7 @@ sub JSValueToNative my $conditional = $signature->extendedAttributes->{"Conditional"}; my $type = $codeGenerator->StripModule($signature->type); - return "$value.toBoolean()" if $type eq "boolean"; + return "$value.toBoolean(exec)" if $type eq "boolean"; return "$value.toNumber(exec)" if $type eq "double"; return "$value.toFloat(exec)" if $type eq "float"; return "$value.toInt32(exec)" if $type eq "long" or $type eq "short"; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 5969d2d47..c68331820 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -2522,7 +2522,6 @@ sub GenerateImplementation AddToImplIncludes("BindingState.h"); AddToImplIncludes("ContextFeatures.h"); AddToImplIncludes("RuntimeEnabledFeatures.h"); - AddToImplIncludes("V8Proxy.h"); AddToImplIncludes("V8Binding.h"); AddToImplIncludes("V8DOMWrapper.h"); AddToImplIncludes("V8IsolatedContext.h"); @@ -3212,11 +3211,10 @@ sub GenerateCallbackImplementation # - Add default header template push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); - + AddToImplIncludes("ScriptExecutionContext.h"); AddToImplIncludes("V8Binding.h"); AddToImplIncludes("V8Callback.h"); - AddToImplIncludes("V8Proxy.h"); push(@implContent, "#include <wtf/Assertions.h>\n\n"); push(@implContent, "namespace WebCore {\n\n"); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp index 8474b1ab6..4cf95c9cf 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -253,7 +253,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener( JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -268,7 +268,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListen JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h index c3aa1f0cd..b442c0701 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h @@ -34,6 +34,7 @@ public: typedef JSDOMWrapper Base; static JSTestEventTarget* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestEventTarget> impl) { + globalObject->masqueradesAsUndefinedWatchpoint()->notifyWrite(); JSTestEventTarget* ptr = new (NotNull, JSC::allocateCell<JSTestEventTarget>(globalObject->globalData().heap)) JSTestEventTarget(structure, globalObject, impl); ptr->finishCreation(globalObject->globalData()); return ptr; diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 18affcc79..e172cf6c7 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -1048,7 +1048,7 @@ void setJSTestObjCreate(ExecState* exec, JSObject* thisObject, JSValue value) UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setCreate(value.toBoolean()); + impl->setCreate(value.toBoolean(exec)); } @@ -1084,7 +1084,7 @@ void setJSTestObjReflectedBooleanAttr(ExecState* exec, JSObject* thisObject, JSV UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean()); + impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean(exec)); } @@ -1120,7 +1120,7 @@ void setJSTestObjReflectedCustomBooleanAttr(ExecState* exec, JSObject* thisObjec UNUSED_PARAM(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean()); + impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean(exec)); } @@ -1681,7 +1681,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecStat JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean()); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -1696,7 +1696,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecS JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean()); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp index c93730d3a..bda47a5ac 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp @@ -33,7 +33,6 @@ #include "V8Float32Array.h" #include "V8Int32Array.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/Float32Array.h> #include <wtf/Float64Array.h> #include <wtf/GetPtr.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp index 23872e961..6e4be7579 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -30,7 +30,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index 0f19bfc91..ed2de6ee6 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -30,7 +30,6 @@ #include "V8Class2.h" #include "V8Class8.h" #include "V8DOMStringList.h" -#include "V8Proxy.h" #include "V8ThisClass.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp index e568d57ae..8975cf632 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index dacbd1d8d..fe3eb4fff 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp index b10b607a9..1940d7dbd 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp @@ -32,7 +32,6 @@ #include "V8Event.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp index ffb49fd4b..9375ce310 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp @@ -28,7 +28,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index d4b8161af..0098d5eb0 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -33,7 +33,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include "V8TestObj.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp index ab66706d6..ac1167998 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp @@ -30,7 +30,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp index d37f46dc0..7a74f5827 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp @@ -29,7 +29,6 @@ #include "V8Binding.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp index 9a3cef794..ce42f92ed 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp @@ -29,7 +29,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Node.h" -#include "V8Proxy.h" #include <wtf/UnusedParam.h> namespace WebCore { diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 3f0b324f0..553a3d1a6 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -44,7 +44,6 @@ #include "V8Document.h" #include "V8Float32Array.h" #include "V8IsolatedContext.h" -#include "V8Proxy.h" #include "V8SVGDocument.h" #include "V8SVGPoint.h" #include "V8ScriptProfile.h" diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index 45ace2076..ae8d18d45 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -34,7 +34,6 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8MessagePort.h" -#include "V8Proxy.h" #include <wtf/ArrayBuffer.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h index 021616e56..21a1d6d54 100644 --- a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h @@ -33,8 +33,8 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "OwnHandle.h" #include "PlatformString.h" +#include "ScopedPersistent.h" #include <v8-debug.h> #include <wtf/RefCounted.h> @@ -66,8 +66,8 @@ private: JavaScriptCallFrame(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame); RefPtr<JavaScriptCallFrame> m_caller; - OwnHandle<v8::Context> m_debuggerContext; - OwnHandle<v8::Object> m_callFrame; + ScopedPersistent<v8::Context> m_debuggerContext; + ScopedPersistent<v8::Object> m_callFrame; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScheduledAction.cpp b/Source/WebCore/bindings/v8/ScheduledAction.cpp index 2a5f89d2d..40ab33dfa 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.cpp +++ b/Source/WebCore/bindings/v8/ScheduledAction.cpp @@ -49,49 +49,20 @@ namespace WebCore { -ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> func, int argc, v8::Handle<v8::Value> argv[]) +ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[]) : m_context(context) + , m_function(function) , m_code(String(), KURL(), TextPosition::belowRangePosition()) { - m_function = v8::Persistent<v8::Function>::New(func); - -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_function); -#endif - - m_argc = argc; - if (argc > 0) { - m_argv = new v8::Persistent<v8::Value>[argc]; - for (int i = 0; i < argc; i++) { - m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]); - -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]); -#endif - } - } else - m_argv = 0; + m_args.reserveCapacity(argc); + for (int i = 0; i < argc; ++i) + m_args.append(v8::Persistent<v8::Value>::New(argv[i])); } ScheduledAction::~ScheduledAction() { - if (m_function.IsEmpty()) - return; - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_function); -#endif - m_function.Dispose(); - - for (int i = 0; i < m_argc; i++) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_argv[i]); -#endif - m_argv[i].Dispose(); - } - - if (m_argc > 0) - delete[] m_argv; + for (size_t i = 0; i < m_args.size(); ++i) + m_args[i].Dispose(); } void ScheduledAction::execute(ScriptExecutionContext* context) @@ -102,7 +73,7 @@ void ScheduledAction::execute(ScriptExecutionContext* context) return; if (!frame->script()->canExecuteScripts(AboutToExecuteScript)) return; - execute(frame->script()); + execute(frame); } #if ENABLE(WORKERS) else { @@ -112,47 +83,46 @@ void ScheduledAction::execute(ScriptExecutionContext* context) #endif } -void ScheduledAction::execute(ScriptController* script) +void ScheduledAction::execute(Frame* frame) { - ASSERT(script->proxy()); - v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get()); - if (v8Context.IsEmpty()) - return; // JS may not be enabled. + + v8::Handle<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + if (context.IsEmpty()) + return; + v8::Context::Scope scope(context); #if PLATFORM(CHROMIUM) TRACE_EVENT0("v8", "ScheduledAction::execute"); #endif - v8::Context::Scope scope(v8Context); - - // FIXME: Need to implement timeouts for preempting a long-running script. - if (!m_function.IsEmpty() && m_function->IsFunction()) - script->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv); + v8::Handle<v8::Function> function = m_function.get(); + if (!function.IsEmpty()) + frame->script()->callFunction(function, context->Global(), m_args.size(), m_args.data()); else - script->compileAndRunScript(m_code); + frame->script()->compileAndRunScript(m_code); - // The 'proxy' may be invalid at this point since JS could have released the owning Frame. + // The frame might be invalid at this point because JavaScript could have released it. } #if ENABLE(WORKERS) -void ScheduledAction::execute(WorkerContext* workerContext) +void ScheduledAction::execute(WorkerContext* worker) { - // In a Worker, the execution should always happen on a worker thread. - ASSERT(workerContext->thread()->threadID() == currentThread()); + ASSERT(worker->thread()->threadID() == currentThread()); - V8RecursionScope recursionScope(workerContext); - WorkerScriptController* scriptController = workerContext->script(); + V8RecursionScope recursionScope(worker); - if (!m_function.IsEmpty() && m_function->IsFunction()) { + v8::Handle<v8::Function> function = m_function.get(); + if (!function.IsEmpty()) { v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context.get()); - ASSERT(!v8Context.IsEmpty()); - v8::Context::Scope scope(v8Context); - m_function->Call(v8Context->Global(), m_argc, m_argv); + + v8::Handle<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + ASSERT(!context.IsEmpty()); + v8::Context::Scope scope(context); + + function->Call(context->Global(), m_args.size(), m_args.data()); } else - scriptController->evaluate(m_code); + worker->script()->evaluate(m_code); } #endif diff --git a/Source/WebCore/bindings/v8/ScheduledAction.h b/Source/WebCore/bindings/v8/ScheduledAction.h index e3f3bb440..17ca7b41a 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.h +++ b/Source/WebCore/bindings/v8/ScheduledAction.h @@ -31,45 +31,42 @@ #ifndef ScheduledAction_h #define ScheduledAction_h -#include "OwnHandle.h" +#include "ScopedPersistent.h" #include "ScriptSourceCode.h" -#include "V8GCController.h" -#include <wtf/Forward.h> - #include <v8.h> +#include <wtf/Forward.h> +#include <wtf/Vector.h> namespace WebCore { - class ScriptController; - class ScriptExecutionContext; - class WorkerContext; +class Frame; +class ScriptExecutionContext; +class WorkerContext; + +class ScheduledAction { +public: + ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); - class ScheduledAction { - public: - ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); - explicit ScheduledAction(v8::Handle<v8::Context> context, const WTF::String& code, const KURL& url = KURL()) - : m_context(context) - , m_argc(0) - , m_argv(0) - , m_code(code, url) - { - } + ScheduledAction(v8::Handle<v8::Context> context, const String& code, const KURL& url = KURL()) + : m_context(context) + , m_code(code, url) + { + } - virtual ~ScheduledAction(); - virtual void execute(ScriptExecutionContext*); + ~ScheduledAction(); + void execute(ScriptExecutionContext*); - private: - void execute(ScriptController*); +private: + void execute(Frame*); #if ENABLE(WORKERS) - void execute(WorkerContext*); + void execute(WorkerContext*); #endif - OwnHandle<v8::Context> m_context; - v8::Persistent<v8::Function> m_function; - int m_argc; - v8::Persistent<v8::Value>* m_argv; - ScriptSourceCode m_code; - }; + ScopedPersistent<v8::Context> m_context; + ScopedPersistent<v8::Function> m_function; + Vector<v8::Persistent<v8::Value> > m_args; + ScriptSourceCode m_code; +}; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/OwnHandle.h b/Source/WebCore/bindings/v8/ScopedPersistent.h index 668f5d414..f5d696ccc 100644 --- a/Source/WebCore/bindings/v8/OwnHandle.h +++ b/Source/WebCore/bindings/v8/ScopedPersistent.h @@ -28,29 +28,31 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef OwnHandle_h -#define OwnHandle_h +#ifndef ScopedPersistent_h +#define ScopedPersistent_h #include <v8.h> +#include <wtf/Noncopyable.h> namespace WebCore { template<typename T> -class OwnHandle { +class ScopedPersistent { + WTF_MAKE_NONCOPYABLE(ScopedPersistent); public: - OwnHandle() { } + ScopedPersistent() { } - explicit OwnHandle(v8::Handle<T> handle) + explicit ScopedPersistent(v8::Handle<T> handle) : m_handle(v8::Persistent<T>::New(handle)) { } - ~OwnHandle() + ~ScopedPersistent() { clear(); } - v8::Handle<T> get() const { return m_handle; } + v8::Persistent<T> get() const { return m_handle; } void set(v8::Handle<T> handle) { @@ -58,6 +60,12 @@ public: m_handle = v8::Persistent<T>::New(handle); } + void adopt(v8::Persistent<T> handle) + { + clear(); + m_handle = handle; + } + // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. void clear() { @@ -73,4 +81,4 @@ private: } // namespace WebCore -#endif // OwnHandle_h +#endif // ScopedPersistent_h diff --git a/Source/WebCore/bindings/v8/ScriptController.cpp b/Source/WebCore/bindings/v8/ScriptController.cpp index 1fb36b374..4672570e6 100644 --- a/Source/WebCore/bindings/v8/ScriptController.cpp +++ b/Source/WebCore/bindings/v8/ScriptController.cpp @@ -59,6 +59,7 @@ #include "V8Binding.h" #include "V8DOMWindow.h" #include "V8Event.h" +#include "V8GCController.h" #include "V8HiddenPropertyName.h" #include "V8HTMLEmbedElement.h" #include "V8IsolatedContext.h" @@ -111,7 +112,6 @@ ScriptController::ScriptController(Frame* frame) , m_sourceURL(0) , m_windowShell(V8DOMWindowShell::create(frame)) , m_paused(false) - , m_proxy(adoptPtr(new V8Proxy(frame))) #if ENABLE(NETSCAPE_PLUGIN_API) , m_wrappedWindowScriptNPObject(0) #endif @@ -120,6 +120,7 @@ ScriptController::ScriptController(Frame* frame) ScriptController::~ScriptController() { + windowShell()->destroyGlobal(); clearForClose(); } @@ -193,7 +194,7 @@ bool ScriptController::processingUserGesture() v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) { - // Keep Frame (and therefore ScriptController and V8Proxy) alive. + // Keep Frame (and therefore ScriptController) alive. RefPtr<Frame> protect(m_frame); return ScriptController::callFunctionWithInstrumentation(m_frame ? m_frame->document() : 0, function, receiver, argc, args); } @@ -647,7 +648,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement void ScriptController::clearWindowShell(DOMWindow*, bool) { // V8 binding expects ScriptController::clearWindowShell only be called - // when a frame is loading a new page. V8Proxy::clearForNavigation + // when a frame is loading a new page. ScriptController::clearForNavigation // creates a new context for the new page. clearForNavigation(); } diff --git a/Source/WebCore/bindings/v8/ScriptController.h b/Source/WebCore/bindings/v8/ScriptController.h index ca59838ac..ad9bf7116 100644 --- a/Source/WebCore/bindings/v8/ScriptController.h +++ b/Source/WebCore/bindings/v8/ScriptController.h @@ -31,18 +31,17 @@ #ifndef ScriptController_h #define ScriptController_h +#include "FrameLoaderTypes.h" #include "ScriptControllerBase.h" #include "ScriptInstance.h" #include "ScriptValue.h" -#include "V8Proxy.h" - #include <v8.h> - #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/TextPosition.h> struct NPObject; @@ -53,12 +52,25 @@ class Event; class Frame; class HTMLDocument; class HTMLPlugInElement; -class PagePopupClient; +class KURL; class ScriptSourceCode; class ScriptState; +class SecurityOrigin; class V8DOMWindowShell; +class V8IsolatedContext; class Widget; +// Note: although the pointer is raw, the instance is kept alive by a strong +// reference to the v8 context it contains, which is not made weak until we +// call world->destroy(). +// +// FIXME: We want to eventually be holding window shells instead of the +// IsolatedContext directly. +// https://bugs.webkit.org/show_bug.cgi?id=94875 +typedef HashMap<int, V8IsolatedContext*> IsolatedWorldMap; + +typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; + typedef WTF::Vector<v8::Extension*> V8Extensions; class ScriptController { @@ -66,9 +78,8 @@ public: ScriptController(Frame*); ~ScriptController(); - // FIXME: V8Proxy should either be folded into ScriptController - // or this accessor should be made JSProxy* - V8Proxy* proxy() { return m_proxy.get(); } + // FIXME: This should eventually take DOMWrapperWorld argument. + // https://bugs.webkit.org/show_bug.cgi?id=94875 V8DOMWindowShell* windowShell() const { return m_windowShell.get(); } ScriptValue executeScript(const ScriptSourceCode&); @@ -150,11 +161,9 @@ public: // --- and there is only one VM instance. --- // Returns the frame for the entered context. See comments in - // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForEnteredContext(); // Returns the frame for the current context. See comments in - // V8Proxy::retrieveFrameForEnteredContext() for more information. static Frame* retrieveFrameForCurrentContext(); // Returns V8 Context. If none exists, creates a new context. @@ -227,7 +236,6 @@ private: bool m_paused; - OwnPtr<V8Proxy> m_proxy; typedef HashMap<Widget*, NPObject*> PluginObjectMap; // A mapping between Widgets and their corresponding script object. diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp index 1455aaec4..ef1691eec 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -441,7 +441,7 @@ void ScriptDebugServer::compileScript(ScriptState* state, const String& expressi return; *scriptId = toWebCoreStringWithNullOrUndefinedCheck(script->Id()); - m_compiledScripts.set(*scriptId, adoptPtr(new OwnHandle<v8::Script>(script))); + m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(script))); } void ScriptDebugServer::clearCompiledScripts() @@ -454,8 +454,8 @@ void ScriptDebugServer::runScript(ScriptState* state, const String& scriptId, Sc if (!m_compiledScripts.contains(scriptId)) return; v8::HandleScope handleScope; - OwnHandle<v8::Script>* scriptOwnHandle = m_compiledScripts.get(scriptId); - v8::Local<v8::Script> script = v8::Local<v8::Script>::New(scriptOwnHandle->get()); + ScopedPersistent<v8::Script>* scriptHandle = m_compiledScripts.get(scriptId); + v8::Local<v8::Script> script = v8::Local<v8::Script>::New(scriptHandle->get()); m_compiledScripts.remove(scriptId); if (script.IsEmpty()) return; diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.h b/Source/WebCore/bindings/v8/ScriptDebugServer.h index 4d1e65e09..244d28577 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.h +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.h @@ -33,8 +33,8 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "OwnHandle.h" #include "PlatformString.h" +#include "ScopedPersistent.h" #include "ScriptBreakpoint.h" #include "Timer.h" #include <v8-debug.h> @@ -125,13 +125,13 @@ protected: v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]); PauseOnExceptionsState m_pauseOnExceptionsState; - OwnHandle<v8::Object> m_debuggerScript; - OwnHandle<v8::Object> m_executionState; + ScopedPersistent<v8::Object> m_debuggerScript; + ScopedPersistent<v8::Object> m_executionState; v8::Local<v8::Context> m_pausedContext; bool m_breakpointsActivated; - OwnHandle<v8::FunctionTemplate> m_breakProgramCallbackTemplate; - HashMap<String, OwnPtr<OwnHandle<v8::Script> > > m_compiledScripts; + ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; + HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptInstance.cpp b/Source/WebCore/bindings/v8/ScriptInstance.cpp index 1f407d0f5..e62fb7d7a 100644 --- a/Source/WebCore/bindings/v8/ScriptInstance.cpp +++ b/Source/WebCore/bindings/v8/ScriptInstance.cpp @@ -31,51 +31,11 @@ #include "config.h" #include "ScriptInstance.h" -#include "V8GCController.h" -#include <wtf/Assertions.h> - namespace WebCore { -V8ScriptInstance::V8ScriptInstance() -{ -} - V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance) + : m_instance(instance) { - set(instance); -} - -V8ScriptInstance::~V8ScriptInstance() -{ - clear(); -} - -v8::Persistent<v8::Object> V8ScriptInstance::instance() -{ - return m_instance; -} - -void V8ScriptInstance::clear() -{ - if (m_instance.IsEmpty()) - return; -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_instance); -#endif - m_instance.Dispose(); - m_instance.Clear(); -} - -void V8ScriptInstance::set(v8::Handle<v8::Object> instance) -{ - clear(); - if (instance.IsEmpty()) - return; - - m_instance = v8::Persistent<v8::Object>::New(instance); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTINSTANCE, this, m_instance); -#endif } } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/ScriptInstance.h b/Source/WebCore/bindings/v8/ScriptInstance.h index 2fe37364f..7f6438799 100644 --- a/Source/WebCore/bindings/v8/ScriptInstance.h +++ b/Source/WebCore/bindings/v8/ScriptInstance.h @@ -31,8 +31,8 @@ #ifndef ScriptInstance_h #define ScriptInstance_h +#include "ScopedPersistent.h" #include <v8.h> - #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -41,19 +41,14 @@ namespace WebCore { class V8ScriptInstance : public RefCounted<V8ScriptInstance> { public: - static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) - { - return adoptRef(new V8ScriptInstance(instance)); - } - V8ScriptInstance(); - V8ScriptInstance(v8::Handle<v8::Object>); - ~V8ScriptInstance(); - v8::Persistent<v8::Object> instance(); + static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance) { return adoptRef(new V8ScriptInstance(instance)); } + + v8::Persistent<v8::Object> instance() { return m_instance.get(); } private: - void clear(); - void set(v8::Handle<v8::Object>); - mutable v8::Persistent<v8::Object> m_instance; + explicit V8ScriptInstance(v8::Handle<v8::Object>); + + ScopedPersistent<v8::Object> m_instance; }; typedef RefPtr<V8ScriptInstance> ScriptInstance; diff --git a/Source/WebCore/bindings/v8/ScriptState.cpp b/Source/WebCore/bindings/v8/ScriptState.cpp index a975b14c5..8a0580bcd 100644 --- a/Source/WebCore/bindings/v8/ScriptState.cpp +++ b/Source/WebCore/bindings/v8/ScriptState.cpp @@ -41,76 +41,53 @@ #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" #include "WorkerScriptController.h" - #include <v8.h> #include <wtf/Assertions.h> namespace WebCore { ScriptState::ScriptState(v8::Handle<v8::Context> context) - : m_context(v8::Persistent<v8::Context>::New(context)) + : m_context(context) { - m_context.MakeWeak(this, &ScriptState::weakReferenceCallback); + m_context.get().MakeWeak(this, &ScriptState::weakReferenceCallback); } ScriptState::~ScriptState() { - m_context.Dispose(); - m_context.Clear(); } DOMWindow* ScriptState::domWindow() const { v8::HandleScope handleScope; - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype()); - if (!V8DOMWrapper::isWrapperOfType(v8RealGlobal, &V8DOMWindow::info)) - return 0; - return V8DOMWindow::toNative(v8RealGlobal); + return toDOMWindow(m_context.get()); } ScriptExecutionContext* ScriptState::scriptExecutionContext() const { v8::HandleScope handleScope; - - v8::Handle<v8::Object> global = m_context->Global(); - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(global->GetPrototype()); - if (V8DOMWrapper::isWrapperOfType(v8RealGlobal, &V8DOMWindow::info)) - return V8DOMWindow::toNative(v8RealGlobal)->scriptExecutionContext(); -#if ENABLE(WORKERS) - global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global); - if (!global.IsEmpty()) - return V8WorkerContext::toNative(global)->scriptExecutionContext(); -#endif - return 0; + return toScriptExecutionContext(m_context.get()); } ScriptState* ScriptState::forContext(v8::Local<v8::Context> context) { v8::Context::Scope contextScope(context); - v8::Local<v8::Object> global = context->Global(); - // Skip proxy object. The proxy object will survive page navigation while we need - // an object whose lifetime coincides with that of the inspected context. - global = v8::Local<v8::Object>::Cast(global->GetPrototype()); + v8::Local<v8::Object> innerGlobal = v8::Local<v8::Object>::Cast(context->Global()->GetPrototype()); - v8::Handle<v8::String> key = V8HiddenPropertyName::scriptState(); - v8::Local<v8::Value> val = global->GetHiddenValue(key); - if (!val.IsEmpty() && val->IsExternal()) - return static_cast<ScriptState*>(v8::External::Cast(*val)->Value()); + v8::Local<v8::Value> scriptStateWrapper = innerGlobal->GetHiddenValue(V8HiddenPropertyName::scriptState()); + if (!scriptStateWrapper.IsEmpty() && scriptStateWrapper->IsExternal()) + return static_cast<ScriptState*>(v8::External::Cast(*scriptStateWrapper)->Value()); - ScriptState* state = new ScriptState(context); - global->SetHiddenValue(key, v8::External::New(state)); - return state; + ScriptState* scriptState = new ScriptState(context); + innerGlobal->SetHiddenValue(V8HiddenPropertyName::scriptState(), v8::External::New(scriptState)); + return scriptState; } ScriptState* ScriptState::current() { v8::HandleScope handleScope; v8::Local<v8::Context> context = v8::Context::GetCurrent(); - if (context.IsEmpty()) { - ASSERT_NOT_REACHED(); - return 0; - } + ASSERT(!context.IsEmpty()); return ScriptState::forContext(context); } diff --git a/Source/WebCore/bindings/v8/ScriptState.h b/Source/WebCore/bindings/v8/ScriptState.h index 009886a17..f59aa8da0 100644 --- a/Source/WebCore/bindings/v8/ScriptState.h +++ b/Source/WebCore/bindings/v8/ScriptState.h @@ -32,11 +32,13 @@ #define ScriptState_h #include "DOMWrapperWorld.h" +#include "ScopedPersistent.h" #include <v8.h> #include <wtf/Noncopyable.h> #include <wtf/RefCounted.h> namespace WebCore { + class DOMWindow; class DOMWrapperWorld; class Frame; @@ -57,7 +59,7 @@ public: v8::Local<v8::Context> context() const { - return v8::Local<v8::Context>::New(m_context); + return v8::Local<v8::Context>::New(m_context.get()); } DOMWindow* domWindow() const; @@ -77,7 +79,7 @@ private: static void weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter); v8::Local<v8::Value> m_exception; - v8::Persistent<v8::Context> m_context; + ScopedPersistent<v8::Context> m_context; }; class EmptyScriptState : public ScriptState { @@ -89,24 +91,24 @@ public: class ScriptStateProtectedPtr { WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); public: - ScriptStateProtectedPtr() : m_scriptState(0) { } - ScriptStateProtectedPtr(ScriptState* scriptState) : m_scriptState(scriptState) + ScriptStateProtectedPtr() + : m_scriptState(0) { - v8::HandleScope handleScope; - // Keep the context from being GC'ed. ScriptState is guaranteed to be live while the context is live. - m_context = v8::Persistent<v8::Context>::New(scriptState->context()); } - ~ScriptStateProtectedPtr() + + ScriptStateProtectedPtr(ScriptState* scriptState) + : m_scriptState(scriptState) { - if (!m_context.IsEmpty()) { - m_context.Dispose(); - m_context.Clear(); - } + v8::HandleScope handleScope; + // Keep the context from being GC'ed. ScriptState is guaranteed to be live while the context is live. + m_context.set(scriptState->context()); } + ScriptState* get() const { return m_scriptState; } + private: ScriptState* m_scriptState; - v8::Persistent<v8::Context> m_context; + ScopedPersistent<v8::Context> m_context; }; DOMWindow* domWindowFromScriptState(ScriptState*); diff --git a/Source/WebCore/bindings/v8/ScriptValue.cpp b/Source/WebCore/bindings/v8/ScriptValue.cpp index 31bcd23ee..1c48fdfc6 100644 --- a/Source/WebCore/bindings/v8/ScriptValue.cpp +++ b/Source/WebCore/bindings/v8/ScriptValue.cpp @@ -40,14 +40,17 @@ namespace WebCore { +ScriptValue::~ScriptValue() +{ +} + PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState) { ScriptScope scope(scriptState); return SerializedScriptValue::create(v8Value()); } -PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, - MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow) +PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow) { ScriptScope scope(scriptState); return SerializedScriptValue::create(v8Value(), messagePorts, arrayBuffers, didThrow); @@ -61,24 +64,23 @@ ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptV bool ScriptValue::getString(String& result) const { - if (m_value.IsEmpty()) + if (m_value.get().IsEmpty()) return false; - if (!m_value->IsString()) + if (!m_value.get()->IsString()) return false; - result = toWebCoreString(m_value); + result = toWebCoreString(m_value.get()); return true; } String ScriptValue::toString(ScriptState*) const { v8::TryCatch block; - v8::Handle<v8::String> s = m_value->ToString(); - // Handle the case where an exception is thrown as part of invoking toString on the object. + v8::Handle<v8::String> string = m_value.get()->ToString(); if (block.HasCaught()) return String(); - return v8StringToWebCoreString<String>(s, DoNotExternalize); + return v8StringToWebCoreString<String>(string, DoNotExternalize); } #if ENABLE(INSPECTOR) @@ -140,7 +142,7 @@ PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptStat v8::HandleScope handleScope; // v8::Object::GetPropertyNames() expects current context to be not null. v8::Context::Scope contextScope(scriptState->context()); - return v8ToInspectorValue(m_value, InspectorValue::maxDepth); + return v8ToInspectorValue(m_value.get(), InspectorValue::maxDepth); } #endif diff --git a/Source/WebCore/bindings/v8/ScriptValue.h b/Source/WebCore/bindings/v8/ScriptValue.h index 0f489afbe..70dbff0dd 100644 --- a/Source/WebCore/bindings/v8/ScriptValue.h +++ b/Source/WebCore/bindings/v8/ScriptValue.h @@ -31,17 +31,17 @@ #ifndef ScriptValue_h #define ScriptValue_h -#include "PlatformString.h" +#include "ScopedPersistent.h" #include "ScriptState.h" - #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> -#ifndef NDEBUG -#include "V8GCController.h" -#endif +#ifndef NDEBUG +#include "V8GCController.h" +#endif namespace WTF { class ArrayBuffer; @@ -57,28 +57,21 @@ typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; class ScriptValue { public: - ScriptValue() {} + ScriptValue() { } + virtual ~ScriptValue(); ScriptValue(v8::Handle<v8::Value> value) { if (value.IsEmpty()) return; - - m_value = v8::Persistent<v8::Value>::New(value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif + m_value.set(value); } ScriptValue(const ScriptValue& value) { - if (value.m_value.IsEmpty()) + if (value.hasNoValue()) return; - - m_value = v8::Persistent<v8::Value>::New(value.m_value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif + m_value.set(value.m_value.get()); } ScriptValue& operator=(const ScriptValue& value) @@ -86,32 +79,28 @@ public: if (this == &value) return *this; - clear(); + m_value.clear(); - if (value.m_value.IsEmpty()) + if (value.hasNoValue()) return *this; - m_value = v8::Persistent<v8::Value>::New(value.m_value); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(SCRIPTVALUE, this, m_value); -#endif - + m_value.set(value.m_value.get()); return *this; } bool operator==(const ScriptValue& value) const { - return m_value == value.m_value; + return m_value.get() == value.m_value.get(); } bool isEqual(ScriptState*, const ScriptValue& value) const { - return m_value == value.m_value; + return m_value.get() == value.m_value.get(); } bool isFunction() const { - return m_value->IsFunction(); + return m_value.get()->IsFunction(); } bool operator!=(const ScriptValue& value) const @@ -121,22 +110,22 @@ public: bool isNull() const { - return m_value->IsNull(); + return m_value.get()->IsNull(); } bool isUndefined() const { - return m_value->IsUndefined(); + return m_value.get()->IsUndefined(); } bool isObject() const { - return m_value->IsObject(); + return m_value.get()->IsObject(); } bool hasNoValue() const { - return m_value.IsEmpty(); + return m_value.get().IsEmpty(); } PassRefPtr<SerializedScriptValue> serialize(ScriptState*); @@ -145,22 +134,11 @@ public: void clear() { - if (m_value.IsEmpty()) - return; - -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_value); -#endif - m_value.Dispose(); - m_value.Clear(); + m_value.clear(); } - virtual ~ScriptValue() - { - clear(); - } + v8::Handle<v8::Value> v8Value() const { return m_value.get(); } - v8::Handle<v8::Value> v8Value() const { return m_value; } bool getString(ScriptState*, String& result) const { return getString(result); } bool getString(String& result) const; String toString(ScriptState*) const; @@ -168,7 +146,7 @@ public: PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const; private: - mutable v8::Persistent<v8::Value> m_value; + ScopedPersistent<v8::Value> m_value; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp index 04f399163..0d2115276 100644 --- a/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -47,10 +47,10 @@ namespace WebCore { -static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter) +void V8AbstractEventListener::weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter) { V8AbstractEventListener* listener = static_cast<V8AbstractEventListener*>(parameter); - listener->disposeListenerObject(); + listener->m_listener.clear(); } V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, const WorldContextHandle& worldContext) @@ -65,12 +65,10 @@ V8AbstractEventListener::V8AbstractEventListener(bool isAttribute, const WorldCo V8AbstractEventListener::~V8AbstractEventListener() { - if (!m_listener.IsEmpty()) { + if (!m_listener.get().IsEmpty()) { v8::HandleScope scope; - v8::Local<v8::Object> listener = v8::Local<v8::Object>::New(m_listener); - V8EventListenerList::clearWrapper(listener, m_isAttribute); + V8EventListenerList::clearWrapper(v8::Local<v8::Object>::New(m_listener.get()), m_isAttribute); } - disposeListenerObject(); #if ENABLE(INSPECTOR) ThreadLocalInspectorCounters::current().decrementCounter(ThreadLocalInspectorCounters::JSEventListenerCounter); #endif @@ -104,25 +102,10 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event invokeEventHandler(context, event, jsEvent); } -void V8AbstractEventListener::disposeListenerObject() -{ - if (!m_listener.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_listener); -#endif - m_listener.Dispose(); - m_listener.Clear(); - } -} - void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener) { - disposeListenerObject(); - m_listener = v8::Persistent<v8::Object>::New(listener); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(EVENT_LISTENER, this, m_listener); -#endif - m_listener.MakeWeak(this, &weakEventListenerCallback); + m_listener.set(listener); + m_listener.get().MakeWeak(this, &V8AbstractEventListener::weakEventListenerCallback); } void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context, Event* event, v8::Handle<v8::Value> jsEvent) @@ -201,8 +184,8 @@ bool V8AbstractEventListener::shouldPreventDefault(v8::Local<v8::Value> returnVa v8::Local<v8::Object> V8AbstractEventListener::getReceiverObject(Event* event) { - if (!m_listener.IsEmpty() && !m_listener->IsFunction()) - return v8::Local<v8::Object>::New(m_listener); + if (!m_listener.get().IsEmpty() && !m_listener.get()->IsFunction()) + return v8::Local<v8::Object>::New(m_listener.get()); EventTarget* target = event->currentTarget(); v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target); diff --git a/Source/WebCore/bindings/v8/V8AbstractEventListener.h b/Source/WebCore/bindings/v8/V8AbstractEventListener.h index 672ba6dba..19a37e0a7 100644 --- a/Source/WebCore/bindings/v8/V8AbstractEventListener.h +++ b/Source/WebCore/bindings/v8/V8AbstractEventListener.h @@ -32,8 +32,8 @@ #define V8AbstractEventListener_h #include "EventListener.h" +#include "ScopedPersistent.h" #include "WorldContextHandle.h" - #include <v8.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -41,8 +41,6 @@ namespace WebCore { class Event; - class Frame; - class V8Proxy; // There are two kinds of event listeners: HTML or non-HMTL. onload, // onfocus, etc (attributes) are always HTML event handler type; Event @@ -80,29 +78,26 @@ namespace WebCore { v8::Local<v8::Object> getListenerObject(ScriptExecutionContext* context) { prepareListenerObject(context); - return v8::Local<v8::Object>::New(m_listener); + return v8::Local<v8::Object>::New(m_listener.get()); } v8::Local<v8::Object> getExistingListenerObject() { - return v8::Local<v8::Object>::New(m_listener); + return v8::Local<v8::Object>::New(m_listener.get()); } // Provides access to the underlying handle for GC. Returned // value is a weak handle and so not guaranteed to stay alive. v8::Persistent<v8::Object> existingListenerObjectPersistentHandle() { - return m_listener; + return m_listener.get(); } bool hasExistingListenerObject() { - return !m_listener.IsEmpty(); + return !m_listener.get().IsEmpty(); } - // Dispose listener object and clear the handle. - void disposeListenerObject(); - const WorldContextHandle& worldContext() const { return m_worldContext; } protected: @@ -118,6 +113,8 @@ namespace WebCore { v8::Local<v8::Object> getReceiverObject(Event*); private: + static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter); + // Implementation of EventListener function. virtual bool virtualisAttribute() const { return m_isAttribute; } @@ -125,7 +122,7 @@ namespace WebCore { virtual bool shouldPreventDefault(v8::Local<v8::Value> returnValue); - v8::Persistent<v8::Object> m_listener; + ScopedPersistent<v8::Object> m_listener; // Indicates if this is an HTML type listener. bool m_isAttribute; diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index bf57f8286..acd043aa5 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -37,17 +37,19 @@ #include "Frame.h" #include "MemoryInstrumentation.h" #include "PlatformString.h" +#include "PlatformSupport.h" #include "QualifiedName.h" #include "Settings.h" #include "V8DOMStringList.h" #include "V8DOMWindow.h" #include "V8Element.h" #include "V8ObjectConstructor.h" +#include "V8WorkerContext.h" #include "V8XPathNSResolver.h" #include "WorkerContext.h" #include "WorkerContextExecutionProxy.h" +#include "WorldContextHandle.h" #include "XPathNSResolver.h" - #include <wtf/MathExtras.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> @@ -261,6 +263,21 @@ DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) return V8DOMWindow::toNative(global); } +ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context> context) +{ + v8::Handle<v8::Object> global = context->Global(); + v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global); + if (!windowWrapper.IsEmpty()) + return V8DOMWindow::toNative(windowWrapper)->scriptExecutionContext(); +#if ENABLE(WORKERS) + v8::Handle<v8::Object> workerWrapper = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global); + if (!workerWrapper.IsEmpty()) + return V8WorkerContext::toNative(workerWrapper)->scriptExecutionContext(); +#endif + // FIXME: Is this line of code reachable? + return 0; +} + Frame* toFrameIfNotDetached(v8::Handle<v8::Context> context) { DOMWindow* window = toDOMWindow(context); diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index 2333cede0..c8f31b28c 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -353,8 +353,8 @@ namespace WebCore { PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>); PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>); - // Returns the window object associated with a context. DOMWindow* toDOMWindow(v8::Handle<v8::Context>); + ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context>); // Returns the context associated with a ScriptExecutionContext. v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle&); diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index 3e6a78e24..4d87e72e1 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -54,6 +54,7 @@ #include "V8DOMMap.h" #include "V8DOMWindow.h" #include "V8Document.h" +#include "V8GCController.h" #include "V8GCForContextDispose.h" #include "V8HTMLDocument.h" #include "V8HiddenPropertyName.h" @@ -93,7 +94,7 @@ static void reportFatalErrorInV8(const char* location, const char* message) { // V8 is shutdown, we cannot use V8 api. // The only thing we can do is to disable JavaScript. - // FIXME: clean up V8Proxy and disable JavaScript. + // FIXME: clean up ScriptController and disable JavaScript. int memoryUsageMB = -1; #if PLATFORM(CHROMIUM) memoryUsageMB = MemoryUsageSupport::actualMemoryUsageMB(); @@ -158,6 +159,31 @@ static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessT targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(activeDOMWindow(BindingState::instance()))); } +static void initializeV8IfNeeded() +{ + ASSERT(isMainThread()); + + static bool initialized = false; + if (initialized) + return; + initialized = true; + + v8::V8::IgnoreOutOfMemoryException(); + v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); + v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); + v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); + v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); + v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); +#if ENABLE(JAVASCRIPT_DEBUGGER) + ScriptProfiler::initialize(); +#endif + V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); + + // FIXME: Remove the following 2 lines when V8 default has changed. + const char es5ReadonlyFlag[] = "--es5_readonly"; + v8::V8::SetFlagsFromString(es5ReadonlyFlag, sizeof(es5ReadonlyFlag)); +} + PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame) { return adoptRef(new V8DOMWindowShell(frame)); @@ -172,16 +198,15 @@ bool V8DOMWindowShell::isContextInitialized() { // m_context, m_global, and m_wrapperBoilerplates should // all be non-empty if if m_context is non-empty. - ASSERT(m_context.IsEmpty() || !m_global.IsEmpty()); - return !m_context.IsEmpty(); + ASSERT(m_context.get().IsEmpty() || !m_global.get().IsEmpty()); + return !m_context.get().IsEmpty(); } void V8DOMWindowShell::disposeContextHandles() { - if (!m_context.IsEmpty()) { - m_frame->loader()->client()->willReleaseScriptContext(m_context, 0); - m_context.Dispose(); - m_context.Clear(); + if (!m_context.get().IsEmpty()) { + m_frame->loader()->client()->willReleaseScriptContext(m_context.get(), 0); + m_context.clear(); // It's likely that disposing the context has created a lot of // garbage. Notify V8 about this so it'll have a chance of cleaning @@ -195,48 +220,40 @@ void V8DOMWindowShell::disposeContextHandles() void V8DOMWindowShell::destroyGlobal() { - if (!m_global.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_global); -#endif - m_global.Dispose(); - m_global.Clear(); - } + m_global.clear(); } void V8DOMWindowShell::clearForClose() { - if (!m_context.IsEmpty()) { - v8::HandleScope handleScope; + if (m_context.get().IsEmpty()) + return; - clearDocumentWrapper(); - disposeContextHandles(); - } + v8::HandleScope handleScope; + clearDocumentWrapper(); + disposeContextHandles(); } void V8DOMWindowShell::clearForNavigation() { - if (!m_context.IsEmpty()) { - v8::HandleScope handle; - clearDocumentWrapper(); - - v8::Context::Scope contextScope(m_context); + if (m_context.get().IsEmpty()) + return; - // Clear the document wrapper cache before turning on access checks on - // the old DOMWindow wrapper. This way, access to the document wrapper - // will be protected by the security checks on the DOMWindow wrapper. - clearDocumentWrapperCache(); + v8::HandleScope handleScope; + clearDocumentWrapper(); - // Turn on access check on the old DOMWindow wrapper. - v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global); - ASSERT(!wrapper.IsEmpty()); - wrapper->TurnOnAccessCheck(); + // FIXME: Should we create a new Local handle here? + v8::Context::Scope contextScope(m_context.get()); - // Separate the context from its global object. - m_context->DetachGlobal(); + // Clear the document wrapper cache before turning on access checks on + // the old DOMWindow wrapper. This way, access to the document wrapper + // will be protected by the security checks on the DOMWindow wrapper. + clearDocumentWrapperCache(); - disposeContextHandles(); - } + v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global.get()); + ASSERT(!windowWrapper.IsEmpty()); + windowWrapper->TurnOnAccessCheck(); + m_context.get()->DetachGlobal(); + disposeContextHandles(); } // Create a new environment and setup the global object. @@ -276,67 +293,35 @@ void V8DOMWindowShell::clearForNavigation() // it won't be able to reach the outer window via its global object. bool V8DOMWindowShell::initContextIfNeeded() { - // Bail out if the context has already been initialized. - if (!m_context.IsEmpty()) + if (!m_context.get().IsEmpty()) return true; - // Create a handle scope for all local handles. v8::HandleScope handleScope; - // Setup the security handlers and message listener. This only has - // to be done once. - static bool isV8Initialized = false; - if (!isV8Initialized) { - // Tells V8 not to call the default OOM handler, binding code - // will handle it. - v8::V8::IgnoreOutOfMemoryException(); - v8::V8::SetFatalErrorHandler(reportFatalErrorInV8); - - v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); - v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); - - v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); - - v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); -#if ENABLE(JAVASCRIPT_DEBUGGER) - ScriptProfiler::initialize(); -#endif - V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); - - // FIXME: Remove the following 2 lines when V8 default has changed. - const char es5ReadonlyFlag[] = "--es5_readonly"; - v8::V8::SetFlagsFromString(es5ReadonlyFlag, sizeof(es5ReadonlyFlag)); + initializeV8IfNeeded(); - isV8Initialized = true; - } - - m_context = createNewContext(m_global, 0, 0); - if (m_context.IsEmpty()) + m_context.adopt(createNewContext(m_global.get(), 0, 0)); + if (m_context.get().IsEmpty()) return false; - v8::Local<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context); - v8::Context::Scope contextScope(v8Context); + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get()); + v8::Context::Scope contextScope(context); - // Store the first global object created so we can reuse it. - if (m_global.IsEmpty()) { - m_global = v8::Persistent<v8::Object>::New(v8Context->Global()); - // Bail out if allocation of the first global objects fails. - if (m_global.IsEmpty()) { + if (m_global.get().IsEmpty()) { + m_global.set(context->Global()); + if (m_global.get().IsEmpty()) { disposeContextHandles(); return false; } -#ifndef NDEBUG - V8GCController::registerGlobalHandle(PROXY, this, m_global); -#endif } - m_perContextData = V8PerContextData::create(m_context); + m_perContextData = V8PerContextData::create(m_context.get()); if (!m_perContextData->init()) { disposeContextHandles(); return false; } - if (!installDOMWindow(v8Context, m_frame->document()->domWindow())) { + if (!installDOMWindow(context, m_frame->document()->domWindow())) { disposeContextHandles(); return false; } @@ -346,9 +331,9 @@ bool V8DOMWindowShell::initContextIfNeeded() setSecurityToken(); if (m_frame->document()) - v8Context->AllowCodeGenerationFromStrings(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); + context->AllowCodeGenerationFromStrings(m_frame->document()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport)); - m_frame->loader()->client()->didCreateScriptContext(m_context, 0, 0); + m_frame->loader()->client()->didCreateScriptContext(m_context.get(), 0, 0); // FIXME: This is wrong. We should actually do this for the proper world once // we do isolated worlds the WebCore way. @@ -400,12 +385,7 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob void V8DOMWindowShell::setContext(v8::Handle<v8::Context> context) { - // if we already have a context, clear it before setting the new one. - if (!m_context.IsEmpty()) { - m_context.Dispose(); - m_context.Clear(); - } - m_context = v8::Persistent<v8::Context>::New(context); + m_context.set(context); } bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window) @@ -435,22 +415,13 @@ void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper) { clearDocumentWrapper(); - ASSERT(m_document.IsEmpty()); - m_document = v8::Persistent<v8::Object>::New(wrapper); -#ifndef NDEBUG - V8GCController::registerGlobalHandle(PROXY, this, m_document); -#endif + ASSERT(m_document.get().IsEmpty()); + m_document.set(wrapper); } void V8DOMWindowShell::clearDocumentWrapper() { - if (!m_document.IsEmpty()) { -#ifndef NDEBUG - V8GCController::unregisterGlobalHandle(this, m_document); -#endif - m_document.Dispose(); - m_document.Clear(); - } + m_document.clear(); } static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document) @@ -462,7 +433,8 @@ static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum void V8DOMWindowShell::updateDocumentWrapperCache() { v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + // FIXME: Should we use a new Local handle here? + v8::Context::Scope contextScope(m_context.get()); // If the document has no frame, NodeToV8Object might get the // document wrapper for a document that is about to be deleted. @@ -471,16 +443,17 @@ void V8DOMWindowShell::updateDocumentWrapperCache() // wrapper cleared. Using the cleared global handle will lead to // crashes. In this case we clear the cache and let the DOMWindow // accessor handle access to the document. + // FIXME: This should not be possible anymore. if (!m_frame->document()->frame()) { clearDocumentWrapperCache(); return; } v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document()); - ASSERT(documentWrapper == m_document || m_document.IsEmpty()); - if (m_document.IsEmpty()) + ASSERT(documentWrapper == m_document.get() || m_document.get().IsEmpty()); + if (m_document.get().IsEmpty()) updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper)); - checkDocumentWrapper(m_document, m_frame->document()); + checkDocumentWrapper(m_document.get(), m_frame->document()); // If instantiation of the document wrapper fails, clear the cache // and let the DOMWindow accessor handle access to the document. @@ -489,27 +462,28 @@ void V8DOMWindowShell::updateDocumentWrapperCache() return; } ASSERT(documentWrapper->IsObject()); - m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); + m_context.get()->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete)); // We also stash a reference to the document on the real global object so that // DOMWindow objects we obtain from JavaScript references are guaranteed to have // live Document objects. - v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype()); + v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(m_context.get()->Global()->GetPrototype()); v8RealGlobal->SetHiddenValue(V8HiddenPropertyName::document(), documentWrapper); } void V8DOMWindowShell::clearDocumentWrapperCache() { - ASSERT(!m_context.IsEmpty()); - m_context->Global()->ForceDelete(v8::String::New("document")); + ASSERT(!m_context.get().IsEmpty()); + m_context.get()->Global()->ForceDelete(v8::String::New("document")); } void V8DOMWindowShell::setSecurityToken() { Document* document = m_frame->document(); - // Setup security origin and security token. + + // FIXME: This shouldn't be possible anymore. if (!document) { - m_context->UseDefaultSecurityToken(); + m_context.get()->UseDefaultSecurityToken(); return; } @@ -529,22 +503,23 @@ void V8DOMWindowShell::setSecurityToken() // case, we use the global object as the security token to avoid // calling canAccess when a script accesses its own objects. if (token.isEmpty() || token == "null") { - m_context->UseDefaultSecurityToken(); + m_context.get()->UseDefaultSecurityToken(); return; } CString utf8Token = token.utf8(); // NOTE: V8 does identity comparison in fast path, must use a symbol // as the security token. - m_context->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length())); + m_context.get()->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length())); } void V8DOMWindowShell::updateDocument() { + // FIXME: This shouldn't be possible anymore. if (!m_frame->document()) return; - if (m_global.IsEmpty()) + if (m_global.get().IsEmpty()) return; // There is an existing JavaScript wrapper for the global object @@ -561,9 +536,9 @@ void V8DOMWindowShell::updateDocument() updateSecurityOrigin(); } -v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) +static v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { - // FIXME(antonm): consider passing AtomicStringImpl directly. + // FIXME: Consider passing AtomicStringImpl directly. AtomicString name = toWebCoreAtomicString(property); HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); ASSERT(htmlDocument); @@ -576,40 +551,40 @@ v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorI return v8::Undefined(); } -void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name) +void V8DOMWindowShell::namedItemAdded(HTMLDocument* document, const AtomicString& name) { if (!initContextIfNeeded()) return; v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + v8::Context::Scope contextScope(m_context.get()); - ASSERT(!m_document.IsEmpty()); - checkDocumentWrapper(m_document, doc); - m_document->SetAccessor(v8String(name), getter); + ASSERT(!m_document.get().IsEmpty()); + checkDocumentWrapper(m_document.get(), document); + m_document.get()->SetAccessor(v8String(name), getter); } -void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) +void V8DOMWindowShell::namedItemRemoved(HTMLDocument* document, const AtomicString& name) { - if (doc->hasNamedItem(name.impl()) || doc->hasExtraNamedItem(name.impl())) + if (document->hasNamedItem(name.impl()) || document->hasExtraNamedItem(name.impl())) return; if (!initContextIfNeeded()) return; v8::HandleScope handleScope; - v8::Context::Scope contextScope(m_context); + v8::Context::Scope contextScope(m_context.get()); - ASSERT(!m_document.IsEmpty()); - checkDocumentWrapper(m_document, doc); - m_document->Delete(v8String(name)); + ASSERT(!m_document.get().IsEmpty()); + checkDocumentWrapper(m_document.get(), document); + m_document.get()->Delete(v8String(name)); } void V8DOMWindowShell::updateSecurityOrigin() { - if (m_context.IsEmpty()) + if (m_context.get().IsEmpty()) return; - v8::HandleScope scope; + v8::HandleScope handleScope; setSecurityToken(); } diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.h b/Source/WebCore/bindings/v8/V8DOMWindowShell.h index b25bbfc48..e2ff81937 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.h @@ -31,6 +31,7 @@ #ifndef V8DOMWindowShell_h #define V8DOMWindowShell_h +#include "ScopedPersistent.h" #include "V8PerContextData.h" #include "WrapperTypeInfo.h" #include <wtf/Forward.h> @@ -52,7 +53,7 @@ class V8DOMWindowShell : public RefCounted<V8DOMWindowShell> { public: static PassRefPtr<V8DOMWindowShell> create(Frame*); - v8::Handle<v8::Context> context() const { return m_context; } + v8::Handle<v8::Context> context() const { return m_context.get(); } // Update document object of the frame. void updateDocument(); @@ -99,9 +100,9 @@ private: OwnPtr<V8PerContextData> m_perContextData; - v8::Persistent<v8::Context> m_context; - v8::Persistent<v8::Object> m_global; - v8::Persistent<v8::Object> m_document; + ScopedPersistent<v8::Context> m_context; + ScopedPersistent<v8::Object> m_global; + ScopedPersistent<v8::Object> m_document; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.h b/Source/WebCore/bindings/v8/V8DOMWrapper.h index f66e89e49..25c14d694 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.h +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.h @@ -53,9 +53,7 @@ namespace WebCore { class Frame; class Node; class V8PerContextData; - class V8Proxy; class WorkerContext; - class XPathResolver; enum ListenerLookupType { ListenerFindOnly, diff --git a/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp b/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp index f7877450a..d390185ca 100644 --- a/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp +++ b/Source/WebCore/bindings/v8/V8ObjectConstructor.cpp @@ -74,8 +74,7 @@ v8::Local<v8::Object> V8ObjectConstructor::newInstanceInDocument(v8::Handle<v8:: TRACE_EVENT0("v8", "v8.newInstance"); #endif - // No artificial limitations on the depth of recursion, see comment in - // V8Proxy::callFunction. + // No artificial limitations on the depth of recursion. V8RecursionScope recursionScope(document); v8::Local<v8::Object> result = function->NewInstance(argc, argv); crashIfV8IsDead(); diff --git a/Source/WebCore/bindings/v8/V8PerContextData.h b/Source/WebCore/bindings/v8/V8PerContextData.h index c8cd6a5c6..20e910c16 100644 --- a/Source/WebCore/bindings/v8/V8PerContextData.h +++ b/Source/WebCore/bindings/v8/V8PerContextData.h @@ -31,7 +31,7 @@ #ifndef V8PerContextData_h #define V8PerContextData_h -#include "OwnHandle.h" +#include "ScopedPersistent.h" #include "WrapperTypeInfo.h" #include <v8.h> #include <wtf/HashMap.h> @@ -90,8 +90,8 @@ private: ConstructorMap m_constructorMap; v8::Handle<v8::Context> m_context; - OwnHandle<v8::Value> m_errorPrototype; - OwnHandle<v8::Value> m_objectPrototype; + ScopedPersistent<v8::Value> m_errorPrototype; + ScopedPersistent<v8::Value> m_objectPrototype; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h deleted file mode 100644 index 07a7781e2..000000000 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Proxy_h -#define V8Proxy_h - -#include "PlatformSupport.h" -#include "SharedPersistent.h" -#include "StatsCounter.h" -#include "V8AbstractEventListener.h" -#include "V8DOMWrapper.h" -#include "V8GCController.h" -#include "V8Utilities.h" -#include "WrapperTypeInfo.h" -#include <v8.h> -#include <wtf/Forward.h> -#include <wtf/HashMap.h> -#include <wtf/PassRefPtr.h> // so generated bindings don't have to -#include <wtf/Vector.h> -#include <wtf/text/TextPosition.h> - -namespace WebCore { - - class CachedScript; - class DOMWindow; - class Frame; - class Node; - class ScriptExecutionContext; - class ScriptSourceCode; - class SecurityOrigin; - class V8DOMWindowShell; - class V8EventListener; - class V8IsolatedContext; - class V8PerContextData; - class WorldContextHandle; - - // Note: although the pointer is raw, the instance is kept alive by a strong - // reference to the v8 context it contains, which is not made weak until we - // call world->destroy(). - // - // FIXME: We want to eventually be holding window shells instead of the - // IsolatedContext directly. - typedef HashMap<int, V8IsolatedContext*> IsolatedWorldMap; - - typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; - - class V8Proxy { - public: - explicit V8Proxy(Frame*); - - ~V8Proxy(); - - Frame* frame() const { return m_frame; } - - // FIXME: This should eventually take DOMWrapperWorld argument! - // FIXME: This method will be soon removed, as all methods that access windowShell() - // will be moved to ScriptController. - V8DOMWindowShell* windowShell() const; - private: - Frame* m_frame; - }; -} - -#endif // V8Proxy_h diff --git a/Source/WebCore/bindings/v8/V8RecursionScope.h b/Source/WebCore/bindings/v8/V8RecursionScope.h index 78b3f2b75..64c6c8aed 100644 --- a/Source/WebCore/bindings/v8/V8RecursionScope.h +++ b/Source/WebCore/bindings/v8/V8RecursionScope.h @@ -46,7 +46,7 @@ namespace WebCore { // // Debug-time checking of this is enforced via this class. // -// Calls of type (1) should generally go through V8Proxy, as inspector +// Calls of type (1) should generally go through ScriptController, as inspector // instrumentation is needed. Calls of type (2) should always stack-allocate a // V8RecursionScope in the same block as the call into script. Calls of type (3) // should stack allocate a V8RecursionScope::MicrotaskSuppression -- this diff --git a/Source/WebCore/bindings/v8/V8Utilities.cpp b/Source/WebCore/bindings/v8/V8Utilities.cpp index 0a45dddf0..4621818e6 100644 --- a/Source/WebCore/bindings/v8/V8Utilities.cpp +++ b/Source/WebCore/bindings/v8/V8Utilities.cpp @@ -38,6 +38,7 @@ #include "MessagePort.h" #include "ScriptExecutionContext.h" #include "ScriptState.h" +#include "V8AbstractEventListener.h" #include "V8ArrayBuffer.h" #include "V8Binding.h" #include "V8MessagePort.h" diff --git a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h index 72260e4b8..03f07e926 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h +++ b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.h @@ -39,8 +39,6 @@ namespace WebCore { -class V8Proxy; - // V8CustomXPathNSResolver does not create a persistent handle to the // given resolver object. So the lifetime of V8CustomXPathNSResolver // must not exceed the lifetime of the passed handle. diff --git a/Source/WebCore/bridge/c/c_utility.cpp b/Source/WebCore/bridge/c/c_utility.cpp index dc3755f27..308af5afd 100644 --- a/Source/WebCore/bridge/c/c_utility.cpp +++ b/Source/WebCore/bridge/c/c_utility.cpp @@ -80,7 +80,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) } else if (value.isNumber()) { DOUBLE_TO_NPVARIANT(value.toNumber(exec), *result); } else if (value.isBoolean()) { - BOOLEAN_TO_NPVARIANT(value.toBoolean(), *result); + BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), *result); } else if (value.isNull()) { NULL_TO_NPVARIANT(*result); } else if (value.isObject()) { diff --git a/Source/WebCore/bridge/jni/jni_jsobject.mm b/Source/WebCore/bridge/jni/jni_jsobject.mm index 98f3aebdd..b5a7d220b 100644 --- a/Source/WebCore/bridge/jni/jni_jsobject.mm +++ b/Source/WebCore/bridge/jni/jni_jsobject.mm @@ -495,7 +495,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const jclass JSObjectClass = env->FindClass ("java/lang/Boolean"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V"); if (constructorID != NULL) { - result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean()); + result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean(exec)); } } else { diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index 842f95d65..785e3a056 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -291,9 +291,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type switch (hint) { case QMetaType::Bool: if (type == Object && object->inherits(&BooleanObject::s_info)) - ret = QVariant(asBooleanObject(value)->internalValue().toBoolean()); + ret = QVariant(asBooleanObject(value)->internalValue().toBoolean(exec)); else - ret = QVariant(value.toBoolean()); + ret = QVariant(value.toBoolean(exec)); if (type == Boolean) dist = 0; else diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index fe10eb0f6..0708c23ba 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -614,7 +614,7 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSProper return 0; } - if (style->position() == AbsolutePosition || style->position() == FixedPosition) { + if (style->hasOutOfFlowPosition()) { if (l.type() == WebCore::Fixed) return zoomAdjustedPixelValue(l.value(), style); else if (l.isViewportPercentage()) @@ -622,7 +622,7 @@ static PassRefPtr<CSSValue> getPositionOffsetValue(RenderStyle* style, CSSProper return cssValuePool().createValue(l); } - if (style->position() == RelativePosition || style->position() == StickyPosition) { + if (style->hasInFlowPosition()) { // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. // In other words if left is auto and right is not auto, then left's computed value is negative right(). // So we should get the opposite length unit and see if it is auto. @@ -715,21 +715,14 @@ static LayoutRect sizingBox(RenderObject* renderer) return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect(); } -static IntRect pixelSnappedSizingBox(RenderObject* renderer) -{ - if (!renderer->isBox()) - return IntRect(); - - RenderBox* box = toRenderBox(renderer); - return box->style()->boxSizing() == BORDER_BOX ? box->pixelSnappedBorderBoxRect() : pixelSnappedIntRect(box->computedCSSContentBoxRect()); -} - static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle* style) { - if (!renderer || style->transform().operations().isEmpty()) + if (!renderer || !renderer->hasTransform() || !style->hasTransform()) return cssValuePool().createIdentifierValue(CSSValueNone); - IntRect box = pixelSnappedSizingBox(renderer); + IntRect box; + if (renderer->isBox()) + box = pixelSnappedIntRect(toRenderBox(renderer)->borderBoxRect()); TransformationMatrix transform; style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); @@ -2327,7 +2320,10 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyWebkitTransformOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { - LayoutRect box = sizingBox(renderer); + LayoutRect box; + if (renderer->isBox()) + box = toRenderBox(renderer)->borderBoxRect(); + RenderView* renderView = m_node->document()->renderView(); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get())); list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get())); diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 18c4c0352..7a5ea37d3 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -46,11 +46,13 @@ #include "CSSPropertySourceData.h" #include "CSSReflectValue.h" #include "CSSSelector.h" +#include "CSSStyleSheet.h" #include "CSSTimingFunctionValue.h" #include "CSSUnicodeRangeValue.h" #include "CSSValueKeywords.h" #include "CSSValueList.h" #include "CSSValuePool.h" +#include "StylePropertyShorthand.h" #if ENABLE(CSS_VARIABLES) #include "CSSVariableValue.h" #endif @@ -1241,6 +1243,30 @@ void CSSParser::parseSelector(const String& string, CSSSelectorList& selectorLis m_selectorListForParseSelector = 0; } +PassRefPtr<StylePropertySet> CSSParser::parseInlineStyleDeclaration(const String& string, Element* element) +{ + CSSParserContext context = element->document()->elementSheet()->contents()->parserContext(); + context.mode = strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode()); + return CSSParser(context).parseDeclaration(string, element->document()->elementSheet()->contents()); +} + +PassRefPtr<StylePropertySet> CSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet) +{ + setStyleSheet(contextStyleSheet); + + setupParser("@-webkit-decls{", string, "} "); + cssyyparse(this); + m_rule = 0; + + if (m_hasFontFaceOnlyValues) + deleteFontFaceOnlyValues(); + + RefPtr<StylePropertySet> style = createStylePropertySet(); + clearProperties(); + return style.release(); +} + + bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, PassRefPtr<CSSRuleSourceData> prpRuleSourceData, StyleSheetContents* contextStyleSheet) { // Length of the "@-webkit-decls{" prefix. @@ -3074,30 +3100,13 @@ void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> r bool CSSParser::parseAnimationShorthand(bool important) { - // When we parse the animation shorthand we need to look for animation-name - // last because otherwise it might match against the keywords for fill mode, - // timing functions and infinite iteration. This means that animation names - // that are the same as keywords (e.g. 'forwards') won't always match in the - // shorthand. In that case they should be using longhands (or reconsidering - // their approach). This is covered by the animations spec bug: - // https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 - // And in the spec (editor's draft) at: - // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property - - static const CSSPropertyID animationProperties[] = { - CSSPropertyWebkitAnimationDuration, - CSSPropertyWebkitAnimationTimingFunction, - CSSPropertyWebkitAnimationDelay, - CSSPropertyWebkitAnimationIterationCount, - CSSPropertyWebkitAnimationDirection, - CSSPropertyWebkitAnimationFillMode, - CSSPropertyWebkitAnimationName - }; + const StylePropertyShorthand& animationProperties = webkitAnimationShorthandForParsing(); const unsigned numProperties = 7; // The list of properties in the shorthand should be the same - // length as the list we have here, even though they are - // a different order. + // length as the list with animation name in last position, even though they are + // in a different order. + ASSERT(numProperties == webkitAnimationShorthandForParsing().length()); ASSERT(numProperties == webkitAnimationShorthand().length()); ShorthandScope scope(this, CSSPropertyWebkitAnimation); @@ -3124,7 +3133,7 @@ bool CSSParser::parseAnimationShorthand(bool important) for (i = 0; i < numProperties; ++i) { if (!parsedProperty[i]) { RefPtr<CSSValue> val; - if (parseAnimationProperty(animationProperties[i], val)) { + if (parseAnimationProperty(animationProperties.properties()[i], val)) { parsedProperty[i] = found = true; addAnimationValue(values[i], val.release()); break; @@ -3143,7 +3152,7 @@ bool CSSParser::parseAnimationShorthand(bool important) if (!parsedProperty[i]) addAnimationValue(values[i], cssValuePool().createImplicitInitialValue()); - addProperty(animationProperties[i], values[i].release(), important); + addProperty(animationProperties.properties()[i], values[i].release(), important); } return true; diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index aec1f6635..16e5bd70c 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -53,6 +53,7 @@ class CSSValue; class CSSValueList; class CSSWrapShape; class Document; +class Element; class MediaQueryExp; class MediaQuerySet; class StyleKeyframe; @@ -83,6 +84,7 @@ public: static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int ident, CSSParserValue*); bool parseDeclaration(StylePropertySet*, const String&, PassRefPtr<CSSRuleSourceData>, StyleSheetContents* contextStyleSheet); + static PassRefPtr<StylePropertySet> parseInlineStyleDeclaration(const String&, Element*); PassOwnPtr<MediaQuery> parseMediaQuery(const String&); void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false); @@ -402,6 +404,7 @@ private: bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&); bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, StyleSheetContents* contextStyleSheet); + PassRefPtr<StylePropertySet> parseDeclaration(const String&, StyleSheetContents* contextStyleSheet); enum SizeParameterType { None, diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index c39a9c021..806605fe3 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -50,6 +50,7 @@ #include "TextRenderingMode.h" #include "ThemeTypes.h" #include "UnicodeBidi.h" +#include "WritingMode.h" #if ENABLE(CSS_SHADERS) #include "CustomFilterOperation.h" diff --git a/Source/WebCore/css/CSSProperty.h b/Source/WebCore/css/CSSProperty.h index 57a30124f..7afaa75ec 100644 --- a/Source/WebCore/css/CSSProperty.h +++ b/Source/WebCore/css/CSSProperty.h @@ -25,6 +25,7 @@ #include "CSSValue.h" #include "RenderStyleConstants.h" #include "TextDirection.h" +#include "WritingMode.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebCore/css/CSSToStyleMap.h b/Source/WebCore/css/CSSToStyleMap.h index 8e0fc953d..6bab40bfc 100644 --- a/Source/WebCore/css/CSSToStyleMap.h +++ b/Source/WebCore/css/CSSToStyleMap.h @@ -30,6 +30,7 @@ namespace WebCore { class FillLayer; class CSSValue; class Animation; +class RenderStyle; class StyleImage; class StyleResolver; class NinePieceImage; diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp index 045bd24f0..d5ecd9746 100644 --- a/Source/WebCore/css/StylePropertyShorthand.cpp +++ b/Source/WebCore/css/StylePropertyShorthand.cpp @@ -261,6 +261,31 @@ const StylePropertyShorthand& webkitAnimationShorthand() return webkitAnimationLonghands; } +const StylePropertyShorthand& webkitAnimationShorthandForParsing() +{ + // When we parse the animation shorthand we need to look for animation-name + // last because otherwise it might match against the keywords for fill mode, + // timing functions and infinite iteration. This means that animation names + // that are the same as keywords (e.g. 'forwards') won't always match in the + // shorthand. In that case the authors should be using longhands (or + // reconsidering their approach). This is covered by the animations spec + // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 + // And in the spec (editor's draft) at: + // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property + static const CSSPropertyID animationPropertiesForParsing[] = { + CSSPropertyWebkitAnimationDuration, + CSSPropertyWebkitAnimationTimingFunction, + CSSPropertyWebkitAnimationDelay, + CSSPropertyWebkitAnimationIterationCount, + CSSPropertyWebkitAnimationDirection, + CSSPropertyWebkitAnimationFillMode, + CSSPropertyWebkitAnimationName + }; + + DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing))); + return webkitAnimationLonghandsForParsing; +} + const StylePropertyShorthand& webkitBorderAfterShorthand() { static const CSSPropertyID borderAfterProperties[] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle, CSSPropertyWebkitBorderAfterColor }; diff --git a/Source/WebCore/css/StylePropertyShorthand.h b/Source/WebCore/css/StylePropertyShorthand.h index ee331c732..72da501ce 100644 --- a/Source/WebCore/css/StylePropertyShorthand.h +++ b/Source/WebCore/css/StylePropertyShorthand.h @@ -80,6 +80,7 @@ const StylePropertyShorthand& outlineShorthand(); const StylePropertyShorthand& overflowShorthand(); const StylePropertyShorthand& paddingShorthand(); const StylePropertyShorthand& webkitAnimationShorthand(); +const StylePropertyShorthand& webkitAnimationShorthandForParsing(); const StylePropertyShorthand& webkitBorderAfterShorthand(); const StylePropertyShorthand& webkitBorderBeforeShorthand(); const StylePropertyShorthand& webkitBorderEndShorthand(); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index a7397aed3..08ee28cda 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -377,6 +377,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) , m_fontDirty(false) , m_matchAuthorAndUserStyles(matchAuthorAndUserStyles) , m_sameOriginOnly(false) + , m_distributedToInsertionPoint(false) , m_fontSelector(CSSFontSelector::create(document)) , m_applyPropertyToRegularStyle(true) , m_applyPropertyToVisitedLinkStyle(false) @@ -1220,9 +1221,11 @@ inline void StyleResolver::initForStyleResolve(Element* e, RenderStyle* parentSt m_parentStyle = context.resetStyleInheritance()? 0 : parentStyle ? parentStyle : m_parentNode ? m_parentNode->renderStyle() : 0; + m_distributedToInsertionPoint = context.insertionPoint(); } else { m_parentNode = 0; m_parentStyle = parentStyle; + m_distributedToInsertionPoint = false; } Node* docElement = e ? e->document()->documentElement() : 0; @@ -1752,7 +1755,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS initElement(element); initForStyleResolve(element, defaultParent); m_regionForStyling = regionForStyling; - if (sharingBehavior == AllowStyleSharing) { + if (sharingBehavior == AllowStyleSharing && !m_distributedToInsertionPoint) { RenderStyle* sharedStyle = locateSharedStyle(); if (sharedStyle) return sharedStyle; @@ -2075,7 +2078,7 @@ static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e) { return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e) - || style->isFloating() || style->isOutOfFlowPositioned(); + || style->isFloating() || style->hasOutOfFlowPosition(); } static bool isDisplayFlexibleBox(EDisplay display) @@ -2145,7 +2148,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty style->setDisplay(BLOCK); // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. - if (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() || (e && e->document()->documentElement() == e)) + if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->document()->documentElement() == e)) style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely @@ -2187,8 +2190,12 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty // Auto z-index becomes 0 for the root element and transparent objects. This prevents // cases where objects that should be blended as a single unit end up with a non-transparent // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections. - if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) || style->opacity() < 1.0f - || style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect() || style->hasFilter() + if (style->hasAutoZIndex() && ((e && e->document()->documentElement() == e) + || style->opacity() < 1.0f + || style->hasTransformRelatedProperty() + || style->hasMask() + || style->boxReflect() + || style->hasFilter() #ifdef FIXED_POSITION_CREATES_STACKING_CONTEXT || style->position() == FixedPosition #else diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h index 712085ba2..2bbc6823e 100644 --- a/Source/WebCore/css/StyleResolver.h +++ b/Source/WebCore/css/StyleResolver.h @@ -496,6 +496,7 @@ private: bool m_fontDirty; bool m_matchAuthorAndUserStyles; bool m_sameOriginOnly; + bool m_distributedToInsertionPoint; RefPtr<CSSFontSelector> m_fontSelector; Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index 7d89c8848..471e519e0 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -27,6 +27,7 @@ #include "ElementAttributeData.h" #include "Attr.h" +#include "CSSParser.h" #include "CSSStyleSheet.h" #include "MemoryInstrumentation.h" #include "StyledElement.h" @@ -211,8 +212,9 @@ void ElementAttributeData::updateInlineStyleAvoidingMutation(StyledElement* elem if (m_inlineStyleDecl && !m_inlineStyleDecl->isMutable()) m_inlineStyleDecl.clear(); if (!m_inlineStyleDecl) - m_inlineStyleDecl = StylePropertySet::create(strictToCSSParserMode(element->isHTMLElement() && !element->document()->inQuirksMode())); - m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); + m_inlineStyleDecl = CSSParser::parseInlineStyleDeclaration(text, element); + else + m_inlineStyleDecl->parseDeclaration(text, element->document()->elementSheet()->contents()); } void ElementAttributeData::destroyInlineStyle(StyledElement* element) const diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp index 5ca7282bc..789a3fabb 100644 --- a/Source/WebCore/editing/TextIterator.cpp +++ b/Source/WebCore/editing/TextIterator.cpp @@ -214,8 +214,7 @@ static inline bool ignoresContainerClip(Node* node) RenderObject* renderer = node->renderer(); if (!renderer || renderer->isText()) return false; - EPosition position = renderer->style()->position(); - return position == AbsolutePosition || position == FixedPosition; + return renderer->style()->hasOutOfFlowPosition(); } static void pushFullyClippedState(BitStack& stack, Node* node) diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index ffb30894b..02a5645c5 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -4377,6 +4377,54 @@ String HTMLMediaElement::mediaPlayerDocumentHost() const return document()->url().host(); } +void HTMLMediaElement::mediaPlayerExitFullscreen() +{ + exitFullscreen(); +} + +bool HTMLMediaElement::mediaPlayerIsVideo() const +{ + return isVideo(); +} + +LayoutRect HTMLMediaElement::mediaPlayerContentBoxRect() const +{ + if (renderer()) + return renderer()->enclosingBox()->contentBoxRect(); + return LayoutRect(); +} + +void HTMLMediaElement::mediaPlayerSetSize(const IntSize& size) +{ + setAttribute(widthAttr, String::number(size.width())); + setAttribute(heightAttr, String::number(size.height())); +} + +void HTMLMediaElement::mediaPlayerPause() +{ + pause(); +} + +void HTMLMediaElement::mediaPlayerPlay() +{ + play(); +} + +bool HTMLMediaElement::mediaPlayerIsPaused() const +{ + return paused(); +} + +HostWindow* HTMLMediaElement::mediaPlayerHostWindow() +{ + return mediaPlayerOwningDocument()->view()->hostWindow(); +} + +IntRect HTMLMediaElement::mediaPlayerWindowClipRect() +{ + return mediaPlayerOwningDocument()->view()->windowClipRect(); +} + void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() { m_restrictions = NoRestrictions; diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index da102a6d2..32b547d32 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -422,6 +422,16 @@ private: virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE; virtual String mediaPlayerDocumentHost() const OVERRIDE; + virtual void mediaPlayerExitFullscreen() OVERRIDE; + virtual bool mediaPlayerIsVideo() const OVERRIDE; + virtual LayoutRect mediaPlayerContentBoxRect() const OVERRIDE; + virtual void mediaPlayerSetSize(const IntSize&) OVERRIDE; + virtual void mediaPlayerPause() OVERRIDE; + virtual void mediaPlayerPlay() OVERRIDE; + virtual bool mediaPlayerIsPaused() const OVERRIDE; + virtual HostWindow* mediaPlayerHostWindow() OVERRIDE; + virtual IntRect mediaPlayerWindowClipRect() OVERRIDE; + #if PLATFORM(WIN) && USE(AVFOUNDATION) virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE; #endif diff --git a/Source/WebCore/html/TimeInputType.cpp b/Source/WebCore/html/TimeInputType.cpp index 798aeff9f..586103231 100644 --- a/Source/WebCore/html/TimeInputType.cpp +++ b/Source/WebCore/html/TimeInputType.cpp @@ -182,8 +182,7 @@ void TimeInputType::createShadowSubtree() { ASSERT(element()->shadow()); - const StepRange stepRange(createStepRange(AnyIsDefaultStep)); - RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(element()->document(), m_dateTimeEditControlOwnerImpl, stepRange)); + RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(element()->document(), m_dateTimeEditControlOwnerImpl)); m_dateTimeEditElement = dateTimeEditElement.get(); element()->userAgentShadowRoot()->appendChild(m_dateTimeEditElement); updateInnerTextValue(); @@ -238,7 +237,7 @@ bool TimeInputType::isMouseFocusable() const void TimeInputType::minOrMaxAttributeChanged() { - updateEditElementLayout(); + updateInnerTextValue(); } void TimeInputType::readonlyAttributeChanged() @@ -266,13 +265,7 @@ bool TimeInputType::shouldUseInputMethod() const void TimeInputType::stepAttributeChanged() { - updateEditElementLayout(); -} - -void TimeInputType::updateEditElementLayout() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->layout(createStepRange(AnyIsDefaultStep)); + updateInnerTextValue(); } void TimeInputType::updateInnerTextValue() @@ -280,13 +273,13 @@ void TimeInputType::updateInnerTextValue() if (!m_dateTimeEditElement) return; + const StepRange stepRange(createStepRange(AnyIsDefaultStep)); DateComponents date; if (parseToDateComponents(element()->value(), &date)) - m_dateTimeEditElement->setValueAsDate(date); + m_dateTimeEditElement->setValueAsDate(stepRange, date); else { - const StepRange stepRange(createStepRange(AnyIsDefaultStep)); setMillisecondToDateComponents(stepRange.minimum().toDouble(), &date); - m_dateTimeEditElement->setEmptyValue(date); + m_dateTimeEditElement->setEmptyValue(stepRange, date); } } #else diff --git a/Source/WebCore/html/TimeInputType.h b/Source/WebCore/html/TimeInputType.h index 8dc6e7740..ee877dcf1 100644 --- a/Source/WebCore/html/TimeInputType.h +++ b/Source/WebCore/html/TimeInputType.h @@ -80,8 +80,6 @@ private: friend class DateTimeEditControlOwnerImpl; - void updateEditElementLayout(); - // InputType functions virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL; virtual void createShadowSubtree() OVERRIDE FINAL; diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index 3a64b9914..44a1c2b0a 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -50,7 +50,7 @@ class DateTimeEditBuilder : private DateTimeFormat::TokenHandler { WTF_MAKE_NONCOPYABLE(DateTimeEditBuilder); public: - DateTimeEditBuilder(DateTimeEditElement&, const StepRange&); + DateTimeEditBuilder(DateTimeEditElement&, const StepRange&, const DateComponents&); bool build(const String&); bool needSecondField() const; @@ -67,11 +67,13 @@ private: virtual void visitLiteral(const String&) OVERRIDE FINAL; DateTimeEditElement& m_editElement; + const DateComponents& m_dateValue; const StepRange& m_stepRange; }; -DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const StepRange& stepRange) +DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const StepRange& stepRange, const DateComponents& dateValue) : m_editElement(elemnt) + , m_dateValue(dateValue) , m_stepRange(stepRange) { } @@ -84,19 +86,22 @@ bool DateTimeEditBuilder::build(const String& formatString) bool DateTimeEditBuilder::needMillisecondField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerSecond)).isZero() + return m_dateValue.millisecond() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerSecond)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); } bool DateTimeEditBuilder::needMinuteField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerHour)).isZero() + return m_dateValue.minute() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerHour)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); } bool DateTimeEditBuilder::needSecondField() const { - return !m_stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() + return m_dateValue.second() + || !m_stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() || !m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); } @@ -161,17 +166,17 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) bool DateTimeEditBuilder::shouldMillisecondFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); + return !m_dateValue.millisecond() && m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); } bool DateTimeEditBuilder::shouldMinuteFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); + return !m_dateValue.minute() && m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); } bool DateTimeEditBuilder::shouldSecondFieldReadOnly() const { - return m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); + return !m_dateValue.second() && m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); } void DateTimeEditBuilder::visitLiteral(const String& text) @@ -213,10 +218,9 @@ void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field) appendChild(field); } -PassRefPtr<DateTimeEditElement> DateTimeEditElement::create(Document* document, EditControlOwner& editControlOwner, const StepRange& stepRange) +PassRefPtr<DateTimeEditElement> DateTimeEditElement::create(Document* document, EditControlOwner& editControlOwner) { RefPtr<DateTimeEditElement> container = adoptRef(new DateTimeEditElement(document, editControlOwner)); - container->layout(stepRange); return container.release(); } @@ -341,12 +345,14 @@ bool DateTimeEditElement::isReadOnly() const return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly(); } -void DateTimeEditElement::layout(const StepRange& stepRange) +void DateTimeEditElement::layout(const StepRange& stepRange, const DateComponents& dateValue) { + size_t focusFieldIndex = m_focusFieldIndex; DateTimeFieldElement* const focusField = fieldAt(m_focusFieldIndex); + const AtomicString focusFieldId = focusField ? focusField->shadowPseudoId() : nullAtom; focusFieldAt(invalidFieldIndex); - DateTimeEditBuilder builder(*this, stepRange); + DateTimeEditBuilder builder(*this, stepRange, dateValue); const String dateTimeFormat = builder.needSecondField() ? localizedTimeFormatText() : localizedShortTimeFormatText(); if (!builder.build(dateTimeFormat) || m_fields.isEmpty()) builder.build(builder.needSecondField() ? "HH:mm:ss" : "HH:mm"); @@ -355,13 +361,14 @@ void DateTimeEditElement::layout(const StepRange& stepRange) m_spinButton = spinButton.get(); appendChild(spinButton); - if (focusField) { + if (focusFieldIndex != invalidFieldIndex) { for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { - if (focusField == m_fields[fieldIndex]) { - focusFieldAt(fieldIndex); + if (m_fields[fieldIndex]->shadowPseudoId() == focusFieldId) { + focusFieldIndex = fieldIndex; break; } } + focusFieldAt(std::min(focusFieldIndex, m_fields.size() - 1)); } } @@ -434,14 +441,16 @@ void DateTimeEditElement::defaultEventHandler(Event* event) focusField->defaultEventHandler(event); } -void DateTimeEditElement::setValueAsDate(const DateComponents& date) +void DateTimeEditElement::setValueAsDate(const StepRange& stepRange, const DateComponents& date) { + layout(stepRange, date); for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) m_fields[fieldIndex]->setValueAsDate(date); } -void DateTimeEditElement::setEmptyValue(const DateComponents& dateForReadOnlyField) +void DateTimeEditElement::setEmptyValue(const StepRange& stepRange, const DateComponents& dateForReadOnlyField) { + layout(stepRange, dateForReadOnlyField); for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) m_fields[fieldIndex]->setEmptyValue(dateForReadOnlyField, DateTimeFieldElement::DispatchNoEvent); } diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h index c6016febf..4767368f4 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.h +++ b/Source/WebCore/html/shadow/DateTimeEditElement.h @@ -59,18 +59,17 @@ public: virtual bool isEditControlOwnerReadOnly() const = 0; }; - static PassRefPtr<DateTimeEditElement> create(Document*, EditControlOwner&, const StepRange&); + static PassRefPtr<DateTimeEditElement> create(Document*, EditControlOwner&); virtual ~DateTimeEditElement(); void addField(PassRefPtr<DateTimeFieldElement>); virtual void defaultEventHandler(Event*) OVERRIDE; void disabledStateChanged(); - void layout(const StepRange&); void readOnlyStateChanged(); void removeEditControlOwner() { m_editControlOwner = 0; } void resetLayout(); - void setEmptyValue(const DateComponents& dateForReadOnlyField); - void setValueAsDate(const DateComponents&); + void setEmptyValue(const StepRange&, const DateComponents& dateForReadOnlyField); + void setValueAsDate(const StepRange&, const DateComponents&); double valueAsDouble() const; private: @@ -95,6 +94,7 @@ private: void handleMouseEvent(MouseEvent*); bool isDisabled() const; bool isReadOnly() const; + void layout(const StepRange&, const DateComponents&); size_t nextFieldIndex() const; size_t previousFieldIndex() const; void updateUIState(); diff --git a/Source/WebCore/html/shadow/MediaControlRootElement.h b/Source/WebCore/html/shadow/MediaControlRootElement.h index 5ce6ac7ea..a0b09d874 100644 --- a/Source/WebCore/html/shadow/MediaControlRootElement.h +++ b/Source/WebCore/html/shadow/MediaControlRootElement.h @@ -152,7 +152,6 @@ private: MediaControlPanelElement* m_panel; #if ENABLE(VIDEO_TRACK) MediaControlTextTrackContainerElement* m_textDisplayContainer; - MediaControlTextTrackDisplayElement* m_textTrackDisplay; #endif Timer<MediaControlRootElement> m_hideFullscreenControlsTimer; bool m_isMouseOverControls; diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index f8685279e..155e3d2de 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -258,6 +258,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) input->setTextAsOfLastFormControlChangeEvent(input->value()); LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true)); bool isVertical = hasVerticalAppearance(input); + bool isLeftToRightDirection = renderBox()->style()->isLeftToRightDirection(); LayoutUnit trackSize; LayoutUnit position; LayoutUnit currentPosition; @@ -276,6 +277,8 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) } else { trackSize = trackElement->renderBox()->contentWidth(); position = offset.x() - renderBox()->width() / 2 - trackBoundingBox.x() + inputBoundingBox.x(); + if (!isLeftToRightDirection) + position += renderBox()->width(); currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x(); } position = max<LayoutUnit>(0, min(position, trackSize)); @@ -283,7 +286,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) return; const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize); - const Decimal fraction = isVertical || !renderBox()->style()->isLeftToRightDirection() ? Decimal(1) - ratio : ratio; + const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio; StepRange stepRange(input->createStepRange(RejectAny)); Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction)); @@ -293,7 +296,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) Decimal closest = input->findClosestTickMarkValue(value); if (closest.isFinite()) { double closestFraction = stepRange.proportionFromValue(closest).toDouble(); - double closestRatio = isVertical || !renderBox()->style()->isLeftToRightDirection() ? 1.0 - closestFraction : closestFraction; + double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - closestFraction : closestFraction; LayoutUnit closestPosition = trackSize * closestRatio; if ((closestPosition - position).abs() <= snappingThreshold) value = closest; diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index f46ed355f..85222538b 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -32,7 +32,6 @@ import os.path import sys import string import optparse -from string import join try: import json except ImportError: @@ -86,8 +85,10 @@ try: raise Exception("Output .h directory must be specified") if not output_cpp_dirname: raise Exception("Output .cpp directory must be specified") -except Exception, e: - sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % e) +except Exception: + # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html + exc = sys.exc_info()[1] + sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) sys.stderr.write("Usage: <script> Inspector.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir>\n") exit(1) @@ -797,7 +798,7 @@ class EnumConstants: output = [] for item in cls.constants_: output.append(" \"" + item + "\"") - return join(output, ",\n") + "\n" + return ",\n".join(output) + "\n" # Typebuilder code is generated in several passes: first typedefs, then other classes. @@ -926,7 +927,7 @@ class TypeBindings: for enum_item in enum: enum_pos = EnumConstants.add_constant(enum_item) condition_list.append("s == \"%s\"" % enum_item) - validator_writer.newline(" ASSERT(%s);\n" % join(condition_list, " || ")) + validator_writer.newline(" ASSERT(%s);\n" % " || ".join(condition_list)) validator_writer.newline("}\n") if domain_guard: @@ -2700,7 +2701,7 @@ class Generator: Generator.frontend_domain_class_lines.append(Templates.frontend_domain_class.substitute(None, domainClassName=domain_name, domainFieldName=domain_name_lower, - frontendDomainMethodDeclarations=join(flatten_list(frontend_method_declaration_lines), ""))) + frontendDomainMethodDeclarations="".join(flatten_list(frontend_method_declaration_lines)))) agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler" Generator.backend_agent_interface_list.append(" class %s {\n" % agent_interface_name) @@ -2769,15 +2770,15 @@ class Generator: backend_js_event_param_list.append("\"%s\"" % parameter_name) method_line_list.append(" %sMessage->setObject(\"params\", paramsObject);\n" % event_name) frontend_method_declaration_lines.append( - " void %s(%s);\n" % (event_name, join(parameter_list, ", "))) + " void %s(%s);\n" % (event_name, ", ".join(parameter_list))) Generator.frontend_method_list.append(Templates.frontend_method.substitute(None, domainName=domain_name, eventName=event_name, - parameters=join(parameter_list, ", "), - code=join(method_line_list, ""))) + parameters=", ".join(parameter_list), + code="".join(method_line_list))) Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerEvent(\"%s.%s\", [%s]);\n" % ( - domain_name, event_name, join(backend_js_event_param_list, ", "))) + domain_name, event_name, ", ".join(backend_js_event_param_list))) @staticmethod def process_command(json_command, domain_name, agent_field_name, agent_interface_name): @@ -2851,7 +2852,7 @@ class Generator: js_param_list.append(js_param_text) - js_parameters_text = join(js_param_list, ", ") + js_parameters_text = ", ".join(js_param_list) response_cook_text = "" js_reply_list = "[]" @@ -2900,9 +2901,9 @@ class Generator: backend_js_reply_param_list.append("\"%s\"" % json_return_name) - js_reply_list = "[%s]" % join(backend_js_reply_param_list, ", ") + js_reply_list = "[%s]" % ", ".join(backend_js_reply_param_list) - response_cook_text = join(response_cook_list, "") + response_cook_text = "".join(response_cook_list) if len(response_cook_text) != 0: response_cook_text = " if (!error.length()) {\n" + response_cook_text + " }" @@ -2912,7 +2913,7 @@ class Generator: agentField="m_" + agent_field_name, methodInCode=method_in_code, methodOutCode=method_out_code, - agentCallParams=join(agent_call_param_list, ""), + agentCallParams="".join(agent_call_param_list), requestMessageObject=request_message_param, responseCook=response_cook_text, commandNameIndex=cmd_enum_name)) @@ -3090,38 +3091,38 @@ backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js backend_h_file.write(Templates.backend_h.substitute(None, - virtualSetters=join(Generator.backend_virtual_setters_list, "\n"), - agentInterfaces=join(flatten_list(Generator.backend_agent_interface_list), ""), - methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"))) + virtualSetters="\n".join(Generator.backend_virtual_setters_list), + agentInterfaces="".join(flatten_list(Generator.backend_agent_interface_list)), + methodNamesEnumContent="\n".join(Generator.method_name_enum_list))) backend_cpp_file.write(Templates.backend_cpp.substitute(None, - constructorInit=join(Generator.backend_constructor_init_list, "\n"), - setters=join(Generator.backend_setters_list, "\n"), - fieldDeclarations=join(Generator.backend_field_list, "\n"), - methodNameDeclarations=join(Generator.backend_method_name_declaration_list, "\n"), - methods=join(Generator.backend_method_implementation_list, "\n"), - methodDeclarations=join(Generator.backend_method_declaration_list, "\n"), - messageHandlers=join(Generator.method_handler_list, "\n"))) + constructorInit="\n".join(Generator.backend_constructor_init_list), + setters="\n".join(Generator.backend_setters_list), + fieldDeclarations="\n".join(Generator.backend_field_list), + methodNameDeclarations="\n".join(Generator.backend_method_name_declaration_list), + methods="\n".join(Generator.backend_method_implementation_list), + methodDeclarations="\n".join(Generator.backend_method_declaration_list), + messageHandlers="\n".join(Generator.method_handler_list))) frontend_h_file.write(Templates.frontend_h.substitute(None, - fieldDeclarations=join(Generator.frontend_class_field_lines, ""), - domainClassList=join(Generator.frontend_domain_class_lines, ""))) + fieldDeclarations="".join(Generator.frontend_class_field_lines), + domainClassList="".join(Generator.frontend_domain_class_lines))) frontend_cpp_file.write(Templates.frontend_cpp.substitute(None, - constructorInit=join(Generator.frontend_constructor_init_list, ""), - methods=join(Generator.frontend_method_list, "\n"))) + constructorInit="".join(Generator.frontend_constructor_init_list), + methods="\n".join(Generator.frontend_method_list))) typebuilder_h_file.write(Templates.typebuilder_h.substitute(None, - typeBuilders=join(flatten_list(Generator.type_builder_fragments), ""), - forwards=join(Generator.type_builder_forwards, ""))) + typeBuilders="".join(flatten_list(Generator.type_builder_fragments)), + forwards="".join(Generator.type_builder_forwards))) typebuilder_cpp_file.write(Templates.typebuilder_cpp.substitute(None, enumConstantValues=EnumConstants.get_enum_constant_code(), - implCode=join(flatten_list(Generator.type_builder_impl_list), ""), - validatorCode=join(flatten_list(Generator.validator_impl_list), ""))) + implCode="".join(flatten_list(Generator.type_builder_impl_list)), + validatorCode="".join(flatten_list(Generator.validator_impl_list)))) backend_js_file.write(Templates.backend_js.substitute(None, - domainInitializers=join(Generator.backend_js_domain_initializer_list, ""))) + domainInitializers="".join(Generator.backend_js_domain_initializer_list))) backend_h_file.close() backend_cpp_file.close() diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 70c2b5997..33b21b4fd 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -130,6 +130,7 @@ public: virtual void onVersionChange(const String& version) { } virtual void onVersionChange(int64_t oldVersion, int64_t newVersion) { } + virtual void onForcedClose() { } private: InspectorIDBDatabaseCallbacks() { } }; diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index fee87cb77..31eadde70 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -30,7 +30,9 @@ import os import os.path import generate_protocol_externs +import shutil import sys +import tempfile inspector_path = "Source/WebCore/inspector" inspector_frontend_path = inspector_path + "/front-end" @@ -365,7 +367,8 @@ def dump_module(name, recursively, processed_modules): command += " \\\n --js " + inspector_frontend_path + "/" + script return command -compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword \\\n" +modules_dir = tempfile.mkdtemp() +compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword --module_output_path_prefix %s/ \\\n" % modules_dir process_recursively = len(sys.argv) == 2 if process_recursively: @@ -407,3 +410,5 @@ if not process_recursively: command += "\n" os.system(command) os.system("rm " + inspector_path + "/" + "InjectedScriptWebGLModuleSourceTmp.js") + +shutil.rmtree(modules_dir) diff --git a/Source/WebCore/inspector/front-end/AdvancedSearchController.js b/Source/WebCore/inspector/front-end/AdvancedSearchController.js index 695059375..be51bd764 100644 --- a/Source/WebCore/inspector/front-end/AdvancedSearchController.js +++ b/Source/WebCore/inspector/front-end/AdvancedSearchController.js @@ -585,7 +585,7 @@ WebInspector.FileBasedSearchResultsPane.prototype = { var showMoreMatchesElement = new TreeElement(showMoreMatchesText, null, false); fileTreeElement.appendChild(showMoreMatchesElement); showMoreMatchesElement.listItemElement.addStyleClass("show-more-matches"); - showMoreMatchesElement.onselect = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex); + showMoreMatchesElement.onselect = this._showMoreMatchesElementSelected.bind(this, searchResult, startMatchIndex, showMoreMatchesElement); }, /** @@ -629,7 +629,7 @@ WebInspector.FileBasedSearchResultsPane.prototype = { fileTreeElement.listItemElement.appendChild(matchesCountSpan); var searchResult = this._searchResults[searchResultIndex]; - fileTreeElement.onexpand = this._fileTreeElementExpanded.bind(this, searchResult); + fileTreeElement.onexpand = this._fileTreeElementExpanded.bind(this, searchResult, fileTreeElement); // Expand until at least certain amount of matches is expanded. if (this._matchesExpandedCount < WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount) diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js index 18cab8ae4..fa3bfe94f 100644 --- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -1042,7 +1042,7 @@ WebInspector.ElementsTreeElement.prototype = { } }, - onselect: function(treeElement, selectedByUser) + onselect: function(selectedByUser) { this.treeOutline.suppressRevealAndSelect = true; this.treeOutline.selectDOMNode(this.representedObject, selectedByUser); diff --git a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js index d8c45d879..9324a5467 100644 --- a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -175,7 +175,7 @@ WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.Properties */ WebInspector.EventListenerBar = function(eventListener, nodeId, linkifier) { - WebInspector.ObjectPropertiesSection.call(this); + WebInspector.ObjectPropertiesSection.call(this, WebInspector.RemoteObject.fromPrimitiveValue("")); this.eventListener = eventListener; this._nodeId = nodeId; diff --git a/Source/WebCore/inspector/front-end/MemoryStatistics.js b/Source/WebCore/inspector/front-end/MemoryStatistics.js index aa52e222e..b4596e194 100644 --- a/Source/WebCore/inspector/front-end/MemoryStatistics.js +++ b/Source/WebCore/inspector/front-end/MemoryStatistics.js @@ -287,8 +287,8 @@ WebInspector.MemoryStatistics.prototype = { _calculateVisibleIndexes: function() { var calculator = this._timelinePanel.calculator; - var start = calculator.minimumBoundary * 1000; - var end = calculator.maximumBoundary * 1000; + var start = calculator.minimumBoundary() * 1000; + var end = calculator.maximumBoundary() * 1000; var firstIndex = 0; var lastIndex = this._counters.length - 1; for (var i = 0; i < this._counters.length; i++) { diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 6aa5fc935..b0b11e011 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -305,7 +305,7 @@ WebInspector.NetworkLogView.prototype = { this._timelineSortSelector.selectedIndex = 0; this._updateOffscreenRows(); - this.performSearch(null); + this.searchCanceled(); }, _sortByTimeline: function() @@ -451,7 +451,7 @@ WebInspector.NetworkLogView.prototype = { selectMultiple = true; this._filter(e.target, selectMultiple); - this.performSearch(null); + this.searchCanceled(); this._updateSummaryBar(); }, @@ -1083,6 +1083,7 @@ WebInspector.NetworkLogView.prototype = { _clearSearchMatchedList: function() { + delete this._searchRegExp; this._matchedRequests = []; this._matchedRequestsMap = {}; this._removeAllHighlights(); @@ -1170,8 +1171,8 @@ WebInspector.NetworkLogView.prototype = { if (this._currentMatchedRequestIndex !== -1) currentMatchedRequestId = this._matchedRequests[this._currentMatchedRequestIndex]; - this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i"); this._clearSearchMatchedList(); + this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i"); var childNodes = this._dataGrid.dataTableBody.childNodes; var requestNodes = Array.prototype.slice.call(childNodes, 0, childNodes.length - 1); // drop the filler row. @@ -1191,7 +1192,8 @@ WebInspector.NetworkLogView.prototype = { /** * @param {string} query */ - performFilter: function(query) { + performFilter: function(query) + { this._filteredOutRequests.clear(); var filterRegExp = createPlainTextSearchRegex(query, "i"); var shownRequests = []; @@ -1462,19 +1464,28 @@ WebInspector.NetworkPanel.prototype = { /** * @param {string} searchQuery - */ + */ performSearch: function(searchQuery) { this._networkLogView.performSearch(searchQuery); }, - + + /** + * @return {boolean} + */ + canFilter: function() + { + return true; + }, + /** * @param {string} query */ - performFilter: function(query){ + performFilter: function(query) + { this._networkLogView.performFilter(query); }, - + jumpToPreviousSearchResult: function() { this._networkLogView.jumpToPreviousSearchResult(); @@ -1514,6 +1525,7 @@ WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; /** * @constructor + * @implements {WebInspector.TimelineGrid.Calculator} */ WebInspector.NetworkBaseCalculator = function() { @@ -1522,12 +1534,12 @@ WebInspector.NetworkBaseCalculator = function() WebInspector.NetworkBaseCalculator.prototype = { computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea; }, computeBarGraphPercentages: function(item) { - return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100}; + return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan()) * 100}; }, computeBarGraphLabels: function(item) @@ -1536,18 +1548,18 @@ WebInspector.NetworkBaseCalculator.prototype = { return {left: label, right: label, tooltip: label}; }, - get boundarySpan() + boundarySpan: function() { - return this.maximumBoundary - this.minimumBoundary; + return this._maximumBoundary - this._minimumBoundary; }, updateBoundaries: function(item) { - this.minimumBoundary = 0; + this._minimumBoundary = 0; var value = this._value(item); - if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) { - this.maximumBoundary = value; + if (typeof this._maximumBoundary === "undefined" || value > this._maximumBoundary) { + this._maximumBoundary = value; return true; } return false; @@ -1555,8 +1567,18 @@ WebInspector.NetworkBaseCalculator.prototype = { reset: function() { - delete this.minimumBoundary; - delete this.maximumBoundary; + delete this._minimumBoundary; + delete this._maximumBoundary; + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; }, _value: function(item) @@ -1590,17 +1612,17 @@ WebInspector.NetworkTimeCalculator.prototype = { computeBarGraphPercentages: function(request) { if (request.startTime !== -1) - var start = ((request.startTime - this.minimumBoundary) / this.boundarySpan) * 100; + var start = ((request.startTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var start = 0; if (request.responseReceivedTime !== -1) - var middle = ((request.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100; + var middle = ((request.responseReceivedTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var middle = (this.startAtZero ? start : 100); if (request.endTime !== -1) - var end = ((request.endTime - this.minimumBoundary) / this.boundarySpan) * 100; + var end = ((request.endTime - this._minimumBoundary) / this.boundarySpan()) * 100; else var end = (this.startAtZero ? middle : 100); @@ -1619,7 +1641,7 @@ WebInspector.NetworkTimeCalculator.prototype = { // of a specific event. If startAtZero is set, then this is useless, and we // want to return 0. if (eventTime !== -1 && !this.startAtZero) - return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100; + return ((eventTime - this._minimumBoundary) / this.boundarySpan()) * 100; return 0; }, @@ -1629,8 +1651,8 @@ WebInspector.NetworkTimeCalculator.prototype = { if (eventTime === -1 || this.startAtZero) return false; - if (typeof this.maximumBoundary === "undefined" || eventTime > this.maximumBoundary) { - this.maximumBoundary = eventTime; + if (typeof this._maximumBoundary === "undefined" || eventTime > this._maximumBoundary) { + this._maximumBoundary = eventTime; return true; } return false; @@ -1674,14 +1696,14 @@ WebInspector.NetworkTimeCalculator.prototype = { else lowerBound = this._lowerBound(request); - if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) { - this.minimumBoundary = lowerBound; + if (lowerBound !== -1 && (typeof this._minimumBoundary === "undefined" || lowerBound < this._minimumBoundary)) { + this._minimumBoundary = lowerBound; didChange = true; } var upperBound = this._upperBound(request); - if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) { - this.maximumBoundary = upperBound; + if (upperBound !== -1 && (typeof this._maximumBoundary === "undefined" || upperBound > this._maximumBoundary)) { + this._maximumBoundary = upperBound; didChange = true; } diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index e0f965b07..8cee1761c 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -126,9 +126,25 @@ WebInspector.Panel.prototype = { }, /** + * @param {string} query * @param {string} text */ - replaceAllWith: function(text) + replaceAllWith: function(query, text) + { + }, + + /** + * @return {boolean} + */ + canFilter: function() + { + return false; + }, + + /** + * @param {string} query + */ + performFilter: function(query) { }, diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 8d2e726d3..04820da1d 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -276,7 +276,7 @@ WebInspector.SearchController.prototype = { _updateFilterVisibility: function() { - if (typeof WebInspector.inspectorView.currentPanel().performFilter === "function") + if (WebInspector.inspectorView.currentPanel().canFilter()) this._filterCheckboxContainer.removeStyleClass("hidden"); else this._filterCheckboxContainer.addStyleClass("hidden"); @@ -431,8 +431,7 @@ WebInspector.SearchController.prototype = { */ _performFilter: function(query) { - if (typeof WebInspector.inspectorView.currentPanel().performFilter === "function") - WebInspector.inspectorView.currentPanel().performFilter(query); + WebInspector.inspectorView.currentPanel().performFilter(query); }, _onFilterInput: function(event) diff --git a/Source/WebCore/inspector/front-end/SidebarPane.js b/Source/WebCore/inspector/front-end/SidebarPane.js index b7fa747dd..af6ed1abd 100644 --- a/Source/WebCore/inspector/front-end/SidebarPane.js +++ b/Source/WebCore/inspector/front-end/SidebarPane.js @@ -108,8 +108,11 @@ WebInspector.SidebarPane.prototype = { return; this._expanded = true; this.element.addStyleClass("expanded"); - if (this.onexpand) - this.onexpand(this); + this.onexpand(); + }, + + onexpand: function() + { }, collapse: function() @@ -118,8 +121,6 @@ WebInspector.SidebarPane.prototype = { return; this._expanded = false; this.element.removeStyleClass("expanded"); - if (this.oncollapse) - this.oncollapse(this); }, toggleExpanded: function() diff --git a/Source/WebCore/inspector/front-end/TimelineGrid.js b/Source/WebCore/inspector/front-end/TimelineGrid.js index a823adef6..a0cd7c85c 100644 --- a/Source/WebCore/inspector/front-end/TimelineGrid.js +++ b/Source/WebCore/inspector/front-end/TimelineGrid.js @@ -132,7 +132,7 @@ WebInspector.TimelineGrid.prototype = { left = dividersElementClientWidth / dividerCount * i + paddingLeft; dividerLabelBar._labelElement.textContent = ""; } else { - left = calculator.computePosition(calculator.minimumBoundary + slice * i); + left = calculator.computePosition(calculator.minimumBoundary() + slice * i); dividerLabelBar._labelElement.textContent = calculator.formatTime(slice * i); } var percentLeft = 100 * left / dividersElementClientWidth; @@ -200,3 +200,25 @@ WebInspector.TimelineGrid.prototype = { this._dividersElement.style.top = scrollTop + "px"; } } + +/** + * @interface + */ +WebInspector.TimelineGrid.Calculator = function() { } + +WebInspector.TimelineGrid.Calculator.prototype = { + /** @param {number} time */ + computePosition: function(time) { }, + + /** @param {number} time */ + formatTime: function(time) { }, + + /** @return {number} */ + minimumBoundary: function() { }, + + /** @return {number} */ + maximumBoundary: function() { }, + + /** @return {number} */ + boundarySpan: function() { } +} diff --git a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js index 48d99602c..797df208b 100644 --- a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -652,13 +652,13 @@ WebInspector.TimelineOverviewCalculator.prototype = { */ computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft; }, computeBarGraphPercentages: function(record) { - var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100; - var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this.minimumBoundary) / this.boundarySpan * 100; + var start = (WebInspector.TimelineModel.startTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100; + var end = (WebInspector.TimelineModel.endTimeInSeconds(record) - this._minimumBoundary) / this.boundarySpan() * 100; return {start: start, end: end}; }, @@ -668,9 +668,8 @@ WebInspector.TimelineOverviewCalculator.prototype = { */ setWindow: function(minimum, maximum) { - this.minimumBoundary = minimum >= 0 ? minimum : undefined; - this.maximumBoundary = maximum >= 0 ? maximum : undefined; - this.boundarySpan = this.maximumBoundary - this.minimumBoundary; + this._minimumBoundary = minimum >= 0 ? minimum : undefined; + this._maximumBoundary = maximum >= 0 ? maximum : undefined; }, /** @@ -691,6 +690,21 @@ WebInspector.TimelineOverviewCalculator.prototype = { formatTime: function(value) { return Number.secondsToString(value); + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; + }, + + boundarySpan: function() + { + return this._maximumBoundary - this._minimumBoundary; } } diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 661d6bb8c..dbfd8a8c0 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -415,7 +415,7 @@ WebInspector.TimelinePanel.prototype = { _shouldShowFrames: function() { - return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan < 1.0; + return this._frameMode && this._presentationModel.frames().length > 0 && this.calculator.boundarySpan() < 1.0; }, _updateFrames: function() @@ -996,6 +996,7 @@ WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; /** * @constructor * @param {WebInspector.TimelineModel} model + * @implements {WebInspector.TimelineGrid.Calculator} */ WebInspector.TimelineCalculator = function(model) { @@ -1010,15 +1011,15 @@ WebInspector.TimelineCalculator.prototype = { */ computePosition: function(time) { - return (time - this.minimumBoundary) / this.boundarySpan * this._workingArea + this.paddingLeft; + return (time - this._minimumBoundary) / this.boundarySpan() * this._workingArea + this.paddingLeft; }, computeBarGraphPercentages: function(record) { - var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100; - var end = (record.startTime + record.selfTime - this.minimumBoundary) / this.boundarySpan * 100; - var endWithChildren = (record.lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100; - var cpuWidth = record.cpuTime / this.boundarySpan * 100; + var start = (record.startTime - this._minimumBoundary) / this.boundarySpan() * 100; + var end = (record.startTime + record.selfTime - this._minimumBoundary) / this.boundarySpan() * 100; + var endWithChildren = (record.lastChildEndTime - this._minimumBoundary) / this.boundarySpan() * 100; + var cpuWidth = record.cpuTime / this.boundarySpan() * 100; return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth}; }, @@ -1043,9 +1044,8 @@ WebInspector.TimelineCalculator.prototype = { setWindow: function(minimumBoundary, maximumBoundary) { - this.minimumBoundary = minimumBoundary; - this.maximumBoundary = maximumBoundary; - this.boundarySpan = this.maximumBoundary - this.minimumBoundary; + this._minimumBoundary = minimumBoundary; + this._maximumBoundary = maximumBoundary; }, /** @@ -1060,7 +1060,22 @@ WebInspector.TimelineCalculator.prototype = { formatTime: function(value) { - return Number.secondsToString(value + this.minimumBoundary - this._model.minimumRecordTime()); + return Number.secondsToString(value + this._minimumBoundary - this._model.minimumRecordTime()); + }, + + maximumBoundary: function() + { + return this._maximumBoundary; + }, + + minimumBoundary: function() + { + return this._minimumBoundary; + }, + + boundarySpan: function() + { + return this._maximumBoundary - this._minimumBoundary; } } diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index c1e07584e..e140cf6f7 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -60,29 +60,46 @@ WebInspector._elementDragStart = function(elementDragStart, elementDrag, element if (elementDragStart && !elementDragStart(event)) return; - // Install glass pane - if (WebInspector._elementDraggingGlassPane) + if (WebInspector._elementDraggingGlassPane) { WebInspector._elementDraggingGlassPane.dispose(); + delete WebInspector._elementDraggingGlassPane; + } - WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane(); + var targetDocument = event.target.ownerDocument; WebInspector._elementDraggingEventListener = elementDrag; WebInspector._elementEndDraggingEventListener = elementDragEnd; + WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument; - var targetDocument = event.target.ownerDocument; targetDocument.addEventListener("mousemove", WebInspector._elementDraggingEventListener, true); targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, true); + targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragging, true); targetDocument.body.style.cursor = cursor; event.preventDefault(); } +WebInspector._mouseOutWhileDragging = function() +{ + WebInspector._unregisterMouseOutWhileDragging(); + WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane(); +} + +WebInspector._unregisterMouseOutWhileDragging = function() +{ + if (!WebInspector._mouseOutWhileDraggingTargetDocument) + return; + WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout", WebInspector._mouseOutWhileDragging, true); + delete WebInspector._mouseOutWhileDraggingTargetDocument; +} + WebInspector._elementDragEnd = function(event) { var targetDocument = event.target.ownerDocument; targetDocument.removeEventListener("mousemove", WebInspector._elementDraggingEventListener, true); targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true); + WebInspector._unregisterMouseOutWhileDragging(); targetDocument.body.style.removeProperty("cursor"); diff --git a/Source/WebCore/inspector/front-end/treeoutline.js b/Source/WebCore/inspector/front-end/treeoutline.js index ddbdbb0e8..fd02f4e02 100644 --- a/Source/WebCore/inspector/front-end/treeoutline.js +++ b/Source/WebCore/inspector/front-end/treeoutline.js @@ -122,9 +122,6 @@ TreeOutline.prototype.insertChild = function(child, index) } child._attach(); - - if (this.treeOutline.onadd) - this.treeOutline.onadd(child); } TreeOutline.prototype.removeChildAtIndex = function(childIndex) @@ -286,15 +283,6 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, return this.getCachedTreeElement(representedObject); } -TreeOutline.prototype._treeElementDidChange = function(treeElement) -{ - if (treeElement.treeOutline !== this) - return; - - if (this.onchange) - this.onchange(treeElement); -} - TreeOutline.prototype.treeElementFromPoint = function(x, y) { var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y); @@ -376,16 +364,12 @@ TreeOutline.prototype._treeKeyDown = function(event) this.selectedTreeElement.expand(); } } - } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */) { - if (this.selectedTreeElement.ondelete) - handled = this.selectedTreeElement.ondelete(); - } else if (isEnterKey(event)) { - if (this.selectedTreeElement.onenter) - handled = this.selectedTreeElement.onenter(); - } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) { - if (this.selectedTreeElement.onspace) - handled = this.selectedTreeElement.onspace(); - } + } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */) + handled = this.selectedTreeElement.ondelete(); + else if (isEnterKey(event)) + handled = this.selectedTreeElement.onenter(); + else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) + handled = this.selectedTreeElement.onspace(); if (nextSelectedElement) { nextSelectedElement.reveal(); @@ -505,8 +489,7 @@ TreeOutline.prototype._searchInputKeyDown = function(event) } else if (isEnterKey(event)) { var lastSearchMatchElement = this._currentSearchMatchElement; this._searchFinished(); - if (lastSearchMatchElement && lastSearchMatchElement.onenter) - lastSearchMatchElement.onenter(); + lastSearchMatchElement.onenter(); handled = true; } @@ -713,9 +696,6 @@ TreeElement.prototype = { _fireDidChange: function() { delete this._didChangeTimeoutIdentifier; - - if (this.treeOutline) - this.treeOutline._treeElementDidChange(this); }, didChange: function() @@ -773,8 +753,7 @@ TreeElement.prototype._attach = function() this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false); this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false); - if (this.onattach) - this.onattach(this); + this.onattach(); } var nextSibling = null; @@ -840,11 +819,10 @@ TreeElement.treeElementDoubleClicked = function(event) if (!element || !element.treeElement) return; - if (element.treeElement.ondblclick) { - var handled = element.treeElement.ondblclick.call(element.treeElement, event); - if (handled) - return; - } else if (element.treeElement.hasChildren && !element.treeElement.expanded) + var handled = element.treeElement.ondblclick.call(element.treeElement, event); + if (handled) + return; + if (element.treeElement.hasChildren && !element.treeElement.expanded) element.treeElement.expand(); } @@ -860,8 +838,7 @@ TreeElement.prototype.collapse = function() if (this.treeOutline) this.treeOutline._expandedStateMap.put(this.representedObject, false); - if (this.oncollapse) - this.oncollapse(this); + this.oncollapse(); } TreeElement.prototype.collapseRecursively = function() @@ -879,9 +856,9 @@ TreeElement.prototype.expand = function() if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode)) return; - // Set this before onpopulate. Since onpopulate can add elements and call onadd, this makes + // Set this before onpopulate. Since onpopulate can add elements, this makes // sure the expanded flag is true before calling those functions. This prevents the possibility - // of an infinite loop if onpopulate or onadd were to call expand. + // of an infinite loop if onpopulate were to call expand. this.expanded = true; if (this.treeOutline) @@ -915,8 +892,7 @@ TreeElement.prototype.expand = function() if (this._childrenListNode) this._childrenListNode.classList.add("expanded"); - if (this.onexpand) - this.onexpand(this); + this.onexpand(); } TreeElement.prototype.expandRecursively = function(maxDepth) @@ -962,8 +938,7 @@ TreeElement.prototype.reveal = function() currentAncestor = currentAncestor.parent; } - if (this.onreveal) - this.onreveal(this); + this.onreveal(this); } TreeElement.prototype.revealed = function() @@ -1009,9 +984,7 @@ TreeElement.prototype.select = function(omitFocus, selectedByUser) if (this._listItemNode) this._listItemNode.classList.add("selected"); - if (this.onselect) - return this.onselect(this, selectedByUser); - return false; + return this.onselect(selectedByUser); } /** @@ -1035,16 +1008,21 @@ TreeElement.prototype.deselect = function(supressOnDeselect) this.treeOutline.selectedTreeElement = null; if (this._listItemNode) this._listItemNode.classList.remove("selected"); - - if (this.ondeselect && !supressOnDeselect) - this.ondeselect(this); return true; } -TreeElement.prototype.onpopulate = function() -{ - // Overriden by subclasses. -} +// Overridden by subclasses. +TreeElement.prototype.onpopulate = function() { } +TreeElement.prototype.onenter = function() { } +TreeElement.prototype.ondelete = function() { } +TreeElement.prototype.onspace = function() { } +TreeElement.prototype.onattach = function() { } +TreeElement.prototype.onexpand = function() { } +TreeElement.prototype.oncollapse = function() { } +TreeElement.prototype.ondblclick = function() { } +TreeElement.prototype.onreveal = function() { } +/** @param {boolean} selectedByUser */ +TreeElement.prototype.onselect = function(selectedByUser) { } /** * @param {boolean} skipUnrevealed diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index 74bec7bca..a3834faa7 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -262,6 +262,9 @@ void CSPSourceList::parse(const UChar* begin, const UChar* end) bool isFirstSourceInList = true; while (position < end) { skipWhile<isASCIISpace>(position, end); + if (position == end) + return; + const UChar* beginSource = position; skipWhile<isSourceCharacter>(position, end); diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index 6ab968e85..7e73150b8 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -398,23 +398,21 @@ private: // Override ScrollView methods to do point conversion via renderers, in order to // take transforms into account. - virtual IntRect convertToContainingView(const IntRect&) const; - virtual IntRect convertFromContainingView(const IntRect&) const; - virtual IntPoint convertToContainingView(const IntPoint&) const; - virtual IntPoint convertFromContainingView(const IntPoint&) const; + virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE; + virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE; // ScrollableArea interface - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual void getTickmarks(Vector<IntRect>&) const; - virtual void scrollTo(const IntSize&); - virtual void setVisibleScrollerThumbRect(const IntRect&); - virtual bool isOnActivePage() const; - virtual ScrollableArea* enclosingScrollableArea() const; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; + virtual void scrollTo(const IntSize&) OVERRIDE; + virtual void setVisibleScrollerThumbRect(const IntRect&) OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; - - void updateScrollableAreaSet(); - + virtual bool scrollAnimatorEnabled() const OVERRIDE; #if USE(ACCELERATED_COMPOSITING) virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; @@ -424,9 +422,9 @@ private: #endif #endif - virtual void notifyPageThatContentAreaWillPaint() const; + void updateScrollableAreaSet(); - virtual bool scrollAnimatorEnabled() const; + virtual void notifyPageThatContentAreaWillPaint() const; void deferredRepaintTimerFired(Timer<FrameView>*); void doDeferredRepaints(); diff --git a/Source/WebCore/platform/FractionalLayoutUnit.h b/Source/WebCore/platform/FractionalLayoutUnit.h index f6daceac7..c3bd697d0 100644 --- a/Source/WebCore/platform/FractionalLayoutUnit.h +++ b/Source/WebCore/platform/FractionalLayoutUnit.h @@ -36,6 +36,7 @@ #include <math.h> #include <stdlib.h> #include <wtf/MathExtras.h> +#include <wtf/SaturatedArithmetic.h> #if PLATFORM(QT) #include <QDataStream> @@ -63,7 +64,7 @@ static const int kFixedPointDenominator = 60; static const int kFixedPointDenominator = 1; #endif const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator; -const int intMinForLayoutUnit = -intMaxForLayoutUnit; +const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; class FractionalLayoutUnit { public: @@ -73,11 +74,27 @@ public: FractionalLayoutUnit() : m_value(0) { } #if ENABLE(SUBPIXEL_LAYOUT) - FractionalLayoutUnit(int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(unsigned short value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(unsigned int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(float value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } - FractionalLayoutUnit(double value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value * kFixedPointDenominator; } + FractionalLayoutUnit(int value) { setValue(value); } + FractionalLayoutUnit(unsigned short value) { setValue(value); } + FractionalLayoutUnit(unsigned int value) { setValue(value); } + FractionalLayoutUnit(float value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_value = clampTo<float>(value * kFixedPointDenominator, INT_MIN, INT_MAX); +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } + FractionalLayoutUnit(double value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + m_value = clampTo<double>(value * kFixedPointDenominator, INT_MIN, INT_MAX); +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } #else FractionalLayoutUnit(int value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value; } FractionalLayoutUnit(unsigned short value) { REPORT_OVERFLOW(isInBounds(value)); m_value = value; } @@ -89,25 +106,42 @@ public: static FractionalLayoutUnit fromFloatCeil(float value) { - REPORT_OVERFLOW(isInBounds(value)); FractionalLayoutUnit v; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + v.m_value = clampToInteger(ceilf(value * kFixedPointDenominator)); +#else + REPORT_OVERFLOW(isInBounds(value)); v.m_value = ceilf(value * kFixedPointDenominator); +#endif return v; } static FractionalLayoutUnit fromFloatFloor(float value) { - REPORT_OVERFLOW(isInBounds(value)); FractionalLayoutUnit v; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + v.m_value = clampToInteger(floorf(value * kFixedPointDenominator)); +#else + REPORT_OVERFLOW(isInBounds(value)); v.m_value = floorf(value * kFixedPointDenominator); +#endif return v; } static FractionalLayoutUnit fromFloatRound(float value) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) if (value >= 0) + return clamp(value + epsilon() / 2.0f); + return clamp(value - epsilon() / 2.0f); +#else + if (value >= 0) { + REPORT_OVERFLOW(isInBounds(value + epsilon() / 2.0f)); return FractionalLayoutUnit(value + epsilon() / 2.0f); + } + REPORT_OVERFLOW(isInBounds(value - epsilon() / 2.0f)); return FractionalLayoutUnit(value - epsilon() / 2.0f); +#endif } #if ENABLE(SUBPIXEL_LAYOUT) @@ -143,8 +177,8 @@ public: return *this; } - int rawValue() const { return m_value; } - void setRawValue(int value) { m_value = value; } + inline int rawValue() const { return m_value; } + inline void setRawValue(int value) { m_value = value; } void setRawValue(long long value) { REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max()); @@ -214,7 +248,7 @@ public: { return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max()); } - + private: static bool isInBounds(int value) { @@ -228,6 +262,33 @@ private: { return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator; } + + inline void setValue(int value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + if (value >= intMaxForLayoutUnit) + m_value = std::numeric_limits<int>::max(); + else if (value <= intMinForLayoutUnit) + m_value = std::numeric_limits<int>::min(); + else + m_value = value * kFixedPointDenominator; +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } + inline void setValue(unsigned value) + { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + if (value >= static_cast<unsigned>(intMaxForLayoutUnit)) + m_value = std::numeric_limits<int>::max(); + else + m_value = value * kFixedPointDenominator; +#else + REPORT_OVERFLOW(isInBounds(value)); + m_value = value * kFixedPointDenominator; +#endif + } int m_value; }; @@ -411,7 +472,9 @@ inline FractionalLayoutUnit boundedMultiply(const FractionalLayoutUnit& a, const inline FractionalLayoutUnit operator*(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { -#if ENABLE(SUBPIXEL_LAYOUT) +#if ENABLE(SUBPIXEL_LAYOUT) && ENABLE(SATURATED_LAYOUT_ARITHMETIC) + return boundedMultiply(a, b); +#elif ENABLE(SUBPIXEL_LAYOUT) FractionalLayoutUnit returnVal; long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator; returnVal.setRawValue(rawVal); @@ -516,7 +579,11 @@ inline FractionalLayoutUnit operator/(unsigned int a, const FractionalLayoutUnit inline FractionalLayoutUnit operator+(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { FractionalLayoutUnit returnVal; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + returnVal.setRawValue(saturatedAddition(a.rawValue(), b.rawValue())); +#else returnVal.setRawValue(a.rawValue() + b.rawValue()); +#endif return returnVal; } @@ -553,7 +620,11 @@ inline double operator+(const double a, const FractionalLayoutUnit& b) inline FractionalLayoutUnit operator-(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { FractionalLayoutUnit returnVal; +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + returnVal.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue())); +#else returnVal.setRawValue(a.rawValue() - b.rawValue()); +#endif return returnVal; } @@ -627,7 +698,11 @@ inline FractionalLayoutUnit operator%(int a, const FractionalLayoutUnit& b) inline FractionalLayoutUnit& operator+=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + a.setRawValue(saturatedAddition(a.rawValue(), b.rawValue())); +#else a = a + b; +#endif return a; } @@ -657,7 +732,11 @@ inline FractionalLayoutUnit& operator-=(FractionalLayoutUnit& a, int b) inline FractionalLayoutUnit& operator-=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b) { +#if ENABLE(SATURATED_LAYOUT_ARITHMETIC) + a.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue())); +#else a = a - b; +#endif return a; } diff --git a/Source/WebCore/platform/LengthBox.cpp b/Source/WebCore/platform/LengthBox.cpp index 4aa745192..a5205f25c 100644 --- a/Source/WebCore/platform/LengthBox.cpp +++ b/Source/WebCore/platform/LengthBox.cpp @@ -31,23 +31,21 @@ #include "config.h" #include "LengthBox.h" -#include "RenderStyle.h" - namespace WebCore { -Length LengthBox::logicalLeft(const RenderStyle* style) const +Length LengthBox::logicalLeft(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -Length LengthBox::logicalRight(const RenderStyle* style) const +Length LengthBox::logicalRight(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -Length LengthBox::before(const RenderStyle* style) const +Length LengthBox::before(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_top; case BottomToTopWritingMode: @@ -61,9 +59,9 @@ Length LengthBox::before(const RenderStyle* style) const return m_top; } -Length LengthBox::after(const RenderStyle* style) const +Length LengthBox::after(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_bottom; case BottomToTopWritingMode: @@ -77,18 +75,18 @@ Length LengthBox::after(const RenderStyle* style) const return m_bottom; } -Length LengthBox::start(const RenderStyle* style) const +Length LengthBox::start(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_left : m_right; - return style->isLeftToRightDirection() ? m_top : m_bottom; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_left : m_right; + return isLeftToRightDirection(direction) ? m_top : m_bottom; } -Length LengthBox::end(const RenderStyle* style) const +Length LengthBox::end(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_right : m_left; - return style->isLeftToRightDirection() ? m_bottom : m_top; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_right : m_left; + return isLeftToRightDirection(direction) ? m_bottom : m_top; } } // namespace WebCore diff --git a/Source/WebCore/platform/LengthBox.h b/Source/WebCore/platform/LengthBox.h index 389cb66f8..d5dfc13bd 100644 --- a/Source/WebCore/platform/LengthBox.h +++ b/Source/WebCore/platform/LengthBox.h @@ -23,6 +23,8 @@ #define LengthBox_h #include "Length.h" +#include "TextDirection.h" +#include "WritingMode.h" namespace WebCore { @@ -70,13 +72,13 @@ struct LengthBox { Length top() const { return m_top; } Length bottom() const { return m_bottom; } - Length logicalLeft(const RenderStyle*) const; - Length logicalRight(const RenderStyle*) const; + Length logicalLeft(WritingMode) const; + Length logicalRight(WritingMode) const; - Length before(const RenderStyle*) const; - Length after(const RenderStyle*) const; - Length start(const RenderStyle*) const; - Length end(const RenderStyle*) const; + Length before(WritingMode) const; + Length after(WritingMode) const; + Length start(WritingMode, TextDirection) const; + Length end(WritingMode, TextDirection) const; bool operator==(const LengthBox& o) const { diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h index 81a56b251..2cbcc270e 100644 --- a/Source/WebCore/platform/ScrollView.h +++ b/Source/WebCore/platform/ScrollView.h @@ -52,13 +52,14 @@ class ScrollView : public Widget, public ScrollableArea { public: ~ScrollView(); - // ScrollableArea functions. FrameView overrides the others. - virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); + // ScrollableArea functions. + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual bool isScrollCornerVisible() const OVERRIDE; + virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE; + virtual void notifyPageThatContentAreaWillPaint() const; - virtual bool isScrollCornerVisible() const; - virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. virtual void scrollTo(const IntSize& newOffset); @@ -74,11 +75,11 @@ public: const HashSet<RefPtr<Widget> >* children() const { return &m_children; } virtual void addChild(PassRefPtr<Widget>); virtual void removeChild(Widget*); - + // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions // can be used to obtain those scrollbars. - virtual Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } - virtual Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } + virtual Scrollbar* horizontalScrollbar() const OVERRIDE { return m_horizontalScrollbar.get(); } + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_verticalScrollbar.get(); } bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; } void positionScrollbarLayers(); @@ -107,7 +108,7 @@ public: virtual bool avoidScrollbarCreation() const { return false; } - virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle); + virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle) OVERRIDE; // By default you only receive paint events for the area that is visible. In the case of using a // tiled backing store, this function can be set, so that the view paints the entire contents. @@ -143,12 +144,12 @@ public: // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use // the setFixedVisibleContentRect instead for the mainframe, though this must be updated manually, e.g just before resuming the page // which usually will happen when panning, pinching and rotation ends, or when scale or position are changed manually. - virtual IntRect visibleContentRect(bool includeScrollbars = false) const; + virtual IntRect visibleContentRect(bool includeScrollbars = false) const OVERRIDE; virtual void setFixedVisibleContentRect(const IntRect& visibleContentRect) { m_fixedVisibleContentRect = visibleContentRect; } IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; } IntSize visibleSize() const { return visibleContentRect().size(); } - int visibleWidth() const { return visibleContentRect().width(); } - int visibleHeight() const { return visibleContentRect().height(); } + virtual int visibleWidth() const OVERRIDE { return visibleContentRect().width(); } + virtual int visibleHeight() const OVERRIDE { return visibleContentRect().height(); } // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead. @@ -162,22 +163,22 @@ public: // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height // values). - IntSize contentsSize() const; // Always at least as big as the visibleWidth()/visibleHeight(). + virtual IntSize contentsSize() const OVERRIDE; // Always at least as big as the visibleWidth()/visibleHeight(). int contentsWidth() const { return contentsSize().width(); } int contentsHeight() const { return contentsSize().height(); } virtual void setContentsSize(const IntSize&); // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). - IntPoint scrollPosition() const { return visibleContentRect().location(); } + virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect().location(); } IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes. - IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to. - IntPoint minimumScrollPosition() const; // The minimum position we can be scrolled to. + virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum position we can be scrolled to. + virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum position we can be scrolled to. // Adjust the passed in scroll position to keep it between the minimum and maximum positions. IntPoint adjustScrollPositionWithinRange(const IntPoint&) const; int scrollX() const { return scrollPosition().x(); } int scrollY() const { return scrollPosition().y(); } - IntSize overhangAmount() const; + virtual IntSize overhangAmount() const OVERRIDE; void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); } IntPoint cachedScrollPosition() const { return m_cachedScrollPosition; } @@ -277,10 +278,10 @@ public: virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&); - virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const; - virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; - virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; - virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; + virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const OVERRIDE; bool containsScrollableAreaWithOverlayScrollbars() const { return m_containsScrollableAreaWithOverlayScrollbars; } void setContainsScrollableAreaWithOverlayScrollbars(bool contains) { m_containsScrollableAreaWithOverlayScrollbars = contains; } @@ -302,7 +303,7 @@ protected: void setHasVerticalScrollbar(bool); virtual void updateScrollCorner(); - virtual void invalidateScrollCornerRect(const IntRect&); + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE; // Scroll the content by blitting the pixels. virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp index 103e03899..b4e7e5591 100644 --- a/Source/WebCore/platform/ScrollableArea.cpp +++ b/Source/WebCore/platform/ScrollableArea.cpp @@ -373,4 +373,39 @@ void ScrollableArea::serviceScrollAnimations() scrollAnimator->serviceScrollAnimations(); } +IntPoint ScrollableArea::scrollPosition() const +{ + int x = horizontalScrollbar() ? horizontalScrollbar()->value() : 0; + int y = verticalScrollbar() ? verticalScrollbar()->value() : 0; + return IntPoint(x, y); +} + +IntPoint ScrollableArea::minimumScrollPosition() const +{ + return IntPoint(); +} + +IntPoint ScrollableArea::maximumScrollPosition() const +{ + return IntPoint(contentsSize().width() - visibleWidth(), contentsSize().height() - visibleHeight()); +} + +IntRect ScrollableArea::visibleContentRect(bool includeScrollbars) const +{ + int verticalScrollbarWidth = 0; + int horizontalScrollbarHeight = 0; + + if (includeScrollbars) { + if (Scrollbar* verticalBar = verticalScrollbar()) + verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0; + if (Scrollbar* horizontalBar = horizontalScrollbar()) + horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0; + } + + return IntRect(scrollPosition().x(), + scrollPosition().y(), + std::max(0, visibleWidth() + verticalScrollbarWidth), + std::max(0, visibleHeight() + horizontalScrollbarHeight)); +} + } // namespace WebCore diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h index 5a278a9b5..721ec32ec 100644 --- a/Source/WebCore/platform/ScrollableArea.h +++ b/Source/WebCore/platform/ScrollableArea.h @@ -133,27 +133,27 @@ public: virtual Scrollbar* horizontalScrollbar() const { return 0; } virtual Scrollbar* verticalScrollbar() const { return 0; } - virtual IntPoint scrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntPoint minimumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntPoint maximumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); } - virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const { ASSERT_NOT_REACHED(); return IntRect(); } - virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; } - virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; } - virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); } - virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); } + virtual IntPoint scrollPosition() const; + virtual IntPoint minimumScrollPosition() const; + virtual IntPoint maximumScrollPosition() const; + virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const; + virtual int visibleHeight() const = 0; + virtual int visibleWidth() const = 0; + virtual IntSize contentsSize() const = 0; + virtual IntSize overhangAmount() const { return IntSize(); } virtual IntPoint currentMousePosition() const { return IntPoint(); } virtual bool shouldSuspendScrollAnimations() const { return true; } virtual void scrollbarStyleChanged(int /*newStyle*/, bool /*forceUpdate*/) { } virtual void setVisibleScrollerThumbRect(const IntRect&) { } - virtual bool isOnActivePage() const { ASSERT_NOT_REACHED(); return true; } + virtual bool isOnActivePage() const = 0; // Note that this only returns scrollable areas that can actually be scrolled. virtual ScrollableArea* enclosingScrollableArea() const = 0; // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view. - virtual IntRect scrollableAreaBoundingBox() const { ASSERT_NOT_REACHED(); return IntRect(); } + virtual IntRect scrollableAreaBoundingBox() const = 0; virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; } diff --git a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp index 09f185a9f..b2bfbea5e 100644 --- a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp +++ b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp @@ -129,6 +129,11 @@ TouchpadFlingPlatformGestureCurve::~TouchpadFlingPlatformGestureCurve() { } +const char* TouchpadFlingPlatformGestureCurve::debugName() const +{ + return "TouchpadFling"; +} + bool TouchpadFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarget* target) { float displacement; diff --git a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h index 46b0aa5b6..e1c85575d 100644 --- a/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h +++ b/Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h @@ -44,8 +44,8 @@ public: static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, IntPoint cumulativeScroll = IntPoint()); virtual ~TouchpadFlingPlatformGestureCurve(); - virtual const char* debugName() const { return "TouchpadFling"; } - virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*); + virtual const char* debugName() const OVERRIDE; + virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*) OVERRIDE; private: TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, const IntPoint& cumulativeScroll); diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp index c9f173289..73ffc381d 100644 --- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp +++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp @@ -46,6 +46,11 @@ WheelFlingPlatformGestureCurve::~WheelFlingPlatformGestureCurve() { } +const char* WheelFlingPlatformGestureCurve::debugName() const +{ + return "WheelFling"; +} + bool WheelFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarget* target) { // Use a Rayleigh distribution for the curve. This simulates a velocity profile diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h index 44d552a86..96cfaca1a 100644 --- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h +++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h @@ -43,8 +43,8 @@ public: static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity); virtual ~WheelFlingPlatformGestureCurve(); - virtual const char* debugName() const { return "WheelFling"; } - virtual bool apply(double time, PlatformGestureCurveTarget*); + virtual const char* debugName() const OVERRIDE; + virtual bool apply(double time, PlatformGestureCurveTarget*) OVERRIDE; private: explicit WheelFlingPlatformGestureCurve(const FloatPoint& velocity); diff --git a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp index 29e81fc74..0572cc45c 100644 --- a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp +++ b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp @@ -60,7 +60,6 @@ static void destroyAudioBufferList(AudioBufferList* bufferList) AudioFileReader::AudioFileReader(const char* filePath) : m_data(0) , m_dataSize(0) - , m_filePath(filePath) , m_audioFileID(0) , m_extAudioFileRef(0) { @@ -75,7 +74,6 @@ AudioFileReader::AudioFileReader(const char* filePath) AudioFileReader::AudioFileReader(const void* data, size_t dataSize) : m_data(data) , m_dataSize(dataSize) - , m_filePath(0) , m_audioFileID(0) , m_extAudioFileRef(0) { diff --git a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h index 212343149..60af2f157 100644 --- a/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h +++ b/Source/WebCore/platform/audio/mac/AudioFileReaderMac.h @@ -57,7 +57,6 @@ private: const void* m_data; size_t m_dataSize; - const char* m_filePath; AudioFileID m_audioFileID; ExtAudioFileRef m_extAudioFileRef; diff --git a/Source/WebCore/platform/blackberry/CookieParser.cpp b/Source/WebCore/platform/blackberry/CookieParser.cpp index e29ea28bd..2564c568e 100644 --- a/Source/WebCore/platform/blackberry/CookieParser.cpp +++ b/Source/WebCore/platform/blackberry/CookieParser.cpp @@ -29,7 +29,7 @@ #include "Logging.h" #include "ParsedCookie.h" -#include <network/TopLevelDomain.h> +#include <network/DomainTools.h> #include <wtf/CurrentTime.h> #include <wtf/text/CString.h> @@ -274,7 +274,7 @@ ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start, // Check whether the domain is a top level domain, if it is throw it out // http://publicsuffix.org/list/ - if (!BlackBerry::Platform::TopLevelDomain::isCookieWritableDomain(realDomain.utf8().data())) + if (BlackBerry::Platform::isTopLevelDomain(realDomain.utf8().data())) LOG_AND_DELETE("Invalid cookie %s (domain): it did not pass the top level domain check", cookie.ascii().data()); res->setDomain(realDomain); diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.cpp b/Source/WebCore/platform/chromium/FramelessScrollView.cpp index 73bec0df8..c410677cb 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.cpp +++ b/Source/WebCore/platform/chromium/FramelessScrollView.cpp @@ -63,6 +63,16 @@ ScrollableArea* FramelessScrollView::enclosingScrollableArea() const return 0; } +bool FramelessScrollView::isOnActivePage() const +{ + return isActive(); +} + +IntRect FramelessScrollView::scrollableAreaBoundingBox() const +{ + return windowClipRect(false); +} + void FramelessScrollView::invalidateRect(const IntRect& rect) { if (HostWindow* h = hostWindow()) diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.h b/Source/WebCore/platform/chromium/FramelessScrollView.h index 3498475dc..ac1eecd1c 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.h +++ b/Source/WebCore/platform/chromium/FramelessScrollView.h @@ -74,9 +74,11 @@ namespace WebCore { #endif // ScrollableArea public methods: - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual ScrollableArea* enclosingScrollableArea() const; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // Widget public methods: virtual void invalidateRect(const IntRect&); diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp index e4e545a1b..f1c4e5b6f 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp @@ -31,33 +31,31 @@ #include "config.h" #include "FractionalLayoutBoxExtent.h" -#include "RenderStyle.h" - namespace WebCore { -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_top : m_left; + return isHorizontalWritingMode(writingMode) ? m_top : m_left; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_bottom : m_right; + return isHorizontalWritingMode(writingMode) ? m_bottom : m_right; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(WritingMode writingMode) const { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::before(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::before(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_top; case BottomToTopWritingMode: @@ -71,9 +69,9 @@ FractionalLayoutUnit FractionalLayoutBoxExtent::before(const RenderStyle* style) return m_top; } -FractionalLayoutUnit FractionalLayoutBoxExtent::after(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::after(WritingMode writingMode) const { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: return m_bottom; case BottomToTopWritingMode: @@ -87,23 +85,23 @@ FractionalLayoutUnit FractionalLayoutBoxExtent::after(const RenderStyle* style) return m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::start(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::start(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_left : m_right; - return style->isLeftToRightDirection() ? m_top : m_bottom; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_left : m_right; + return isLeftToRightDirection(direction) ? m_top : m_bottom; } -FractionalLayoutUnit FractionalLayoutBoxExtent::end(const RenderStyle* style) const +FractionalLayoutUnit FractionalLayoutBoxExtent::end(WritingMode writingMode, TextDirection direction) const { - if (style->isHorizontalWritingMode()) - return style->isLeftToRightDirection() ? m_right : m_left; - return style->isLeftToRightDirection() ? m_bottom : m_top; + if (isHorizontalWritingMode(writingMode)) + return isLeftToRightDirection(direction) ? m_right : m_left; + return isLeftToRightDirection(direction) ? m_bottom : m_top; } -void FractionalLayoutBoxExtent::setBefore(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setBefore(WritingMode writingMode, FractionalLayoutUnit value) { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: m_top = value; break; @@ -122,9 +120,9 @@ void FractionalLayoutBoxExtent::setBefore(const RenderStyle* style, FractionalLa } } -void FractionalLayoutBoxExtent::setAfter(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setAfter(WritingMode writingMode, FractionalLayoutUnit value) { - switch (style->writingMode()) { + switch (writingMode) { case TopToBottomWritingMode: m_bottom = value; break; @@ -143,56 +141,56 @@ void FractionalLayoutBoxExtent::setAfter(const RenderStyle* style, FractionalLay } } -void FractionalLayoutBoxExtent::setStart(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value) { - if (style->isHorizontalWritingMode()) { - if (style->isLeftToRightDirection()) + if (isHorizontalWritingMode(writingMode)) { + if (isLeftToRightDirection(direction)) m_left = value; else m_right = value; } else { - if (style->isLeftToRightDirection()) + if (isLeftToRightDirection(direction)) m_top = value; else m_bottom = value; } } -void FractionalLayoutBoxExtent::setEnd(const RenderStyle* style, FractionalLayoutUnit value) +void FractionalLayoutBoxExtent::setEnd(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value) { - if (style->isHorizontalWritingMode()) { - if (style->isLeftToRightDirection()) + if (isHorizontalWritingMode(writingMode)) { + if (isLeftToRightDirection(direction)) m_right = value; else m_left = value; } else { - if (style->isLeftToRightDirection()) + if (isLeftToRightDirection(direction)) m_bottom = value; else m_top = value; } } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? m_left : m_top; + return isHorizontalWritingMode(writingMode) ? m_left : m_top; } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? m_right : m_bottom; + return isHorizontalWritingMode(writingMode) ? m_right : m_bottom; } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_bottom : m_top) : - (style->isFlippedBlocksWritingMode() ? m_right: m_left); + return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_bottom : m_top) : + (isFlippedBlocksWritingMode(writingMode) ? m_right: m_left); } -FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(const RenderStyle* style) +FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(WritingMode writingMode) { - return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_top : m_bottom) : - (style->isFlippedBlocksWritingMode() ? m_left: m_right); + return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) : + (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h index 921c84b90..28bdb9cd7 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h @@ -32,11 +32,11 @@ #define FractionalLayoutBoxExtent_h #include "FractionalLayoutUnit.h" +#include "TextDirection.h" +#include "WritingMode.h" namespace WebCore { -class RenderStyle; - class FractionalLayoutBoxExtent { public: FractionalLayoutBoxExtent() : m_top(0), m_right(0), m_bottom(0), m_left(0) { } @@ -53,26 +53,26 @@ public: inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; } inline void setLeft(FractionalLayoutUnit value) { m_left = value; } - FractionalLayoutUnit logicalTop(const RenderStyle*) const; - FractionalLayoutUnit logicalBottom(const RenderStyle*) const; - FractionalLayoutUnit logicalLeft(const RenderStyle*) const; - FractionalLayoutUnit logicalRight(const RenderStyle*) const; + FractionalLayoutUnit logicalTop(WritingMode) const; + FractionalLayoutUnit logicalBottom(WritingMode) const; + FractionalLayoutUnit logicalLeft(WritingMode) const; + FractionalLayoutUnit logicalRight(WritingMode) const; - FractionalLayoutUnit before(const RenderStyle*) const; - FractionalLayoutUnit after(const RenderStyle*) const; - FractionalLayoutUnit start(const RenderStyle*) const; - FractionalLayoutUnit end(const RenderStyle*) const; + FractionalLayoutUnit before(WritingMode) const; + FractionalLayoutUnit after(WritingMode) const; + FractionalLayoutUnit start(WritingMode, TextDirection) const; + FractionalLayoutUnit end(WritingMode, TextDirection) const; - void setBefore(const RenderStyle*, FractionalLayoutUnit); - void setAfter(const RenderStyle*, FractionalLayoutUnit); - void setStart(const RenderStyle*, FractionalLayoutUnit); - void setEnd(const RenderStyle*, FractionalLayoutUnit); + void setBefore(WritingMode, FractionalLayoutUnit); + void setAfter(WritingMode, FractionalLayoutUnit); + void setStart(WritingMode, TextDirection, FractionalLayoutUnit); + void setEnd(WritingMode, TextDirection, FractionalLayoutUnit); - FractionalLayoutUnit& mutableLogicalLeft(const RenderStyle*); - FractionalLayoutUnit& mutableLogicalRight(const RenderStyle*); + FractionalLayoutUnit& mutableLogicalLeft(WritingMode); + FractionalLayoutUnit& mutableLogicalRight(WritingMode); - FractionalLayoutUnit& mutableBefore(const RenderStyle*); - FractionalLayoutUnit& mutableAfter(const RenderStyle*); + FractionalLayoutUnit& mutableBefore(WritingMode); + FractionalLayoutUnit& mutableAfter(WritingMode); private: FractionalLayoutUnit m_top; diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index 2b19f1349..655b6d14f 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -80,7 +80,7 @@ bool Image::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, ColorSpace styleColorSpace, CompositeOperator op) { - if (color.alpha() <= 0) + if (!color.alpha()) return; CompositeOperator previousOperator = ctxt->compositeOperation(); diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h index 40d757fa0..78f0de8ce 100644 --- a/Source/WebCore/platform/graphics/ImageSource.h +++ b/Source/WebCore/platform/graphics/ImageSource.h @@ -153,8 +153,11 @@ public: private: NativeImageSourcePtr m_decoder; + +#if !USE(CG) AlphaOption m_alphaOption; GammaAndColorProfileOption m_gammaAndColorProfileOption; +#endif #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) static unsigned s_maxPixelsPerDecodedImage; #endif diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index de692227c..eac345c17 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -98,6 +98,7 @@ class IntSize; class MediaPlayer; struct MediaPlayerFactory; class TimeRanges; +class HostWindow; #if PLATFORM(WIN) && USE(AVFOUNDATION) struct GraphicsDeviceAdapter; @@ -189,6 +190,15 @@ public: virtual String mediaPlayerReferrer() const { return String(); } virtual String mediaPlayerUserAgent() const { return String(); } virtual CORSMode mediaPlayerCORSMode() const { return Unspecified; } + virtual void mediaPlayerExitFullscreen() { } + virtual bool mediaPlayerIsVideo() const { return false; } + virtual LayoutRect mediaPlayerContentBoxRect() const { return LayoutRect(); } + virtual void mediaPlayerSetSize(const IntSize&) { } + virtual void mediaPlayerPause() { } + virtual void mediaPlayerPlay() { } + virtual bool mediaPlayerIsPaused() const { return true; } + virtual HostWindow* mediaPlayerHostWindow() { return 0; } + virtual IntRect mediaPlayerWindowClipRect() { return IntRect(); } }; class MediaPlayerSupportsTypeClient { diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h index c0b044d2c..820c26573 100644 --- a/Source/WebCore/platform/graphics/SimpleFontData.h +++ b/Source/WebCore/platform/graphics/SimpleFontData.h @@ -39,7 +39,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/text/StringHash.h> -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) #include <wtf/RetainPtr.h> #endif @@ -176,7 +176,7 @@ public: NSFont* getNSFont() const { return m_platformData.nsFont(); } #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; #endif @@ -273,7 +273,7 @@ private: float m_syntheticBoldOffset; #endif -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || (PLATFORM(WX) && OS(DARWIN)) mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; #endif diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h index 0fe6131d6..d44a30c73 100644 --- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h +++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h @@ -124,7 +124,6 @@ private: void paintWithVideoOutput(GraphicsContext*, const IntRect&); #endif - MediaPlayer* m_player; RetainPtr<AVAsset> m_avAsset; RetainPtr<AVPlayer> m_avPlayer; RetainPtr<AVPlayerItem> m_avPlayerItem; diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp index 6fad26e53..d7f9acba6 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp @@ -27,7 +27,6 @@ #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" -#include "HTMLMediaElement.h" #include "HTMLNames.h" #include "HostWindow.h" #include "MediaStreamDescriptor.h" @@ -122,8 +121,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) MediaPlayerPrivate::~MediaPlayerPrivate() { if (isFullscreen()) { - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - element->exitFullscreen(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerExitFullscreen(); } #if USE(ACCELERATED_COMPOSITING) // Remove media player from platform layer. @@ -151,9 +149,7 @@ void MediaPlayerPrivate::load(const String& url) modifiedUrl = decodeURLEscapeSequences(modifiedUrl); } - void* tabId = 0; - if (frameView() && frameView()->hostWindow()) - tabId = frameView()->hostWindow()->platformPageClient(); + void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient(); deleteGuardedObject(m_platformPlayer); #if USE(ACCELERATED_COMPOSITING) @@ -370,7 +366,7 @@ void MediaPlayerPrivate::paintCurrentFrameInContext(GraphicsContext* context, co ASSERT(graphics); BlackBerry::Platform::IntRect platformRect(rect.x(), rect.y(), rect.width(), rect.height()); - IntRect clippedRect = frameView()->windowClipRect(); + IntRect clippedRect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerWindowClipRect(); BlackBerry::Platform::IntRect platformWindowClipRect(clippedRect.x(), clippedRect.y(), clippedRect.width(), clippedRect.height()); m_platformPlayer->paint(graphics->canvas(), platformRect, platformWindowClipRect); } @@ -399,39 +395,27 @@ void MediaPlayerPrivate::resizeSourceDimensions() if (!m_webCorePlayer) return; - HTMLMediaElement* client = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - - if (!client || !client->isVideo()) - return; - - RenderObject* o = client->renderer(); - if (!o) + if (!m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsVideo()) return; // If we have an HTMLVideoElement but the source has no video, then we need to resize the media element. if (!hasVideo()) { - IntRect rect = o->enclosingBox()->contentBoxRect(); + LayoutRect rect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerContentBoxRect(); static const int playbookMinAudioElementWidth = 300; static const int playbookMinAudioElementHeight = 32; // If the rect dimensions are less than the allowed minimum, use the minimum instead. - int newWidth = max(rect.width(), playbookMinAudioElementWidth); - int newHeight = max(rect.height(), playbookMinAudioElementHeight); - - char attrString[12]; + int newWidth = max(rect.width().toInt(), playbookMinAudioElementWidth); + int newHeight = max(rect.height().toInt(), playbookMinAudioElementHeight); - sprintf(attrString, "%d", newWidth); - client->setAttribute(HTMLNames::widthAttr, attrString); - - sprintf(attrString, "%d", newHeight); - client->setAttribute(HTMLNames::heightAttr, attrString); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerSetSize(IntSize(newWidth, newHeight)); } // If we don't know what the width and height of the video source is, then we need to set it to something sane. if (m_platformPlayer->sourceWidth() && m_platformPlayer->sourceHeight()) return; - IntRect rect = o->enclosingBox()->contentBoxRect(); - m_platformPlayer->setSourceDimension(rect.width(), rect.height()); + LayoutRect rect = m_webCorePlayer->mediaPlayerClient()->mediaPlayerContentBoxRect(); + m_platformPlayer->setSourceDimension(rect.width().toUnsigned(), rect.height().toUnsigned()); } void MediaPlayerPrivate::setFullscreenWebPageClient(BlackBerry::WebKit::WebPageClient* client) @@ -511,8 +495,6 @@ void MediaPlayerPrivate::updateStates() PlatformPlayer::Error currentError = m_platformPlayer->error(); - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - if (currentError != PlatformPlayer::MediaOK) { m_readyState = MediaPlayer::HaveNothing; if (currentError == PlatformPlayer::MediaDecodeError) @@ -549,7 +531,7 @@ void MediaPlayerPrivate::updateStates() } #endif if (isFullscreen()) - element->exitFullscreen(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerExitFullscreen(); break; case PlatformPlayer::MP_STATE_ACTIVE: #if USE(ACCELERATED_COMPOSITING) @@ -608,15 +590,14 @@ void MediaPlayerPrivate::onPauseStateChanged() if (!isFullscreen()) return; - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); // Paused state change not due to local controller. if (m_platformPlayer->isPaused()) - element->pause(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPause(); else { // The HMI fullscreen widget has resumed play. Check if the // pause timeout occurred. m_platformPlayer->processPauseTimeoutIfNecessary(); - element->play(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPlay(); } } @@ -644,14 +625,12 @@ void MediaPlayerPrivate::onSizeChanged() void MediaPlayerPrivate::onPlayNotified() { - if (HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient())) - element->play(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPlay(); } void MediaPlayerPrivate::onPauseNotified() { - if (HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient())) - element->pause(); + m_webCorePlayer->mediaPlayerClient()->mediaPlayerPause(); } static const int popupDialogInterval = 10; @@ -726,8 +705,8 @@ bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge) Credential credential = CredentialStorage::get(protectionSpace); bool isConfirmed = false; if (credential.isEmpty()) { - if (frameView() && frameView()->hostWindow()) - isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential); + isConfirmed = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential); + } else isConfirmed = true; @@ -783,11 +762,7 @@ int MediaPlayerPrivate::showErrorDialog(PlatformPlayer::Error type) LOG(Media, "Alert type does not exist."); return -1; } - - int rc = 0; - if (frameView() && frameView()->hostWindow()) - rc = frameView()->hostWindow()->platformPageClient()->showAlertDialog(atype); - return rc; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->showAlertDialog(atype); } static WebMediaStreamSource toWebMediaStreamSource(MediaStreamSource* src) @@ -817,23 +792,9 @@ WebMediaStreamDescriptor MediaPlayerPrivate::lookupMediaStream(const string& url return toWebMediaStreamDescriptor(descriptor); } -FrameView* MediaPlayerPrivate::frameView() const -{ - // We previously used m_webCorePlayer->frameView(), but this method returns - // a null frameView until quite late in the media player initialization, - // and starting quite early in the media player destruction (because - // it may be set to zero by the destructor in RenderVideo.cpp before - // our destructor is called, leaving us unable to clean up child windows - // in mmrDisconnect). - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - return element->document()->view(); -} - BlackBerry::Platform::Graphics::Window* MediaPlayerPrivate::platformWindow() { - if (frameView() && frameView()->hostWindow()) - return frameView()->hostWindow()->platformPageClient()->platformWindow(); - return 0; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->platformWindow(); } bool MediaPlayerPrivate::isFullscreen() const @@ -843,17 +804,12 @@ bool MediaPlayerPrivate::isFullscreen() const bool MediaPlayerPrivate::isElementPaused() const { - HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_webCorePlayer->mediaPlayerClient()); - if (!element || element->paused()) - return true; - return false; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsPaused(); } bool MediaPlayerPrivate::isTabVisible() const { - if (frameView() && frameView()->hostWindow()) - return frameView()->hostWindow()->platformPageClient()->isVisible(); - return true; + return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->isVisible(); } #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h index 40156fbb7..570741ce2 100644 --- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h +++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h @@ -145,7 +145,6 @@ public: private: MediaPlayerPrivate(MediaPlayer*); - FrameView* frameView() const; void updateStates(); String userAgent(const String&) const; diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 7cf02968e..b00666759 100644 --- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -70,12 +70,10 @@ void sharedBufferRelease(void* info) } #endif -ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) +ImageSource::ImageSource(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption) : m_decoder(0) - // FIXME: m_premultiplyAlpha is ignored in cg at the moment. - , m_alphaOption(alphaOption) - , m_gammaAndColorProfileOption(gammaAndColorProfileOption) { + // FIXME: AlphaOption and GammaAndColorProfileOption are ignored. } ImageSource::~ImageSource() diff --git a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp b/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp index 63cff30d9..8064ae38e 100644 --- a/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp +++ b/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp @@ -123,16 +123,16 @@ WebTransformOperations toWebTransformOperations(const TransformOperations& trans } template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithStandardTimingFunction(Curve& curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&) +bool appendKeyframeWithStandardTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize&) { - curve.add(Keyframe(keyTime, value->value()), timingFunctionType); + curve->add(Keyframe(keyTime, value->value()), timingFunctionType); return true; } template <class Value, class Keyframe, class Curve> -bool appendKeyframeWithCustomBezierTimingFunction(Curve& curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&) +bool appendKeyframeWithCustomBezierTimingFunction(Curve* curve, double keyTime, const Value* value, const Value* lastValue, double x1, double y1, double x2, double y2, const FloatSize&) { - curve.add(Keyframe(keyTime, value->value()), x1, y1, x2, y2); + curve->add(Keyframe(keyTime, value->value()), x1, y1, x2, y2); return true; } @@ -185,28 +185,28 @@ bool causesRotationOfAtLeast180Degrees(const TransformAnimationValue* value, con } template <> -bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) +bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) { if (causesRotationOfAtLeast180Degrees(value, lastValue)) return false; WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize); if (operations.apply().isInvertible()) { - curve.add(WebTransformKeyframe(keyTime, operations), timingFunctionType); + curve->add(WebTransformKeyframe(keyTime, operations), timingFunctionType); return true; } return false; } template <> -bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve& curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) +bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) { if (causesRotationOfAtLeast180Degrees(value, lastValue)) return false; WebTransformOperations operations = toWebTransformOperations(*value->value(), boxSize); if (operations.apply().isInvertible()) { - curve.add(WebTransformKeyframe(keyTime, operations), x1, y1, x2, y2); + curve->add(WebTransformKeyframe(keyTime, operations), x1, y1, x2, y2); return true; } return false; @@ -225,7 +225,7 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val reverse = true; } - Curve curve; + OwnPtr<Curve> curve = adoptPtr(Curve::create()); for (size_t i = 0; i < valueList.size(); i++) { size_t index = reverse ? valueList.size() - i - 1 : i; @@ -277,14 +277,14 @@ PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& val bool addedKeyframe = false; if (isUsingCustomBezierTimingFunction) - addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize); + addedKeyframe = appendKeyframeWithCustomBezierTimingFunction<Value, Keyframe, Curve>(curve.get(), keyTime, originalValue, lastOriginalValue, x1, y1, x2, y2, boxSize); else - addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve, keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize); + addedKeyframe = appendKeyframeWithStandardTimingFunction<Value, Keyframe, Curve>(curve.get(), keyTime, originalValue, lastOriginalValue, timingFunctionType, boxSize); if (!addedKeyframe) return nullptr; } - OwnPtr<WebKit::WebAnimation> anim(adoptPtr(WebKit::WebAnimation::create(curve, animationId, groupId, targetProperty))); + OwnPtr<WebKit::WebAnimation> anim(adoptPtr(WebKit::WebAnimation::create(*curve, animationId, groupId, targetProperty))); int iterations = (animation && animation->isIterationCountSet()) ? animation->iterationCount() : 1; anim->setIterations(iterations); diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp index 10654312c..ed332b187 100644 --- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp +++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp @@ -27,10 +27,10 @@ #include "Canvas2DLayerBridge.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GrContext.h" #include "GraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" -#include "LayerRendererChromium.h" // For GLC() macro. #include "TraceEvent.h" #include <public/WebCompositor.h> #include <public/WebGraphicsContext3D.h> @@ -166,4 +166,3 @@ unsigned Canvas2DLayerBridge::backBufferTexture() } } - diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index a8f57e296..c2bf45ead 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -117,7 +117,7 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); m_textureUpdater->setOpaque(opaque()); - GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp b/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp index 67ab4624f..960ef958e 100644 --- a/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp +++ b/Source/WebCore/platform/graphics/chromium/GeometryBinding.cpp @@ -29,8 +29,8 @@ #include "GeometryBinding.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include <public/WebGraphicsContext3D.h> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp index 7d5591be3..cf4435bda 100644 --- a/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp @@ -597,16 +597,17 @@ void GraphicsLayerChromium::setDebugBorder(const Color& color, float borderWidth void GraphicsLayerChromium::updateChildList() { - Vector<WebLayer*> newChildren; + WebLayer* childHost = m_transformLayer ? m_transformLayer.get() : m_layer->layer(); + childHost->removeAllChildren(); if (m_transformLayer) { // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind. - newChildren.append(m_layer->layer()); + childHost->addChild(m_layer->layer()); } else if (m_contentsLayer) { // FIXME: add the contents layer in the correct order with negative z-order children. // This does not cause visible rendering issues because currently contents layers are only used // for replaced elements that don't have children. - newChildren.append(m_contentsLayer); + childHost->addChild(m_contentsLayer); } const Vector<GraphicsLayer*>& childLayers = children(); @@ -614,29 +615,18 @@ void GraphicsLayerChromium::updateChildList() for (size_t i = 0; i < numChildren; ++i) { GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]); - newChildren.append(curChild->platformLayer()); + childHost->addChild(curChild->platformLayer()); } if (m_linkHighlight) - newChildren.append(m_linkHighlight->layer()); + childHost->addChild(m_linkHighlight->layer()); - for (size_t i = 0; i < newChildren.size(); ++i) - newChildren[i]->removeFromParent(); - - WebVector<WebLayer*> newWebChildren; - newWebChildren.assign(newChildren.data(), newChildren.size()); - - if (m_transformLayer) { - m_transformLayer->setChildren(newWebChildren); - - if (m_contentsLayer) { - // If we have a transform layer, then the contents layer is parented in the - // primary layer (which is itself a child of the transform layer). - m_layer->layer()->removeAllChildren(); - m_layer->layer()->addChild(m_contentsLayer); - } - } else - m_layer->layer()->setChildren(newWebChildren); + if (m_transformLayer && m_contentsLayer) { + // If we have a transform layer, then the contents layer is parented in the + // primary layer (which is itself a child of the transform layer). + m_layer->layer()->removeAllChildren(); + m_layer->layer()->addChild(m_contentsLayer); + } } void GraphicsLayerChromium::updateLayerPosition() diff --git a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp index 2ae58ab7b..dc71d271c 100644 --- a/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/HeadsUpDisplayLayerChromium.cpp @@ -52,7 +52,7 @@ HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium() void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) { const CCLayerTreeSettings& settings = layerTreeHost()->settings(); - int maxTextureSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize; + int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; IntSize bounds; if (settings.showPlatformLayerTree || settings.showDebugRects()) { diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index f8d869fad..1049e03ee 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -157,7 +157,7 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() return; m_textureUpdater = ImageLayerTextureUpdater::create(); - GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp index 83c7114ba..5c8960ee2 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp @@ -29,8 +29,8 @@ #include "LayerTextureSubImage.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3DChromium.h" -#include "LayerRendererChromium.h" // For GLC() macro #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp index 2f6ca2286..ccc14875f 100644 --- a/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp +++ b/Source/WebCore/platform/graphics/chromium/ProgramBinding.cpp @@ -29,9 +29,9 @@ #include "ProgramBinding.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GeometryBinding.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> #include <wtf/text/CString.h> diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 7b11f6aac..787eaaec2 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -37,7 +37,6 @@ namespace WebCore { class LayerChromium; -class LayerRendererChromium; class RenderSurfaceChromium { WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); diff --git a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp index 67fbd3679..5dd1045ab 100644 --- a/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp @@ -188,7 +188,7 @@ void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() { - m_textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart)); diff --git a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp index fbb7cffd5..e20c323cc 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp @@ -26,8 +26,8 @@ #include "TextureCopier.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" // For the GLC() macro #include "TraceEvent.h" #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 68bfa45b0..5dc65ec5a 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -149,7 +149,7 @@ void TiledLayerChromium::updateTileSizeAndTilingOption() isTiled = autoTiled; IntSize requestedSize = isTiled ? tileSize : contentBounds(); - const int maxSize = layerTreeHost()->layerRendererCapabilities().maxTextureSize; + const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize; IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize)); setTileSize(clampedSize); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp index 271174002..c2a8892d0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp @@ -97,9 +97,9 @@ double CCDelayBasedTimeSource::lastTickTime() return m_lastTickTime; } -double CCDelayBasedTimeSource::nextTickTime() +double CCDelayBasedTimeSource::nextTickTimeIfActivated() { - return active() ? m_currentParameters.tickTarget : 0.0; + return active() ? m_currentParameters.tickTarget : nextTickTarget(monotonicTimeNow()); } void CCDelayBasedTimeSource::onTimerFired() @@ -207,7 +207,7 @@ double CCDelayBasedTimeSource::monotonicTimeNow() const // now=37 tickTarget=16.667 newTarget=50.000 --> tick(), postDelayedTask(floor(50.000-37)) --> postDelayedTask(13) // // Note, that in the above discussion, times are expressed in milliseconds, but in the code, seconds are used. -void CCDelayBasedTimeSource::postNextTickTask(double now) +double CCDelayBasedTimeSource::nextTickTarget(double now) { double newInterval = m_nextParameters.interval; double intervalsElapsed = floor((now - m_nextParameters.tickTarget) / newInterval); @@ -221,9 +221,16 @@ void CCDelayBasedTimeSource::postNextTickTask(double now) if (newTickTarget - m_lastTickTime <= newInterval * doubleTickThreshold) newTickTarget += newInterval; + return newTickTarget; +} + +void CCDelayBasedTimeSource::postNextTickTask(double now) +{ + double newTickTarget = nextTickTarget(now); + // Post another task *before* the tick and update state double delay = newTickTarget - now; - ASSERT(delay <= newInterval * (1.0 + doubleTickThreshold)); + ASSERT(delay <= m_nextParameters.interval * (1.0 + doubleTickThreshold)); m_timer.startOneShot(delay); m_nextParameters.tickTarget = newTickTarget; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h index f99837446..c68dc0b99 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDelayBasedTimeSource.h @@ -50,9 +50,8 @@ public: virtual bool active() const OVERRIDE { return m_state != STATE_INACTIVE; } // Get the last and next tick times. - // If not active, nextTickTime will return 0. virtual double lastTickTime() OVERRIDE; - virtual double nextTickTime() OVERRIDE; + virtual double nextTickTimeIfActivated() OVERRIDE; // CCTimerClient implementation. virtual void onTimerFired() OVERRIDE; @@ -62,6 +61,7 @@ public: protected: CCDelayBasedTimeSource(double interval, CCThread*); + double nextTickTarget(double now); void postNextTickTask(double now); enum State { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp index 5b00fef79..8d85fb342 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.cpp @@ -151,10 +151,10 @@ void CCFrameRateController::didAbortAllPendingFrames() m_numFramesPending = 0; } -double CCFrameRateController::nextTickTime() +double CCFrameRateController::nextTickTimeIfActivated() { if (m_isTimeSourceThrottling) - return m_timeSource->nextTickTime(); + return m_timeSource->nextTickTimeIfActivated(); return monotonicallyIncreasingTime(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h index 13d853b70..11b29a72e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateController.h @@ -67,7 +67,7 @@ public: void didFinishFrame(); void didAbortAllPendingFrames(); void setMaxFramesPending(int); // 0 for unlimited. - double nextTickTime(); + double nextTickTimeIfActivated(); void setTimebaseAndInterval(double timebase, double intervalSeconds); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp index 5fdd2cd69..99df0ea57 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.cpp @@ -35,7 +35,6 @@ #include "CCTextureDrawQuad.h" #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "SkBitmap.h" #include "SkColorMatrixFilter.h" #include "SkPaint.h" @@ -91,16 +90,18 @@ void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); } -void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { if (!m_hudTexture->id()) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + IntRect quadRect(IntPoint(), bounds()); bool premultipliedAlpha = true; FloatRect uvRect(0, 0, 1, 1); bool flipped = false; - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped)); } void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourceProvider) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h index 1ee24c47e..f7d477fff 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplayLayerImpl.h @@ -49,7 +49,7 @@ public: void setFontAtlas(PassOwnPtr<CCFontAtlas>); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; void updateHudTexture(CCResourceProvider*); virtual void didDraw(CCResourceProvider*) OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp index 283b7c99a..9f69e238f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp @@ -33,8 +33,8 @@ #include "CCIOSurfaceDrawQuad.h" #include "CCLayerTreeHostImpl.h" #include "CCQuadSink.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3D.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include <public/WebGraphicsContext3D.h> @@ -96,10 +96,13 @@ void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) } } -void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCIOSurfaceLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); + quadSink.append(CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, CCIOSurfaceDrawQuad::Flipped)); } void CCIOSurfaceLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h index 019b8fe2d..3a55bf2e2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h @@ -41,7 +41,7 @@ public: void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void willDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 8444d1d88..e6de00e24 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -144,9 +144,9 @@ bool CCLayerImpl::descendantDrawsContent() return false; } -PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState(int id) const +PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const { - return CCSharedQuadState::create(id, m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_opaque); + return CCSharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_opaque); } void CCLayerImpl::willDraw(CCResourceProvider*) @@ -263,7 +263,7 @@ void CCLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const void sortLayers(Vector<CCLayerImpl*>::iterator first, Vector<CCLayerImpl*>::iterator end, CCLayerSorter* layerSorter) { - TRACE_EVENT0("cc", "LayerRendererChromium::sortLayers"); + TRACE_EVENT0("cc", "CCLayerImpl::sortLayers"); layerSorter->sort(first, end); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index e951c5d7c..e12b1b1a7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -89,15 +89,14 @@ public: CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; } - PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; + PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; // willDraw must be called before appendQuads. If willDraw is called, // didDraw is guaranteed to be called before another willDraw or before // the layer is destroyed. To enforce this, any class that overrides // willDraw/didDraw must call the base class version. virtual void willDraw(CCResourceProvider*); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) { } + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) { } virtual void didDraw(CCResourceProvider*); - void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; virtual CCResourceProvider::ResourceId contentsResourceId() const; @@ -275,6 +274,8 @@ public: protected: explicit CCLayerImpl(int); + void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*) const; + virtual void dumpLayerProperties(TextStream&, int indent) const; static void writeIndent(TextStream&, int indent); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 2e3a7deb3..5ee1bf6e9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -75,7 +75,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre , m_client(client) , m_commitNumber(0) , m_renderingStats() - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_contextLost(false) , m_numTimesRecreateShouldFail(0) , m_numFailedRecreateAttempts(0) @@ -131,30 +131,30 @@ void CCLayerTreeHost::setSurfaceReady() m_proxy->setSurfaceReady(); } -void CCLayerTreeHost::initializeLayerRenderer() +void CCLayerTreeHost::initializeRenderer() { - TRACE_EVENT0("cc", "CCLayerTreeHost::initializeLayerRenderer"); - if (!m_proxy->initializeLayerRenderer()) { + TRACE_EVENT0("cc", "CCLayerTreeHost::initializeRenderer"); + if (!m_proxy->initializeRenderer()) { // Uh oh, better tell the client that we can't do anything with this context. m_client->didRecreateOutputSurface(false); return; } // Update m_settings based on capabilities that we got back from the renderer. - m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; + m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceleratedPainting; // Update m_settings based on partial update capability. m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); - m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize, CCRenderer::ContentPool); + m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool); m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); - m_layerRendererInitialized = true; + m_rendererInitialized = true; - m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->layerRendererCapabilities().maxTextureSize), - min(m_settings.defaultTileSize.height(), m_proxy->layerRendererCapabilities().maxTextureSize)); - m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->layerRendererCapabilities().maxTextureSize), - min(m_settings.maxUntiledLayerSize.height(), m_proxy->layerRendererCapabilities().maxTextureSize)); + m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize), + min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); + m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize), + min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); } CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() @@ -195,7 +195,7 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) { ASSERT(CCProxy::isImplThread()); - if (m_layerRendererInitialized) + if (m_rendererInitialized) m_contentsTextureManager->clearAllMemory(resourceProvider); } @@ -317,7 +317,7 @@ bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) void CCLayerTreeHost::finishAllRendering() { - if (!m_layerRendererInitialized) + if (!m_rendererInitialized) return; m_proxy->finishAllRendering(); } @@ -328,9 +328,9 @@ void CCLayerTreeHost::renderingStats(CCRenderingStats& stats) const m_proxy->implSideRenderingStats(stats); } -const LayerRendererCapabilities& CCLayerTreeHost::layerRendererCapabilities() const +const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const { - return m_proxy->layerRendererCapabilities(); + return m_proxy->rendererCapabilities(); } void CCLayerTreeHost::setNeedsAnimate() @@ -446,12 +446,12 @@ void CCLayerTreeHost::scheduleComposite() m_client->scheduleComposite(); } -bool CCLayerTreeHost::initializeLayerRendererIfNeeded() +bool CCLayerTreeHost::initializeRendererIfNeeded() { - if (!m_layerRendererInitialized) { - initializeLayerRenderer(); + if (!m_rendererInitialized) { + initializeRenderer(); // If we couldn't initialize, then bail since we're returning to software mode. - if (!m_layerRendererInitialized) + if (!m_rendererInitialized) return false; } if (m_contextLost) { @@ -464,7 +464,7 @@ bool CCLayerTreeHost::initializeLayerRendererIfNeeded() void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes) { - ASSERT(m_layerRendererInitialized); + ASSERT(m_rendererInitialized); ASSERT(memoryAllocationLimitBytes); if (!rootLayer()) @@ -486,7 +486,7 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu { TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, layerRendererCapabilities().maxTextureSize, updateList); + CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); CCLayerTreeHostCommon::calculateVisibleRects(updateList); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index baee9e5e5..cc0b45d3d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -115,8 +115,8 @@ struct CCLayerTreeSettings { }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost -struct LayerRendererCapabilities { - LayerRendererCapabilities() +struct RendererCapabilities { + RendererCapabilities() : bestTextureFormat(0) , contextHasCachedFrontBuffer(false) , usingPartialSwap(false) @@ -178,7 +178,7 @@ public: void deleteContentsTexturesOnImplThread(CCResourceProvider*); virtual void acquireLayerTextures(); // Returns false if we should abort this frame due to initialization failure. - bool initializeLayerRendererIfNeeded(); + bool initializeRendererIfNeeded(); void updateLayers(CCTextureUpdateQueue&, size_t contentsMemoryLimitBytes); CCLayerTreeHostClient* client() { return m_client; } @@ -200,7 +200,7 @@ public: void renderingStats(CCRenderingStats&) const; - const LayerRendererCapabilities& layerRendererCapabilities() const; + const RendererCapabilities& rendererCapabilities() const; // Test only hook void loseContext(int numTimes); @@ -269,7 +269,7 @@ private: typedef Vector<RefPtr<LayerChromium> > LayerList; typedef Vector<OwnPtr<CCPrioritizedTexture> > TextureList; - void initializeLayerRenderer(); + void initializeRenderer(); void update(LayerChromium*, CCTextureUpdateQueue&, const CCOcclusionTracker*); bool paintLayerContents(const LayerList&, CCTextureUpdateQueue&); @@ -297,7 +297,7 @@ private: CCRenderingStats m_renderingStats; OwnPtr<CCProxy> m_proxy; - bool m_layerRendererInitialized; + bool m_rendererInitialized; bool m_contextLost; int m_numTimesRecreateShouldFail; int m_numFailedRecreateAttempts; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 46edcc0a8..647de88f7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -41,12 +41,12 @@ #include "CCPageScaleAnimation.h" #include "CCPrioritizedTextureManager.h" #include "CCRenderPassDrawQuad.h" +#include "CCRendererGL.h" #include "CCRenderingStats.h" #include "CCScrollbarAnimationController.h" #include "CCScrollbarLayerImpl.h" #include "CCSettings.h" #include "CCSingleThreadProxy.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include "TraceEvent.h" #include <wtf/CurrentTime.h> @@ -175,8 +175,8 @@ bool CCLayerTreeHostImpl::canDraw() TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw empty viewport"); return false; } - if (!m_layerRenderer) { - TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no layerRenderer"); + if (!m_renderer) { + TRACE_EVENT_INSTANT0("cc", "CCLayerTreeHostImpl::canDraw no renderer"); return false; } if (m_contentsTexturesPurged) { @@ -255,11 +255,11 @@ void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSur { ASSERT(renderSurfaceLayerList.isEmpty()); ASSERT(m_rootLayerImpl); - ASSERT(m_layerRenderer); // For maxTextureSize. + ASSERT(m_renderer); // For maxTextureSize. { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::calcDrawEtc"); - CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, layerRendererCapabilities().maxTextureSize, renderSurfaceLayerList); + CCLayerTreeHostCommon::calculateDrawTransforms(m_rootLayerImpl.get(), deviceViewportSize(), m_deviceScaleFactor, &m_layerSorter, rendererCapabilities().maxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); trackDamageForAllSurfaces(m_rootLayerImpl.get(), renderSurfaceLayerList); @@ -281,7 +281,9 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); int renderPassId = renderSurfaceLayer->id(); - OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId); + IntRect outputRect = renderSurface->contentRect(); + const WebTransformationMatrix& transformToRootTarget = renderSurface->screenSpaceTransform(); + OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderPassId, outputRect, transformToRootTarget); pass->setDamageRect(renderSurface->damageTracker()->currentDamageRect()); pass->setFilters(renderSurfaceLayer->filters()); pass->setBackgroundFilters(renderSurfaceLayer->backgroundFilters()); @@ -338,6 +340,13 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) occlusionTracker.leaveLayer(it); } +#if !ASSERT_DISABLED + for (size_t i = 0; i < frame.renderPasses.size(); ++i) { + for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) + ASSERT(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0); + } +#endif + if (!m_hasTransparentBackground) { frame.renderPasses.last()->setHasTransparentBackground(false); frame.renderPasses.last()->appendQuadsToFillScreen(m_rootLayerImpl.get(), m_backgroundColor, occlusionTracker); @@ -347,8 +356,8 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) occlusionTracker.overdrawMetrics().recordMetrics(this); removeRenderPasses(CullRenderPassesWithNoQuads(), frame); - m_layerRenderer->decideRenderPassAllocationsForFrame(frame.renderPasses); - removeRenderPasses(CullRenderPassesWithCachedTextures(*m_layerRenderer), frame); + m_renderer->decideRenderPassAllocationsForFrame(frame.renderPasses); + removeRenderPasses(CullRenderPassesWithCachedTextures(*m_renderer), frame); return drawFrame; } @@ -557,7 +566,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) if (m_hudLayerImpl) m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); - m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById); + m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); // Once a RenderPass has been drawn, its damage should be cleared in // case the RenderPass will be reused next frame. @@ -578,26 +587,26 @@ void CCLayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) void CCLayerTreeHostImpl::finishAllRendering() { - if (m_layerRenderer) - m_layerRenderer->finish(); + if (m_renderer) + m_renderer->finish(); } bool CCLayerTreeHostImpl::isContextLost() { - return m_layerRenderer && m_layerRenderer->isContextLost(); + return m_renderer && m_renderer->isContextLost(); } -const LayerRendererCapabilities& CCLayerTreeHostImpl::layerRendererCapabilities() const +const RendererCapabilities& CCLayerTreeHostImpl::rendererCapabilities() const { - return m_layerRenderer->capabilities(); + return m_renderer->capabilities(); } bool CCLayerTreeHostImpl::swapBuffers() { - ASSERT(m_layerRenderer); + ASSERT(m_renderer); m_fpsCounter->markEndOfFrame(); - return m_layerRenderer->swapBuffers(); + return m_renderer->swapBuffers(); } void CCLayerTreeHostImpl::didLoseContext() @@ -612,8 +621,8 @@ void CCLayerTreeHostImpl::onSwapBuffersComplete() void CCLayerTreeHostImpl::readback(void* pixels, const IntRect& rect) { - ASSERT(m_layerRenderer); - m_layerRenderer->getFramebufferPixels(pixels, rect); + ASSERT(m_renderer); + m_renderer->getFramebufferPixels(pixels, rect); } static CCLayerImpl* findRootScrollLayer(CCLayerImpl* layer) @@ -681,15 +690,15 @@ void CCLayerTreeHostImpl::setVisible(bool visible) m_visible = visible; didVisibilityChange(this, m_visible); - if (!m_layerRenderer) + if (!m_renderer) return; - m_layerRenderer->setVisible(visible); + m_renderer->setVisible(visible); setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); } -bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader) +bool CCLayerTreeHostImpl::initializeRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader) { if (!context->bindToClient(this)) return false; @@ -703,26 +712,26 @@ bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> OwnPtr<CCGraphicsContext> contextRef(context); OwnPtr<CCResourceProvider> resourceProvider = CCResourceProvider::create(contextRef.get()); - OwnPtr<LayerRendererChromium> layerRenderer; + OwnPtr<CCRendererGL> renderer; if (resourceProvider.get()) - layerRenderer = LayerRendererChromium::create(this, resourceProvider.get(), textureUploader); + renderer = CCRendererGL::create(this, resourceProvider.get(), textureUploader); - // Since we now have a new context/layerRenderer, we cannot continue to use the old + // Since we now have a new context/renderer, we cannot continue to use the old // resources (i.e. renderSurfaces and texture IDs). if (m_rootLayerImpl) { clearRenderSurfaces(); sendDidLoseContextRecursive(m_rootLayerImpl.get()); } - m_layerRenderer = layerRenderer.release(); + m_renderer = renderer.release(); m_resourceProvider = resourceProvider.release(); - if (m_layerRenderer) + if (m_renderer) m_context = contextRef.release(); - if (!m_visible && m_layerRenderer) - m_layerRenderer->setVisible(m_visible); + if (!m_visible && m_renderer) + m_renderer->setVisible(m_visible); - return m_layerRenderer; + return m_renderer; } void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize) @@ -735,8 +744,8 @@ void CCLayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, con updateMaxScrollPosition(); - if (m_layerRenderer) - m_layerRenderer->viewportChanged(); + if (m_renderer) + m_renderer->viewportChanged(); } static void adjustScrollsForPageScaleChange(CCLayerImpl* layerImpl, float pageScaleChange) @@ -840,7 +849,7 @@ bool CCLayerTreeHostImpl::ensureRenderSurfaceLayerList() { if (!m_rootLayerImpl) return false; - if (!m_layerRenderer) + if (!m_renderer) return false; // We need both a non-empty render surface layer list and a root render diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 5a4b64a57..bfda2b129 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -47,8 +47,7 @@ class CCLayerTreeHostImplTimeSourceAdapter; class CCPageScaleAnimation; class CCRenderPassDrawQuad; class CCResourceProvider; -class LayerRendererChromium; -struct LayerRendererCapabilities; +struct RendererCapabilities; struct CCRenderingStats; // CCLayerTreeHost->CCProxy callback interface. @@ -129,10 +128,10 @@ public: void finishAllRendering(); int sourceAnimationFrameNumber() const; - bool initializeLayerRenderer(PassOwnPtr<CCGraphicsContext>, TextureUploaderOption); + bool initializeRenderer(PassOwnPtr<CCGraphicsContext>, TextureUploaderOption); bool isContextLost(); - CCRenderer* layerRenderer() { return m_layerRenderer.get(); } - const LayerRendererCapabilities& layerRendererCapabilities() const; + CCRenderer* renderer() { return m_renderer.get(); } + const RendererCapabilities& rendererCapabilities() const; bool swapBuffers(); @@ -267,7 +266,7 @@ private: OwnPtr<CCGraphicsContext> m_context; OwnPtr<CCResourceProvider> m_resourceProvider; - OwnPtr<CCRenderer> m_layerRenderer; + OwnPtr<CCRenderer> m_renderer; OwnPtr<CCLayerImpl> m_rootLayerImpl; CCLayerImpl* m_rootScrollLayerImpl; CCLayerImpl* m_currentlyScrollingLayerImpl; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index b1722763a..d9f68af0a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -28,7 +28,6 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" #include <algorithm> using namespace std; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index 4a24179c5..96fb05d94 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -28,7 +28,6 @@ #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" #include "TraceEvent.h" #include <algorithm> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp index 90084043d..5a8bebaca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.cpp @@ -26,8 +26,6 @@ #include "CCPriorityCalculator.h" -#include "LayerRendererChromium.h" - using namespace std; namespace WebCore { @@ -92,4 +90,3 @@ int CCPriorityCalculator::priorityFromVisibility(bool visible, bool drawsToRootS } } // WebCore - diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h index 935f13361..602e9d49f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h @@ -36,7 +36,7 @@ namespace WebCore { class CCThread; struct CCRenderingStats; -struct LayerRendererCapabilities; +struct RendererCapabilities; // Abstract class responsible for proxying commands from the main-thread side of // the compositor over to the compositor implementation. @@ -64,7 +64,7 @@ public: virtual bool isStarted() const = 0; // Attempts to initialize a context to use for rendering. Returns false if the context could not be created. - // The context will not be used and no frames may be produced until initializeLayerRenderer() is called. + // The context will not be used and no frames may be produced until initializeRenderer() is called. virtual bool initializeContext() = 0; // Indicates that the compositing surface associated with our context is ready to use. @@ -73,7 +73,7 @@ public: virtual void setVisible(bool) = 0; // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing. - virtual bool initializeLayerRenderer() = 0; + virtual bool initializeRenderer() = 0; // Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be // reinitialized. @@ -83,7 +83,7 @@ public: virtual void implSideRenderingStats(CCRenderingStats&) = 0; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const = 0; + virtual const RendererCapabilities& rendererCapabilities() const = 0; virtual void setNeedsAnimate() = 0; virtual void setNeedsCommit() = 0; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index f2e9e9ffe..78a0bd9ec 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -48,8 +48,10 @@ static const int debugTileBorderColorRed = 160; static const int debugTileBorderColorGreen = 100; static const int debugTileBorderColorBlue = 0; -CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) +CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCSharedQuadStateList& sharedQuadStateList, CCLayerImpl* layer, const CCOcclusionTrackerImpl* occlusionTracker, bool showCullingWithDebugBorderQuads, bool forSurface) : m_quadList(quadList) + , m_sharedQuadStateList(sharedQuadStateList) + , m_currentSharedQuadState(0) , m_layer(layer) , m_occlusionTracker(occlusionTracker) , m_showCullingWithDebugBorderQuads(showCullingWithDebugBorderQuads) @@ -58,6 +60,17 @@ CCQuadCuller::CCQuadCuller(CCQuadList& quadList, CCLayerImpl* layer, const CCOcc { } +CCSharedQuadState* CCQuadCuller::useSharedQuadState(PassOwnPtr<CCSharedQuadState> passSharedQuadState) +{ + OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); + sharedQuadState->id = m_sharedQuadStateList.size(); + + // FIXME: If all quads are culled for the sharedQuadState, we can drop it from the list. + m_currentSharedQuadState = sharedQuadState.get(); + m_sharedQuadStateList.append(sharedQuadState.release()); + return m_currentSharedQuadState; +} + static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const IntRect& culledRect, CCQuadList& quadList, const CCOcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads) { OwnPtr<CCDrawQuad> drawQuad(passDrawQuad); @@ -82,6 +95,11 @@ static inline bool appendQuadInternal(PassOwnPtr<CCDrawQuad> passDrawQuad, const bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad) { + ASSERT(passDrawQuad->sharedQuadState() == m_currentSharedQuadState); + ASSERT(passDrawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); + ASSERT(!m_sharedQuadStateList.isEmpty()); + ASSERT(m_sharedQuadStateList.last().get() == m_currentSharedQuadState); + IntRect culledRect; bool hasOcclusionFromOutsideTargetSurface; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h index e67b4468d..7fd8efbe4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.h @@ -27,27 +27,29 @@ #define CCQuadCuller_h #include "CCQuadSink.h" +#include "CCRenderPass.h" namespace WebCore { class CCLayerImpl; class CCRenderSurface; -class CCQuadList; template<typename LayerType, typename SurfaceType> class CCOcclusionTrackerBase; class CCQuadCuller : public CCQuadSink { public: - CCQuadCuller(CCQuadList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); - + CCQuadCuller(CCQuadList&, CCSharedQuadStateList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface); virtual ~CCQuadCuller() { } - // Returns true if the quad is added to the list, and false if the quad is entirely culled. - virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad) OVERRIDE; + // CCQuadSink implementation. + virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState>) OVERRIDE; + virtual bool append(PassOwnPtr<CCDrawQuad>) OVERRIDE; bool hasOcclusionFromOutsideTargetSurface() { return m_hasOcclusionFromOutsideTargetSurface; } private: CCQuadList& m_quadList; + CCSharedQuadStateList& m_sharedQuadStateList; + CCSharedQuadState* m_currentSharedQuadState; CCLayerImpl* m_layer; const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker; bool m_showCullingWithDebugBorderQuads; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h index 4ae6f238a..09bdd0ae2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadSink.h @@ -32,10 +32,16 @@ namespace WebCore { class CCDrawQuad; +struct CCSharedQuadState; + class CCQuadSink { public: virtual ~CCQuadSink() { } + // Call this to add a SharedQuadState before appending quads that refer to it. Returns a pointer + // to the given SharedQuadState for convenience, that can be set on the quads to append. + virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState>) = 0; + // Returns true if the quad is added to the list, and false if the quad is entirely culled. virtual bool append(PassOwnPtr<CCDrawQuad> passDrawQuad) = 0; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 3133e23d5..04fe91802 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -38,59 +38,44 @@ using WebKit::WebTransformationMatrix; namespace WebCore { -PassOwnPtr<CCRenderPass> CCRenderPass::create(CCRenderSurface* targetSurface, int id) +PassOwnPtr<CCRenderPass> CCRenderPass::create(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) { - return adoptPtr(new CCRenderPass(targetSurface, id)); + return adoptPtr(new CCRenderPass(id, outputRect, transformToRootTarget)); } -CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface, int id) +CCRenderPass::CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) : m_id(id) - , m_transformToRootTarget(targetSurface->screenSpaceTransform()) - , m_outputRect(targetSurface->contentRect()) + , m_transformToRootTarget(transformToRootTarget) + , m_outputRect(outputRect) , m_hasTransparentBackground(true) , m_hasOcclusionFromOutsideTargetSurface(false) { - ASSERT(targetSurface); ASSERT(id > 0); } void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImpl* occlusionTracker, bool& hadMissingTiles) { const bool forSurface = false; - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(m_sharedQuadStateList.size()); - layer->appendDebugBorderQuad(quadCuller, sharedQuadState.get()); - layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - m_sharedQuadStateList.append(sharedQuadState.release()); + layer->appendQuads(quadCuller, hadMissingTiles); m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl* occlusionTracker) { - // FIXME: render surface layers should be a CCLayerImpl-derived class and - // not be handled specially here. const bool forSurface = true; - CCQuadCuller quadCuller(m_quadList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTracker, layer->hasDebugBorders(), forSurface); - CCRenderSurface* surface = layer->renderSurface(); - - OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(m_sharedQuadStateList.size()); bool isReplica = false; - surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); - m_sharedQuadStateList.append(sharedQuadState.release()); - - m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); - - if (!layer->hasReplica()) - return; + layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingRenderPass->id()); // Add replica after the surface so that it appears below the surface. - OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(m_sharedQuadStateList.size()); - isReplica = true; - surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); - m_sharedQuadStateList.append(replicaSharedQuadState.release()); + if (layer->hasReplica()) { + isReplica = true; + layer->renderSurface()->appendQuads(quadCuller, isReplica, contributingRenderPass->id()); + } m_hasOcclusionFromOutsideTargetSurface |= quadCuller.hasOcclusionFromOutsideTargetSurface(); } @@ -104,22 +89,25 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree if (fillRegion.isEmpty()) return; + bool forSurface = false; + CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, rootLayer, &occlusionTracker, rootLayer->hasDebugBorders(), forSurface); + // Manually create the quad state for the gutter quads, as the root layer // doesn't have any bounds and so can't generate this itself. // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas). IntRect rootTargetRect = rootLayer->renderSurface()->contentRect(); float opacity = 1; bool opaque = true; - OwnPtr<CCSharedQuadState> sharedQuadState = CCSharedQuadState::create(0, rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque); + CCSharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(CCSharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque)); ASSERT(rootLayer->screenSpaceTransform().isInvertible()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, fillRects[i]); - m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState.get(), layerRect, screenBackgroundColor)); + // Skip the quad culler and just append the quads directly to avoid occlusion checks. + m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor)); } - m_sharedQuadStateList.append(sharedQuadState.release()); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 67ecb4306..4aaaf4717 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -53,10 +53,12 @@ public: inline constBackToFrontIterator backToFrontEnd() const { return rend(); } }; +typedef Vector<OwnPtr<CCSharedQuadState> > CCSharedQuadStateList; + class CCRenderPass { WTF_MAKE_NONCOPYABLE(CCRenderPass); public: - static PassOwnPtr<CCRenderPass> create(CCRenderSurface*, int id); + static PassOwnPtr<CCRenderPass> create(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, bool& hadMissingTiles); void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*); @@ -88,14 +90,14 @@ public: bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } protected: - CCRenderPass(CCRenderSurface*, int id); + CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); int m_id; CCQuadList m_quadList; + CCSharedQuadStateList m_sharedQuadStateList; WebKit::WebTransformationMatrix m_transformToRootTarget; IntRect m_outputRect; FloatRect m_damageRect; - Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList; bool m_hasTransparentBackground; bool m_hasOcclusionFromOutsideTargetSurface; WebKit::WebFilterOperations m_filters; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index 11edbfa88..50234aca3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -36,8 +36,6 @@ #include "CCQuadSink.h" #include "CCRenderPassDrawQuad.h" #include "CCSharedQuadState.h" -#include "GraphicsContext3D.h" -#include "LayerRendererChromium.h" #include "TextStream.h" #include <public/WebTransformationMatrix.h> #include <wtf/text/CString.h> @@ -181,30 +179,21 @@ static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer) return clippedRectInTarget; } -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState(int id) const +void CCRenderSurface::appendQuads(CCQuadSink& quadSink, bool forReplica, int renderPassId) { - IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); - bool isOpaque = false; - return CCSharedQuadState::create(id, m_drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque); -} + ASSERT(!forReplica || m_owningLayer->hasReplica()); -PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState(int id) const -{ IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); bool isOpaque = false; - return CCSharedQuadState::create(id, m_replicaDrawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque); -} - -void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) -{ - ASSERT(!forReplica || m_owningLayer->hasReplica()); + const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque)); if (m_owningLayer->hasDebugBorders()) { int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed; int green = forReplica ? debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen; int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue; SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); + quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth)); } // FIXME: By using the same RenderSurface for both the content and its reflection, @@ -237,7 +226,7 @@ void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* share CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, + quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY)); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 0e518b2aa..a7d639562 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -42,7 +42,6 @@ class CCDamageTracker; class CCQuadSink; class CCRenderPass; class CCLayerImpl; -class LayerRendererChromium; class TextStream; class CCRenderSurface { @@ -104,10 +103,7 @@ public: CCDamageTracker* damageTracker() const { return m_damageTracker.get(); } - PassOwnPtr<CCSharedQuadState> createSharedQuadState(int id) const; - PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState(int id) const; - - void appendQuads(CCQuadSink&, CCSharedQuadState*, bool forReplica, int renderPassId); + void appendQuads(CCQuadSink&, bool forReplica, int renderPassId); private: CCLayerImpl* m_owningLayer; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h index 40ab241c5..946aec633 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h @@ -66,7 +66,7 @@ public: virtual ~CCRenderer() { } - virtual const LayerRendererCapabilities& capabilities() const = 0; + virtual const RendererCapabilities& capabilities() const = 0; const CCLayerTreeSettings& settings() const { return m_client->settings(); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp index 84f00a1c7..b91b59a57 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp @@ -32,7 +32,7 @@ #include "config.h" #if USE(ACCELERATED_COMPOSITING) -#include "LayerRendererChromium.h" +#include "CCRendererGL.h" #include "CCDamageTracker.h" #include "CCLayerQuad.h" @@ -83,16 +83,16 @@ bool needsIOSurfaceReadbackWorkaround() } // anonymous namespace -PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) +PassOwnPtr<CCRendererGL> CCRendererGL::create(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) { - OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, resourceProvider, textureUploaderSetting))); - if (!layerRenderer->initialize()) + OwnPtr<CCRendererGL> renderer(adoptPtr(new CCRendererGL(client, resourceProvider, textureUploaderSetting))); + if (!renderer->initialize()) return nullptr; - return layerRenderer.release(); + return renderer.release(); } -LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, +CCRendererGL::CCRendererGL(CCRendererClient* client, CCResourceProvider* resourceProvider, TextureUploaderOption textureUploaderSetting) : CCDirectRenderer(client, resourceProvider) @@ -108,7 +108,7 @@ LayerRendererChromium::LayerRendererChromium(CCRendererClient* client, ASSERT(m_context); } -bool LayerRendererChromium::initialize() +bool CCRendererGL::initialize() { if (!m_context->makeContextCurrent()) return false; @@ -138,15 +138,13 @@ bool LayerRendererChromium::initialize() // Use the swapBuffers callback only with the threaded proxy. if (CCProxy::hasImplThread()) m_capabilities.usingSwapCompleteCallback = extensions.contains("GL_CHROMIUM_swapbuffers_complete_callback"); - if (m_capabilities.usingSwapCompleteCallback) { + if (m_capabilities.usingSwapCompleteCallback) m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); - } m_capabilities.usingSetVisibility = extensions.contains("GL_CHROMIUM_set_visibility"); - if (extensions.contains("GL_CHROMIUM_iosurface")) { + if (extensions.contains("GL_CHROMIUM_iosurface")) ASSERT(extensions.contains("GL_ARB_texture_rectangle")); - } m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager"); if (m_capabilities.usingGpuMemoryManager) @@ -169,7 +167,7 @@ bool LayerRendererChromium::initialize() return true; } -LayerRendererChromium::~LayerRendererChromium() +CCRendererGL::~CCRendererGL() { ASSERT(CCProxy::isImplThread()); m_context->setSwapBuffersCompleteCallbackCHROMIUM(0); @@ -178,19 +176,19 @@ LayerRendererChromium::~LayerRendererChromium() cleanupSharedObjects(); } -WebGraphicsContext3D* LayerRendererChromium::context() +WebGraphicsContext3D* CCRendererGL::context() { return m_context; } -void LayerRendererChromium::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) +void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) { unsigned long error = context->getError(); if (error != GraphicsContext3D::NO_ERROR) LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error)); } -void LayerRendererChromium::setVisible(bool visible) +void CCRendererGL::setVisible(bool visible) { if (m_visible == visible) return; @@ -198,22 +196,21 @@ void LayerRendererChromium::setVisible(bool visible) // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers // crbug.com/116049 - if (m_capabilities.usingSetVisibility) { + if (m_capabilities.usingSetVisibility) m_context->setVisibilityCHROMIUM(visible); - } } -void LayerRendererChromium::releaseRenderPassTextures() +void CCRendererGL::releaseRenderPassTextures() { m_renderPassTextures.clear(); } -void LayerRendererChromium::viewportChanged() +void CCRendererGL::viewportChanged() { m_isViewportChanged = true; } -void LayerRendererChromium::clearFramebuffer(DrawingFrame& frame) +void CCRendererGL::clearFramebuffer(DrawingFrame& frame) { // On DEBUG builds, opaque render passes are cleared to blue to easily see regions that were not drawn on the screen. if (frame.currentRenderPass->hasTransparentBackground()) @@ -227,7 +224,7 @@ void LayerRendererChromium::clearFramebuffer(DrawingFrame& frame) m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); } -void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) +void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) { // FIXME: Remove this once framebuffer is automatically recreated on first use ensureFramebuffer(); @@ -235,7 +232,7 @@ void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) if (viewportSize().isEmpty()) return; - TRACE_EVENT0("cc", "LayerRendererChromium::drawLayers"); + TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); if (m_isViewportChanged) { // Only reshape when we know we are going to draw. Otherwise, the reshape // can leave the window at the wrong size if we never draw and the proper @@ -255,13 +252,13 @@ void LayerRendererChromium::beginDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); } -void LayerRendererChromium::doNoOp() +void CCRendererGL::doNoOp() { GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); GLC(m_context, m_context->flush()); } -void LayerRendererChromium::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) +void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) { if (quad->needsBlending()) GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); @@ -302,7 +299,7 @@ void LayerRendererChromium::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad } } -void LayerRendererChromium::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) +void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) { const TileCheckerboardProgram* program = tileCheckerboardProgram(); ASSERT(program && program->initialized()); @@ -324,7 +321,7 @@ void LayerRendererChromium::drawCheckerboardQuad(const DrawingFrame& frame, cons drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); } -void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) +void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugBorderDrawQuad* quad) { static float glMatrix[16]; const SolidColorProgram* program = solidColorProgram(); @@ -336,7 +333,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const WebTransformationMatrix renderMatrix = quad->quadTransform(); renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y()); renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); - LayerRendererChromium::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); + CCRendererGL::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLocation(), 1, false, &glMatrix[0])); SkColor color = quad->color(); @@ -350,7 +347,7 @@ void LayerRendererChromium::drawDebugBorderQuad(const DrawingFrame& frame, const GLC(context(), context()->drawElements(GraphicsContext3D::LINE_LOOP, 4, GraphicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short))); } -static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) +static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) { if (filters.isEmpty()) return SkBitmap(); @@ -361,14 +358,14 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const if (!filterContext || !filterGrContext) return SkBitmap(); - layerRenderer->context()->flush(); + renderer->context()->flush(); - CCResourceProvider::ScopedWriteLockGL lock(layerRenderer->resourceProvider(), sourceTexture->id()); + CCResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourceTexture->id()); SkBitmap source = CCRenderSurfaceFilters::apply(filters, lock.textureId(), sourceTexture->size(), filterContext, filterGrContext); return source; } -PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) +PassOwnPtr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& frame, const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform) { // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background. // The algorithm works as follows: @@ -439,7 +436,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(Drawing return backgroundTexture.release(); } -void LayerRendererChromium::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) +void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDrawQuad* quad) { CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId()); if (!contentsTexture || !contentsTexture->id()) @@ -581,7 +578,7 @@ void LayerRendererChromium::drawRenderPassQuad(DrawingFrame& frame, const CCRend drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation); } -void LayerRendererChromium::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) +void CCRendererGL::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidColorDrawQuad* quad) { const SolidColorProgram* program = solidColorProgram(); GLC(context(), context()->useProgram(program->program())); @@ -620,7 +617,7 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms) uniforms.edgeLocation = program->fragmentShader().edgeLocation(); } -void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) +void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) { IntRect tileRect = quad->quadVisibleRect(); @@ -754,7 +751,7 @@ void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTile localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become - // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. + // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. } else { // Move fragment shader transform to vertex shader. We can do this while // still producing correct results as fragmentTexTransformLocation @@ -787,7 +784,7 @@ void LayerRendererChromium::drawTileQuad(const DrawingFrame& frame, const CCTile drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrixLocation); } -void LayerRendererChromium::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) +void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) { const VideoYUVProgram* program = videoYUVProgram(); ASSERT(program && program->initialized()); @@ -847,7 +844,7 @@ void LayerRendererChromium::drawYUVVideoQuad(const DrawingFrame& frame, const CC GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); } -void LayerRendererChromium::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) +void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) { static float glMatrix[16]; @@ -892,7 +889,7 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding { int texTransformLocation; }; -void LayerRendererChromium::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) +void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); @@ -936,7 +933,7 @@ void LayerRendererChromium::drawTextureQuad(const DrawingFrame& frame, const CCT GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); } -void LayerRendererChromium::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) +void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) { ASSERT(CCProxy::isImplThread()); TexTransformTextureProgramBinding binding; @@ -958,7 +955,7 @@ void LayerRendererChromium::drawIOSurfaceQuad(const DrawingFrame& frame, const C GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); } -void LayerRendererChromium::finishDrawingFrame(DrawingFrame& frame) +void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) { m_currentFramebufferLock.clear(); m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); @@ -967,7 +964,7 @@ void LayerRendererChromium::finishDrawingFrame(DrawingFrame& frame) GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); } -void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformationMatrix& m) +void CCRendererGL::toGLMatrix(float* flattened, const WebTransformationMatrix& m) { flattened[0] = m.m11(); flattened[1] = m.m12(); @@ -987,7 +984,7 @@ void LayerRendererChromium::toGLMatrix(float* flattened, const WebTransformation flattened[15] = m.m44(); } -void LayerRendererChromium::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) +void CCRendererGL::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) { if (quadLocation == -1) return; @@ -1004,13 +1001,13 @@ void LayerRendererChromium::setShaderFloatQuad(const FloatQuad& quad, int quadLo GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); } -void LayerRendererChromium::setShaderOpacity(float opacity, int alphaLocation) +void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation) { if (alphaLocation != -1) GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); } -void LayerRendererChromium::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) +void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation) { WebTransformationMatrix quadRectMatrix; quadRectTransform(&quadRectMatrix, drawTransform, quadRect); @@ -1021,7 +1018,7 @@ void LayerRendererChromium::drawQuadGeometry(const DrawingFrame& frame, const We GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)); } -void LayerRendererChromium::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) +void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) { const RenderPassProgram* program = renderPassProgram(); @@ -1038,18 +1035,18 @@ void LayerRendererChromium::copyTextureToFramebuffer(const DrawingFrame& frame, drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLocation()); } -void LayerRendererChromium::finish() +void CCRendererGL::finish() { - TRACE_EVENT0("cc", "LayerRendererChromium::finish"); + TRACE_EVENT0("cc", "CCRendererGL::finish"); m_context->finish(); } -bool LayerRendererChromium::swapBuffers() +bool CCRendererGL::swapBuffers() { ASSERT(m_visible); ASSERT(!m_isFramebufferDiscarded); - TRACE_EVENT0("cc", "LayerRendererChromium::swapBuffers"); + TRACE_EVENT0("cc", "CCRendererGL::swapBuffers"); // We're done! Time to swapbuffers! if (m_capabilities.usingPartialSwap) { @@ -1068,12 +1065,12 @@ bool LayerRendererChromium::swapBuffers() return true; } -void LayerRendererChromium::onSwapBuffersComplete() +void CCRendererGL::onSwapBuffersComplete() { m_client->onSwapBuffersComplete(); } -void LayerRendererChromium::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) +void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation) { // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread. if (!CCProxy::hasImplThread()) { @@ -1086,7 +1083,7 @@ void LayerRendererChromium::onMemoryAllocationChanged(WebGraphicsMemoryAllocatio } } -void LayerRendererChromium::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) +void CCRendererGL::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation) { if (m_visible && !allocation.gpuResourceSizeInBytes) return; @@ -1102,7 +1099,7 @@ void LayerRendererChromium::onMemoryAllocationChangedOnImplThread(WebKit::WebGra m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes); } -void LayerRendererChromium::discardFramebuffer() +void CCRendererGL::discardFramebuffer() { if (m_isFramebufferDiscarded) return; @@ -1118,7 +1115,7 @@ void LayerRendererChromium::discardFramebuffer() m_client->setFullRootLayerDamage(); } -void LayerRendererChromium::ensureFramebuffer() +void CCRendererGL::ensureFramebuffer() { if (!m_isFramebufferDiscarded) return; @@ -1130,13 +1127,13 @@ void LayerRendererChromium::ensureFramebuffer() m_isFramebufferDiscarded = false; } -void LayerRendererChromium::onContextLost() +void CCRendererGL::onContextLost() { m_client->didLoseContext(); } -void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& rect) +void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) { ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); @@ -1184,7 +1181,7 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re } if (!m_visible) { - TRACE_EVENT0("cc", "LayerRendererChromium::getFramebufferPixels dropping resources after readback"); + TRACE_EVENT0("cc", "CCRendererGL::getFramebufferPixels dropping resources after readback"); discardFramebuffer(); releaseRenderPassTextures(); m_client->releaseContentsTextures(); @@ -1192,7 +1189,7 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re } } -bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) +bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) { ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); @@ -1206,7 +1203,7 @@ bool LayerRendererChromium::getFramebufferTexture(CCScopedTexture* texture, cons return true; } -bool LayerRendererChromium::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) +bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) { ASSERT(texture->id()); frame.currentRenderPass = 0; @@ -1215,13 +1212,13 @@ bool LayerRendererChromium::useScopedTexture(DrawingFrame& frame, const CCScoped return bindFramebufferToTexture(frame, texture, viewportRect); } -void LayerRendererChromium::bindFramebufferToOutputSurface(DrawingFrame& frame) +void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) { m_currentFramebufferLock.clear(); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); } -bool LayerRendererChromium::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) +bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) { ASSERT(texture->id()); @@ -1243,30 +1240,30 @@ bool LayerRendererChromium::bindFramebufferToTexture(DrawingFrame& frame, const return true; } -void LayerRendererChromium::enableScissorTestRect(const IntRect& scissorRect) +void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) { GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorRect.width(), scissorRect.height())); } -void LayerRendererChromium::disableScissorTest() +void CCRendererGL::disableScissorTest() { GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); } -void LayerRendererChromium::setDrawViewportSize(const IntSize& viewportSize) +void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) { GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.height())); } -bool LayerRendererChromium::makeContextCurrent() +bool CCRendererGL::makeContextCurrent() { return m_context->makeContextCurrent(); } -bool LayerRendererChromium::initializeSharedObjects() +bool CCRendererGL::initializeSharedObjects() { - TRACE_EVENT0("cc", "LayerRendererChromium::initializeSharedObjects"); + TRACE_EVENT0("cc", "CCRendererGL::initializeSharedObjects"); makeContextCurrent(); // Create an FBO for doing offscreen rendering. @@ -1290,191 +1287,191 @@ bool LayerRendererChromium::initializeSharedObjects() return true; } -const LayerRendererChromium::TileCheckerboardProgram* LayerRendererChromium::tileCheckerboardProgram() +const CCRendererGL::TileCheckerboardProgram* CCRendererGL::tileCheckerboardProgram() { if (!m_tileCheckerboardProgram) m_tileCheckerboardProgram = adoptPtr(new TileCheckerboardProgram(m_context)); if (!m_tileCheckerboardProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::checkerboardProgram::initalize"); + TRACE_EVENT0("cc", "CCRendererGL::checkerboardProgram::initalize"); m_tileCheckerboardProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileCheckerboardProgram.get(); } -const LayerRendererChromium::SolidColorProgram* LayerRendererChromium::solidColorProgram() +const CCRendererGL::SolidColorProgram* CCRendererGL::solidColorProgram() { if (!m_solidColorProgram) m_solidColorProgram = adoptPtr(new SolidColorProgram(m_context)); if (!m_solidColorProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::solidColorProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::solidColorProgram::initialize"); m_solidColorProgram->initialize(m_context, m_isUsingBindUniform); } return m_solidColorProgram.get(); } -const LayerRendererChromium::RenderPassProgram* LayerRendererChromium::renderPassProgram() +const CCRendererGL::RenderPassProgram* CCRendererGL::renderPassProgram() { ASSERT(m_renderPassProgram); if (!m_renderPassProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassProgram::initialize"); m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgram.get(); } -const LayerRendererChromium::RenderPassProgramAA* LayerRendererChromium::renderPassProgramAA() +const CCRendererGL::RenderPassProgramAA* CCRendererGL::renderPassProgramAA() { if (!m_renderPassProgramAA) m_renderPassProgramAA = adoptPtr(new RenderPassProgramAA(m_context)); if (!m_renderPassProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassProgramAA::initialize"); m_renderPassProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassProgramAA.get(); } -const LayerRendererChromium::RenderPassMaskProgram* LayerRendererChromium::renderPassMaskProgram() +const CCRendererGL::RenderPassMaskProgram* CCRendererGL::renderPassMaskProgram() { if (!m_renderPassMaskProgram) m_renderPassMaskProgram = adoptPtr(new RenderPassMaskProgram(m_context)); if (!m_renderPassMaskProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassMaskProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgram::initialize"); m_renderPassMaskProgram->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgram.get(); } -const LayerRendererChromium::RenderPassMaskProgramAA* LayerRendererChromium::renderPassMaskProgramAA() +const CCRendererGL::RenderPassMaskProgramAA* CCRendererGL::renderPassMaskProgramAA() { if (!m_renderPassMaskProgramAA) m_renderPassMaskProgramAA = adoptPtr(new RenderPassMaskProgramAA(m_context)); if (!m_renderPassMaskProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::renderPassMaskProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::renderPassMaskProgramAA::initialize"); m_renderPassMaskProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_renderPassMaskProgramAA.get(); } -const LayerRendererChromium::TileProgram* LayerRendererChromium::tileProgram() +const CCRendererGL::TileProgram* CCRendererGL::tileProgram() { ASSERT(m_tileProgram); if (!m_tileProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgram::initialize"); m_tileProgram->initialize(m_context, m_isUsingBindUniform); } return m_tileProgram.get(); } -const LayerRendererChromium::TileProgramOpaque* LayerRendererChromium::tileProgramOpaque() +const CCRendererGL::TileProgramOpaque* CCRendererGL::tileProgramOpaque() { ASSERT(m_tileProgramOpaque); if (!m_tileProgramOpaque->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramOpaque::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramOpaque::initialize"); m_tileProgramOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramOpaque.get(); } -const LayerRendererChromium::TileProgramAA* LayerRendererChromium::tileProgramAA() +const CCRendererGL::TileProgramAA* CCRendererGL::tileProgramAA() { if (!m_tileProgramAA) m_tileProgramAA = adoptPtr(new TileProgramAA(m_context)); if (!m_tileProgramAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramAA::initialize"); m_tileProgramAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramAA.get(); } -const LayerRendererChromium::TileProgramSwizzle* LayerRendererChromium::tileProgramSwizzle() +const CCRendererGL::TileProgramSwizzle* CCRendererGL::tileProgramSwizzle() { if (!m_tileProgramSwizzle) m_tileProgramSwizzle = adoptPtr(new TileProgramSwizzle(m_context)); if (!m_tileProgramSwizzle->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzle::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzle::initialize"); m_tileProgramSwizzle->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzle.get(); } -const LayerRendererChromium::TileProgramSwizzleOpaque* LayerRendererChromium::tileProgramSwizzleOpaque() +const CCRendererGL::TileProgramSwizzleOpaque* CCRendererGL::tileProgramSwizzleOpaque() { if (!m_tileProgramSwizzleOpaque) m_tileProgramSwizzleOpaque = adoptPtr(new TileProgramSwizzleOpaque(m_context)); if (!m_tileProgramSwizzleOpaque->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzleOpaque::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleOpaque::initialize"); m_tileProgramSwizzleOpaque->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleOpaque.get(); } -const LayerRendererChromium::TileProgramSwizzleAA* LayerRendererChromium::tileProgramSwizzleAA() +const CCRendererGL::TileProgramSwizzleAA* CCRendererGL::tileProgramSwizzleAA() { if (!m_tileProgramSwizzleAA) m_tileProgramSwizzleAA = adoptPtr(new TileProgramSwizzleAA(m_context)); if (!m_tileProgramSwizzleAA->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::tileProgramSwizzleAA::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::tileProgramSwizzleAA::initialize"); m_tileProgramSwizzleAA->initialize(m_context, m_isUsingBindUniform); } return m_tileProgramSwizzleAA.get(); } -const LayerRendererChromium::TextureProgram* LayerRendererChromium::textureProgram() +const CCRendererGL::TextureProgram* CCRendererGL::textureProgram() { if (!m_textureProgram) m_textureProgram = adoptPtr(new TextureProgram(m_context)); if (!m_textureProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureProgram::initialize"); m_textureProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureProgram.get(); } -const LayerRendererChromium::TextureProgramFlip* LayerRendererChromium::textureProgramFlip() +const CCRendererGL::TextureProgramFlip* CCRendererGL::textureProgramFlip() { if (!m_textureProgramFlip) m_textureProgramFlip = adoptPtr(new TextureProgramFlip(m_context)); if (!m_textureProgramFlip->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureProgramFlip::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureProgramFlip::initialize"); m_textureProgramFlip->initialize(m_context, m_isUsingBindUniform); } return m_textureProgramFlip.get(); } -const LayerRendererChromium::TextureIOSurfaceProgram* LayerRendererChromium::textureIOSurfaceProgram() +const CCRendererGL::TextureIOSurfaceProgram* CCRendererGL::textureIOSurfaceProgram() { if (!m_textureIOSurfaceProgram) m_textureIOSurfaceProgram = adoptPtr(new TextureIOSurfaceProgram(m_context)); if (!m_textureIOSurfaceProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::textureIOSurfaceProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::textureIOSurfaceProgram::initialize"); m_textureIOSurfaceProgram->initialize(m_context, m_isUsingBindUniform); } return m_textureIOSurfaceProgram.get(); } -const LayerRendererChromium::VideoYUVProgram* LayerRendererChromium::videoYUVProgram() +const CCRendererGL::VideoYUVProgram* CCRendererGL::videoYUVProgram() { if (!m_videoYUVProgram) m_videoYUVProgram = adoptPtr(new VideoYUVProgram(m_context)); if (!m_videoYUVProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::videoYUVProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::videoYUVProgram::initialize"); m_videoYUVProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoYUVProgram.get(); } -const LayerRendererChromium::VideoStreamTextureProgram* LayerRendererChromium::videoStreamTextureProgram() +const CCRendererGL::VideoStreamTextureProgram* CCRendererGL::videoStreamTextureProgram() { if (!m_videoStreamTextureProgram) m_videoStreamTextureProgram = adoptPtr(new VideoStreamTextureProgram(m_context)); if (!m_videoStreamTextureProgram->initialized()) { - TRACE_EVENT0("cc", "LayerRendererChromium::streamTextureProgram::initialize"); + TRACE_EVENT0("cc", "CCRendererGL::streamTextureProgram::initialize"); m_videoStreamTextureProgram->initialize(m_context, m_isUsingBindUniform); } return m_videoStreamTextureProgram.get(); } -void LayerRendererChromium::cleanupSharedObjects() +void CCRendererGL::cleanupSharedObjects() { makeContextCurrent(); @@ -1528,7 +1525,7 @@ void LayerRendererChromium::cleanupSharedObjects() releaseRenderPassTextures(); } -bool LayerRendererChromium::isContextLost() +bool CCRendererGL::isContextLost() { return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.h index 3575c193d..832503352 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.h @@ -29,8 +29,8 @@ */ -#ifndef LayerRendererChromium_h -#define LayerRendererChromium_h +#ifndef CCRendererGL_h +#define CCRendererGL_h #if USE(ACCELERATED_COMPOSITING) @@ -60,17 +60,17 @@ class GeometryBinding; class ScopedEnsureFramebufferAllocation; // Class that handles drawing of composited render layers using GL. -class LayerRendererChromium : public CCDirectRenderer, - public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM, - public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM , - public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { - WTF_MAKE_NONCOPYABLE(LayerRendererChromium); +class CCRendererGL : public CCDirectRenderer, + public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM, + public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM , + public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { + WTF_MAKE_NONCOPYABLE(CCRendererGL); public: - static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); - virtual ~LayerRendererChromium(); + virtual ~CCRendererGL(); - virtual const LayerRendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; } + virtual const RendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; } WebKit::WebGraphicsContext3D* context(); @@ -100,7 +100,7 @@ public: virtual void setVisible(bool) OVERRIDE; protected: - LayerRendererChromium(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); + CCRendererGL(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } bool initialize(); @@ -156,7 +156,7 @@ private: // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. virtual void onContextLost() OVERRIDE; - LayerRendererCapabilities m_capabilities; + RendererCapabilities m_capabilities; unsigned m_offscreenFramebufferId; @@ -258,7 +258,7 @@ private: #define DEBUG_GL_CALLS 0 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) -#define GLC(context, x) (x, LayerRendererChromium::debugGLCall(&*context, #x, __FILE__, __LINE__)) +#define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__)) #else #define GLC(context, x) (x) #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp index fb36b4cae..3aad147ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp @@ -27,9 +27,9 @@ #include "CCResourceProvider.h" #include "CCProxy.h" +#include "CCRendererGL.h" // For the GLC() macro. #include "Extensions3DChromium.h" #include "IntRect.h" -#include "LayerRendererChromium.h" // For the GLC() macro #include "LayerTextureSubImage.h" #include <limits.h> #include <public/WebGraphicsContext3D.h> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp index fa3dbe1ed..999a08ec9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp @@ -175,7 +175,7 @@ void CCScheduler::processScheduledActions() break; case CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES: if (m_client->hasMoreResourceUpdates()) { - m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTime()); + m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTimeIfActivated()); m_updateMoreResourcesPending = true; } else m_stateMachine.beginUpdateMoreResourcesComplete(false); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp index e29931884..dc191dc2c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp @@ -89,13 +89,16 @@ static FloatRect toUVRect(const WebRect& r, const IntRect& bounds) static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height()); } -void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { bool premultipledAlpha = false; bool flipped = false; FloatRect uvRect(0, 0, 1, 1); IntRect boundsRect(IntPoint(), contentBounds()); + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + WebRect thumbRect, backTrackRect, foreTrackRect; m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), backTrackRect, thumbRect, foreTrackRect); if (!m_geometry->hasThumb(&m_scrollbar)) @@ -104,7 +107,7 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadS if (m_thumbResourceId && !thumbRect.isEmpty()) { OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadState, IntRect(thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height), m_thumbResourceId, premultipledAlpha, uvRect, flipped); quad->setNeedsBlending(); - quadList.append(quad.release()); + quadSink.append(quad.release()); } if (!m_backTrackResourceId) @@ -112,12 +115,12 @@ void CCScrollbarLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadS // We only paint the track in two parts if we were given a texture for the forward track part. if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(foreTrackRect.x, foreTrackRect.y, foreTrackRect.width, foreTrackRect.height), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(foreTrackRect.x, foreTrackRect.y, foreTrackRect.width, foreTrackRect.height), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped)); // Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and // fore track quads. The back track texture contains (and displays) the buttons. if (!boundsRect.isEmpty()) - quadList.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(boundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(boundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped)); } void CCScrollbarLayerImpl::didLoseContext() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h index ca40d099f..f8fd7bf8c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h @@ -61,7 +61,7 @@ public: WebKit::WebScrollbar::Orientation orientation() const { return m_orientation; } - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp index 337987497..f3922b301 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp @@ -31,13 +31,13 @@ namespace WebCore { -PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) +PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) { - return adoptPtr(new CCSharedQuadState(id, quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); + return adoptPtr(new CCSharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) - : id(id) +CCSharedQuadState::CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque) + : id(-1) , quadTransform(quadTransform) , visibleContentRect(visibleContentRect) , clippedRectInTarget(clippedRectInTarget) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h index af12bec5a..f3adf0301 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h @@ -43,8 +43,8 @@ struct CCSharedQuadState { float opacity; bool opaque; - static PassOwnPtr<CCSharedQuadState> create(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); - CCSharedQuadState(int id, const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); + CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque); bool isLayerAxisAlignedIntRect() const; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 88a8ffb82..6876ea218 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -47,7 +47,7 @@ CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) : m_layerTreeHost(layerTreeHost) , m_contextLost(false) , m_compositorIdentifier(-1) - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_nextFrameIsNewlyCommittedFrame(false) { TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); @@ -127,16 +127,16 @@ void CCSingleThreadProxy::setVisible(bool visible) m_layerTreeHostImpl->setVisible(visible); } -bool CCSingleThreadProxy::initializeLayerRenderer() +bool CCSingleThreadProxy::initializeRenderer() { ASSERT(CCProxy::isMainThread()); ASSERT(m_contextBeforeInitialization); { DebugScopedSetImplThread impl; - bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitialization.release(), UnthrottledUploader); + bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.release(), UnthrottledUploader); if (ok) { - m_layerRendererInitialized = true; - m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); + m_rendererInitialized = true; + m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); } return ok; @@ -156,10 +156,11 @@ bool CCSingleThreadProxy::recreateContext() bool initialized; { DebugScopedSetImplThread impl; - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - initialized = m_layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); + if (!m_layerTreeHostImpl->contentsTexturesPurged()) + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + initialized = m_layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader); if (initialized) { - m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); + m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities(); } } @@ -174,11 +175,11 @@ void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats) m_layerTreeHostImpl->renderingStats(stats); } -const LayerRendererCapabilities& CCSingleThreadProxy::layerRendererCapabilities() const +const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const { - ASSERT(m_layerRendererInitialized); + ASSERT(m_rendererInitialized); // Note: this gets called during the commit by the "impl" thread - return m_layerRendererCapabilitiesForMainThread; + return m_RendererCapabilitiesForMainThread; } void CCSingleThreadProxy::loseContext() @@ -212,7 +213,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue) // single thread mode. For correctness, loop until no more updates are // pending. while (queue.hasMoreUpdates()) - CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader(), &queue, maxPartialTextureUpdates()); + CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates()); m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); @@ -287,8 +288,8 @@ void CCSingleThreadProxy::forceSerializeOnSwapBuffers() { { DebugScopedSetImplThread impl; - if (m_layerRendererInitialized) - m_layerTreeHostImpl->layerRenderer()->doNoOp(); + if (m_rendererInitialized) + m_layerTreeHostImpl->renderer()->doNoOp(); } } @@ -297,7 +298,7 @@ bool CCSingleThreadProxy::commitAndComposite() ASSERT(CCProxy::isMainThread()); - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) + if (!m_layerTreeHost->initializeRendererIfNeeded()) return false; if (m_layerTreeHostImpl->contentsTexturesPurged()) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h index 7f8047859..a73a6aa17 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h @@ -48,11 +48,11 @@ public: virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; - virtual bool initializeLayerRenderer() OVERRIDE; + virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; virtual int compositorIdentifier() const OVERRIDE { return m_compositorIdentifier; } virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE; + virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; virtual void setNeedsCommit() OVERRIDE; @@ -89,14 +89,14 @@ private: bool m_contextLost; int m_compositorIdentifier; - // Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't + // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't // be used for anything else. OwnPtr<CCGraphicsContext> m_contextBeforeInitialization; // Used on the CCThread, but checked on main thread during initialization/shutdown. OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; - bool m_layerRendererInitialized; - LayerRendererCapabilities m_layerRendererCapabilitiesForMainThread; + bool m_rendererInitialized; + RendererCapabilities m_RendererCapabilitiesForMainThread; bool m_nextFrameIsNewlyCommittedFrame; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp index 23984f9d4..fe0007f55 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp @@ -49,8 +49,11 @@ CCSolidColorLayerImpl::~CCSolidColorLayerImpl() { } -void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + // We create a series of smaller quads instead of just one large one so that the // culler can reduce the total pixels drawn. int width = contentBounds().width(); @@ -58,7 +61,7 @@ void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuad for (int x = 0; x < width; x += m_tileSize) { for (int y = 0; y < height; y += m_tileSize) { IntRect solidTileRect(x, y, min(width - x, m_tileSize), min(height - y, m_tileSize)); - quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor())); + quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor())); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h index d19a230dc..a2914017d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorLayerImpl.h @@ -31,8 +31,6 @@ namespace WebCore { -class LayerRendererChromium; - class CCSolidColorLayerImpl : public CCLayerImpl { public: static PassOwnPtr<CCSolidColorLayerImpl> create(int id) @@ -41,7 +39,7 @@ public: } virtual ~CCSolidColorLayerImpl(); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; protected: explicit CCSolidColorLayerImpl(int id); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp index b981f713d..59dbc8ac0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.cpp @@ -58,12 +58,16 @@ void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); } -void CCTextureLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCTextureLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { if (!m_externalTextureResource) return; + + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + IntRect quadRect(IntPoint(), contentBounds()); - quadList.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); + quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped)); } void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h index 153eb918e..55d48b451 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureLayerImpl.h @@ -39,7 +39,7 @@ public: virtual ~CCTextureLayerImpl(); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void didLoseContext() OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index 297b13563..583c70c60 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -71,7 +71,7 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_forcedCommitRequested(false) , m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) - , m_layerRendererInitialized(false) + , m_rendererInitialized(false) , m_started(false) , m_texturesAcquired(true) , m_inCompositeAndReadback(false) @@ -101,7 +101,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) ASSERT(isMainThread()); ASSERT(m_layerTreeHost); - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) { + if (!m_layerTreeHost->initializeRendererIfNeeded()) { TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); return false; } @@ -208,23 +208,23 @@ void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool v completion->signal(); } -bool CCThreadProxy::initializeLayerRenderer() +bool CCThreadProxy::initializeRenderer() { - TRACE_EVENT0("cc", "CCThreadProxy::initializeLayerRenderer"); - // Make a blocking call to initializeLayerRendererOnImplThread. The results of that call + TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer"); + // Make a blocking call to initializeRendererOnImplThread. The results of that call // are pushed into the initializeSucceeded and capabilities local variables. CCCompletionEvent completion; bool initializeSucceeded = false; - LayerRendererCapabilities capabilities; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnImplThread, + RendererCapabilities capabilities; + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeRendererOnImplThread, &completion, &initializeSucceeded, &capabilities)); completion.wait(); if (initializeSucceeded) { - m_layerRendererInitialized = true; - m_layerRendererCapabilitiesMainThreadCopy = capabilities; + m_rendererInitialized = true; + m_RendererCapabilitiesMainThreadCopy = capabilities; } return initializeSucceeded; } @@ -247,7 +247,7 @@ bool CCThreadProxy::recreateContext() // variables. CCCompletionEvent completion; bool recreateSucceeded = false; - LayerRendererCapabilities capabilities; + RendererCapabilities capabilities; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread, &completion, context.leakPtr(), @@ -256,7 +256,7 @@ bool CCThreadProxy::recreateContext() completion.wait(); if (recreateSucceeded) - m_layerRendererCapabilitiesMainThreadCopy = capabilities; + m_RendererCapabilitiesMainThreadCopy = capabilities; return recreateSucceeded; } @@ -277,10 +277,10 @@ void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) completion.wait(); } -const LayerRendererCapabilities& CCThreadProxy::layerRendererCapabilities() const +const RendererCapabilities& CCThreadProxy::rendererCapabilities() const { - ASSERT(m_layerRendererInitialized); - return m_layerRendererCapabilitiesMainThreadCopy; + ASSERT(m_rendererInitialized); + return m_RendererCapabilitiesMainThreadCopy; } void CCThreadProxy::loseContext() @@ -418,8 +418,8 @@ void CCThreadProxy::forceSerializeOnSwapBuffers() void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* completion) { - if (m_layerRendererInitialized) - m_layerTreeHostImpl->layerRenderer()->doNoOp(); + if (m_rendererInitialized) + m_layerTreeHostImpl->renderer()->doNoOp(); completion->signal(); } @@ -517,7 +517,7 @@ void CCThreadProxy::beginFrame() m_commitRequested = false; m_forcedCommitRequested = false; - if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) + if (!m_layerTreeHost->initializeRendererIfNeeded()) return; if (request->contentsTexturesWereDeleted) @@ -577,7 +577,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion } else m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; - m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader()); + m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader()); m_commitCompletionEventOnImplThread = completion; m_schedulerOnImplThread->beginFrameComplete(); @@ -663,8 +663,8 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte if (!m_layerTreeHostImpl) return result; - ASSERT(m_layerTreeHostImpl->layerRenderer()); - if (!m_layerTreeHostImpl->layerRenderer()) + ASSERT(m_layerTreeHostImpl->renderer()); + if (!m_layerTreeHostImpl->renderer()) return result; // FIXME: compute the frame display time more intelligently @@ -850,14 +850,14 @@ void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context) m_contextBeforeInitializationOnImplThread = adoptPtr(context); } -void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities) +void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) { - TRACE_EVENT0("cc", "CCThreadProxy::initializeLayerRendererOnImplThread"); + TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); ASSERT(isImplThread()); ASSERT(m_contextBeforeInitializationOnImplThread); - *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release(), textureUploader); + *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.release(), textureUploader); if (*initializeSucceeded) { - *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); + *capabilities = m_layerTreeHostImpl->rendererCapabilities(); if (capabilities->usingSwapCompleteCallback) m_schedulerOnImplThread->setMaxFramesPending(2); } @@ -888,14 +888,15 @@ size_t CCThreadProxy::maxPartialTextureUpdates() const return CCTextureUpdateController::maxPartialTextureUpdates(); } -void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities) +void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); ASSERT(isImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); - *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptPtr(contextPtr), textureUploader); + if (!m_layerTreeHostImpl->contentsTexturesPurged()) + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contextPtr), textureUploader); if (*recreateSucceeded) { - *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); + *capabilities = m_layerTreeHostImpl->rendererCapabilities(); m_schedulerOnImplThread->didRecreateContext(); } completion->signal(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index 91a9e4d44..a240281c5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -57,11 +57,11 @@ public: virtual bool initializeContext() OVERRIDE; virtual void setSurfaceReady() OVERRIDE; virtual void setVisible(bool) OVERRIDE; - virtual bool initializeLayerRenderer() OVERRIDE; + virtual bool initializeRenderer() OVERRIDE; virtual bool recreateContext() OVERRIDE; virtual int compositorIdentifier() const OVERRIDE; virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; - virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE; + virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; virtual void loseContext() OVERRIDE; virtual void setNeedsAnimate() OVERRIDE; virtual void setNeedsCommit() OVERRIDE; @@ -136,11 +136,11 @@ private: void setSurfaceReadyOnImplThread(); void setVisibleOnImplThread(CCCompletionEvent*, bool); void initializeContextOnImplThread(CCGraphicsContext*); - void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*); + void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, RendererCapabilities*); void layerTreeHostClosedOnImplThread(CCCompletionEvent*); void setFullRootLayerDamageOnImplThread(); void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*); - void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, LayerRendererCapabilities*); + void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, RendererCapabilities*); void implSideRenderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*); CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw); void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*); @@ -153,8 +153,8 @@ private: OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer; CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; - bool m_layerRendererInitialized; - LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; + bool m_rendererInitialized; + RendererCapabilities m_RendererCapabilitiesMainThreadCopy; bool m_started; bool m_texturesAcquired; bool m_inCompositeAndReadback; @@ -168,7 +168,7 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; // Holds on to the context we might use for compositing in between initializeContext() - // and initializeLayerRenderer() calls. + // and initializeRenderer() calls. OwnPtr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread; // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index ad993ca15..b611d9891 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -125,13 +125,16 @@ DrawableTile* CCTiledLayerImpl::createTile(int i, int j) return addedTile; } -void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) +void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, bool& hadMissingTiles) { const IntRect& contentRect = visibleContentRect(); if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + int left, top, right, bottom; m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); @@ -146,7 +149,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderMissingTileColorRed, debugTileBorderMissingTileColorGreen, debugTileBorderMissingTileColorBlue); else borderColor = SkColorSetARGB(debugTileBorderAlpha, debugTileBorderColorRed, debugTileBorderColorGreen, debugTileBorderColorBlue); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth)); + quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, tileRect, borderColor, debugTileBorderWidth)); } } } @@ -167,9 +170,9 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState if (!tile || !tile->resourceId()) { if (drawCheckerboardForMissingTiles()) - hadMissingTiles |= quadList.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); + hadMissingTiles |= quadSink.append(CCCheckerboardDrawQuad::create(sharedQuadState, tileRect)); else - hadMissingTiles |= quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor())); + hadMissingTiles |= quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, tileRect, backgroundColor())); continue; } @@ -195,7 +198,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; - quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h index 6b877b341..1bc60aba4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h @@ -42,7 +42,7 @@ public: } virtual ~CCTiledLayerImpl(); - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h b/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h index c6309d210..426a25364 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTimeSource.h @@ -52,7 +52,7 @@ public: virtual bool active() const = 0; virtual void setTimebaseAndInterval(double timebase, double intervalSeconds) = 0; virtual double lastTickTime() = 0; - virtual double nextTickTime() = 0; + virtual double nextTickTimeIfActivated() = 0; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 14cb32726..662cd2f03 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -177,13 +177,16 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } -void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState* sharedQuadState, bool&) +void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) { ASSERT(CCProxy::isImplThread()); if (!m_frame) return; + CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState()); + appendDebugBorderQuad(quadSink, sharedQuadState); + // FIXME: When we pass quads out of process, we need to double-buffer, or // otherwise synchonize use of all textures in the quad. @@ -196,7 +199,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; const FramePlane& vPlane = m_framePlanes[WebKit::WebVideoFrame::vPlane]; OwnPtr<CCYUVVideoDrawQuad> yuvVideoQuad = CCYUVVideoDrawQuad::create(sharedQuadState, quadRect, yPlane, uPlane, vPlane); - quadList.append(yuvVideoQuad.release()); + quadSink.append(yuvVideoQuad.release()); break; } case GraphicsContext3D::RGBA: { @@ -208,7 +211,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState FloatRect uvRect(0, 0, widthScaleFactor, 1); bool flipped = false; OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped); - quadList.append(textureQuad.release()); + quadSink.append(textureQuad.release()); break; } case GraphicsContext3D::TEXTURE_2D: { @@ -217,19 +220,19 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadList, const CCSharedQuadState FloatRect uvRect(0, 0, 1, 1); bool flipped = false; OwnPtr<CCTextureDrawQuad> textureQuad = CCTextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped); - quadList.append(textureQuad.release()); + quadSink.append(textureQuad.release()); break; } case Extensions3D::TEXTURE_RECTANGLE_ARB: { IntSize textureSize(m_frame->width(), m_frame->height()); OwnPtr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); - quadList.append(ioSurfaceQuad.release()); + quadSink.append(ioSurfaceQuad.release()); break; } case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. OwnPtr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); - quadList.append(streamVideoQuad.release()); + quadSink.append(streamVideoQuad.release()); break; } default: diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index 30070c8c1..2c54e3513 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -51,7 +51,7 @@ public: virtual ~CCVideoLayerImpl(); virtual void willDraw(CCResourceProvider*) OVERRIDE; - virtual void appendQuads(CCQuadSink&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; + virtual void appendQuads(CCQuadSink&, bool& hadMissingTiles) OVERRIDE; virtual void didDraw(CCResourceProvider*) OVERRIDE; virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE; diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index d042c660c..d570f485a 100644 --- a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm +++ b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -57,15 +57,9 @@ namespace WebCore { // the restructuring in https://bugs.webkit.org/show_bug.cgi?id=66903 is done class GraphicsContext3DPrivate { public: - GraphicsContext3DPrivate(GraphicsContext3D* graphicsContext3D) - : m_graphicsContext3D(graphicsContext3D) - { - } + GraphicsContext3DPrivate(GraphicsContext3D*) { } ~GraphicsContext3DPrivate() { } - -private: - GraphicsContext3D* m_graphicsContext3D; // Weak back-pointer }; static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest) diff --git a/Source/WebCore/platform/text/TextDirection.h b/Source/WebCore/platform/text/TextDirection.h index 5be416e49..9a074c85d 100644 --- a/Source/WebCore/platform/text/TextDirection.h +++ b/Source/WebCore/platform/text/TextDirection.h @@ -28,7 +28,9 @@ namespace WebCore { - enum TextDirection { RTL, LTR }; +enum TextDirection { RTL, LTR }; + +inline bool isLeftToRightDirection(TextDirection direction) { return direction == LTR; } } diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/platform/text/WritingMode.h index ed36d8675..9a4a2064b 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/platform/text/WritingMode.h @@ -1,10 +1,10 @@ /* - * Copyright (C) 2008, 2009 Google Inc. All rights reserved. - * + * Copyright (c) 2012, Google Inc. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -28,69 +28,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "V8Proxy.h" - -#include "BindingState.h" -#include "CachedMetadata.h" -#include "DateExtension.h" -#include "Document.h" -#include "DocumentLoader.h" -#include "ExceptionHeaders.h" -#include "ExceptionInterfaces.h" -#include "Frame.h" -#include "FrameLoaderClient.h" -#include "IDBFactoryBackendInterface.h" -#include "InspectorInstrumentation.h" -#include "PlatformSupport.h" -#include "ScriptCallStack.h" -#include "ScriptCallStackFactory.h" -#include "ScriptRunner.h" -#include "ScriptSourceCode.h" -#include "SecurityOrigin.h" -#include "Settings.h" -#include "StylePropertySet.h" -#include "V8Binding.h" -#include "V8Collection.h" -#include "V8DOMCoreException.h" -#include "V8DOMMap.h" -#include "V8DOMWindow.h" -#include "V8HiddenPropertyName.h" -#include "V8IsolatedContext.h" -#include "V8RecursionScope.h" -#include "WorkerContext.h" -#include "WorkerContextExecutionProxy.h" - -#include <algorithm> -#include <stdio.h> -#include <utility> -#include <wtf/Assertions.h> -#include <wtf/OwnArrayPtr.h> -#include <wtf/OwnPtr.h> -#include <wtf/StdLibExtras.h> -#include <wtf/StringExtras.h> -#include <wtf/UnusedParam.h> -#include <wtf/text/WTFString.h> - -#if PLATFORM(CHROMIUM) -#include "TraceEvent.h" -#endif +#ifndef WritingMode_h +#define WritingMode_h namespace WebCore { -V8Proxy::V8Proxy(Frame* frame) - : m_frame(frame) +enum WritingMode { + TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode +}; + +inline bool isHorizontalWritingMode(WritingMode writingMode) { + return writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode; } -V8Proxy::~V8Proxy() +inline bool isFlippedLinesWritingMode(WritingMode writingMode) { - windowShell()->destroyGlobal(); + return writingMode == LeftToRightWritingMode || writingMode == BottomToTopWritingMode; } -V8DOMWindowShell* V8Proxy::windowShell() const +inline bool isFlippedBlocksWritingMode(WritingMode writingMode) { - return frame()->script()->windowShell(); + return writingMode == RightToLeftWritingMode || writingMode == BottomToTopWritingMode; } -} // namespace WebCore +} // namespace WebCore + +#endif // WritingMode_h diff --git a/Source/WebCore/platform/win/PopupMenuWin.cpp b/Source/WebCore/platform/win/PopupMenuWin.cpp index eb5c5b1a0..a86847ddf 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.cpp +++ b/Source/WebCore/platform/win/PopupMenuWin.cpp @@ -726,6 +726,31 @@ void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& ::InvalidateRect(m_popup, &r, false); } +int PopupMenuWin::visibleHeight() const +{ + return m_scrollbar ? m_scrollbar->visibleSize() : m_windowRect.height(); +} + +int PopupMenuWin::visibleWidth() const +{ + return m_windowRect.width(); +} + +IntSize PopupMenuWin::contentsSize() const +{ + return m_windowRect.size(); +} + +bool PopupMenuWin::isOnActivePage() const +{ + return m_showPopup; +} + +IntRect PopupMenuWin::scrollableAreaBoundingBox() const +{ + return m_windowRect; +} + void PopupMenuWin::registerClass() { static bool haveRegisteredWindowClass = false; diff --git a/Source/WebCore/platform/win/PopupMenuWin.h b/Source/WebCore/platform/win/PopupMenuWin.h index 3aee51cb9..9b6ffa7d3 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.h +++ b/Source/WebCore/platform/win/PopupMenuWin.h @@ -91,16 +91,21 @@ private: void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } // ScrollableArea - virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual void invalidateScrollCornerRect(const WebCore::IntRect&) { } - virtual bool isActive() const { return true; } - ScrollableArea* enclosingScrollableArea() const { return 0; } - virtual bool isScrollCornerVisible() const { return false; } - virtual WebCore::IntRect scrollCornerRect() const { return WebCore::IntRect(); } - virtual Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); } + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } + virtual bool isActive() const OVERRIDE { return true; } + ScrollableArea* enclosingScrollableArea() const OVERRIDE { return 0; } + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } + virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_scrollbar.get(); } + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual IntSize contentsSize() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. void scrollTo(int offset); diff --git a/Source/WebCore/platform/wx/CursorWx.cpp b/Source/WebCore/platform/wx/CursorWx.cpp index dd61f1e88..5ffaa9db9 100644 --- a/Source/WebCore/platform/wx/CursorWx.cpp +++ b/Source/WebCore/platform/wx/CursorWx.cpp @@ -62,61 +62,61 @@ Cursor::Cursor(wxCursor* c) const Cursor& pointerCursor() { - static Cursor c = new wxCursor(wxCURSOR_ARROW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_ARROW)); return c; } const Cursor& crossCursor() { - static Cursor c = new wxCursor(wxCURSOR_CROSS); + static Cursor c = Cursor(new wxCursor(wxCURSOR_CROSS)); return c; } const Cursor& handCursor() { - static Cursor c = new wxCursor(wxCURSOR_HAND); + static Cursor c = Cursor(new wxCursor(wxCURSOR_HAND)); return c; } const Cursor& iBeamCursor() { - static Cursor c = new wxCursor(wxCURSOR_IBEAM); + static Cursor c = Cursor(new wxCursor(wxCURSOR_IBEAM)); return c; } const Cursor& waitCursor() { - static Cursor c = new wxCursor(wxCURSOR_WAIT); + static Cursor c = Cursor(new wxCursor(wxCURSOR_WAIT)); return c; } const Cursor& helpCursor() { - static Cursor c = new wxCursor(wxCURSOR_QUESTION_ARROW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_QUESTION_ARROW)); return c; } const Cursor& eastResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZEWE); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZEWE)); return c; } const Cursor& northResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENS); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENS)); return c; } const Cursor& northEastResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENESW); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENESW)); return c; } const Cursor& northWestResizeCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZENWSE); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZENWSE)); return c; } @@ -171,14 +171,14 @@ const Cursor& northWestSouthEastResizeCursor() const Cursor& columnResizeCursor() { // FIXME: Windows does not have a standard column resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } const Cursor& rowResizeCursor() { // FIXME: Windows does not have a standard row resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } @@ -270,13 +270,13 @@ const Cursor& noneCursor() const Cursor& notAllowedCursor() { - static Cursor c = new wxCursor(wxCURSOR_NO_ENTRY); + static Cursor c = Cursor(new wxCursor(wxCURSOR_NO_ENTRY)); return c; } const Cursor& zoomInCursor() { - static Cursor c = new wxCursor(wxCURSOR_MAGNIFIER); + static Cursor c = Cursor(new wxCursor(wxCURSOR_MAGNIFIER)); return c; } @@ -300,7 +300,7 @@ const Cursor& grabbingCursor() const Cursor& moveCursor() { - static Cursor c = new wxCursor(wxCURSOR_SIZING); + static Cursor c = Cursor(new wxCursor(wxCURSOR_SIZING)); return c; } diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index c3da10025..126db27f9 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -792,10 +792,10 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets(); - LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style); - LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style); - LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style); - LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style); + LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style->writingMode()); + LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style->writingMode()); + LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style->writingMode()); + LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style->writingMode()); // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes. diff --git a/Source/WebCore/rendering/LayoutState.cpp b/Source/WebCore/rendering/LayoutState.cpp index f750cb159..1dff9533e 100644 --- a/Source/WebCore/rendering/LayoutState.cpp +++ b/Source/WebCore/rendering/LayoutState.cpp @@ -55,15 +55,15 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz if (renderer->isOutOfFlowPositioned() && !fixed) { if (RenderObject* container = renderer->container()) { - if (container->isRelPositioned() && container->isRenderInline()) - m_paintOffset += toRenderInline(container)->relativePositionedInlineOffset(renderer); + if (container->isInFlowPositioned() && container->isRenderInline()) + m_paintOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer); } } m_layoutOffset = m_paintOffset; - if (renderer->isRelPositioned() && renderer->hasLayer()) - m_paintOffset += renderer->layer()->relativePositionOffset(); + if (renderer->isInFlowPositioned() && renderer->hasLayer()) + m_paintOffset += renderer->layer()->offsetForInFlowPosition(); m_clipped = !fixed && prev->m_clipped; if (m_clipped) diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index a4158f4e1..119cbb7fd 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -309,7 +309,7 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt toRenderBlock(cb)->removePositionedObjects(this); } - if (containsFloats() && !isFloating() && !isOutOfFlowPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition)) + if (containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newStyle->hasOutOfFlowPosition()) markAllDescendantsWithFloatsForLayout(); } @@ -1143,6 +1143,8 @@ void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c RenderObject* nextSibling = child->nextSibling(); RenderFlowThread* childFlowThread = child->enclosingRenderFlowThread(); + CurrentRenderFlowThreadMaintainer flowThreadMaintainer(childFlowThread); + RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer())); anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); // Delete the now-empty block's lines and nuke it. @@ -3174,9 +3176,10 @@ bool RenderBlock::isSelectionRoot() const if (isTable()) return false; - if (isBody() || isRoot() || hasOverflowClip() || isRelPositioned() - || isFloatingOrOutOfFlowPositioned() || isTableCell() || isInlineBlockOrInlineTable() || hasTransform() - || hasReflection() || hasMask() || isWritingModeRoot()) + if (isBody() || isRoot() || hasOverflowClip() + || isInFlowPositioned() || isFloatingOrOutOfFlowPositioned() + || isTableCell() || isInlineBlockOrInlineTable() + || hasTransform() || hasReflection() || hasMask() || isWritingModeRoot()) return true; if (view() && view()->selectionStart()) { @@ -3396,10 +3399,10 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoi if (curr->isFloatingOrOutOfFlowPositioned()) continue; // We must be a normal flow object in order to even be considered. - if (curr->isRelPositioned() && curr->hasLayer()) { + if (curr->isInFlowPositioned() && curr->hasLayer()) { // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element. // Just disregard it completely. - LayoutSize relOffset = curr->layer()->relativePositionOffset(); + LayoutSize relOffset = curr->layer()->offsetForInFlowPosition(); if (relOffset.width() || relOffset.height()) continue; } @@ -4879,8 +4882,9 @@ static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child static VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) { LayoutPoint childLocation = child->location(); - if (child->isRelPositioned()) - childLocation += child->relativePositionOffset(); + if (child->isInFlowPositioned()) + childLocation += child->offsetForInFlowPosition(); + // FIXME: This is wrong if the child's writing-mode is different from the parent's. LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation)); diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index a0056e03b..f16457b5e 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -197,9 +197,9 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl markContainingBlocksForLayout(); if (oldStyle->position() == StaticPosition) repaint(); - else if (newStyle->isOutOfFlowPositioned()) + else if (newStyle->hasOutOfFlowPosition()) parent()->setChildNeedsLayout(true); - if (isFloating() && !isOutOfFlowPositioned() && newStyle->isOutOfFlowPositioned()) + if (isFloating() && !isOutOfFlowPositioned() && newStyle->hasOutOfFlowPosition()) removeFloatingOrPositionedChildFromBlockLists(); } } else if (newStyle && isBody()) @@ -301,7 +301,7 @@ void RenderBox::updateBoxModelInfoFromStyle() if (isRootObject || isViewObject) setHasBoxDecorations(true); - setPositioned(styleToUse->isOutOfFlowPositioned()); + setPositioned(styleToUse->hasOutOfFlowPosition()); setFloating(!isOutOfFlowPositioned() && styleToUse->isFloating()); // We also handle <body> and <html>, whose overflow applies to the viewport. @@ -433,19 +433,23 @@ void RenderBox::updateLayerTransform() layer()->updateTransform(); } -LayoutUnit RenderBox::logicalHeightConstrainedByMinMax(LayoutUnit availableHeight) +LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) { RenderStyle* styleToUse = style(); - LayoutUnit result = computeLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight()); - if (result == -1) - result = availableHeight; - LayoutUnit minH = computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight()); // Leave as -1 if unset. - LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? result : computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); - if (maxH == -1) - maxH = result; - result = min(maxH, result); - result = max(minH, result); - return result; + if (!styleToUse->logicalMaxWidth().isUndefined()) + logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSize, availableWidth, cb, region, offsetFromLogicalTopOfFirstPage)); + return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, availableWidth, cb, region, offsetFromLogicalTopOfFirstPage)); +} + +LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) +{ + RenderStyle* styleToUse = style(); + if (!styleToUse->logicalMaxHeight().isUndefined()) { + LayoutUnit maxH = computeLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight()); + if (maxH != -1) + logicalHeight = min(logicalHeight, maxH); + } + return max(logicalHeight, computeLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight())); } IntRect RenderBox::absoluteContentBox() const @@ -1272,8 +1276,8 @@ void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, Tran if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); LayoutSize offset = layoutState->m_paintOffset + locationOffset(); - if (style()->position() == RelativePosition && layer()) - offset += layer()->relativePositionOffset(); + if (style()->hasInFlowPosition() && layer()) + offset += layer()->offsetForInFlowPosition(); transformState.move(offset); return; } @@ -1390,11 +1394,11 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po ASSERT(o == container()); LayoutSize offset; - if (isRelPositioned()) - offset += relativePositionOffset(); + if (isInFlowPositioned()) + offset += offsetForInFlowPosition(); if (!isInline() || isReplaced()) { - if (!style()->isOutOfFlowPositioned() && o->hasColumns()) { + if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { RenderBlock* block = toRenderBlock(o); LayoutRect columnRect(frameRect()); block->adjustStartEdgeForWritingModeIncludingColumns(columnRect); @@ -1413,8 +1417,8 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po if (o->hasOverflowClip()) offset -= toRenderBox(o)->scrolledContentOffset(); - if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isRenderInline()) - offset += toRenderInline(o)->relativePositionedInlineOffset(this); + if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) + offset += toRenderInline(o)->offsetForInFlowPositionedInline(this); return offset; } @@ -1527,8 +1531,9 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La if (layer() && layer()->transform()) rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); - if (styleToUse->position() == RelativePosition && layer()) - rect.move(layer()->relativePositionOffset()); + // We can't trust the bits on RenderObject, because this might be called while re-resolving style. + if (styleToUse->hasInFlowPosition() && layer()) + rect.move(layer()->offsetForInFlowPosition()); rect.moveBy(location()); rect.move(layoutState->m_paintOffset); @@ -1570,14 +1575,14 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, La } else if (position == FixedPosition) fixed = true; - if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInline()) - topLeft += toRenderInline(o)->relativePositionedInlineOffset(this); - else if (position == RelativePosition && layer()) { + if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) + topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this); + else if ((position == RelativePosition) && layer()) { // Apply the relative position offset when invalidating a rectangle. The layer // is translated, but the render box isn't, so we need to do this to get the // right dirty rect. Since this is called from RenderObject::setStyle, the relative position // flag on the RenderObject has been cleared, so use the one on the style(). - topLeft += layer()->relativePositionOffset(); + topLeft += layer()->offsetForInFlowPosition(); } if (o->isBlockFlow() && position != AbsolutePosition && position != FixedPosition) { @@ -1690,20 +1695,8 @@ void RenderBox::computeLogicalWidthInRegion(RenderRegion* region, LayoutUnit off if (treatAsReplaced) setLogicalWidth(logicalWidthLength.value() + borderAndPaddingLogicalWidth()); else { - // Calculate LogicalWidth - setLogicalWidth(computeLogicalWidthInRegionUsing(MainOrPreferredSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage)); - - // Calculate MaxLogicalWidth - if (!styleToUse->logicalMaxWidth().isUndefined()) { - LayoutUnit maxLogicalWidth = computeLogicalWidthInRegionUsing(MaxSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); - if (logicalWidth() > maxLogicalWidth) - setLogicalWidth(maxLogicalWidth); - } - - // Calculate MinLogicalWidth - LayoutUnit minLogicalWidth = computeLogicalWidthInRegionUsing(MinSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); - if (logicalWidth() < minLogicalWidth) - setLogicalWidth(minLogicalWidth); + LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage); + setLogicalWidth(constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region, offsetFromLogicalTopOfFirstPage)); } // Fieldsets are currently the only objects that stretch to their minimum width. @@ -2013,9 +2006,12 @@ void RenderBox::computeLogicalHeight() } LayoutUnit heightResult; - if (checkMinMaxHeight) - heightResult = logicalHeightConstrainedByMinMax(logicalHeight()); - else { + if (checkMinMaxHeight) { + heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight()); + if (heightResult == -1) + heightResult = logicalHeight(); + heightResult = constrainLogicalHeightByMinMax(heightResult); + } else { // The only times we don't check min/max height are when a fixed length has // been given as an override. Just use that. The value has already been adjusted // for box-sizing. @@ -2390,7 +2386,7 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo return result; } - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); + ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned()); const RenderInline* flow = toRenderInline(containingBlock); InlineFlowBox* first = flow->firstLineBox(); @@ -2431,7 +2427,7 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM return result; } - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); + ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned()); const RenderInline* flow = toRenderInline(containingBlock); InlineFlowBox* first = flow->firstLineBox(); @@ -2538,8 +2534,8 @@ void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit o const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); const Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop(); const Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom(); - LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()); - LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()); + LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode()); + LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode()); Length logicalLeftLength = style()->logicalLeft(); Length logicalRightLength = style()->logicalRight(); @@ -2878,8 +2874,8 @@ void RenderBox::computePositionedLogicalHeight() const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); const Length marginBefore = styleToUse->marginBefore(); const Length marginAfter = styleToUse->marginAfter(); - LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse); - LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse); + LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse->writingMode()); + LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse->writingMode()); Length logicalTopLength = styleToUse->logicalTop(); Length logicalBottomLength = styleToUse->logicalBottom(); @@ -3145,8 +3141,8 @@ void RenderBox::computePositionedLogicalWidthReplaced() Length logicalRight = style()->logicalRight(); Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop(); Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom(); - LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()); - LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()); + LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode()); + LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode()); /*-----------------------------------------------------------------------*\ * 1. The used value of 'width' is determined as for inline replaced @@ -3306,8 +3302,8 @@ void RenderBox::computePositionedLogicalHeightReplaced() // Variables to solve. Length marginBefore = style()->marginBefore(); Length marginAfter = style()->marginAfter(); - LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style()); - LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style()); + LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style()->writingMode()); + LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style()->writingMode()); Length logicalTop = style()->logicalTop(); Length logicalBottom = style()->logicalBottom(); @@ -3836,7 +3832,7 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) rect.unite(layoutOverflowRect()); bool hasTransform = hasLayer() && layer()->transform(); - if (isRelPositioned() || hasTransform) { + if (isInFlowPositioned() || hasTransform) { // If we are relatively positioned or if we have a transform, then we have to convert // this rectangle into physical coordinates, apply relative positioning and transforms // to it, and then convert it back. @@ -3845,8 +3841,8 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) if (hasTransform) rect = layer()->currentTransform().mapRect(rect); - if (isRelPositioned()) - rect.move(relativePositionOffset()); + if (isInFlowPositioned()) + rect.move(offsetForInFlowPosition()); // Now we need to flip back. flipForWritingMode(rect); diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 00b05f4e1..f011714cb 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -44,7 +44,7 @@ public: // hasAutoZIndex only returns true if the element is positioned or a flex-item since // position:static elements that are not flex-items get their z-index coerced to auto. - virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } + virtual bool requiresLayer() const OVERRIDE { return isRoot() || isOutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } // Use this with caution! No type checking is done! RenderBox* firstChildBox() const; @@ -75,7 +75,8 @@ public: LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); } LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } - LayoutUnit logicalHeightConstrainedByMinMax(LayoutUnit); + LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = ZERO_LAYOUT_UNIT); + LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit); int pixelSnappedLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedHeight() : pixelSnappedWidth(); } int pixelSnappedLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedWidth() : pixelSnappedHeight(); } @@ -234,17 +235,33 @@ public: void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); } void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); } - virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()); } - virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()); } + virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()->writingMode()); } + virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()->writingMode()); } - virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.start(overrideStyle ? overrideStyle : style()); } - virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.end(overrideStyle ? overrideStyle : style()); } - void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore(overrideStyle ? overrideStyle : style(), value); } - void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter(overrideStyle ? overrideStyle : style(), value); } - void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setStart(overrideStyle ? overrideStyle : style(), value); } - void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setEnd(overrideStyle ? overrideStyle : style(), value); } + virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before((overrideStyle ? overrideStyle : style())->writingMode()); } + virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after((overrideStyle ? overrideStyle : style())->writingMode()); } + virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + return m_marginBox.start(styleToUse->writingMode(), styleToUse->direction()); + } + virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction()); + } + void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : style())->writingMode(), value); } + void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : style())->writingMode(), value); } + void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value); + } + void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) + { + const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style(); + m_marginBox.setEnd(styleToUse->writingMode(), styleToUse->direction(), value); + } // The following five functions are used to implement collapsing margins. // All objects know their maximal positive and negative margins. The diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index caf327b13..7dcd24129 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -459,16 +459,16 @@ void RenderBoxModelObject::updateBoxModelInfoFromStyle() setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); } -static LayoutSize accumulateRelativePositionOffsets(const RenderObject* child) +static LayoutSize accumulateInFlowPositionOffsets(const RenderObject* child) { - if (!child->isAnonymousBlock() || !child->isRelPositioned()) + if (!child->isAnonymousBlock() || !child->isInFlowPositioned()) return LayoutSize(); LayoutSize offset; RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); while (p && p->isRenderInline()) { - if (p->isRelPositioned()) { + if (p->isInFlowPositioned()) { RenderInline* renderInline = toRenderInline(p); - offset += renderInline->relativePositionOffset(); + offset += renderInline->offsetForInFlowPosition(); } p = p->parent(); } @@ -477,7 +477,7 @@ static LayoutSize accumulateRelativePositionOffsets(const RenderObject* child) LayoutSize RenderBoxModelObject::relativePositionOffset() const { - LayoutSize offset = accumulateRelativePositionOffsets(this); + LayoutSize offset = accumulateInFlowPositionOffsets(this); RenderBlock* containingBlock = this->containingBlock(); @@ -550,6 +550,14 @@ LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L return referencePoint; } +LayoutSize RenderBoxModelObject::offsetForInFlowPosition() const +{ + if (isRelPositioned()) + return relativePositionOffset(); + + return LayoutSize(); +} + LayoutUnit RenderBoxModelObject::offsetLeft() const { // Note that RenderInline and RenderBox override this to pass a different @@ -745,14 +753,14 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co // while rendering.) if (forceBackgroundToWhite) { // Note that we can't reuse this variable below because the bgColor might be changed - bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha() > 0; + bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha(); if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { bgColor = Color::white; shouldPaintBackgroundImage = false; } } - bool colorVisible = bgColor.isValid() && bgColor.alpha() > 0; + bool colorVisible = bgColor.isValid() && bgColor.alpha(); // Fast path for drawing simple color backgrounds. if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) { @@ -2420,7 +2428,7 @@ bool RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(BackgroundBleedA return false; Color backgroundColor = style()->visitedDependentColor(CSSPropertyBackgroundColor); - if (!backgroundColor.isValid() || backgroundColor.alpha() < 255) + if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) return false; const FillLayer* lastBackgroundLayer = style()->backgroundLayers(); @@ -2733,7 +2741,7 @@ void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransform LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); - if (!style()->isOutOfFlowPositioned() && o->hasColumns()) { + if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { RenderBlock* block = static_cast<RenderBlock*>(o); LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint())); point -= containerOffset; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index 067f6046d..8d5e83e7a 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -62,6 +62,8 @@ public: LayoutSize relativePositionOffset() const; LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } + LayoutSize offsetForInFlowPosition() const; + // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) // to return the remaining width on a given line (and the height of a single line). virtual LayoutUnit offsetLeft() const; @@ -74,13 +76,13 @@ public: int pixelSnappedOffsetWidth() const; int pixelSnappedOffsetHeight() const; - virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle) OVERRIDE; + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE; virtual void updateBoxModelInfoFromStyle(); bool hasSelfPaintingLayer() const; RenderLayer* layer() const { return m_layer; } - virtual bool requiresLayer() const { return isRoot() || isOutOfFlowPositioned() || isRelPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } + virtual bool requiresLayer() const { return isRoot() || isOutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } // This will work on inlines to return the bounding box of all of the lines' border boxes. virtual IntRect borderBoundingBox() const = 0; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 448d4da6d..9f87cf835 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -1233,10 +1233,10 @@ void RenderFlexibleBox::alignChildren(OrderIterator& iterator, const WTF::Vector void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUnit lineCrossAxisExtent) { if (!isColumnFlow() && child->style()->logicalHeight().isAuto()) { - // FIXME: If the child has orthogonal flow, then it already has an override height set. How do we stretch? + // FIXME: If the child has orthogonal flow, then it already has an override height set, so use it. if (!hasOrthogonalFlow(child)) { LayoutUnit stretchedLogicalHeight = child->logicalHeight() + availableAlignmentSpaceForChild(lineCrossAxisExtent, child); - LayoutUnit desiredLogicalHeight = child->logicalHeightConstrainedByMinMax(stretchedLogicalHeight); + LayoutUnit desiredLogicalHeight = child->constrainLogicalHeightByMinMax(stretchedLogicalHeight); // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. if (desiredLogicalHeight != child->logicalHeight()) { @@ -1246,14 +1246,18 @@ void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUni child->layoutIfNeeded(); } } - } else if (isColumnFlow() && child->style()->logicalWidth().isAuto() && isMultiline()) { - // FIXME: Handle min-width and max-width. - // FIXME: We only need to relayout here if the width changes. - // FIXME: The isMultiline check above may not be necessary if the width has not changed. See https://webkit.org/b/94237 - LayoutUnit childWidth = lineCrossAxisExtent - crossAxisMarginExtentForChild(child); - child->setOverrideLogicalContentWidth(std::max(ZERO_LAYOUT_UNIT, childWidth)); - child->setChildNeedsLayout(true, MarkOnlyThis); - child->layoutIfNeeded(); + } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { + // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it. + if (hasOrthogonalFlow(child)) { + LayoutUnit childWidth = std::max(ZERO_LAYOUT_UNIT, lineCrossAxisExtent - crossAxisMarginExtentForChild(child)); + childWidth = child->constrainLogicalWidthInRegionByMinMax(childWidth, childWidth, this); + + if (childWidth != child->logicalWidth()) { + child->setOverrideLogicalContentWidth(childWidth); + child->setChildNeedsLayout(true, MarkOnlyThis); + child->layoutIfNeeded(); + } + } } } diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 429dad3a9..f3e47df47 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -107,26 +107,6 @@ void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) checkRegionsWithStyling(); } -class CurrentRenderFlowThreadMaintainer { - WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); -public: - CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) - : m_renderFlowThread(renderFlowThread) - { - RenderView* view = m_renderFlowThread->view(); - ASSERT(!view->flowThreadController()->currentRenderFlowThread()); - view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); - } - ~CurrentRenderFlowThreadMaintainer() - { - RenderView* view = m_renderFlowThread->view(); - ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFlowThread); - view->flowThreadController()->setCurrentRenderFlowThread(0); - } -private: - RenderFlowThread* m_renderFlowThread; -}; - class CurrentRenderFlowThreadDisabler { WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadDisabler); public: @@ -793,4 +773,24 @@ bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const Rend return false; } +CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) + : m_renderFlowThread(renderFlowThread) +{ + if (!m_renderFlowThread) + return; + RenderView* view = m_renderFlowThread->view(); + ASSERT(!view->flowThreadController()->currentRenderFlowThread()); + view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); +} + +CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer() +{ + if (!m_renderFlowThread) + return; + RenderView* view = m_renderFlowThread->view(); + ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFlowThread); + view->flowThreadController()->setCurrentRenderFlowThread(0); +} + + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index 4730be8dc..34dec69d8 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -197,6 +197,15 @@ inline const RenderFlowThread* toRenderFlowThread(const RenderObject* object) // This will catch anyone doing an unnecessary cast. void toRenderFlowThread(const RenderFlowThread*); +class CurrentRenderFlowThreadMaintainer { + WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadMaintainer); +public: + CurrentRenderFlowThreadMaintainer(RenderFlowThread*); + ~CurrentRenderFlowThreadMaintainer(); +private: + RenderFlowThread* m_renderFlowThread; +}; + } // namespace WebCore #endif // RenderFlowThread_h diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index d58bfc1ab..b139bcb44 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -129,14 +129,14 @@ void RenderInline::updateBoxModelInfoFromStyle() setHasReflection(false); } -static bool hasRelPositionedInlineAncestor(RenderObject* p) +static RenderObject* inFlowPositionedInlineAncestor(RenderObject* p) { while (p && p->isRenderInline()) { - if (p->isRelPositioned()) - return true; + if (p->isInFlowPositioned()) + return p; p = p->parent(); } - return false; + return 0; } static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const RenderStyle* newStyle, const RenderStyle* oldStyle) @@ -144,10 +144,10 @@ static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { if (!toRenderBlock(block)->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position()) continue; - // If we are no longer relatively positioned but our descendant block(s) still have a relatively positioned ancestor then - // their containing anonymous block should keep its relative positioning. + // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then + // their containing anonymous block should keep its in-flow positioning. RenderInline* cont = toRenderBlock(block)->inlineElementContinuation(); - if (oldStyle->position() == RelativePosition && hasRelPositionedInlineAncestor(cont)) + if (oldStyle->hasInFlowPosition() && inFlowPositionedInlineAncestor(cont)) continue; RefPtr<RenderStyle> blockStyle = RenderStyle::createAnonymousStyleWithDisplay(block->style(), BLOCK); blockStyle->setPosition(newStyle->position()); @@ -174,10 +174,10 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt currCont->setContinuation(nextCont); } - // If an inline's relative positioning has changed then any descendant blocks will need to change their relative positioning accordingly. + // If an inline's in-flow positioning has changed then any descendant blocks will need to change their in-flow positioning accordingly. // Do this by updating the position of the descendant blocks' containing anonymous blocks - there may be more than one. - if (continuation && oldStyle && newStyle->position() != oldStyle->position() - && (newStyle->position() == RelativePosition || (oldStyle->position() == RelativePosition))) { + if (continuation && oldStyle && newStyle->position() != oldStyle->position() + && (newStyle->hasInFlowPosition() || oldStyle->hasInFlowPosition())) { // If any descendant blocks exist then they will be in the next anonymous block and its siblings. RenderObject* block = containingBlock()->nextSibling(); ASSERT(block && block->isAnonymousBlock()); @@ -310,10 +310,10 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb // the children after |beforeChild| and put them in a clone of this object. RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK); - // If inside an inline affected by relative positioning the block needs to be affected by it too. + // If inside an inline affected by in-flow positioning the block needs to be affected by it too. // Giving the block a layer like this allows it to collect the x/y offsets from inline parents later. - if (hasRelPositionedInlineAncestor(this)) - newStyle->setPosition(RelativePosition); + if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(this)) + newStyle->setPosition(positionedAncestor->style()->position()); RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); newBox->setStyle(newStyle.release()); @@ -969,7 +969,7 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep LayoutRect repaintRect(linesVisualOverflowBoundingBox()); bool hitRepaintContainer = false; - // We need to add in the relative position offsets of any inlines (including us) up to our + // We need to add in the in-flow position offsets of any inlines (including us) up to our // containing block. RenderBlock* cb = containingBlock(); for (const RenderObject* inlineFlow = this; inlineFlow && inlineFlow->isRenderInline() && inlineFlow != cb; @@ -978,8 +978,8 @@ LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* rep hitRepaintContainer = true; break; } - if (inlineFlow->style()->position() == RelativePosition && inlineFlow->hasLayer()) - repaintRect.move(toRenderInline(inlineFlow)->layer()->relativePositionOffset()); + if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer()) + repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlowPosition()); } LayoutUnit outlineSize = style()->outlineSize(); @@ -1032,8 +1032,8 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, // LayoutState is only valid for root-relative repainting if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); - if (style()->position() == RelativePosition && layer()) - rect.move(layer()->relativePositionOffset()); + if (style()->hasInFlowPosition() && layer()) + rect.move(layer()->offsetForInFlowPosition()); rect.move(layoutState->m_paintOffset); if (layoutState->m_clipped) rect.intersect(layoutState->m_clipRect); @@ -1051,7 +1051,7 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutPoint topLeft = rect.location(); - if (o->isBlockFlow() && !style()->isOutOfFlowPositioned()) { + if (o->isBlockFlow() && !style()->hasOutOfFlowPosition()) { RenderBlock* cb = toRenderBlock(o); if (cb->hasColumns()) { LayoutRect repaintRect(topLeft, rect.size()); @@ -1061,12 +1061,12 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, } } - if (style()->position() == RelativePosition && layer()) { - // Apply the relative position offset when invalidating a rectangle. The layer + if (style()->hasInFlowPosition() && layer()) { + // Apply the in-flow position offset when invalidating a rectangle. The layer // is translated, but the render box isn't, so we need to do this to get the - // right dirty rect. Since this is called from RenderObject::setStyle, the relative position + // right dirty rect. Since this is called from RenderObject::setStyle, the relative position // flag on the RenderObject has been cleared, so use the one on the style(). - topLeft += layer()->relativePositionOffset(); + topLeft += layer()->offsetForInFlowPosition(); } // FIXME: We ignore the lightweight clipping rect that controls use, since if |o| is in mid-layout, @@ -1102,8 +1102,8 @@ LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const Layo ASSERT(container == this->container()); LayoutSize offset; - if (isRelPositioned()) - offset += relativePositionOffset(); + if (isInFlowPositioned()) + offset += offsetForInFlowPosition(); container->adjustForColumns(offset, point); @@ -1125,8 +1125,8 @@ void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, T if (v->layoutStateEnabled() && !repaintContainer) { LayoutState* layoutState = v->layoutState(); LayoutSize offset = layoutState->m_paintOffset; - if (style()->position() == RelativePosition && layer()) - offset += layer()->relativePositionOffset(); + if (style()->hasInFlowPosition() && layer()) + offset += layer()->offsetForInFlowPosition(); transformState.move(offset); return; } @@ -1311,12 +1311,12 @@ LayoutUnit RenderInline::baselinePosition(FontBaseline baselineType, bool firstL return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; } -LayoutSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const +LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const { // FIXME: This function isn't right with mixed writing modes. - ASSERT(isRelPositioned()); - if (!isRelPositioned()) + ASSERT(isInFlowPositioned()); + if (!isInFlowPositioned()) return LayoutSize(); // When we have an enclosing relpositioned inline, we need to add in the offset of the first line diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h index bb43289be..9adec42b0 100644 --- a/Source/WebCore/rendering/RenderInline.h +++ b/Source/WebCore/rendering/RenderInline.h @@ -72,7 +72,7 @@ public: virtual void updateDragState(bool dragOn); - LayoutSize relativePositionedInlineOffset(const RenderBox* child) const; + LayoutSize offsetForInFlowPositionedInline(const RenderBox* child) const; virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); void paintOutline(GraphicsContext*, const LayoutPoint&); @@ -124,7 +124,7 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; - virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask() || hasFilter(); } + virtual bool requiresLayer() const { return isInFlowPositioned() || isTransparent() || hasMask() || hasFilter(); } virtual LayoutUnit offsetLeft() const; virtual LayoutUnit offsetTop() const; diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 661d0eb08..edb3cf58d 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -847,8 +847,8 @@ void RenderLayer::updateLayerPosition() LayoutSize offset = positionedParent->scrolledContentOffset(); localPoint -= offset; - if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()->isRelPositioned() && positionedParent->renderer()->isRenderInline()) { - LayoutSize offset = toRenderInline(positionedParent->renderer())->relativePositionedInlineOffset(toRenderBox(renderer())); + if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()->isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { + LayoutSize offset = toRenderInline(positionedParent->renderer())->offsetForInFlowPositionedInline(toRenderBox(renderer())); localPoint += offset; } } else if (parent()) { @@ -867,12 +867,12 @@ void RenderLayer::updateLayerPosition() IntSize scrollOffset = parent()->scrolledContentOffset(); localPoint -= scrollOffset; } - - if (renderer()->isRelPositioned()) { - m_relativeOffset = renderer()->relativePositionOffset(); - localPoint.move(m_relativeOffset); + + if (renderer()->isInFlowPositioned()) { + m_offsetForInFlowPosition = renderer()->offsetForInFlowPosition(); + localPoint.move(m_offsetForInFlowPosition); } else { - m_relativeOffset = LayoutSize(); + m_offsetForInFlowPosition = LayoutSize(); } // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the renderers. @@ -933,7 +933,7 @@ RenderLayer* RenderLayer::stackingContext() const static inline bool isPositionedContainer(RenderLayer* layer) { RenderBoxModelObject* layerRenderer = layer->renderer(); - return layer->isRootLayer() || layerRenderer->isOutOfFlowPositioned() || layerRenderer->isRelPositioned() || layer->hasTransform(); + return layer->isRootLayer() || layerRenderer->isOutOfFlowPositioned() || layerRenderer->isInFlowPositioned() || layer->hasTransform(); } static inline bool isFixedPositionedContainer(RenderLayer* layer) @@ -3950,8 +3950,7 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* clipRects.setPosClipRect(clipRects.fixedClipRect()); clipRects.setOverflowClipRect(clipRects.fixedClipRect()); clipRects.setFixed(true); - } - else if (renderer()->style()->position() == RelativePosition) + } else if (renderer()->style()->hasInFlowPosition()) clipRects.setPosClipRect(clipRects.overflowClipRect()); else if (renderer()->style()->position() == AbsolutePosition) clipRects.setOverflowClipRect(clipRects.posClipRect()); @@ -3976,7 +3975,7 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* if (renderer()->style()->hasBorderRadius()) newOverflowClip.setHasRadius(true); clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); - if (renderer()->isOutOfFlowPositioned() || renderer()->isRelPositioned()) + if (renderer()->isOutOfFlowPositioned() || renderer()->isInFlowPositioned()) clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect())); } if (renderer()->hasClip()) { @@ -4779,7 +4778,7 @@ bool RenderLayer::shouldBeNormalFlowOnly() const || renderer()->isRenderIFrame() || (renderer()->style()->specifiesColumns() && !isRootLayer())) && !renderer()->isOutOfFlowPositioned() - && !renderer()->isRelPositioned() + && !renderer()->isInFlowPositioned() && !renderer()->hasTransform() #if ENABLE(CSS_FILTERS) && !renderer()->hasFilter() diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 00c5c19d2..e4f790e05 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -402,7 +402,7 @@ public: void updateBlendMode(); #endif - const LayoutSize& relativePositionOffset() const { return m_relativeOffset; } + const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; } void clearClipRectsIncludingDescendants(ClipRectsType typeToClear = AllClipRectTypes); void clearClipRects(ClipRectsType typeToClear = AllClipRectTypes); @@ -951,7 +951,7 @@ protected: LayoutRect m_outlineBox; // Our current relative position offset. - LayoutSize m_relativeOffset; + LayoutSize m_offsetForInFlowPosition; // Our (x,y) coordinates are in our parent layer's coordinate space. LayoutPoint m_topLeft; diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index 944ea5f08..6376b098b 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -632,11 +632,6 @@ void RenderListBox::setScrollOffset(const IntPoint& offset) scrollTo(offset.y()); } -IntPoint RenderListBox::scrollPosition() const -{ - return IntPoint(0, m_indexOffset); -} - void RenderListBox::scrollTo(int newOffset) { if (newOffset == m_indexOffset) diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index d968c8717..496191206 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -101,28 +101,27 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; // ScrollableArea interface. - virtual int scrollSize(ScrollbarOrientation) const; - virtual int scrollPosition(Scrollbar*) const; - virtual void setScrollOffset(const IntPoint&); - virtual IntPoint scrollPosition() const OVERRIDE; - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const; - virtual bool isScrollCornerVisible() const { return false; } // We don't support resize on list boxes yet. If we did these would have to change. - virtual IntRect scrollCornerRect() const { return IntRect(); } - virtual void invalidateScrollCornerRect(const IntRect&) { } - virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const; - virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; - virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; - virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; - virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } - virtual IntSize contentsSize() const; - virtual int visibleHeight() const; - virtual int visibleWidth() const; - virtual IntPoint currentMousePosition() const; - virtual bool shouldSuspendScrollAnimations() const; - virtual bool isOnActivePage() const; - - virtual ScrollableArea* enclosingScrollableArea() const; + virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; + virtual int scrollPosition(Scrollbar*) const OVERRIDE; + virtual void setScrollOffset(const IntPoint&) OVERRIDE; + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE; + virtual bool isActive() const OVERRIDE; + virtual bool isScrollCornerVisible() const OVERRIDE { return false; } // We don't support resize on list boxes yet. If we did these would have to change. + virtual IntRect scrollCornerRect() const OVERRIDE { return IntRect(); } + virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE { } + virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE; + virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const OVERRIDE; + virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_vBar.get(); } + virtual IntSize contentsSize() const OVERRIDE; + virtual int visibleHeight() const OVERRIDE; + virtual int visibleWidth() const OVERRIDE; + virtual IntPoint currentMousePosition() const OVERRIDE; + virtual bool shouldSuspendScrollAnimations() const OVERRIDE; + virtual bool isOnActivePage() const OVERRIDE; + + virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE; virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 391c11988..933a559c4 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -639,7 +639,7 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderOb RenderObject* container = object->container(); if (!container && !object->isRenderView()) return; - if (!last->isText() && last->style()->isOutOfFlowPositioned()) { + if (!last->isText() && last->style()->hasOutOfFlowPosition()) { bool willSkipRelativelyPositionedInlines = !object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer(); // Skip relatively positioned inlines and anonymous blocks (and the flow threads container) to get to the enclosing RenderBlock. while (object && (!object->isRenderBlock() || object->isAnonymousBlock() || object->isRenderFlowThreadContainer())) @@ -690,7 +690,7 @@ void RenderObject::setPreferredLogicalWidthsDirty(bool shouldBeDirty, MarkingBeh { bool alreadyDirty = preferredLogicalWidthsDirty(); m_bitfields.setPreferredLogicalWidthsDirty(shouldBeDirty); - if (shouldBeDirty && !alreadyDirty && markParents == MarkContainingBlockChain && (isText() || !style()->isOutOfFlowPositioned())) + if (shouldBeDirty && !alreadyDirty && markParents == MarkContainingBlockChain && (isText() || !style()->hasOutOfFlowPosition())) invalidateContainerPreferredLogicalWidths(); } @@ -707,7 +707,7 @@ void RenderObject::invalidateContainerPreferredLogicalWidths() break; o->m_bitfields.setPreferredLogicalWidthsDirty(true); - if (o->style()->isOutOfFlowPositioned()) + if (o->style()->hasOutOfFlowPosition()) // A positioned object has no effect on the min/max width of its containing block ever. // We can optimize this case and not go up any further. break; @@ -764,7 +764,7 @@ RenderBlock* RenderObject::containingBlock() const if (o->hasTransform() && o->isRenderBlock()) break; - if (o->style()->position() == RelativePosition && o->isInline() && !o->isReplaced()) { + if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplaced()) { o = o->containingBlock(); break; } @@ -2435,9 +2435,8 @@ void RenderObject::willBeRemovedFromTree() parent()->dirtyLinesFromChangedChild(this); if (inRenderFlowThread()) { - if (isBox()) - enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(this)); - enclosingRenderFlowThread()->clearRenderObjectCustomStyle(this); + ASSERT(enclosingRenderFlowThread()); + enclosingRenderFlowThread()->removeFlowChildInfo(this); } if (RenderNamedFlowThread* containerFlowThread = parent()->enclosingRenderNamedFlowThread()) diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index 3ca2a2255..05ccea48d 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -511,9 +511,11 @@ public: virtual RenderBoxModelObject* virtualContinuation() const { return 0; } bool isFloating() const { return m_bitfields.floating(); } + bool isOutOfFlowPositioned() const { return m_bitfields.positioned(); } // absolute or fixed positioning bool isInFlowPositioned() const { return m_bitfields.relPositioned(); } // relative positioning bool isRelPositioned() const { return m_bitfields.relPositioned(); } // relative positioning + bool isText() const { return m_bitfields.isText(); } bool isBox() const { return m_bitfields.isBox(); } bool isInline() const { return m_bitfields.isInline(); } // inline object diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index bdb5516b7..98a287627 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -397,7 +397,7 @@ void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, Pseudo return; if (owner->isRenderInline() && !pseudoElementStyle->isDisplayInlineType() && !pseudoElementStyle->isFloating() && - !(pseudoElementStyle->position() == AbsolutePosition || pseudoElementStyle->position() == FixedPosition)) + !pseudoElementStyle->hasOutOfFlowPosition()) // According to the CSS2 spec (the end of section 12.1), the only allowed // display values for the pseudo style are NONE and INLINE for inline flows. // FIXME: CSS2.1 lifted this restriction, but block display types will crash. diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 77428c499..b5c308373 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -197,16 +197,17 @@ void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild) section->addChild(child); } -void RenderTable::removeChild(RenderObject* oldChild) +void RenderTable::removeCaption(const RenderTableCaption* oldCaption) { - RenderBox::removeChild(oldChild); - - size_t index = m_captions.find(oldChild); - if (index != notFound) { - m_captions.remove(index); - if (node()) - node()->setNeedsStyleRecalc(); - } + size_t index = m_captions.find(oldCaption); + ASSERT(index != notFound); + m_captions.remove(index); + + // FIXME: The rest of this function is probably not needed since we have + // implemented proper multiple captions support (see bug 58249). + if (node()) + node()->setNeedsStyleRecalc(); + setNeedsSectionRecalc(); } diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h index e4c70f47f..bbafdb716 100644 --- a/Source/WebCore/rendering/RenderTable.h +++ b/Source/WebCore/rendering/RenderTable.h @@ -231,6 +231,8 @@ public: const BorderValue& tableStartBorderAdjoiningCell(const RenderTableCell*) const; const BorderValue& tableEndBorderAdjoiningCell(const RenderTableCell*) const; + void removeCaption(const RenderTableCaption*); + protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); @@ -241,8 +243,6 @@ private: virtual bool avoidsFloats() const { return true; } - virtual void removeChild(RenderObject* oldChild); - virtual void paint(PaintInfo&, const LayoutPoint&); virtual void paintObject(PaintInfo&, const LayoutPoint&); virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&); diff --git a/Source/WebCore/rendering/RenderTableCaption.cpp b/Source/WebCore/rendering/RenderTableCaption.cpp index b84891c7f..9785f372d 100644 --- a/Source/WebCore/rendering/RenderTableCaption.cpp +++ b/Source/WebCore/rendering/RenderTableCaption.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "RenderTableCaption.h" +#include "RenderTable.h" + namespace WebCore { RenderTableCaption::RenderTableCaption(Node* node) @@ -37,4 +39,16 @@ LayoutUnit RenderTableCaption::containingBlockLogicalWidthForContent() const return cb->logicalWidth(); } +void RenderTableCaption::willBeRemovedFromTree() +{ + RenderBlock::willBeRemovedFromTree(); + + table()->removeCaption(this); +} + +RenderTable* RenderTableCaption::table() const +{ + return toRenderTable(parent()); +} + } diff --git a/Source/WebCore/rendering/RenderTableCaption.h b/Source/WebCore/rendering/RenderTableCaption.h index 23079c0e9..b505ebe10 100644 --- a/Source/WebCore/rendering/RenderTableCaption.h +++ b/Source/WebCore/rendering/RenderTableCaption.h @@ -24,6 +24,8 @@ namespace WebCore { +class RenderTable; + class RenderTableCaption : public RenderBlock { public: explicit RenderTableCaption(Node*); @@ -32,6 +34,10 @@ public: private: virtual bool isTableCaption() const OVERRIDE { return true; } + + virtual void willBeRemovedFromTree() OVERRIDE; + + RenderTable* table() const; }; inline RenderTableCaption* toRenderTableCaption(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderTableCol.cpp b/Source/WebCore/rendering/RenderTableCol.cpp index 97cd8cc3e..7c5e9ed10 100644 --- a/Source/WebCore/rendering/RenderTableCol.cpp +++ b/Source/WebCore/rendering/RenderTableCol.cpp @@ -69,6 +69,16 @@ void RenderTableCol::updateFromElement() setNeedsLayoutAndPrefWidthsRecalc(); } +void RenderTableCol::willBeRemovedFromTree() +{ + RenderBox::willBeRemovedFromTree(); + + // We don't really need to recompute our sections, but we need to update our + // column count and whether we have a column. Currently, we only have one + // size-fit-all flag but we may have to consider splitting it. + table()->setNeedsSectionRecalc(); +} + bool RenderTableCol::isChildAllowed(RenderObject* child, RenderStyle* style) const { // We cannot use isTableColumn here as style() may return 0. diff --git a/Source/WebCore/rendering/RenderTableCol.h b/Source/WebCore/rendering/RenderTableCol.h index 62f3288e8..887afd6c8 100644 --- a/Source/WebCore/rendering/RenderTableCol.h +++ b/Source/WebCore/rendering/RenderTableCol.h @@ -75,6 +75,8 @@ private: virtual bool isRenderTableCol() const OVERRIDE { return true; } virtual void updateFromElement(); + virtual void willBeRemovedFromTree() OVERRIDE; + virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; virtual bool canHaveChildren() const; virtual bool requiresLayer() const { return false; } diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 02b54c660..8cc34a330 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -315,7 +315,7 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&) frameView()->setCannotBlitToWindow(); // The parent must show behind the child. else { Color baseColor = frameView()->baseBackgroundColor(); - if (baseColor.alpha() > 0) { + if (baseColor.alpha()) { CompositeOperator previousOperator = paintInfo.context->compositeOperation(); paintInfo.context->setCompositeOperation(CompositeCopy); paintInfo.context->fillRect(paintInfo.rect, baseColor, style()->colorSpace()); diff --git a/Source/WebCore/rendering/TextAutosizer.cpp b/Source/WebCore/rendering/TextAutosizer.cpp index 6122962b2..4cd735a1c 100644 --- a/Source/WebCore/rendering/TextAutosizer.cpp +++ b/Source/WebCore/rendering/TextAutosizer.cpp @@ -107,6 +107,34 @@ void TextAutosizer::setMultiplier(RenderObject* renderer, float multiplier) renderer->setStyle(newStyle.release()); } +float TextAutosizer::computeAutosizedFontSize(float specifiedSize, float multiplier) +{ + // Somewhat arbitrary "pleasant" font size. + const float pleasantSize = 16; + + // Multiply fonts that the page author has specified to be larger than + // pleasantSize by less and less, until huge fonts are not increased at all. + // For specifiedSize between 0 and pleasantSize we directly apply the + // multiplier; hence for specifiedSize == pleasantSize, computedSize will be + // multiplier * pleasantSize. For greater specifiedSizes we want to + // gradually fade out the multiplier, so for every 1px increase in + // specifiedSize beyond pleasantSize we will only increase computedSize + // by gradientAfterPleasantSize px until we meet the + // computedSize = specifiedSize line, after which we stay on that line (so + // then every 1px increase in specifiedSize increases computedSize by 1px). + const float gradientAfterPleasantSize = 0.5; + + float computedSize; + if (specifiedSize <= pleasantSize) + computedSize = multiplier * specifiedSize; + else { + computedSize = multiplier * pleasantSize + gradientAfterPleasantSize * (specifiedSize - pleasantSize); + if (computedSize < specifiedSize) + computedSize = specifiedSize; + } + return computedSize; +} + bool TextAutosizer::isNotAnAutosizingContainer(const RenderObject* renderer) { // "Autosizing containers" are the smallest unit for which we can enable/disable diff --git a/Source/WebCore/rendering/TextAutosizer.h b/Source/WebCore/rendering/TextAutosizer.h index 3524f5f95..c8ade00f7 100644 --- a/Source/WebCore/rendering/TextAutosizer.h +++ b/Source/WebCore/rendering/TextAutosizer.h @@ -51,6 +51,8 @@ public: bool processSubtree(RenderObject* layoutRoot); + static float computeAutosizedFontSize(float specifiedSize, float multiplier); + private: explicit TextAutosizer(Document*); diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 37d98904e..b1b5faab0 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -43,6 +43,10 @@ #include <wtf/StdLibExtras.h> #include <algorithm> +#if ENABLE(TEXT_AUTOSIZING) +#include "TextAutosizer.h" +#endif + using namespace std; namespace WebCore { @@ -1223,7 +1227,7 @@ Length RenderStyle::lineHeight() const // too, though this involves messily poking into CalcExpressionLength. float multiplier = textAutosizingMultiplier(); if (multiplier > 1 && lh.isFixed()) - return Length(lh.value() * multiplier, Fixed); + return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multiplier), Fixed); #endif return lh; } @@ -1262,8 +1266,7 @@ void RenderStyle::setFontSize(float size) #if ENABLE(TEXT_AUTOSIZING) float multiplier = textAutosizingMultiplier(); if (multiplier > 1) { - // FIXME: Large font sizes needn't be multiplied as much since they are already more legible. - desc.setComputedSize(size * multiplier); + desc.setComputedSize(TextAutosizer::computeAutosizedFontSize(size, multiplier)); } #endif diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 011950c8e..2378c7a72 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -439,7 +439,7 @@ public: bool hasBackground() const { Color color = visitedDependentColor(CSSPropertyBackgroundColor); - if (color.isValid() && color.alpha() > 0) + if (color.isValid() && color.alpha()) return true; return hasBackgroundImage(); } @@ -496,10 +496,10 @@ public: Length bottom() const { return surround->offset.bottom(); } // Accessors for positioned object edges that take into account writing mode. - Length logicalLeft() const { return surround->offset.logicalLeft(this); } - Length logicalRight() const { return surround->offset.logicalRight(this); } - Length logicalTop() const { return surround->offset.before(this); } - Length logicalBottom() const { return surround->offset.after(this); } + Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); } + Length logicalRight() const { return surround->offset.logicalRight(writingMode()); } + Length logicalTop() const { return surround->offset.before(writingMode()); } + Length logicalBottom() const { return surround->offset.after(writingMode()); } // Whether or not a positioned element requires normal flow x/y to be computed // to determine its position. @@ -509,7 +509,8 @@ public: bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); } EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); } - bool isOutOfFlowPositioned() const { return position() == AbsolutePosition || position() == FixedPosition; } + bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; } + bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; } EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); } Length width() const { return m_box->width(); } @@ -728,24 +729,24 @@ public: Length marginBottom() const { return surround->margin.bottom(); } Length marginLeft() const { return surround->margin.left(); } Length marginRight() const { return surround->margin.right(); } - Length marginBefore() const { return surround->margin.before(this); } - Length marginAfter() const { return surround->margin.after(this); } - Length marginStart() const { return surround->margin.start(this); } - Length marginEnd() const { return surround->margin.end(this); } - Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle); } - Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle); } - Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle); } - Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle); } + Length marginBefore() const { return surround->margin.before(writingMode()); } + Length marginAfter() const { return surround->margin.after(writingMode()); } + Length marginStart() const { return surround->margin.start(writingMode(), direction()); } + Length marginEnd() const { return surround->margin.end(writingMode(), direction()); } + Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); } + Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); } + Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); } + Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); } LengthBox paddingBox() const { return surround->padding; } Length paddingTop() const { return surround->padding.top(); } Length paddingBottom() const { return surround->padding.bottom(); } Length paddingLeft() const { return surround->padding.left(); } Length paddingRight() const { return surround->padding.right(); } - Length paddingBefore() const { return surround->padding.before(this); } - Length paddingAfter() const { return surround->padding.after(this); } - Length paddingStart() const { return surround->padding.start(this); } - Length paddingEnd() const { return surround->padding.end(this); } + Length paddingBefore() const { return surround->padding.before(writingMode()); } + Length paddingAfter() const { return surround->padding.after(writingMode()); } + Length paddingStart() const { return surround->padding.start(writingMode(), direction()); } + Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); } ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); } @@ -955,8 +956,11 @@ public: ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); } WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); } + // Lines have horizontal orientation; modes horizontal-tb or horizontal-bt. bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; } + // Bottom of the line occurs earlier in the block; modes vertical-rl or horizontal-bt. bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; } + // Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt. bool isFlippedBlocksWritingMode() const { return writingMode() == RightToLeftWritingMode || writingMode() == BottomToTopWritingMode; } #if ENABLE(CSS_IMAGE_ORIENTATION) diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 880b62243..6d967cba3 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -130,11 +130,6 @@ enum ETableLayout { TAUTO, TFIXED }; -// CSS Text Layout Module Level 3: Vertical writing support -enum WritingMode { - TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode -}; - enum TextCombine { TextCombineNone, TextCombineHorizontal }; |